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

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

/* ── LIGHT MODE (default) ── */
:root {
  --flame-deep: #B83A1A;
  --flame-mid: #D85A30;
  --flame-warm: #EF9F27;
  --cream: #FAF8F4;
  --dark: #1C1814;
  --mid: #5F5E5A;
  --light-border: #E8E4DE;
  --card-bg: #FFFFFF;
  --success: #3B6D11;
  --success-bg: #EAF3DE;
  --error: #A32D2D;
  --error-bg: #FCEBEB;
  /* Hero sections — always dark regardless of theme */
  --hero-bg: #1C1814;
  --hero-text: #FAF8F4;
  --hero-sub: #B4B2A9;
  --hero-muted: #888888;
}

/* ── DARK MODE ── */
[data-theme="dark"] {
  --cream: #111009;
  --dark: #F0EDE8;
  --mid: #9A9590;
  --light-border: #2E2C28;
  --card-bg: #1C1A16;
  --success: #5DCAA5;
  --success-bg: #0D2E24;
  --error: #F09595;
  --error-bg: #2E1010;
  /* Hero bg stays dark — slightly lighter than pure black for depth */
  --hero-bg: #0D0B08;
  --hero-text: #F0EDE8;
  --hero-sub: #9A9590;
  --hero-muted: #5F5E5A;
}

