/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-raised: #f2f6fb;
  --border: #dbe3ee;
  --border-hover: #aebed1;
  --text: #162033;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent2: #0f766e;
  --accent3: #f59e0b;
  --danger: #dc2626;
  --shadow-card: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 16px 34px rgba(37, 99, 235, 0.16);
  --radius-card: 8px;
  --radius-pill: 999px;
  --font: 'Sora', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --transition: 0.3s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background:
    linear-gradient(180deg, #eef6ff 0%, var(--bg) 360px),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
  z-index: 0;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  z-index: 1000;
  transition: top 0.2s;
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

/* ── Sticky Nav ── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(219, 227, 238, 0.9);
  padding: 0 clamp(20px, 5vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 20px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}

.topnav-brand {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: 0;
  white-space: nowrap;
  text-decoration: none;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.topnav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  transition: color var(--transition), background var(--transition);
}

.topnav-links a:hover {
  color: var(--text);
  background: rgba(37, 99, 235, 0.08);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

#bookmarkToggle {
  background: rgba(37, 99, 235, 0.08) !important;
  border-color: rgba(37, 99, 235, 0.18) !important;
  color: var(--accent) !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

#bookmarkToggle:hover {
  background: rgba(37, 99, 235, 0.14) !important;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.14);
  transform: translateY(-1px);
}



/* ── Page ── */
.page {
  position: relative;
  z-index: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 40px clamp(20px, 5vw, 64px) 100px;
}

/* ── Hero ── */
.hero {
  padding: 56px 0 44px;
  max-width: 760px;
}

.hero h1 {
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
  margin-bottom: 16px;
  color: var(--text);
}

.hero h1 span {
  color: var(--accent2);
}

.hero p {
  font-size: 1.08rem;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 580px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.87rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--border);
  color: var(--text-muted);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.stat-chip strong {
  color: var(--accent);
}

/* ── Search & Filters ── */
.search-area {
  position: sticky;
  top: 64px;
  z-index: 90;
  background: rgba(247, 249, 252, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  margin: 0 calc(-1 * clamp(20px, 5vw, 64px));
  padding-left: clamp(20px, 5vw, 64px);
  padding-right: clamp(20px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 150px 200px 100px; /* Fixed widths for stability */
  gap: 12px;
  align-items: center;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1rem;
}

#searchInput {
  width: 100%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 11px 18px 11px 42px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.97rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

#searchInput::placeholder {
  color: var(--text-muted);
}

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 14px center;
  background-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 10px 40px 10px 18px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  white-space: nowrap;
  width: 200px; /* Fixed width to prevent jumping */
  text-overflow: ellipsis;
}

#classFilter {
  width: 150px; /* Slightly smaller for class */
}

.filter-select:focus {
  border-color: var(--accent);
}

.filter-select option {
  background: var(--bg);
  color: var(--text);
}

#clearBtn {
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid rgba(251, 113, 133, 0.25);
  border-radius: var(--radius-pill);
  color: var(--danger);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
  width: 100px; /* Match grid column */
  text-align: center;
}

#clearBtn:hover {
  background: rgba(251, 113, 133, 0.2);
}

#clearBtn.hidden {
  display: none;
}

/* ── Quick Jump (Consolidated) ── */
.quick-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.jump-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.jump-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
}

.jump-links {
  display: flex;
  gap: 5px;
}

.jump-chip {
  font-size: 0.8rem;
  font-weight: 700;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
}

.jump-chip:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ── Status Bar ── */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 0 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status-bar strong {
  color: var(--text);
}

.view-toggle {
  display: flex;
  gap: 6px;
}

.view-btn {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 1rem;
  transition: all var(--transition);
}

.view-btn.active,
.view-btn:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Class Group ── */
.class-group {
  margin-bottom: 48px;
}

.class-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 220px;
}

.class-heading h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0;
}

.class-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.22);
  color: var(--accent);
}

.class-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* ── Subject Group ── */
.subject-group {
  margin-bottom: 32px;
}

.subject-group:last-child {
  margin-bottom: 0;
}

.subject-subheading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.subject-subheading::after {
  content: '';
  height: 1px;
  flex: 1;
  background: linear-gradient(to right, var(--border), transparent);
}

/* ── Grid / List ── */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid.list-view {
  grid-template-columns: 1fr;
}

.grid.list-view .card {
  flex-direction: row;
  align-items: center;
  min-height: unset;
  padding: 18px 22px;
  gap: 20px;
}

.grid.list-view .card h2 {
  font-size: 1rem;
  flex: 1;
}

.grid.list-view .actions {
  flex-shrink: 0;
}

/* ── Card ── */
.card {
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 140px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(15, 118, 110, 0.04) 55%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.card:hover::before {
  opacity: 1;
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}

/* ── Actions ── */
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
  background: #1d4ed8;
}

.btn-ghost {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: #eef6ff;
  color: var(--accent);
  border-color: var(--accent);
}



/* ── Bookmark ── */
.bookmark-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  font-size: 0.95rem;
  line-height: 1;
  transition: all var(--transition);
}

.bookmark-btn:hover,
.bookmark-btn.active {
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.38);
  color: var(--accent3);
}

