/* ============================================
   NAIJLEARN — Main Stylesheet
   Nigeria's Educational Resource Library
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ─── RESET & ROOT VARIABLES ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --ink:      #0D1B2A;
  --ink2:     #2D3F50;
  --muted:    #6B7F8E;
  --sage:     #3D7A6B;
  --sage-l:   #E8F4F0;
  --sage-m:   #B8DDD5;
  --sage-d:   #2d6457;
  --gold:     #C8882A;
  --gold-l:   #FBF3E8;
  --cream:    #FAFAF7;
  --white:    #FFFFFF;
  --border:   #E4E8EB;
  --r:        12px;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.06);
  --shadow-md:  0 8px 40px rgba(61,122,107,.12), 0 2px 8px rgba(0,0,0,.04);
  --shadow-lg:  0 12px 40px rgba(61,122,107,.14);
}

/* ─── BASE ─── */
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
  line-height: 1.5;
}

a { text-decoration: none; }

img {
  max-width: 100%;
  display: block;
}

/* ─── UTILITY ─── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 0 48px;
}

.section {
  padding: 56px 48px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 28px;
}

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 68px;
  font-weight: 700;
  color: var(--ink);
}

.section-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--sage);
}

.section-link:hover { text-decoration: underline; }

/* ─── BUTTONS ─── */
.btn-primary {
  background: var(--sage);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--sage-d); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-ghost:hover { border-color: var(--sage); color: var(--sage); }

.btn-nav {
  background: var(--sage);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s;
}
.btn-nav:hover { background: var(--sage-d); }

.btn-sage {
  background: var(--sage);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.btn-sage:hover { background: #4a907e; transform: translateY(-1px); }

.btn-outline-w {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.6);
  border-radius: 10px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.btn-outline-w:hover { border-color: #5BBDA8; color: #5BBDA8; }

.btn-white {
  background: #fff;
  color: var(--sage);
  border: none;
  border-radius: 10px;
  padding: 13px 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.btn-white:hover { background: var(--cream); transform: translateY(-1px); }

/* ─── NAVIGATION ─── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 48px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--sage);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.nav-logo span { color: var(--gold); }

.nav-logo-img {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink2);
  transition: color .2s;
}
.nav-links a:hover { color: var(--sage); }
.nav-links a.active { color: var(--sage); font-weight: 600; }

/* ── Nav tooltips (all nav links with a title attribute) ── */
/* Show custom tooltip only on non-touch devices */
@media (hover: hover) {
  .nav-links a[title],
  .nav-links button[title] {
    position: relative;
  }
  .nav-links a[title]::after,
  .nav-links button[title]::after {
    content: attr(title);
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: #FAFAF7;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s;
    z-index: 9000;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
  }
  .nav-links a[title]::before,
  .nav-links button[title]::before {
    content: '';
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: var(--ink);
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s;
    z-index: 9000;
  }
  .nav-links a[title]:hover::after,
  .nav-links a[title]:hover::before,
  .nav-links button[title]:hover::after,
  .nav-links button[title]:hover::before { opacity: 1; }

  /* Dark mode — lighter tooltip bubble for contrast */
  [data-theme="dark"] .nav-links a[title]::after,
  [data-theme="dark"] .nav-links button[title]::after {
    background: #E8EFF5;
    color: #0D1B2A;
    box-shadow: 0 2px 8px rgba(0,0,0,.45);
  }
  [data-theme="dark"] .nav-links a[title]::before,
  [data-theme="dark"] .nav-links button[title]::before {
    border-bottom-color: #E8EFF5;
  }
}

/* Legacy class kept for any markup that still uses it */
.nav-browse-tip { /* intentionally empty — handled by [title] rule above */ }

/* Mobile hamburger (hidden on desktop) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--ink);
}

/* ─── HERO ─── */
.hero-wrapper { max-width: 1296px; margin: 0 auto; }

.hero {
  padding: 72px 48px 60px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--sage-l);
  color: var(--sage);
  border: 1px solid var(--sage-m);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}
.hero-badge::before { content: '🇳🇬'; font-size: 14px; }

h1 {
  font-family: 'Playfair Display', serif;
  font-size: 52px;
  line-height: 1.1;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 20px;
}
h1 em { font-style: normal; color: var(--sage); }

.hero-sub {
  font-size: 17px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 36px;
  font-weight: 400;
  max-width: 460px;
}

.hero-ctas {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.hero-stats { display: flex; gap: 32px; }

.stat-item { text-align: left; }

.stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  display: block;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ─── SEARCH CARD ─── */
.search-card {
  background: var(--white);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.search-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.search-input-wrap {
  display: flex;
  background: #F4F6F5;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1.5px solid transparent;
  transition: border-color .2s;
}
.search-input-wrap:focus-within { border-color: var(--sage); }

.search-icon {
  padding: 0 14px;
  display: flex;
  align-items: center;
  color: var(--sage);
  font-size: 20px;
}

.search-input {
  border: none;
  background: transparent;
  flex: 1;
  padding: 14px 0;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
}
.search-input::placeholder { color: #9CA9B2; }

.btn-search {
  background: var(--sage);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin: 6px;
  transition: background .2s;
}
.btn-search:hover { background: var(--sage-d); }

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink2);
  background: var(--white);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7F8E' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color .2s;
}
.filter-select:focus { border-color: var(--sage); }

.search-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stag {
  background: var(--sage-l);
  color: var(--sage);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--sage-m);
  transition: all .2s;
}
.stag:hover { background: var(--sage); color: #fff; }

/* ─── SUBJECTS GRID ─── */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.subject-pill {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all .2s;
}
.subject-pill:hover {
  border-color: var(--sage);
  background: var(--sage-l);
  transform: translateY(-2px);
}

.subj-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.subj-info { text-align: left; }
.subj-name { font-size: 13px; font-weight: 600; color: var(--ink); display: block; }
.subj-count { font-size: 11px; color: var(--muted); }

/* ─── RESOURCE CARDS ─── */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.res-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all .25s;
  position: relative;
}
.res-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--sage-m);
}

.res-thumb {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
}

.res-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--white);
  color: var(--ink2);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
}

