/* ============================================
   EduFlame — books.css  (Updated)
   Index Books Section + books.html + books-detail.html
   Depends on: style.css (variables & base styles)
============================================ */

/* ============================================
   INDEX PAGE — BOOKS SECTION
============================================ */

.books-section-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 8px;
}

.books-section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted, #888);
  margin-bottom: 16px;
}

.books-cat-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.books-cat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 14px;
  border: 1.5px solid var(--border-card, #e5e7eb);
  background: var(--bg-card, #fff);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 160px;
  max-width: 280px;
  position: relative;
  overflow: hidden;
}

.books-cat-btn::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.books-cat-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(232, 160, 32, 0.15);
  transform: translateY(-2px);
}
.books-cat-btn:hover::after { transform: scaleX(1); }

.books-cat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
  transition: background 0.2s;
}

.books-cat-icon-matric  { background: #fef9c3; color: #92400e; }
.books-cat-icon-fsc     { background: #d1fae5; color: #065f46; }
.books-cat-icon-bs      { background: #dbeafe; color: #1e40af; }
.books-cat-icon-general { background: #f3f4f6; color: #374151; }
.books-cat-icon-amber   { background: #fff7ed; color: #c2410c; }
.books-cat-icon-purple  { background: #f5f3ff; color: #7c3aed; }

.books-cat-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.books-cat-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}

.books-cat-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  opacity: 0.75;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.books-cat-count {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-light);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 9px;
  flex-shrink: 0;
}

@media (prefers-color-scheme: dark) {
  .books-cat-btn {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
  }
  .books-cat-icon-matric  { background: #3b3210; color: #fbbf24; }
  .books-cat-icon-fsc     { background: #052e16; color: #34d399; }
  .books-cat-icon-bs      { background: #1e3a5f; color: #60a5fa; }
  .books-cat-icon-general { background: #374151; color: #9ca3af; }
}


/* ============================================
   BOOKS PAGE HEADER
============================================ */

.books-page-header {
  background: linear-gradient(135deg, var(--navy, #0b1f3a) 0%, var(--navy-mid, #122d52) 60%, var(--navy-light, #1a3d6b) 100%);
  position: relative;
  overflow: hidden;
  padding: 36px 32px 42px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.books-page-header::before {
  content: '';
  position: absolute;
  width: 380px; height: 380px;
  background: var(--accent, #e8a020);
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.09;
  top: -120px; right: 60px;
  pointer-events: none;
}

.books-header-inner {
  max-width: var(--max-w, 1140px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  z-index: 2;
}

.books-header-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1;
  min-width: 0;
}

.books-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.42);
  transition: color 0.2s;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}
.books-breadcrumb:hover { color: var(--accent); }

.books-header-icon-wrap {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--accent, #e8a020);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy, #0b1f3a);
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(232,160,32,0.38);
}

.books-page-title {
  font-family: var(--font-display, 'Merriweather', serif);
  font-size: clamp(18px, 3vw, 26px);
  color: #fff;
  line-height: 1.25;
  margin-bottom: 5px;
}

.books-title-skeleton {
  display: inline-block;
  width: 220px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.08) 25%,
    rgba(255,255,255,0.18) 50%,
    rgba(255,255,255,0.08) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}

.books-page-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.42);
  line-height: 1.55;
  margin-top: 2px;
}

.books-header-stat-box {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.books-header-stat {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg, 14px);
  padding: 14px 24px;
  text-align: center;
  min-width: 90px;
  backdrop-filter: blur(8px);
}

.books-header-stat span {
  display: block;
  font-family: var(--font-display, serif);
  font-size: 28px;
  color: var(--accent, #e8a020);
  line-height: 1;
  margin-bottom: 5px;
}

.books-header-stat small {
  font-size: 11px;
  color: rgba(255,255,255,0.38);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}


/* ============================================
   FILTER PILLS
============================================ */

.books-filter-outer {
  background: var(--bg-card, #fff);
  border-bottom: 1px solid var(--border, #dde4ee);
  box-shadow: 0 2px 8px rgba(11,31,58,0.05);
  position: sticky;
  top: var(--nav-h, 58px);
  z-index: 80;
}

.books-filter-inner {
  max-width: var(--max-w, 1140px);
  margin: 0 auto;
  padding: 13px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.books-filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.books-pills-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  padding-bottom: 2px;
}
.books-pills-row::-webkit-scrollbar { display: none; }

.books-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 30px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.books-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.books-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--navy);
  box-shadow: 0 3px 10px rgba(232,160,32,0.28);
}


/* ============================================
   BOOKS GRID  ← IMPROVED
============================================ */

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 20px;
}


/* ============================================
   BOOK CARD  ← FULLY REDESIGNED
============================================ */

.book-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1.5px solid var(--border-card);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  color: inherit;
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
  box-shadow: 0 2px 8px rgba(11, 31, 58, 0.07);
  animation: fadeUp 0.35s ease both;
}

/* Gold accent underline on hover */
.book-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #f5c842);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s ease;
  border-radius: 0 0 2px 2px;
}

.book-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(11, 31, 58, 0.15);
  border-color: rgba(232, 160, 32, 0.40);
}
.book-card:hover::after { transform: scaleX(1); }


/* ---- Cover image area ---- */
.book-card-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 210px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(145deg, var(--navy) 0%, var(--navy-light) 100%);
}

/* Dark gradient overlay at bottom of cover */
.book-card-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 40%,
    rgba(11, 31, 58, 0.55) 100%
  );
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.book-card:hover .book-card-cover::before {
  opacity: 0.7;
}

.book-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.42s ease;
}

.book-card:hover .book-card-cover img {
  transform: scale(1.07);
}

/* Placeholder when no image */
.book-card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.18);
}