/* ── Bookmarks Panel ── */
#bookmarkPanel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(400px, 100vw);
  background: rgba(248, 251, 255, 0.96);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(20px);
  box-shadow: -18px 0 46px rgba(15, 23, 42, 0.14);
}

@media (max-width: 480px) {
  #bookmarkPanel {
    width: 100vw;
    border-left: none;
  }
}

#bookmarkPanel.open {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #ffffff;
}

.panel-close {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  font-size: 1.3rem;
  padding: 4px;
  transition: opacity 0.2s;
}

.panel-close:hover {
  opacity: 0.8;
}

#bookmarkList {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bookmark-item {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.bookmark-item h3 {
  font-size: 0.92rem;
  font-weight: 700;
}

.bookmark-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 38px 24px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 260px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(100, 116, 139, 0.35);
  border-radius: 18px;
  margin: 8px 0;
  animation: bookmarkFadeIn 0.6s ease-out;
}

.bookmark-empty-icon {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 10px 18px rgba(245, 158, 11, 0.22));
  animation: bookmarkFloat 3s ease-in-out infinite;
}

.bookmark-empty-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin: 0;
}

.bookmark-empty-hint {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 2px;
  max-width: 240px;
}

.bookmark-empty-hint span {
  display: inline-block;
  color: var(--accent3);
  font-weight: 800;
  padding: 0 4px;
  animation: bookmarkPulse 2s infinite;
}

@keyframes bookmarkFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes bookmarkPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.8; }
}

@keyframes bookmarkFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Back to Top ── */
#backToTop {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 150;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--radius-pill);
  color: #ffffff;
  cursor: pointer;
  padding: 12px 16px;
  font-size: 1.1rem;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.25);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

#backToTop.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 11px 22px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  backdrop-filter: blur(12px);
  z-index: 300;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 72px 24px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 8px;
}

/* ── Error ── */
.error-box {
  padding: 18px 22px;
  border-radius: 8px;
  background: rgba(217, 83, 79, 0.08);
  color: #c9302c;
  border: 1px solid rgba(217, 83, 79, 0.2);
  margin-top: 16px;
  font-size: 0.93rem;
}

/* ── Footer ── */
footer {
  margin-top: 80px;
  padding: 36px 0 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.04);
}

footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

footer a:hover {
  color: var(--accent2);
  text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .search-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .filter-select {
    width: 100%;
  }

  .filter-selects {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
  }

  .topnav-links {
    display: none;
  }

  .grid.list-view .card {
    flex-direction: column;
  }

  .hero h1 {
    font-size: 2.2rem;
  }
}

/* ── Desktop Sidebar Layout ── */
@media (min-width: 1024px) {
  .class-group {
    display: flex;
    gap: 40px;
    align-items: flex-start;
  }

  .class-heading {
    flex: 0 0 160px;
    position: sticky;
    top: 230px; 
    flex-direction: column;
    align-items: flex-start;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding-bottom: 0;
    padding-right: 24px;
    margin-bottom: 0;
    z-index: 10;
  }

  .class-heading h2 {
    font-size: 1.5rem;
    white-space: nowrap;
  }

  .class-count {
    margin-left: 0;
    margin-top: 8px;
  }

  .subjects-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 64px;
  }

  .subject-group {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    margin-bottom: 0;
  }

  .subject-subheading {
    flex: 0 0 140px;
    position: sticky;
    top: 230px;
    margin-bottom: 0;
    padding-top: 8px;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    z-index: 5;
  }

  .subject-subheading::after {
    display: none; /* Hide the divider in sidebar mode */
  }

  .grid {
    flex: 1;
  }
}

/* ── Download Modal ── */
.download-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.download-modal.open {
  display: flex;
}

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

.download-modal-content {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.download-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.download-modal-header h2 {
  font-size: 1.2rem;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text);
}

.download-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.progress-section {
  margin-bottom: 24px;
}

.progress-stat {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e6edf7;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  width: 0%;
  transition: width 0.3s ease-out;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.28);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.download-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 600;
}

.stat-value {
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-mono);
}

.download-info {
  padding: 12px 14px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.download-failed-list {
  padding: 12px;
  background: rgba(251, 113, 133, 0.08);
  border: 1px solid rgba(251, 113, 133, 0.2);
  border-radius: 10px;
  margin-top: 12px;
}

.download-modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: rgba(248, 251, 255, 0.84);
}

.download-modal-footer .btn {
  flex: 1;
  margin: 0;
  padding: 10px 12px;
  font-size: 0.88rem;
}

/* Button Styles (ensure they exist) */
.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.93rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.26);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #eef6ff;
  border-color: var(--accent);
}

.btn-danger {
  background: rgba(217, 83, 79, 0.15);
  color: #d9534f;
  border-color: rgba(217, 83, 79, 0.3);
}

.btn-danger:hover {
  background: rgba(217, 83, 79, 0.25);
  border-color: rgba(217, 83, 79, 0.5);
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
  font-weight: 700;
}

.btn-accent:hover {
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
  transform: translateY(-1px);
  background: #1d4ed8;
}

/* ── Light mode ── */