.res-verified {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--sage);
  color: #fff;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
}

.res-body { padding: 16px; }

.res-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.meta-tag {
  background: var(--cream);
  color: var(--muted);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
.meta-tag.green { background: var(--sage-l); color: var(--sage); }

.res-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.res-topic { font-size: 12px; color: var(--muted); margin-bottom: 14px; }

.res-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.res-uploader {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.avatar-sm {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--sage-l);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--sage);
  flex-shrink: 0;
  overflow: hidden;
}

.res-downloads {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.dl-icon { font-size: 14px; }

/* ─── HOW IT WORKS ─── */
.how-section {
  background: var(--white);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 64px 48px;
}

.how-inner { max-width: 1200px; margin: 0 auto; }

.how-title {
  font-family: 'Playfair Display', serif;
  font-size: 34px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.how-sub {
  color: var(--muted);
  text-align: center;
  font-size: 16px;
  margin-bottom: 52px;
}

.how-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 44px;
}

.how-tab {
  padding: 8px 22px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: transparent;
  font-family: inherit;
  color: var(--muted);
  transition: all .2s;
}
.how-tab.active { background: var(--sage); color: #fff; border-color: var(--sage); }

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.step-card {
  background: var(--cream);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
}

.step-num {
  width: 44px;
  height: 44px;
  background: var(--sage);
  color: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  margin: 0 auto 16px;
  font-family: 'Playfair Display', serif;
}

.step-icon { font-size: 28px; margin-bottom: 12px; }
.step-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.step-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ─── TESTIMONIALS ─── */
.testi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 28px;
}

.testi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.testi-quote {
  font-size: 14px;
  color: var(--ink2);
  line-height: 1.7;
  margin-bottom: 20px;
  font-style: italic;
}

.testi-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.testi-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.testi-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.testi-role { font-size: 12px; color: var(--muted); }
.stars { color: var(--gold); font-size: 13px; margin-bottom: 12px; }

/* ─── HOMESCHOOL BANNER ─── */
.home-banner-wrapper {
  max-width: 1296px;
  margin: 0 auto;
  padding: 0 0 56px;
}

.home-banner {
  background: linear-gradient(135deg, #1B5E52 0%, #3D7A6B 60%, #5A9E8C 100%);
  border-radius: 24px;
  padding: 52px 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 48px;
  max-width: 1200px;
  position: relative;
  overflow: hidden;
}
.home-banner::before {
  content: '📚';
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 120px;
  opacity: .15;
}

.banner-content { max-width: 560px; }

.banner-tag {
  display: inline-block;
  background: rgba(255,255,255,.15);
  color: #fff;
  border-radius: 100px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: .5px;
}

.banner-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.2;
}

.banner-desc {
  font-size: 15px;
  color: rgba(255,255,255,.8);
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ─── CTA SECTION ─── */
.cta-section {
  background: var(--ink);
  padding: 72px 48px;
  text-align: center;
}

.cta-inner { max-width: 600px; margin: 0 auto; }

.cta-title {
  font-family: 'Playfair Display', serif;
  font-size: 38px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
  line-height: 1.2;
}
.cta-title em { font-style: normal; color: #5BBDA8; }

.cta-sub {
  color: rgba(255,255,255,.85);
  font-size: 16px;
  margin-bottom: 36px;
  line-height: 1.6;
}

.cta-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── FOOTER ─── */
footer {
  background: #0A151F;
  padding: 48px;
  color: rgba(255,255,255,.5);
  font-size: 13px;
  text-align: center;
}

.footer-logo {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--sage);
  margin-bottom: 8px;
}

.footer-tagline { margin-bottom: 24px; color: rgba(255,255,255,.75); }

.footer-links {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.footer-links a {
  color: rgba(255,255,255,.75);
  transition: color .2s;
}
.footer-links a:hover { color: var(--sage); }

.footer-copy { color: rgba(255,255,255,.55); }

/* ─── BROWSE PAGE SPECIFIC ─── */
.browse-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 32px 48px;
}

.browse-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.browse-sub { color: var(--muted); font-size: 15px; }

.browse-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 48px;
  align-items: start;
}

.filter-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  position: sticky;
  top: 90px;
}

