/* ============================================================
   BOOK RALLY ITEMS SECTION - COMPLETE CSS
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  color: #333;
  overflow-x: hidden;
}

/* ============================================================
   NAVBAR STYLES
   ============================================================ */

.navbar {
  background: linear-gradient(to right, #8f0000, #d40000);
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}

.navbar .logo img {
  height: 45px;
  width: 45px;
  border-radius: 50%;
  object-fit: cover;
}

.navbar .nav-links {
  display: flex;
  list-style: none;
  gap: 15px;
}

.navbar .nav-links a {
  color: white;
  text-decoration: none;
  font-size: 14px;
  transition: opacity 0.3s;
}

.navbar .nav-links a:hover {
  opacity: 0.8;
}

@media (min-width: 768px) {
  .navbar {
    padding: 14px 40px;
  }

  .navbar .logo {
    font-size: 18px;
  }

  .navbar .logo img {
    height: 50px;
    width: 50px;
  }
}

@media (min-width: 1024px) {
  .navbar {
    padding: 14px 60px;
  }

  .navbar .logo {
    font-size: 20px;
  }

  .navbar .logo img {
    height: 58px;
    width: 58px;
  }
}

/* ============================================================
   ITEMS SECTION STYLES
   ============================================================ */

.items-section {
  padding: 30px 15px;
  background: #f9f9f9;
  min-height: 80vh;
}

@media (min-width: 768px) {
  .items-section {
    padding: 40px 30px;
  }
}

@media (min-width: 1024px) {
  .items-section {
    padding: 60px 50px;
  }
}

.items-container {
  max-width: 1200px;
  margin: 0 auto;
}

.items-section-title {
  font-size: 24px;
  font-weight: 700;
  color: #8f0000;
  margin-bottom: 8px;
  text-align: center;
}

@media (min-width: 768px) {
  .items-section-title {
    font-size: 28px;
    margin-bottom: 10px;
  }
}

@media (min-width: 1024px) {
  .items-section-title {
    font-size: 34px;
    margin-bottom: 12px;
  }
}

.items-section-subtitle {
  font-size: 14px;
  color: #666;
  text-align: center;
  margin-bottom: 30px;
}

@media (min-width: 768px) {
  .items-section-subtitle {
    font-size: 16px;
    margin-bottom: 40px;
  }
}

@media (min-width: 1024px) {
  .items-section-subtitle {
    font-size: 18px;
    margin-bottom: 50px;
  }
}

.items-subsection {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.balances-subsection {
  background: white;
  border: 1px solid rgba(143, 0, 0, 0.16);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.balances-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.balances-header h2 {
  color: #8f0000;
  font-size: 20px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.balances-header p {
  color: #666;
  font-size: 14px;
}

.balances-count {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #fff4f4;
  color: #8f0000;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border: 1px solid rgba(143, 0, 0, 0.18);
}

.balances-loading,
.balances-error {
  text-align: center;
  padding: 24px 16px;
}

.balances-error,
.balances-error p {
  color: #d40000;
}

.balances-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.balances-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 360px;
}

.balances-table th,
.balances-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid #ececec;
}

.balances-table th {
  background: linear-gradient(to right, #8f0000, #d40000);
  color: white;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.balances-table td {
  color: #333;
  font-size: 15px;
  font-weight: 700;
}

.balances-table tbody tr:hover {
  background: #fff7f7;
}

@media (min-width: 768px) {
  .items-subsection {
    padding: 30px;
  }

  .balances-subsection {
    padding: 26px 30px;
    margin-bottom: 30px;
  }

  .balances-header h2 {
    font-size: 24px;
  }
}

/* ============================================================
   ITEMS GRID STYLES
   ============================================================ */

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

@media (min-width: 480px) {
  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
}

@media (min-width: 768px) {
  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
  }
}

/* ============================================================
   ITEM CARD STYLES
   ============================================================ */

.item-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.item-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: #d40000;
}

.item-image-container {
  width: 100%;
  height: 120px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

@media (min-width: 768px) {
  .item-image-container {
    height: 140px;
  }
}

@media (min-width: 1024px) {
  .item-image-container {
    height: 180px;
  }
}

.item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #f5f5f5;
  animation: fadeIn 0.3s ease-in-out;
}

.item-image.placeholder-active {
  opacity: 0.7;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.item-image[loading="lazy"] {
  /* Provide visual feedback for lazy-loaded images */
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.item-image[loading="lazy"]:not([src^="data"]) {
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.item-placeholder {
  color: #999;
  font-size: 12px;
  text-align: center;
  padding: 10px;
}

@media (min-width: 768px) {
  .item-placeholder {
    font-size: 14px;
  }
}

.item-content {
  padding: 10px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .item-content {
    padding: 12px;
  }
}

@media (min-width: 1024px) {
  .item-content {
    padding: 15px;
  }
}

.item-name {
  font-size: 13px;
  font-weight: 700;
  color: #333;
  margin-bottom: 6px;
  line-height: 1.3;
  word-wrap: break-word;
}

@media (min-width: 768px) {
  .item-name {
    font-size: 14px;
    margin-bottom: 8px;
  }
}

@media (min-width: 1024px) {
  .item-name {
    font-size: 16px;
    margin-bottom: 10px;
  }
}

.item-author {
  font-size: 11px;
  color: #999;
  margin-bottom: 6px;
  font-style: italic;
}

@media (min-width: 768px) {
  .item-author {
    font-size: 12px;
    margin-bottom: 8px;
  }
}

.item-description {
  color: #666;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 8px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (min-width: 768px) {
  .item-description {
    font-size: 13px;
  }
}

.item-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .item-meta {
    gap: 8px;
    margin-bottom: 10px;
  }
}

.item-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

@media (min-width: 768px) {
  .item-meta-row {
    font-size: 13px;
  }
}

@media (min-width: 1024px) {
  .item-meta-row {
    font-size: 14px;
  }
}

.item-label {
  color: #999;
  font-weight: 600;
}

.item-value {
  color: #333;
  font-weight: 700;
  color: #8f0000;
}

.item-rate {
  font-size: 15px;
  font-weight: 700;
  color: #d40000;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .item-rate {
    font-size: 16px;
    margin-bottom: 10px;
  }
}

@media (min-width: 1024px) {
  .item-rate {
    font-size: 18px;
    margin-bottom: 12px;
  }
}

.item-id {
  font-size: 11px;
  color: #999;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .item-id {
    font-size: 12px;
    margin-bottom: 10px;
  }
}

/* ============================================================
   ORDER BUTTON STYLES
   ============================================================ */

.item-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: auto;
}

.item-btn-order,
.item-btn-pdf {
  background: linear-gradient(to right, #8f0000, #d40000);
  color: white;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  width: 100%;
}

.item-btn-pdf {
  background: #ffffff;
  color: #8f0000;
  border: 1px solid rgba(143, 0, 0, 0.25);
}

.item-btn-order:hover,
.item-btn-pdf:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.item-btn-order:active,
.item-btn-pdf:active {
  transform: scale(0.98);
}

@media (min-width: 768px) {
  .item-btn-order,
  .item-btn-pdf {
    padding: 10px 14px;
    font-size: 13px;
  }
}

@media (min-width: 1024px) {
  .item-btn-order,
  .item-btn-pdf {
    padding: 12px 16px;
    font-size: 14px;
  }
}

/* ============================================================
   LOADING / ERROR / EMPTY STATES
   ============================================================ */

.items-loading,
.items-error,
.items-empty {
  text-align: center;
  padding: 40px 20px;
}

.items-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #8f0000;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.items-loading p,
.items-error p,
.items-empty p {
  color: #666;
  font-size: 16px;
}

.items-error {
  color: #d40000;
}

.items-error p {
  color: #d40000;
}

/* ============================================================
   SHOW MORE BUTTON STYLES
   ============================================================ */

.items-show-more-container {
  text-align: center;
  margin-top: 20px;
}

.items-show-more-btn {
  background: linear-gradient(to right, #8f0000, #d40000);
  color: white;
  padding: 12px 30px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s ease;
}

.items-show-more-btn:hover {
  background: linear-gradient(to right, #7a0000, #b30000);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(212, 0, 0, 0.3);
}

.items-show-more-btn:active {
  transform: translateY(0);
}

/* ============================================================
   FOOTER STYLES
   ============================================================ */

.footer {
  background: #1a1a1a;
  color: white;
  padding: 30px 15px;
  margin-top: 40px;
}

@media (min-width: 768px) {
  .footer {
    padding: 40px 30px;
  }
}

@media (min-width: 1024px) {
  .footer {
    padding: 50px 60px;
  }
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto 30px;
}

.footer-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 30px;
}

@media (min-width: 768px) {
  .footer-top {
    margin-bottom: 40px;
  }
}

.footer-logo {
  height: 60px;
  width: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 15px;
}

@media (min-width: 768px) {
  .footer-logo {
    height: 70px;
    width: 70px;
  }
}

.footer-brand {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #d40000;
}

@media (min-width: 768px) {
  .footer-brand {
    font-size: 20px;
  }
}

.footer-description p {
  font-size: 13px;
  color: #ccc;
}

@media (min-width: 768px) {
  .footer-description p {
    font-size: 14px;
  }
}

.footer-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

@media (min-width: 768px) {
  .footer-links {
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
  }
}

.footer-column h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: #d40000;
}

@media (min-width: 768px) {
  .footer-column h3 {
    font-size: 16px;
  }
}

.footer-column ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-column a {
  color: #ccc;
  text-decoration: none;
  font-size: 12px;
  transition: 0.3s;
}

@media (min-width: 768px) {
  .footer-column a {
    font-size: 13px;
  }
}

.footer-column a:hover {
  color: #d40000;
}

.footer-bottom {
  border-top: 1px solid #333;
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    gap: 0;
  }
}

.footer-content p {
  font-size: 12px;
  color: #999;
  margin-bottom: 5px;
}

@media (min-width: 768px) {
  .footer-content p {
    font-size: 13px;
    margin-bottom: 0;
  }
}

.footer-content strong {
  color: #d40000;
}

.footer-links-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

@media (min-width: 768px) {
  .footer-links-bottom {
    justify-content: flex-end;
  }
}

.footer-links-bottom a {
  color: #999;
  text-decoration: none;
  font-size: 12px;
  transition: 0.3s;
}

@media (min-width: 768px) {
  .footer-links-bottom a {
    font-size: 13px;
  }
}

.footer-links-bottom a:hover {
  color: #d40000;
}