/* ---- Class badge (top-left on cover) ---- */
.book-card-class-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent);
  color: var(--navy);
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.28);
  backdrop-filter: blur(4px);
}


/* ---- Card body (below cover) ---- */
.book-card-body {
  padding: 13px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.book-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  /* Max 2 lines */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-subject {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Description — 2 lines max, hidden on small screens */
.book-card-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  opacity: 0.78;
}


/* ---- Card footer ---- */
.book-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  gap: 6px;
}

/* Download pill-button */
.book-card-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--amber, #b45309);
  border: 1px solid rgba(232, 160, 32, 0.25);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.book-card:hover .book-card-type {
  background: var(--accent);
  color: var(--navy);
  border-color: var(--accent);
}

/* Arrow icon */
.book-card-arrow {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  color: var(--text-light);
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.book-card:hover .book-card-arrow {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--navy);
  transform: translateX(2px);
}


/* ---- Card animation delays ---- */
.book-card:nth-child(1)  { animation-delay: 0.04s; }
.book-card:nth-child(2)  { animation-delay: 0.08s; }
.book-card:nth-child(3)  { animation-delay: 0.12s; }
.book-card:nth-child(4)  { animation-delay: 0.16s; }
.book-card:nth-child(5)  { animation-delay: 0.20s; }
.book-card:nth-child(6)  { animation-delay: 0.24s; }
.book-card:nth-child(7)  { animation-delay: 0.28s; }
.book-card:nth-child(8)  { animation-delay: 0.32s; }
.book-card:nth-child(9)  { animation-delay: 0.36s; }
.book-card:nth-child(10) { animation-delay: 0.40s; }


/* ============================================
   BOOK DETAIL PAGE  ← REDESIGNED
============================================ */

.book-detail-main {
  flex: 1;
  width: 100%;
}

/* Loading skeleton */
.book-detail-loading {
  max-width: 920px;
  margin: 56px auto;
  padding: 0 24px;
  display: flex;
  gap: 52px;
  align-items: flex-start;
}

.bd-skeleton-cover {
  width: 230px;
  flex-shrink: 0;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}

.bd-skeleton-info { flex: 1; padding-top: 6px; }

/* Content wrapper */
.book-detail-content {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ---- Breadcrumb ---- */
.bd-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 26px 0 22px;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.bd-breadcrumb a { color: var(--text-muted); font-weight: 600; transition: color 0.2s; }
.bd-breadcrumb a:hover { color: var(--accent); }
.bd-breadcrumb svg { color: var(--text-light); flex-shrink: 0; }
.bd-breadcrumb span { color: var(--text); font-weight: 700; }

/* ---- Two-column layout ---- */
.bd-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 52px;
  align-items: flex-start;
}

/* LEFT: Cover column — sticky */
.bd-cover-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: calc(var(--nav-h, 58px) + 24px);
}

/* Book cover — 3D depth effect */
.bd-cover-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--navy) 0%, var(--navy-light) 100%);
  position: relative;
  box-shadow:
    4px 6px 0 rgba(11, 31, 58, 0.10),
    8px 14px 0 rgba(11, 31, 58, 0.06),
    0 28px 52px rgba(11, 31, 58, 0.24);
}

/* Subtle shine overlay on cover */
.bd-cover-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    130deg,
    rgba(255, 255, 255, 0.13) 0%,
    transparent 55%
  );
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
}