.filter-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-clear {
  font-size: 12px;
  font-weight: 600;
  color: var(--sage);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.filter-group { margin-bottom: 20px; }

.filter-group-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}

.filter-options { display: flex; flex-direction: column; gap: 8px; }

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink2);
  cursor: pointer;
}

.filter-option input[type="checkbox"] { accent-color: var(--sage); }

/* ── Filter dropdown (subject / term / type) ── */
.filter-dropdown-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.filter-dropdown {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--cream, #faf8f4);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 32px 9px 12px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s;
  font-family: inherit;
}
.filter-dropdown:focus {
  outline: none;
  border-color: var(--sage);
  background: #fff;
}
.filter-dropdown-arrow {
  position: absolute;
  right: 11px;
  pointer-events: none;
  font-size: 11px;
  color: var(--muted);
}

/* active subject badge shown after picking */
.filter-active-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  background: #E8F4F0;
  border: 1px solid #3D7A6B33;
  border-radius: 20px;
  padding: 4px 10px 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1A4A3A;
}
.filter-active-badge button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: #3D7A6B;
  padding: 0;
  line-height: 1;
}

/* ── Class level pill-style chips ── */
.filter-check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  cursor: pointer;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 4px 11px;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.filter-chip input[type="checkbox"] {
  display: none;
}
.filter-chip:has(input:checked) {
  background: #E8F4F0;
  border-color: var(--sage);
  color: #1A4A3A;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.results-count { font-size: 14px; color: var(--muted); }
.results-count strong { color: var(--ink); }

.sort-select {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink2);
  background: var(--white);
  cursor: pointer;
  outline: none;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ─── UPLOAD PAGE SPECIFIC ─── */
.upload-wrapper {
  max-width: 700px;
  margin: 48px auto;
  padding: 0 48px;
}

.upload-page-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.upload-page-sub { color: var(--muted); font-size: 15px; margin-bottom: 36px; }

.upload-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  margin-bottom: 24px;
}

