/* ============================================================
   GCC IT Student Hub — Stylesheet
   Design: Design 2 layout with dark purple navbar & gold CTA
   Supports: light mode (default) + dark mode via [data-theme="dark"]
   ============================================================ */

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

/* ── Design tokens ── */
:root {
  /* Brand */
  --accent:      #3c2864;
  --accent-dk:   #2a1b48;
  --accent-lt:   #5a3e8a;
  --gold:        #f0a028;
  --gold-dk:     #d48a18;
  --accent2:     #3c78b4;

  /* Surface */
  --bg:          #f4f3f8;
  --surface:     #ffffff;
  --surface-2:   #f0eef8;

  /* Text */
  --text:        #1a1028;
  --muted:       #6b6480;

  /* Borders / utility */
  --border:      #e2dff0;
  --danger:      #ef4444;
  --success:     #16a34a;
  --success-bg:  #f0fdf4;
  --success-bd:  #bbf7d0;

  /* Misc */
  --radius:      12px;
  --radius-lg:   18px;
  --shadow:      0 1px 3px rgba(60,40,100,.07), 0 4px 20px rgba(60,40,100,.09);
  --shadow-lg:   0 4px 12px rgba(60,40,100,.10), 0 16px 48px rgba(60,40,100,.12);

  /* Nav height */
  --nav-h:       64px;
}

/* ── Dark mode overrides ── */
[data-theme="dark"] {
  --bg:        #0f0b1a;
  --surface:   #1c1630;
  --surface-2: #251e3a;
  --text:      #f0eeff;
  --muted:     #9b93b8;
  --border:    #2e2650;
  --shadow:    0 1px 3px rgba(0,0,0,.3), 0 4px 20px rgba(0,0,0,.25);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.35), 0 16px 48px rgba(0,0,0,.3);
}

/* ── Base ── */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .25s, color .25s;
}

a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

/* ============================================================
   PAGE WRAPPER
   ============================================================ */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   NAVIGATION / HEADER
   ============================================================ */
.site-header {
  background: var(--accent);
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--nav-h);
}

/* Logo */
.logo-group {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-mark.large {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  margin: 0 auto 1rem;
  background: rgba(60,40,100,.08);
}

.site-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.site-subtitle {
  font-size: .72rem;
  color: rgba(255,255,255,.6);
  margin-top: 1px;
}

/* Nav links (desktop) */
.nav-links {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
}

.nav-link {
  color: rgba(255,255,255,.8);
  font-size: .88rem;
  font-weight: 500;
  padding: .45rem .85rem;
  border-radius: 8px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}

/* Secure Login — gold tinted */
.nav-link-secure {
  color: var(--gold) !important;
  border: 1px solid rgba(240,160,40,.35);
  border-radius: 8px;
}

.nav-link-secure:hover {
  background: rgba(240,160,40,.15) !important;
  color: var(--gold) !important;
}

/* Student Portal nav link — accent2 blue tint */
.nav-link-portal {
  color: var(--accent2) !important;
  border: 1px solid rgba(60,120,180,.35);
  border-radius: 8px;
}

.nav-link-portal:hover {
  background: rgba(60,120,180,.12) !important;
  color: var(--accent2) !important;
}

[data-theme="dark"] .nav-link-portal {
  color: #7eb8f0 !important;
  border-color: rgba(126,184,240,.3);
}
[data-theme="dark"] .nav-link-portal:hover {
  background: rgba(126,184,240,.12) !important;
  color: #7eb8f0 !important;
}

/* Dark-mode toggle button */
.btn-theme {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
  margin-left: .5rem;
}

.btn-theme:hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.4);
}

.btn-theme svg { pointer-events: none; }

/* Logout button (admin) */
.btn-logout {
  margin-left: .5rem;
  background: none;
  border: 1.5px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.85);
  padding: .4rem .9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.btn-logout:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

/* Mobile hamburger placeholder — nav collapses on small screens */
@media (max-width: 640px) {
  .nav-links .nav-link { display: none; }
  .nav-links .nav-link.nav-icon-only { display: flex; }
}

/* ── Hamburger button ── */
.btn-hamburger {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-left: .5rem;
  flex-shrink: 0;
  transition: background .15s;
}

.btn-hamburger:hover { background: rgba(255,255,255,.18); }