/* Smooth theme transition */
body, nav, footer, .card, .btn-primary, .btn-secondary, .btn-ghost {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Dark mode pill adjustments */
[data-theme="dark"] .pill-flame { background: #3D1A0E; color: #F0997B; }
[data-theme="dark"] .pill-green { background: #0D2E24; color: #5DCAA5; }
[data-theme="dark"] .pill-amber { background: #2E1E06; color: #FAC775; }
[data-theme="dark"] .pill-gray  { background: #1E1D1A; color: #9A9590; }
[data-theme="dark"] .pill-blue  { background: #0C1E30; color: #85B7EB; }

/* Dark mode form fields */
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  background: #111009;
  color: #F0EDE8;
  border-color: #2E2C28;
}
[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder { color: #5F5E5A; }

/* Dark mode select options */
[data-theme="dark"] select option { background: #1C1A16; }

/* Dark mode secondary button */
[data-theme="dark"] .btn-secondary {
  color: var(--dark);
  border-color: var(--dark);
}
[data-theme="dark"] .btn-secondary:hover { background: var(--dark); color: #111009; }

/* Dark mode ghost button */
[data-theme="dark"] .btn-ghost { color: var(--mid); border-color: var(--light-border); }
[data-theme="dark"] .btn-ghost:hover { border-color: var(--mid); color: var(--dark); }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--dark);
  min-height: 100vh;
  overflow-x: hidden;
  padding: 0;
}

/* Page content wrapper — constrains width without affecting nav */
.page-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
}

/* ==================== NAV ==================== */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 5%;           /* Controls how close to the edges it sits */
  background: var(--cream);
  border-bottom: 1px solid var(--light-border);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
}

/* Logo - left */
.logo {
  display: flex;
  align-items: center;
  gap: 0;
  color: var(--dark);
  text-decoration: none;
  flex-shrink: 0;
}
.logo-svg {
  display: block;
  height: 34px;
  width: auto;
}

/* Nav links - center */
.nav-links {
  display: flex;
  gap: 1rem;
  list-style: none;
  align-items: center;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  flex: 1;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  font-size: 14px;
  color: var(--mid);
  text-decoration: none;
  font-weight: 400;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--flame-deep);
}

/* Right side buttons/avatar */
.nav-auth,
nav > div:last-child {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Animated upload button in nav */
@keyframes flame-pulse {
  0%,100% { box-shadow: 0 0 6px 1px rgba(216,90,48,0.45); }
  50%      { box-shadow: 0 0 14px 3px rgba(239,159,39,0.7); }
}
.nav-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #B83A1A 0%, #D85A30 50%, #EF9F27 100%);
  background-size: 200% 200%;
  animation: flame-pulse 2s ease-in-out infinite;
  transition: transform 0.15s, opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-upload-btn:hover { transform: translateY(-1px); opacity: 0.9; }

/* Nav inner — fills remaining space between logo and auth section */
#nav-inner {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 1rem;
  margin-left: 2rem;
}

/* Anon (guest) nav buttons */
.nav-anon {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Pro badge */
.nav-pro-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--flame-deep);
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* Avatar circle */
.nav-user-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
}
.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--flame-deep);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  user-select: none;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.nav-avatar:hover,
.nav-avatar:focus { border-color: var(--flame-deep); outline: none; }

/* Dropdown panel */
.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--light-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
  animation: menuSlide 0.15s ease;
}
.nav-dropdown.open { display: block; }
.nav-dropdown-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--light-border);
}
.nd-name { font-size: 14px; font-weight: 600; color: var(--dark); }
.nd-role { font-size: 12px; color: var(--mid); margin-top: 1px; }
.nd-item {
  display: block;
  padding: 9px 16px;
  font-size: 14px;
  color: var(--dark);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nd-item:hover { background: var(--cream); }
.nd-divider { height: 1px; background: var(--light-border); margin: 4px 0; }
.nd-signout { color: #c0392b; }

/* Dark mode adjustments */
[data-theme="dark"] .nav-dropdown {
  background: #1C1A16;
  border-color: #2E2C28;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
[data-theme="dark"] .nd-item { color: #F0EDE8; }
[data-theme="dark"] .nd-item:hover { background: #111009; }
[data-theme="dark"] .nd-divider { background: #2E2C28; }
[data-theme="dark"] .nav-dropdown-header { border-color: #2E2C28; }

/* BUTTONS */
.btn-primary {
  background: var(--flame-deep);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  text-decoration: none;
  display: inline-block;
}
.btn-primary:hover { background: var(--flame-mid); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: transparent;
  color: var(--dark);
  border: 1.5px solid var(--dark);
  padding: 10px 22px;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover { background: var(--dark); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--mid);
  border: 1px solid var(--light-border);
  padding: 8px 16px;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-ghost:hover { border-color: var(--mid); color: var(--dark); }

/* FORM ELEMENTS */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--dark); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 11px 14px;
  border: 1px solid var(--light-border);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--dark);
  background: var(--card-bg);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-group select { padding-right: 36px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--flame-mid); }
.form-group input::placeholder,
.form-group textarea::placeholder { color: #B4B2A9; }

/* CARDS */
.card {
  background: var(--card-bg);
  border: 1px solid var(--light-border);
  border-radius: 12px;
  padding: 1.75rem;
}

/* BADGES / PILLS */
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
}
.pill-flame { background: #FAECE7; color: var(--flame-deep); }
.pill-green { background: #EAF3DE; color: #3B6D11; }
.pill-amber { background: #FAEEDA; color: #633806; }
.pill-gray  { background: #F1EFE8; color: #5F5E5A; }
.pill-blue  { background: #E6F1FB; color: #185FA5; }

/* ── BETA BANNER ── */
#ignis-beta-banner {
  background: linear-gradient(90deg, #D85A30 0%, #C04B22 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  padding: 9px 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 90;
}
#ignis-beta-banner strong { font-weight: 600; }
#beta-discord-link {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}
#beta-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  line-height: 1;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}
#beta-dismiss:hover { color: #fff; }

/* FOOTER */
footer {
  border-top: 1px solid var(--light-border);
  padding: 3.5rem 5% 0;
  margin-top: 4rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 3rem;
  flex-wrap: wrap;
  padding-bottom: 3rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 160px;
}
.footer-tagline { font-size: 13px; color: var(--mid); margin: 0; }

.footer-cols {
  display: flex;
  gap: 3.5rem;
  flex-wrap: wrap;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 120px;
}
.footer-col-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dark);
  margin-bottom: 0.25rem;
}
.footer-col a {
  font-size: 13px;
  color: var(--mid);
  text-decoration: none;
  transition: color 0.15s;
  font-weight: 300;
}
.footer-col a:hover { color: var(--flame-deep); }

.footer-bottom {
  border-top: 1px solid var(--light-border);
  padding: 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-bottom p { font-size: 12px; color: var(--mid); margin: 0; }

.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a { font-size: 12px; color: var(--mid); text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: var(--flame-deep); }

.footer-social { display: flex; gap: 0.75rem; align-items: center; }
.footer-social a { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--cream); border: 1px solid var(--light-border); color: var(--mid); text-decoration: none; transition: all 0.15s; flex-shrink: 0; }
.footer-social a:hover { background: var(--flame-deep); border-color: var(--flame-deep); color: #fff; }

/* Hide logo injected by auth.js */
footer > .logo { display: none; }

@media (max-width: 600px) {
  footer { padding: 2.5rem 1.25rem 0; }
  .footer-inner { flex-direction: column; gap: 2rem; }
  .footer-cols { gap: 2rem; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 600px) {
  nav { padding: 1rem 1.25rem; }
  .nav-links { display: none; }
  footer { flex-direction: column; text-align: center; }
  .hero { padding: 3rem 1.25rem 2.5rem; }
  .stats-bar { gap: 2rem; }
  .section { padding: 3rem 1.25rem; }
  .audience-grid { grid-template-columns: 1fr; }
  .step::after { display: none; }
  .signup-section { margin: 0 1.25rem 3rem; padding: 2.5rem 1.5rem; }
}

/* ── HAMBURGER MENU ── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--dark);
  border-radius: 2px;
  transition: all 0.25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none;
  position: fixed;
  top: 65px;
  left: 0; right: 0;
  background: var(--card-bg);
  border-bottom: 1px solid var(--light-border);
  z-index: 99;
  padding: 0.75rem 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  animation: menuSlide 0.2s ease;
}
@keyframes menuSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mobile-menu.open { display: block; }

.mobile-menu a, .mobile-menu button.mm-btn {
  display: block;
  padding: 0.85rem 1.5rem;
  font-size: 15px;
  color: var(--dark);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--light-border);
}
.mobile-menu a:last-child, .mobile-menu button.mm-btn:last-child { border-bottom: none; }
.mobile-menu a:hover, .mobile-menu button.mm-btn:hover { background: var(--cream); }
.mobile-menu a.active-page { color: var(--flame-deep); font-weight: 500; }
.mobile-menu .mm-section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mid);
  padding: 0.6rem 1.5rem 0.3rem;
}
.mobile-menu .mm-divider { height: 1px; background: var(--light-border); margin: 4px 0; }

@media (max-width: 860px) {
  .nav-links { display: none !important; }
  .hamburger { display: flex; }
  /* hide "Join free" text on small screens, keep icon buttons */
  .nav-hide-sm { display: none !important; }
}

/* ── DARK MODE HERO SECTION TEXT ── */
/* Hero sections use var(--hero-bg) — always dark, text uses hero variables */
.browse-hero, .lb-hero, .groups-hero, .profile-hero,
.group-hero, .admin-hero, .sa-hero, .td-greeting-hero {
  background: var(--hero-bg);
}

/* ── ALWAYS-DARK SECTIONS: text must stay light in both themes ── */
/* These bg colours are near-black in both light AND dark mode.    */

/* Browse / leaderboard / groups heroes */
[data-theme="dark"] .browse-hero h1,
[data-theme="dark"] .browse-hero p,
[data-theme="dark"] .lb-hero h1,
[data-theme="dark"] .lb-hero p,
[data-theme="dark"] .groups-hero h1,
[data-theme="dark"] .groups-hero p,
[data-theme="dark"] .group-hero .group-hero-name,
[data-theme="dark"] .group-hero .group-hero-desc { color: var(--hero-text); }

/* Profile hero — hardcoded hex colours flip with var(--dark) in dark mode */
[data-theme="dark"] .profile-hero .profile-name        { color: #FAF8F4 !important; }
[data-theme="dark"] .profile-hero .profile-bio         { color: #B4B2A9 !important; }
[data-theme="dark"] .profile-hero .profile-stat .num   { color: #FAF8F4 !important; }
[data-theme="dark"] .profile-hero .profile-stat .lbl   { color: #888888 !important; }
[data-theme="dark"] .profile-hero .profile-role-pill   { color: #FAC775 !important; }
[data-theme="dark"] .profile-hero .social-link         { color: #B4B2A9 !important; border-color: rgba(255,255,255,0.15) !important; }
[data-theme="dark"] .profile-hero .social-link:hover   { color: #FAF8F4 !important; }

/* School-admin hero (background: var(--dark)) */
[data-theme="dark"] .admin-hero h1        { color: #FAF8F4 !important; }
[data-theme="dark"] .admin-hero p         { color: #B4B2A9 !important; }
[data-theme="dark"] .admin-hero .plan-badge { color: #FAF8F4 !important; }

/* Site-admin hero */
[data-theme="dark"] .sa-hero h1           { color: #FAF8F4 !important; }
[data-theme="dark"] .sa-hero p            { color: #9A9590 !important; }
[data-theme="dark"] .sa-hero .admin-badge { color: #FAF8F4 !important; }

/* Dark upgrade cards inside light pages (settings, school-admin) */
/* .upgrade-dark-card class added to those divs in HTML patches below */
[data-theme="dark"] .upgrade-dark-card {
  background: #0D0B08 !important;
}
[data-theme="dark"] .upgrade-dark-card .upgrade-title { color: #FAF8F4 !important; }
[data-theme="dark"] .upgrade-dark-card p              { color: #B4B2A9 !important; }
[data-theme="dark"] .upgrade-dark-card .btn-ghost     { color: #FAF8F4 !important; border-color: rgba(255,255,255,0.25) !important; }

/* Leaderboard table — names and points readable on dark cards */
[data-theme="dark"] .lb-name { color: #F0EDE8; }
[data-theme="dark"] .lb-pts { color: #F0EDE8; }
[data-theme="dark"] .podium-name,
[data-theme="dark"] .podium-score { color: #F0EDE8; }

/* Active category + filter chips — white text on dark bg */
[data-theme="dark"] .cat-tab.active,
[data-theme="dark"] .chip.active { color: #F0EDE8; }

/* Streak boxes — always dark background regardless of theme */
.streak-card, .streak-box, .rank-display, .headboy-box {
  background: var(--hero-bg) !important;
}
.streak-num, .streak-lbl, .streak-sub,
.rank-num, .rank-label, .rank-sub { color: var(--hero-text) !important; }
.streak-lbl, .streak-sub, .rank-label, .rank-sub { color: var(--hero-sub) !important; }

/* Nav dropdown ↑ upload icon visibility */
[data-theme="dark"] #user-dropdown a,
[data-theme="dark"] #user-dropdown button { color: var(--dark); }

/* Search bar inside dark hero */
[data-theme="dark"] .search-bar { background: #1C1A16; border-color: #2E2C28; }
[data-theme="dark"] .search-bar input { color: var(--dark); background: transparent; }
[data-theme="dark"] .search-bar input::placeholder { color: #5F5E5A; }

/* Filter bar */
[data-theme="dark"] .filter-bar { background: #1C1A16; border-color: #2E2C28; }
[data-theme="dark"] .filter-group { border-color: #2E2C28; }
[data-theme="dark"] .chip { background: #111009; border-color: #2E2C28; color: #9A9590; }
[data-theme="dark"] .chip:hover { border-color: #9A9590; color: #F0EDE8; }
[data-theme="dark"] .chip.active { background: #F0EDE8; color: #111009; border-color: #F0EDE8; }
[data-theme="dark"] .filter-group-label { color: #5F5E5A; }

/* Period + category tabs (leaderboard, groups) */
[data-theme="dark"] .period-tabs { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .period-tab { color: #5F5E5A; }
[data-theme="dark"] .period-tab.active { background: #1C1A16; color: #F0EDE8; }
[data-theme="dark"] .cat-tab { background: #1C1A16; border-color: #2E2C28; color: #9A9590; }
[data-theme="dark"] .cat-tab:hover { border-color: #9A9590; color: #F0EDE8; }
[data-theme="dark"] .cat-tab.active { background: #F0EDE8; color: #111009; border-color: #F0EDE8; }

/* Profile + group dark hero tabs */
[data-theme="dark"] .profile-tabs,
[data-theme="dark"] .group-tabs { border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .profile-tab,
[data-theme="dark"] .g-tab { color: #5F5E5A; }
[data-theme="dark"] .profile-tab:hover,
[data-theme="dark"] .g-tab:hover { color: #F0EDE8; }
[data-theme="dark"] .profile-tab.active,
[data-theme="dark"] .g-tab.active { color: #F0EDE8; border-color: var(--flame-mid); }

/* Stats rows on profile hero */
[data-theme="dark"] .profile-stat .num { color: #F0EDE8; }
[data-theme="dark"] .profile-stat .lbl,
[data-theme="dark"] .gh-stat .lbl { color: #5F5E5A; }
[data-theme="dark"] .gh-stat .num { color: #F0EDE8; }

/* Leaderboard podium cards */
[data-theme="dark"] .podium-card { background: #1C1A16; border-color: #2E2C28; }
[data-theme="dark"] .podium-name,
[data-theme="dark"] .podium-score { color: var(--dark); }
[data-theme="dark"] .podium-role,
[data-theme="dark"] .podium-score-label { color: var(--mid); }

/* Leaderboard table rows */
[data-theme="dark"] .lb-row { border-color: #2E2C28; }
[data-theme="dark"] .lb-row:hover { background: #1C1A16; }
[data-theme="dark"] .lb-row.you { background: #2E1E06; }

/* ── index.html audience-card.featured (Teachers card) ── */
/* Uses var(--dark) as background — must stay dark in dark mode */
[data-theme="dark"] .audience-card.featured { background: #0D0B08; border-color: #2E2C28; }
[data-theme="dark"] .audience-card.featured h3 { color: #FAF8F4; }
[data-theme="dark"] .audience-card.featured p  { color: #B4B2A9; }
[data-theme="dark"] .audience-card.featured li { color: #B4B2A9; }

/* ── index.html bottom CTA section ── */
[data-theme="dark"] .signup-section { background: #0D0B08; }
[data-theme="dark"] .signup-section h2 { color: #FAF8F4; }
[data-theme="dark"] .signup-section p  { color: #B4B2A9; }

/* ── index.html streak card ── */
[data-theme="dark"] .streak-card { background: #0D0B08 !important; }
[data-theme="dark"] .lb-name,
[data-theme="dark"] .lb-pts-lbl { color: var(--mid); }

/* Resource and group cards */
[data-theme="dark"] .resource-card,
[data-theme="dark"] .group-card,
[data-theme="dark"] .group-resource-row,
[data-theme="dark"] .member-row,
[data-theme="dark"] .trending-row,
[data-theme="dark"] .rm-row,
[data-theme="dark"] .lib-row,
[data-theme="dark"] .res-row,
[data-theme="dark"] .teacher-row,
[data-theme="dark"] .award-card,
[data-theme="dark"] .badge-card { background: #1C1A16; border-color: #2E2C28; }

[data-theme="dark"] .resource-card:hover,
[data-theme="dark"] .group-card:hover,
[data-theme="dark"] .group-resource-row:hover,
[data-theme="dark"] .member-row:hover,
[data-theme="dark"] .trending-row:hover { border-color: #5F5E5A; }

/* Card titles and text */
[data-theme="dark"] .card-title,
[data-theme="dark"] .rr-title,
[data-theme="dark"] .gr-title,
[data-theme="dark"] .rm-title,
[data-theme="dark"] .tr-title,
[data-theme="dark"] .lib-title,
[data-theme="dark"] .group-name,
[data-theme="dark"] .m-name,
[data-theme="dark"] .res-title,
[data-theme="dark"] .t-name,
[data-theme="dark"] .award-name,
[data-theme="dark"] .badge-name { color: #F0EDE8; }

[data-theme="dark"] .card-subject,
[data-theme="dark"] .rr-meta,
[data-theme="dark"] .gr-meta,
[data-theme="dark"] .gr-uploader,
[data-theme="dark"] .rm-meta,
[data-theme="dark"] .tr-meta,
[data-theme="dark"] .lib-sub,
[data-theme="dark"] .group-desc,
[data-theme="dark"] .m-sub,
[data-theme="dark"] .res-sub,
[data-theme="dark"] .t-sub,
[data-theme="dark"] .award-desc,
[data-theme="dark"] .badge-desc { color: #9A9590; }

/* Sidebar boxes */
[data-theme="dark"] .sidebar-card,
[data-theme="dark"] .sidebar-box,
[data-theme="dark"] .td-sidebar-box,
[data-theme="dark"] .home-sidebar-box,
[data-theme="dark"] .settings-section,
[data-theme="dark"] .s-section,
[data-theme="dark"] .analytics-card,
[data-theme="dark"] .teaching-lib,
[data-theme="dark"] .lib-header,
[data-theme="dark"] .res-table,
[data-theme="dark"] .student-table,
[data-theme="dark"] .admin-nav,
[data-theme="dark"] .settings-nav { background: #1C1A16; border-color: #2E2C28; }

[data-theme="dark"] .sidebar-stat,
[data-theme="dark"] .spec-row,
[data-theme="dark"] .toggle-row,
[data-theme="dark"] .connected-row,
[data-theme="dark"] .lb-mini-row,
[data-theme="dark"] .usage-bar-row,
[data-theme="dark"] .st-row,
[data-theme="dark"] .award-row,
[data-theme="dark"] .recent-subject,
[data-theme="dark"] .group-lb-row { border-color: #2E2C28; }

/* Stat cards */
[data-theme="dark"] .td-stat,
[data-theme="dark"] .mini-stat,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .bill-card,
[data-theme="dark"] .point-item { background: #111009; }
[data-theme="dark"] .points-box { background: #0C1E30; }
[data-theme="dark"] .points-box h3 { color: #85B7EB; }
[data-theme="dark"] .point-item .point-val,
[data-theme="dark"] .point-item .point-act { color: #85B7EB; }

/* Admin/settings nav items */
[data-theme="dark"] .admin-nav-item,
[data-theme="dark"] .sn-item { color: #9A9590; border-color: #2E2C28; }
[data-theme="dark"] .admin-nav-item:hover,
[data-theme="dark"] .sn-item:hover { background: #111009; color: #F0EDE8; }
[data-theme="dark"] .admin-nav-item.active { background: #3D1A0E; color: #F0997B; border-left-color: var(--flame-mid); }
[data-theme="dark"] .sn-item.active { background: #3D1A0E; color: #F0997B; border-left-color: var(--flame-mid); }

/* Bar chart */
[data-theme="dark"] .bar { background: #2E2C28; }
[data-theme="dark"] .bar.highlight { background: var(--flame-mid); }

/* Progress bars */
[data-theme="dark"] .progress-bar-track,
[data-theme="dark"] .st-bar-wrap,
[data-theme="dark"] .usage-bar-track { background: #2E2C28; }

/* Modal backdrops */
[data-theme="dark"] .modal,
[data-theme="dark"] .create-modal,
[data-theme="dark"] .pro-modal,
[data-theme="dark"] .pick-modal,
[data-theme="dark"] .gate-modal { background: #1C1A16; }

/* Input fields in dark hero (search bar etc) */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #1C1A16;
  color: #F0EDE8;
  border-color: #2E2C28;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #5F5E5A; }

/* Dropzone */
[data-theme="dark"] .drop-zone { background: #111009; border-color: #2E2C28; }
[data-theme="dark"] .drop-zone:hover,
[data-theme="dark"] .drop-zone.dragover { border-color: var(--flame-mid); background: #3D1A0E; }

/* Type picker */
[data-theme="dark"] .type-opt { background: #1C1A16; border-color: #2E2C28; }
[data-theme="dark"] .type-opt:hover { border-color: var(--flame-mid); }
[data-theme="dark"] .type-opt.active { background: #3D1A0E; border-color: var(--flame-deep); }

/* Flash card / quiz builders */
[data-theme="dark"] .quiz-question { background: #111009; border-color: #2E2C28; }
[data-theme="dark"] .flashcard-row textarea,
[data-theme="dark"] .quiz-q-text,
[data-theme="dark"] .quiz-option-row input[type="text"] { background: #1C1A16; border-color: #2E2C28; color: #F0EDE8; }

/* Active filter tags */
[data-theme="dark"] .active-filter-tag { background: #3D1A0E; border-color: #F0997B; color: #F0997B; }

/* Mobile menu */
[data-theme="dark"] .mobile-menu { background: #1C1A16; border-color: #2E2C28; }
[data-theme="dark"] .mobile-menu a,
[data-theme="dark"] .mobile-menu button.mm-btn { color: #F0EDE8; border-color: #2E2C28; }
[data-theme="dark"] .mobile-menu a:hover,
[data-theme="dark"] .mobile-menu button.mm-btn:hover { background: #111009; }
[data-theme="dark"] .mobile-menu .mm-section-label { color: #5F5E5A; }
[data-theme="dark"] .mobile-menu .mm-divider { background: #2E2C28; }

/* Pricing cards */
[data-theme="dark"] .pricing-card { background: #1C1A16; border-color: #2E2C28; }
[data-theme="dark"] .pricing-name { color: #F0EDE8; }
[data-theme="dark"] .pricing-amount .big,
[data-theme="dark"] .pricing-amount .free-tag { color: #F0EDE8; }
[data-theme="dark"] .billing-toggle { background: #2E2C28; }
[data-theme="dark"] .bt.active { background: #1C1A16; color: #F0EDE8; }

/* Dashboard greeting */
[data-theme="dark"] .dash-greeting h1,
[data-theme="dark"] .td-greeting,
[data-theme="dark"] .panel-header h2,
[data-theme="dark"] .settings-page-header h1 { color: #F0EDE8; }

/* Recently viewed strip */
[data-theme="dark"] #recently-viewed a { background: #1C1A16; border-color: #2E2C28; }
[data-theme="dark"] #recently-viewed a:hover { border-color: #5F5E5A; }

/* Pro overlay cards */
[data-theme="dark"] .pro-overlay { background: rgba(17,16,9,0.88); }
[data-theme="dark"] .pro-overlay-card,
[data-theme="dark"] .timetable-overlay-card { background: #1C1A16; border-color: #2E2C28; }

/* Footer */
[data-theme="dark"] footer { border-color: #2E2C28; }

/* ── GLOBAL MOBILE IMPROVEMENTS ── */

/* Prevent horizontal scroll on small screens */
@media (max-width: 860px) {
  body { overflow-x: hidden; }

  /* Ensure page padding is touch-friendly */
  .page-wrapper { padding: 0; }

  /* Wider inputs / buttons on mobile for easier tapping */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  select,
  textarea { font-size: 16px; } /* 16px prevents iOS zoom on focus */

  /* Upload / form grids collapse on small screens */
  .form-2col { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; padding: 1.25rem; }
  .settings-nav { position: static; }

  /* Pricing cards and school grid collapse */
  .pricing-grid { grid-template-columns: 1fr; padding: 0 1.25rem 2rem; }
  .school-grid { grid-template-columns: 1fr; }

  /* Resource and badge grids */
  .badges-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .badge-editor-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

  /* Hero stats wrap nicely */
  .hero-stats { gap: 1.25rem; }
  .profile-stats-row { gap: 1.25rem; }
}

@media (max-width: 480px) {
  /* Very small screens — single column everywhere */
  .features-grid,
  .audience-grid,
  .home-quick-actions { grid-template-columns: 1fr; }

  /* Sidebar below main on narrow screens */
  .profile-body { grid-template-columns: 1fr; }
}

/* Browse filter scroll wrap — layout handled in browse.html page styles */