.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  margin-bottom: 8px;
}

.form-label span { color: var(--gold); }

.form-input,
.form-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  outline: none;
  transition: border-color .2s;
}
.form-input:focus,
.form-textarea:focus { border-color: var(--sage); }
.form-textarea { resize: vertical; min-height: 100px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--cream);
}
.dropzone:hover { border-color: var(--sage); background: var(--sage-l); }
.dropzone-icon { font-size: 40px; margin-bottom: 12px; }
.dropzone-text { font-size: 14px; font-weight: 600; color: var(--ink2); margin-bottom: 4px; }
.dropzone-sub { font-size: 12px; color: var(--muted); }
.dropzone input[type="file"] { display: none; }

.upload-tip {
  background: var(--sage-l);
  border: 1px solid var(--sage-m);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 13px;
  color: var(--sage-d);
  line-height: 1.5;
  margin-bottom: 20px;
}
.upload-tip strong { font-weight: 700; }

/* ─── AUTH PAGES ─── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--sage);
  text-align: center;
  margin-bottom: 4px;
}
.auth-logo span { color: var(--gold); }

.auth-sub {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 32px;
}

.auth-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 12px;
  color: var(--muted);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 20px;
}
.auth-switch a { color: var(--sage); font-weight: 600; }

.btn-full {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.btn-full.primary { background: var(--sage); color: #fff; }
.btn-full.primary:hover { background: var(--sage-d); }

/* ─── TOAST NOTIFICATIONS ─── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--ink);
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: slideIn .3s ease;
  max-width: 320px;
}
.toast.success { border-left: 4px solid var(--sage); }
.toast.error   { border-left: 4px solid #E05656; }
.toast.info    { border-left: 4px solid var(--gold); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .subjects-grid { grid-template-columns: repeat(3, 1fr); }
  .resources-grid, .results-grid { grid-template-columns: repeat(2, 1fr); }
  .testi-grid { grid-template-columns: repeat(2, 1fr); }
  .browse-layout { grid-template-columns: 220px 1fr; }
}

@media (max-width: 768px) {
  nav { padding: 16px 20px; }
  .nav-links { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--white); border-bottom: 1px solid var(--border); padding: 20px; gap: 16px; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }

  .hero { grid-template-columns: 1fr; padding: 40px 20px; gap: 32px; }
  h1 { font-size: 36px; }

  .section { padding: 36px 20px; }
  .divider { margin: 0 20px; }

  .subjects-grid { grid-template-columns: repeat(2, 1fr); }
  .resources-grid, .results-grid { grid-template-columns: 1fr; }
  .testi-grid { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }

  .home-banner { padding: 36px 28px; margin: 0 20px; }
  .home-banner::before { display: none; }
  .banner-title { font-size: 24px; }

  .how-section { padding: 48px 20px; }
  .cta-section { padding: 48px 20px; }
  .cta-title { font-size: 28px; }

  footer { padding: 36px 20px; }

  .browse-layout { grid-template-columns: 1fr; padding: 24px 20px; }
  .filter-panel { position: static; }

  .upload-wrapper { padding: 0 20px; margin: 32px auto; }
  .upload-card { padding: 24px; }
  .form-row { grid-template-columns: 1fr; }

  .auth-card { padding: 28px 24px; }
}

/* ─── DARK MODE (moon) ─── */
[data-theme="dark"] {
  --ink:      #E8EFF5;
  --ink2:     #B0C4D4;
  --muted:    #7A95A8;
  --sage:     #5BBDA8;
  --sage-l:   #1A3530;
  --sage-m:   #2A5248;
  --sage-d:   #4AADA0;
  --gold:     #E8A84A;
  --gold-l:   #2A2010;
  --cream:    #0F1923;
  --white:    #18262F;
  --border:   #253545;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.25);
  --shadow-md:  0 8px 40px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.2);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.4);
}