/* ── Mobile drawer ── */
.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--accent-dk);
  border-bottom: 3px solid var(--gold);
  padding: .5rem 0;
  position: sticky;
  top: var(--nav-h);
  z-index: 99;
}

.mobile-menu.open { display: flex; }

.mobile-menu-link {
  color: rgba(255,255,255,.85);
  font-size: .95rem;
  font-weight: 500;
  padding: .85rem 1.5rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.07);
  transition: background .15s, color .15s;
  display: block;
}

.mobile-menu-link:last-child { border-bottom: none; }

.mobile-menu-link:hover,
.mobile-menu-link.active {
  background: rgba(255,255,255,.08);
  color: #fff;
}

@media (max-width: 640px) {
  .nav-links .nav-link { display: none; }
  .btn-hamburger { display: flex; }
}
/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  text-align: center;
  padding: 5rem 2rem 3.5rem;
  max-width: 700px;
  margin: 0 auto;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.2rem;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: .9rem;
}

.hero-title .highlight {
  color: var(--accent);
}

[data-theme="dark"] .hero-title .highlight {
  color: #a78bfa;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 480px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* Secure login CTA in hero */
.hero-secure-btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .75rem 1.6rem;
  background: var(--gold);
  color: #1a1028;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s, transform .1s;
  margin-bottom: .6rem;
}

.hero-secure-btn:hover {
  background: var(--gold-dk);
  transform: translateY(-1px);
}

.hero-secure-sub {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* Student Portal CTA in hero */
.hero-portal-btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .75rem 1.6rem;
  background: var(--accent2);
  color: #fff;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s, transform .1s;
  margin-bottom: .6rem;
}

.hero-portal-btn:hover {
  background: #2e62a0;
  transform: translateY(-1px);
}

[data-theme="dark"] .hero-portal-btn {
  background: #4a8fd4;
}
[data-theme="dark"] .hero-portal-btn:hover {
  background: #3a7abf;
}

/* ============================================================
   SEARCH CARD
   ============================================================ */
.search-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  max-width: 760px;
  margin: 0 auto 1.5rem;
  border: 1px solid var(--border);
}

.search-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .4rem;
  flex-wrap: wrap;
  gap: .5rem;
}

.search-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

.search-card-hint {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  color: var(--muted);
  font-weight: 500;
}

.search-card-sub {
  font-size: .83rem;
  color: var(--muted);
  margin-bottom: 1.2rem;
}

.search-form {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.input-icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: .8rem .9rem .8rem 2.6rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s, background .15s;
}

.search-input::placeholder { color: var(--muted); }

.search-input:focus {
  border-color: var(--gold);
  background: var(--surface);
}

/* ── Loading spinner inside button ── */
@keyframes spin { to { transform: rotate(360deg); } }

.btn-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2.5px solid rgba(26,16,40,.25);
  border-top-color: #1a1028;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

.btn-search {
  padding: .8rem 1.8rem;
  background: var(--gold);
  color: #1a1028;
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, opacity .15s, transform .1s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 120px;
  justify-content: center;
}

.btn-search:hover:not(:disabled) {
  background: var(--gold-dk);
  transform: translateY(-1px);
}

.btn-search:disabled,
.btn-search.loading {
  opacity: .75;
  cursor: not-allowed;
  transform: none;
}

.search-input:disabled { opacity: .6; cursor: not-allowed; }

/* Error banner */
.error-msg {
  margin-top: 1rem;
  padding: .75rem 1rem .75rem .9rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  font-size: .875rem;
  color: var(--danger);
  display: flex;
  align-items: flex-start;
  gap: .55rem;
}

[data-theme="dark"] .error-msg {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.3);
}

/* Feature pills below card */
.search-features {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.search-feature {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--muted);
  font-weight: 500;
}

.search-feature svg { color: var(--success); }

/* ============================================================
   FEATURE CARDS GRID
   ============================================================ */
.features-section {
  max-width: 1140px;
  margin: 0 auto 1.25rem;
  padding: 0 2rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
  }
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.2rem 1.1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.feature-card:hover {
  border-color: rgba(60,40,100,.2);
}

[data-theme="dark"] .feature-card:hover {
  border-color: rgba(167,139,250,.25);
}