.bd-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.22);
}

.bd-cover-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* Mobile download button — ALWAYS hidden on desktop */
.bd-download-mobile { display: none !important; }

/* RIGHT: Info column */
.bd-info-col { padding-top: 6px; }

/* ---- Badges row ---- */
.bd-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.bd-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 13px;
  border-radius: 20px;
  line-height: 1;
  /* Fallback for any unmatched badge */
  background: var(--bg);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}

.bd-badge-level {
  background: rgba(232, 160, 32, 0.13);
  color: #92400e;
  border: 1.5px solid rgba(232, 160, 32, 0.32);
}

.bd-badge-class {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1.5px solid rgba(29, 78, 216, 0.18);
}

.bd-badge-type {
  background: #f0fdfa;
  color: #0f766e;
  border: 1.5px solid rgba(15, 118, 110, 0.20);
}

.bd-badge-new {
  background: var(--accent);
  color: var(--navy);
  border: 1.5px solid transparent;
}

/* ---- Book Title ---- */
.bd-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 3.5vw, 32px);
  color: var(--text);
  line-height: 1.22;
  margin-bottom: 10px;
  letter-spacing: -0.2px;
}

/* ---- Subject — teal with dot ---- */
.bd-subject {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--teal-icon, #0f766e);
  margin-bottom: 24px;
}

.bd-subject::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--teal, #1a9e8a);
  flex-shrink: 0;
}

/* ---- Meta row — redesigned as stat boxes ---- */
.bd-meta-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.bd-meta-item {
  background: var(--bg-card);
  border: 1.5px solid var(--border-card);
  border-radius: 12px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.bd-meta-item:hover {
  border-color: rgba(232, 160, 32, 0.38);
  box-shadow: 0 3px 12px rgba(232, 160, 32, 0.10);
}

.bd-meta-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 5px;
}

.bd-meta-label svg {
  flex-shrink: 0;
  color: var(--accent);
}

.bd-meta-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

/* ---- Description — styled card with gold accent ---- */
.bd-desc-section {
  background: var(--bg-card);
  border: 1.5px solid var(--border-card);
  border-left: 3.5px solid var(--accent);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 28px;
}

.bd-desc-heading {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.bd-desc-heading::before {
  content: '';
  display: inline-block;
  width: 16px; height: 2px;
  background: var(--accent);
  border-radius: 1px;
  flex-shrink: 0;
}

.bd-desc {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.85;
}

/* ---- Download Button — dark navy premium style ---- */
.bd-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  padding: 15px 28px;
  border-radius: 12px;
  border: 2px solid rgba(232, 160, 32, 0.30);
  transition: background 0.22s, transform 0.2s, box-shadow 0.22s, border-color 0.2s;
  box-shadow: 0 4px 20px rgba(11, 31, 58, 0.26);
  margin-bottom: 10px;
  width: 100%;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

/* Gold left accent bar */
.bd-download-btn::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
}

/* Gold icon inside button */
.bd-download-btn svg { color: var(--accent); flex-shrink: 0; }

.bd-download-btn:hover {
  background: var(--navy-mid);
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(11, 31, 58, 0.32);
  border-color: rgba(232, 160, 32, 0.55);
}

/* ---- View Online Button ---- */
.bd-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  transition: all 0.2s;
  margin-bottom: 18px;
  text-decoration: none;
  width: 100%;
  cursor: pointer;
}

.bd-view-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232, 160, 32, 0.07);
}

/* ---- Free notice ---- */
.bd-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--teal-icon);
  background: #f0fdfa;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 10px;
  padding: 12px 16px;
  line-height: 1.6;
}
.bd-notice svg { flex-shrink: 0; color: var(--teal); margin-top: 1px; }


/* ============================================
   RESPONSIVE — CARDS + GRID
============================================ */

/* Large desktop: 5 columns */
@media (min-width: 1100px) {
  .books-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
  }
}

/* Desktop: 4 columns */
@media (min-width: 768px) and (max-width: 1099px) {
  .books-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
  }
}