[data-theme="dark"] body {
  background: var(--cream);
  color: var(--ink);
}

[data-theme="dark"] nav {
  background: var(--white);
  border-bottom-color: var(--border);
}

[data-theme="dark"] .panel,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .res-card,
[data-theme="dark"] .res-item,
[data-theme="dark"] .saved-item,
[data-theme="dark"] .hero-card,
[data-theme="dark"] .profile-hero,
[data-theme="dark"] .dash-hero,
[data-theme="dark"] .form-wrap,
[data-theme="dark"] .upload-card,
[data-theme="dark"] .resource-main,
[data-theme="dark"] .sidebar-card {
  background: var(--white);
  border-color: var(--border);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #1E2F3A;
  color: var(--ink);
  border-color: var(--border);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--muted);
}

[data-theme="dark"] .meta-pill,
[data-theme="dark"] .meta-tag {
  background: #1E2F3A;
  color: var(--ink2);
}

[data-theme="dark"] .filter-chip label {
  background: #1E2F3A;
  border-color: var(--border);
  color: var(--ink2);
}

[data-theme="dark"] .filter-chip input:checked + label {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}

[data-theme="dark"] .browse-header,
[data-theme="dark"] .browse-filters {
  background: var(--white);
  border-color: var(--border);
}

[data-theme="dark"] .delete-modal-box {
  background: var(--white);
}

/* ─── CTA + FOOTER DARK MODE ─── */
[data-theme="dark"] .cta-section {
  background: #0A141E;
}
[data-theme="dark"] .cta-title {
  color: #E8EFF5;
}
[data-theme="dark"] .cta-title em {
  color: #5BBDA8;
}
[data-theme="dark"] .cta-sub {
  color: rgba(232,239,245,.8);
}
[data-theme="dark"] .btn-outline-w {
  color: #E8EFF5;
  border-color: rgba(232,239,245,.55);
}
[data-theme="dark"] .btn-outline-w:hover {
  border-color: #5BBDA8;
  color: #5BBDA8;
}
[data-theme="dark"] footer {
  background: #060E15;
}
[data-theme="dark"] footer,
[data-theme="dark"] .footer-tagline {
  color: rgba(232,239,245,.75);
}
[data-theme="dark"] .footer-links a {
  color: rgba(232,239,245,.7);
}
[data-theme="dark"] .footer-links a:hover {
  color: #5BBDA8;
}
[data-theme="dark"] .footer-copy {
  color: rgba(232,239,245,.45);
}

/* ─── THEME TOGGLE BUTTON ─── */
.theme-toggle {
  background: var(--sage-l, #E8F4F0);
  border: 1.5px solid var(--sage-d, #4AADA0);
  border-radius: 20px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--ink, #0D1B2A);
  transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  min-width: 38px;
}
.theme-toggle:hover {
  border-color: var(--sage);
  background: var(--sage-m, #2A5248);
  transform: rotate(20deg);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
[data-theme="dark"] .theme-toggle {
  background: #1E3A4A;
  border-color: var(--sage, #5BBDA8);
  color: #E8EFF5;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
[data-theme="dark"] .theme-toggle:hover {
  background: var(--sage-m, #2A5248);
  border-color: var(--sage, #5BBDA8);
}