.feature-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: .2rem;
  flex-shrink: 0;
}

[data-theme="dark"] .feature-icon {
  color: #a78bfa;
}

.feature-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.feature-desc {
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}

.feature-arrow {
  color: var(--accent);
  display: flex;
  align-items: center;
  margin-top: .5rem;
  font-size: .82rem;
  font-weight: 600;
  gap: .3rem;
  width: fit-content;
  transition: gap .15s;
}

[data-theme="dark"] .feature-arrow { color: #a78bfa; }

.feature-card:hover .feature-arrow { gap: .55rem; }

/* ============================================================
   SECURITY BANNER
   ============================================================ */
.security-banner {
  max-width: 1140px;
  margin: 0 auto 3rem;
  padding: 0 2rem;
}

.security-inner {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.security-text { flex: 1; min-width: 200px; }

.security-icon-wrap {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: .6rem;
  flex-shrink: 0;
}

[data-theme="dark"] .security-icon-wrap {
  background: rgba(167,139,250,.15);
  color: #a78bfa;
}

.security-heading {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .4rem;
}

.security-desc {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 380px;
}

.security-illustration {
  width: 160px;
  flex-shrink: 0;
  opacity: .92;
}

.security-illustration img,
.security-illustration svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main {
  flex: 1;
  padding: 0 2rem 3rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.admin-main {
  max-width: 1140px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  text-align: center;
  padding: 1.4rem 2rem;
  font-size: .78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
  line-height: 2;
  transition: background .25s;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: .3rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
  font-size: .78rem;
  transition: color .15s;
}

.footer-links a:hover { color: var(--text); }

.footer-credit  { color: var(--accent); font-weight: 600; }
[data-theme="dark"] .footer-credit { color: #a78bfa; }

.footer-powered { color: var(--gold-dk); font-weight: 700; }

/* ============================================================
   RESULT CARD
   ============================================================ */
.result-section { margin-top: 1.5rem; }

.result-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .35s ease, transform .35s ease;
  border: 1px solid var(--border);
}

.result-card.show {
  opacity: 1;
  transform: translateY(0);
}

.result-badge {
  background: var(--accent);
  color: var(--gold);
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .55rem 1rem;
}

.result-body { padding: 1.8rem 2rem; }

.result-name {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 1.2rem;
  color: var(--text);
}

.result-rows {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.result-row {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child { border-bottom: none; padding-bottom: 0; }

.result-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  min-width: 90px;
}

.result-value {
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
}

/* ============================================================
   TIMETABLE ACTIONS
   ============================================================ */
.timetable-actions {
  display: flex;
  gap: .75rem;
  padding: 1rem 2rem 1.5rem;
  flex-wrap: wrap;
}

.btn-timetable {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.3rem;
  border-radius: 8px;
  font-size: .92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}

.btn-timetable-view {
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
}

.btn-timetable-view:hover {
  background: var(--accent-dk);
  border-color: var(--accent-dk);
}

.btn-timetable-dl {
  background: none;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-timetable-dl:hover {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .btn-timetable-dl { color: #a78bfa; border-color: #a78bfa; }
[data-theme="dark"] .btn-timetable-dl:hover { background: #a78bfa; color: #0f0b1a; }

/* ============================================================
   QR CODE SECTION
   ============================================================ */
.qr-divider {
  height: 1px;
  background: var(--border);
  margin: 0 2rem;
}

.qr-inner { padding: 1.8rem 2rem 2rem; }

.qr-heading {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .3rem;
  color: var(--text);
}

.qr-desc {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 1.4rem;
}

.qr-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .9rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem 1.2rem;
  margin-bottom: 1.4rem;
}

#qrCanvas img,
#qrCanvas canvas {
  display: block;
  border-radius: 6px;
}

.qr-student-info { text-align: center; }
.qr-student-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}
.qr-student-meta {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .2rem;
  font-weight: 500;
}

.qr-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.btn-qr {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.3rem;
  border-radius: 8px;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
  border: 2px solid transparent;
}

.btn-qr-download {
  background: var(--gold);
  color: #1a1028;
  border-color: var(--gold);
}

.btn-qr-download:hover {
  background: var(--gold-dk);
  border-color: var(--gold-dk);
}

.btn-qr-print {
  background: none;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-qr-print:hover {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .btn-qr-print { color: #a78bfa; border-color: #a78bfa; }
[data-theme="dark"] .btn-qr-print:hover { background: #a78bfa; color: #0f0b1a; }

/* ============================================================
   DP1 RESULTS SECTION
   ============================================================ */
.results-section {
  border-top: 1px solid var(--border);
  padding: 1.2rem 2rem 1.6rem;
}

.results-heading {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 1rem;
}

/* ── Subject cards grid ── */
.results-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.result-subject-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  position: relative;
  overflow: hidden;
}

.result-subject-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.mark-scored-card::before  { background: var(--accent); }
.mark-pending-card::before { background: #9333ea; }

.rsc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .25rem;
}

.rsc-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mark-scored-icon  { background: var(--surface-2); color: var(--accent); }
.mark-pending-icon { background: #f3e8ff; color: #9333ea; }

[data-theme="dark"] .mark-scored-icon  { background: #2e2650; color: #a78bfa; }
[data-theme="dark"] .mark-pending-icon { background: rgba(147,51,234,.18); color: #c084fc; }

.rsc-dp-badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .18rem .6rem;
}

.rsc-subject {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.rsc-mark {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.02em;
  margin: .15rem 0;
}

.mark-scored  { color: var(--accent); }
.mark-pending { color: #9333ea; font-size: 1rem; font-weight: 700; line-height: 1.4; }

[data-theme="dark"] .mark-scored  { color: #a78bfa; }
[data-theme="dark"] .mark-pending { color: #c084fc; }

.rsc-status {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  margin-top: .15rem;
}

.mark-scored-status  { color: var(--muted); }
.mark-pending-status { color: #9333ea; }

[data-theme="dark"] .mark-scored-status  { color: var(--muted); }
[data-theme="dark"] .mark-pending-status { color: #c084fc; }

@media (max-width: 600px) {
  .results-section  { padding: 1rem 1rem 1.4rem; }
  .results-cards    { grid-template-columns: 1fr; }
  .rsc-mark         { font-size: 1.7rem; }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrap {
  max-width: 420px;
  margin: 8vh auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  border: 1px solid var(--border);
}

.login-title { font-size: 1.4rem; font-weight: 700; margin-bottom: .3rem; }
.login-sub   { font-size: .85rem; color: var(--muted); margin-bottom: 1.8rem; }

.login-form { text-align: left; }

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }

.field label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.field input,
.field select {
  padding: .7rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s, background .15s;
}

.field input:focus,
.field select:focus {
  border-color: var(--gold);
  background: var(--surface);
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.stats-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.stat-card {
  flex: 1;
  min-width: 100px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  border: 1px solid var(--border);
}

.stat-num   { font-size: 1.7rem; font-weight: 800; color: var(--gold); }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; }

.admin-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.8rem 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.admin-section-title { font-size: 1rem; font-weight: 700; margin-bottom: 1.2rem; }

.add-form { display: flex; flex-direction: column; gap: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem 1rem;
  margin-bottom: 1rem;
}

/* Table toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1rem;
}

.table-toolbar .admin-section-title { margin-bottom: 0; flex-shrink: 0; }

.toolbar-right {
  margin-left: auto;
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
}

.admin-search-input {
  padding: .5rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  background: var(--bg);
  color: var(--text);
  min-width: 220px;
  transition: border-color .15s;
}

.admin-search-input:focus {
  border-color: var(--gold);
  background: var(--surface);
}

.btn-export {
  padding: .5rem 1.1rem;
  border: 1.5px solid var(--accent);
  background: none;
  color: var(--accent);
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.btn-export:hover { background: var(--accent); color: var(--gold); }

.btn-export.accent { border-color: var(--accent2); color: var(--accent2); }
.btn-export.accent:hover { background: var(--accent2); color: #fff; }

[data-theme="dark"] .btn-export { color: #a78bfa; border-color: #a78bfa; }
[data-theme="dark"] .btn-export:hover { background: #a78bfa; color: #0f0b1a; }

/* Table */
.table-wrap { overflow-x: auto; }

.student-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.student-table th {
  text-align: left;
  padding: .65rem .85rem;
  background: var(--bg);
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}

.student-table td {
  padding: .65rem .85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.student-table tbody tr:last-child td { border-bottom: none; }
.student-table tbody tr:hover { background: var(--bg); }

.btn-delete {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 6px;
  transition: background .15s;
}

.btn-delete:hover { background: #fef2f2; }
[data-theme="dark"] .btn-delete:hover { background: rgba(239,68,68,.12); }

/* Year badges */
.year-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .18rem .55rem;
  border-radius: 20px;
  white-space: nowrap;
}
.year-1 { background: #e0f2fe; color: #0369a1; }
.year-2 { background: #ede9fe; color: #6d28d9; }

[data-theme="dark"] .year-1 { background: rgba(3,105,161,.18); color: #7dd3fc; }
[data-theme="dark"] .year-2 { background: rgba(109,40,217,.18); color: #c084fc; }

/* ============================================================
   RESULTS IMPORTER
   ============================================================ */
.import-controls {
  display: flex;
  gap: .85rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.import-summary { display: flex; flex-wrap: wrap; gap: .65rem; }

.import-stat {
  font-size: .85rem;
  font-weight: 700;
  padding: .3rem .85rem;
  border-radius: 20px;
}

.import-ok   { background: #dcfce7; color: #16a34a; }
.import-warn { background: #fef9c3; color: #854d0e; }

[data-theme="dark"] .import-ok   { background: rgba(22,163,74,.15); color: #4ade80; }
[data-theme="dark"] .import-warn { background: rgba(133,77,14,.2); color: #fde68a; }

/* ============================================================
   HELP PAGE
   ============================================================ */
.help-hero {
  background: var(--accent);
  padding: 4rem 2rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.help-hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  background: var(--bg);
  border-radius: 40px 40px 0 0;
}

.help-hero-eyebrow {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .85rem;
}

.help-hero-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  color: #fff;
  margin-bottom: .75rem;
  line-height: 1.15;
}

.help-hero-desc {
  font-size: 1rem;
  color: rgba(255,255,255,.72);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

.help-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.help-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  margin-bottom: 4rem;
}

.help-section.reverse { direction: rtl; }
.help-section.reverse > * { direction: ltr; }



.help-section-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .6rem;
}

.help-section-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .75rem;
  line-height: 1.25;
}

.help-section-desc {
  font-size: .92rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.help-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.help-step {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  font-size: .88rem;
  color: var(--text);
}

.help-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: .05rem;
}

[data-theme="dark"] .help-step-num { background: #a78bfa; color: #0f0b1a; }

.help-section-illustration {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
}

.help-section-illustration img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(60,40,100,.12));
}

[data-theme="dark"] .help-section-illustration img {
  filter: drop-shadow(0 8px 24px rgba(0,0,0,.35)) brightness(.9);
}

/* FAQ */
.faq-section { margin-bottom: 4rem; }

.faq-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  text-align: center;
}

.faq-list { display: flex; flex-direction: column; gap: .75rem; }

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq-q {
  width: 100%;
  text-align: left;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
  transition: background .15s;
}

.faq-q:hover { background: var(--bg); }

.faq-chevron {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform .2s;
  flex-shrink: 0;
}

.faq-item.open .faq-chevron { transform: rotate(180deg); }

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, padding .3s;
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.65;
  padding: 0 1.25rem;
}

.faq-item.open .faq-a {
  max-height: 300px;
  padding: 0 1.25rem 1rem;
}

/* ============================================================
   ASK AI PAGE
   ============================================================ */
.ask-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-h));
  max-width: 800px;
  margin: 0 auto;
  padding: 0;
  width: 100%;
}

.ask-intro {
  text-align: center;
  padding: 2.5rem 2rem 1.5rem;
  flex-shrink: 0;
}

.ask-intro-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .4rem;
}

.ask-intro-desc {
  font-size: .88rem;
  color: var(--muted);
  max-width: 440px;
  margin: 0 auto;
}

.ask-intro-illustration {
  width: 120px;
  margin: 0 auto 1rem;
}

.ask-intro-illustration img {
  width: 100%;
  height: auto;
  display: block;
}

/* Chat window */
.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.chat-window::-webkit-scrollbar { width: 6px; }
.chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-window::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Messages */
.msg {
  display: flex;
  gap: .75rem;
  max-width: 88%;
  animation: msgIn .2s ease;
}

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

.msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: .15rem;
}

.msg.bot .msg-avatar {
  background: var(--accent);
  color: var(--gold);
}

[data-theme="dark"] .msg.bot .msg-avatar {
  background: #a78bfa;
  color: #0f0b1a;
}

.msg.user .msg-avatar {
  background: var(--gold);
  color: #1a1028;
}

.msg-bubble {
  padding: .75rem 1rem;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.55;
  color: var(--text);
}

.msg.bot .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg.user .msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

[data-theme="dark"] .msg.user .msg-bubble {
  background: #5a3e8a;
}

.msg-bubble p + p { margin-top: .5rem; }

.msg-bubble ul {
  margin: .4rem 0 .4rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

/* Typing indicator */
.typing-dots {
  display: flex;
  gap: .3rem;
  align-items: center;
  padding: .75rem 1rem;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* Suggestion chips */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .5rem 2rem 1rem;
  flex-shrink: 0;
}

.chip {
  padding: .45rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-2);
}

[data-theme="dark"] .chip:hover { color: #a78bfa; border-color: #a78bfa; }

/* Input bar */
.chat-input-bar {
  padding: .75rem 2rem 1.25rem;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.chat-input-form {
  display: flex;
  gap: .6rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: .92rem;
  outline: none;
  background: var(--bg);
  color: var(--text);
  resize: none;
  max-height: 120px;
  line-height: 1.45;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}

.chat-input::placeholder { color: var(--muted); }
.chat-input:focus { border-color: var(--accent); background: var(--surface); }
[data-theme="dark"] .chat-input:focus { border-color: #a78bfa; }

.btn-send {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}

.btn-send:hover { background: var(--accent-dk); transform: scale(1.05); }
.btn-send:disabled { opacity: .45; cursor: not-allowed; transform: none; }

[data-theme="dark"] .btn-send { background: #a78bfa; color: #0f0b1a; }
[data-theme="dark"] .btn-send:hover { background: #c084fc; }

/* ============================================================
   SUPPORT PAGE
   ============================================================ */
.support-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.support-hero-text {
  text-align: center;
  margin-bottom: 2.5rem;
}

.support-illustration {
  width: 200px;
  margin: 0 auto 1.5rem;
}

.support-illustration img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 20px rgba(60,40,100,.12));
}

.support-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.support-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .18s;
}

.support-card:hover { transform: translateY(-2px); }

.support-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin: 0 auto .85rem;
}

[data-theme="dark"] .support-card-icon { color: #a78bfa; }

.support-card-title {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .35rem;
  color: var(--text);
}

.support-card-desc {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .help-section {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .help-section.reverse { direction: ltr; }

  .help-section-illustration { max-width: 240px; }

  .security-inner { flex-direction: column; gap: 1.5rem; }
  .security-illustration { width: 200px; }
}

@media (max-width: 640px) {
  .hero { padding: 3rem 1.5rem 2.5rem; }
  .search-card { padding: 1.5rem; }
  .features-section, .security-banner { padding: 0 1rem; }

  .site-header { padding: 0; }
  .header-inner { padding: 0 1rem; }

  .main { padding: 0 1rem 3rem; }
  .result-body { padding: 1.2rem 1rem; }
  .result-name { font-size: 1.3rem; }
  .admin-card { padding: 1.5rem 1rem; }

  .table-toolbar { flex-direction: column; align-items: flex-start; }
  .toolbar-right { margin-left: 0; }

  .timetable-actions { padding: .75rem 1rem 1.2rem; flex-direction: column; }
  .btn-timetable { justify-content: center; }

  .qr-inner { padding: 1.2rem 1rem 1.5rem; }
  .qr-divider { margin: 0 1rem; }
  .qr-actions { flex-direction: column; }
  .btn-qr { justify-content: center; }

  .import-controls { flex-direction: column; }

  .chat-window, .suggestion-chips, .chat-input-bar { padding-left: 1rem; padding-right: 1rem; }

  .help-content { padding: 2rem 1rem 3rem; }
  .support-content { padding: 2rem 1rem 3rem; }

  .ask-intro { padding: 1.5rem 1rem 1rem; }
  .ask-intro-title { font-size: 1.2rem; }
}