/* ---- Tablet (900px) ---- */
@media (max-width: 900px) {
  /* Books list page */
  .books-page-header { padding: 26px 20px 32px; }
  .books-header-left { gap: 12px; }
  .books-header-stat-box { display: none; }

  .books-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  .book-card-desc { display: none; }

  /* Detail page — tablet */
  .bd-layout {
    grid-template-columns: 200px 1fr;
    gap: 36px;
  }
  .bd-cover-col { position: static; }
  .bd-title { font-size: 26px; }
  .bd-meta-row { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Mobile: 2-column book grid ---- */
@media (max-width: 600px) {
  /* Index section */
  .books-section-wrap { padding: 32px 16px 8px; }
  .books-cat-row { gap: 8px; }
  .books-cat-btn {
    min-width: calc(50% - 4px);
    max-width: 100%;
    padding: 12px 14px;
    flex: 1 1 calc(50% - 4px);
  }
  .books-cat-icon { width: 36px; height: 36px; }

  /* Books page header */
  .books-page-header { padding: 18px 16px 22px; }
  .books-header-left { gap: 10px; }
  .books-breadcrumb { display: none; }
  .books-header-icon-wrap { width: 42px; height: 42px; border-radius: 11px; }
  .books-header-icon-wrap svg { width: 20px; height: 20px; }
  .books-page-title { font-size: 17px; }
  .books-page-sub { font-size: 12px; }

  /* Filter pills */
  .books-filter-inner { padding: 10px 16px; gap: 8px; }
  .books-filter-label { display: none; }
  .books-pill { padding: 6px 13px; font-size: 12.5px; }

  /* 2-column grid */
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Card tweaks */
  .book-card-cover { max-height: 170px; }
  .book-card-body { padding: 10px 11px 12px; gap: 3px; }
  .book-card-title { font-size: 12.5px; }
  .book-card-subject { font-size: 11px; }
  .book-card-desc { display: none; }
  .book-card-footer { padding-top: 8px; }
  .book-card-type { font-size: 9.5px; padding: 4px 9px; }
  .book-card-arrow { width: 22px; height: 22px; }

  /* ---- Detail page — mobile ---- */
  .book-detail-loading {
    flex-direction: column;
    align-items: center;
    margin: 24px auto;
    padding: 0 16px;
    gap: 24px;
  }
  .bd-skeleton-cover { width: 130px; }

  .book-detail-content { padding: 0 16px 56px; }
  .bd-breadcrumb { padding: 16px 0 12px; font-size: 12px; }

  /* Stack layout vertically on mobile */
  .bd-layout { grid-template-columns: 1fr; gap: 0; }

  /* Cover + mobile button side by side */
  .bd-cover-col {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 22px;
    position: static;
  }
  .bd-cover-wrap {
    width: 130px;
    border-radius: 14px;
    box-shadow:
      3px 5px 0 rgba(11,31,58,0.10),
      0 16px 32px rgba(11,31,58,0.20);
  }

  /* Show mobile button next to cover */
  .bd-download-mobile {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    align-self: flex-start;
    padding-top: 4px;
  }

  /* Mobile download button styling */
  .bd-download-mobile.bd-download-btn {
    background: var(--navy);
    color: #fff;
    font-size: 13px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid rgba(232,160,32,0.30);
    box-shadow: 0 4px 14px rgba(11,31,58,0.22);
    width: auto;
    margin-bottom: 0;
  }

  /* Hide desktop button on mobile */
  .bd-download-desktop { display: none !important; }

  /* Info column adjustments */
  .bd-title { font-size: 19px; margin-bottom: 7px; }
  .bd-subject { font-size: 13px; margin-bottom: 16px; }
  .bd-badges { gap: 6px; margin-bottom: 12px; }
  .bd-badge { font-size: 9.5px; padding: 4px 10px; }

  /* Meta row — 3 cols still, smaller */
  .bd-meta-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-bottom: 20px;
  }
  .bd-meta-item { padding: 10px 10px; border-radius: 10px; }
  .bd-meta-label { font-size: 8.5px; }
  .bd-meta-value { font-size: 12px; }

  /* Description card */
  .bd-desc-section {
    padding: 14px 16px;
    margin-bottom: 20px;
    border-radius: 10px;
  }
  .bd-desc { font-size: 14px; line-height: 1.75; }

  /* Action buttons */
  .bd-view-btn { font-size: 13px; padding: 11px 18px; margin-bottom: 14px; }
  .bd-notice { font-size: 11.5px; padding: 10px 13px; }
}

/* ---- Very small phones ---- */
@media (max-width: 380px) {
  .books-grid { gap: 8px; }
  .book-card-cover { max-height: 140px; }
  .book-card-body { padding: 9px 10px 11px; }
  .book-card-title { font-size: 12px; }
  .book-card-class-badge { font-size: 8.5px; padding: 2px 8px; }

  .bd-cover-col { grid-template-columns: 110px 1fr; gap: 12px; }
  .bd-cover-wrap { width: 110px; border-radius: 12px; }
  .bd-meta-row { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .bd-title { font-size: 17px; }
}