/* ============================================================
   IPURESULT - Shared stylesheet
   (login page, student dashboard, footer)
   ============================================================ */

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

:root {
  --purple: #8b5cf6;
  --indigo: #6366f1;
  --bg-dark: #0b0d17;
  --card: #121425;
  --card-2: #171a2e;
  --border: rgba(255, 255, 255, 0.07);
  --text: #f4f5fb;
  --muted: #8b90a7;
  --teal: #2dd4bf;
  --orange: #fb923c;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #eab308;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-body {
  min-height: 100vh;
  background: #eef0f7;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 34px 16px 0;
}

.login-card {
  width: 100%;
  max-width: 540px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(25, 25, 80, 0.16);
}

.login-header {
  background: linear-gradient(115deg, #5a54e6 0%, #7c3aed 60%, #9333ea 100%);
  padding: 36px 30px 32px;
  text-align: center;
}

.logo-oval {
  display: block;
  width: 300px;
  height: auto;
  max-width: 92%;
  margin: 0 auto;
  filter: drop-shadow(0 5px 16px rgba(0, 0, 0, 0.22));
}

.login-header h1 {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  margin-top: 20px;
}

.login-sub {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14.5px;
  margin-top: 6px;
}

.exam-badge {
  display: inline-block;
  background: rgba(25, 15, 70, 0.35);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 8px 22px;
  border-radius: 999px;
  margin-top: 16px;
}

.login-form-wrap { padding: 32px 36px 24px; }

.field-label {
  display: block;
  color: #334155;
  font-weight: 600;
  font-size: 15px;
  margin: 18px 0 8px;
}
.field-label:first-child { margin-top: 0; }

.text-input {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid #dbe0ea;
  background: #f8fafc;
  border-radius: 8px;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.text-input::placeholder { color: #94a3b8; }
.text-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: #fff;
}

.captcha-box {
  margin-top: 22px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px;
  padding: 16px;
}
.cap-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #475569;
  margin-bottom: 12px;
}
.captcha-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
#captchaCanvas {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}
.btn-refresh {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid #dbe0ea;
  background: #fff;
  border-radius: 8px;
  color: #4f46e5;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-refresh:hover { background: #eef2ff; }
.btn-refresh svg { width: 20px; height: 20px; }

.login-error {
  margin-top: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.login-error .err-meta {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: #dc2626;
  margin-top: 6px;
}

.btn-secure {
  width: 100%;
  margin-top: 22px;
  background: #6366f1;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn-secure:hover { background: #4f46e5; }
.btn-secure:active { transform: scale(0.99); }

.forgot {
  display: block;
  text-align: center;
  margin: 20px 0 8px;
  color: #4f46e5;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.forgot:hover { text-decoration: underline; }

/* ============================================================
   DASHBOARD PAGE
   ============================================================ */

.dash-body {
  min-height: 100vh;
  background-color: var(--bg-dark);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 34px 34px;
  color: var(--text);
}

.dash-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px 46px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.icon-chip {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 11px;
  color: #fff;
}
.icon-chip svg { width: 20px; height: 20px; }
.icon-chip.grad-purple { background: linear-gradient(135deg, #7c3aed, #a855f7); box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35); }
.icon-chip.grad-pink   { background: linear-gradient(135deg, #db2777, #ec4899); box-shadow: 0 4px 14px rgba(236, 72, 153, 0.35); }
.icon-chip.grad-indigo { background: linear-gradient(135deg, #4f46e5, #6366f1); box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35); }
.icon-chip.grad-green  { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35); }
.icon-chip.grad-blue   { background: linear-gradient(135deg, #2563eb, #3b82f6); box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35); }

/* ---- Profile header section ---- */

.profile-card {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 22px;
  background: transparent;
  border: none;
  border-radius: 0;
}

.profile-head { display: flex; align-items: center; gap: 18px; }
.profile-head .icon-chip { width: 58px; height: 58px; min-width: 58px; border-radius: 16px; }
.profile-head .icon-chip svg { width: 30px; height: 30px; }
.profile-head h1 { font-size: 30px; font-weight: 800; letter-spacing: 0.01em; }
.profile-head p { color: var(--muted); font-size: 14.5px; margin-top: 2px; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
}

.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  gap: 13px;
  align-items: flex-start;
}
.info-card .icon-chip { width: 36px; height: 36px; min-width: 36px; border-radius: 10px; background: rgba(139, 92, 246, 0.16); color: #a78bfa; }
.info-card .icon-chip svg { width: 17px; height: 17px; }
.info-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.info-value {
  font-size: 15px;
  font-weight: 600;
  color: #e8eaf2;
  margin-top: 4px;
  word-break: break-word;
}

.mini-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 8px;
  vertical-align: 2px;
}

.profile-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  color: #e8eaf2;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.45); }
.btn-logout svg { width: 17px; height: 17px; }

.cgpa-card {
  flex: 1;
  background: linear-gradient(135deg, #6d28d9, #a855f7);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cgpa-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.85);
}
.cgpa-value { margin-top: 6px; color: #fff; font-size: 54px; font-weight: 800; line-height: 1; }
.cgpa-value small { font-size: 20px; font-weight: 600; color: rgba(255, 255, 255, 0.7); }
.cgpa-note { color: rgba(255, 255, 255, 0.85); font-size: 13px; margin-top: 8px; }
.cgpa-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  margin-top: 16px;
  overflow: hidden;
}
.cgpa-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  transition: width 1s ease;
}

/* ---- Semester selection ---- */

.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 30px 0 12px;
}

.semester-chips { display: flex; flex-wrap: wrap; gap: 12px; }

.sem-chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 14px 22px;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sem-chip strong { display: block; font-size: 15.5px; font-weight: 700; }
.sem-chip span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.sem-chip.active {
  border-color: rgba(139, 92, 246, 0.65);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.4), 0 6px 18px rgba(139, 92, 246, 0.18);
}
.sem-chip:hover { border-color: rgba(139, 92, 246, 0.5); }

/* ---- Stat cards ---- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 26px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
}
.stat-card .icon-chip { width: 46px; height: 46px; border-radius: 13px; }
.stat-card .icon-chip svg { width: 22px; height: 22px; }
.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 14px;
}
.stat-value { font-size: 34px; font-weight: 800; margin-top: 4px; line-height: 1.1; }
.stat-value small { font-size: 16px; font-weight: 600; color: var(--muted); }
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

/* ---- Section titles ---- */

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 23px;
  font-weight: 700;
  margin: 38px 0 16px;
  padding-left: 13px;
}
.section-title::before {
  content: "";
  width: 4px;
  height: 26px;
  border-radius: 4px;
  background: var(--teal);
}
.section-title.orange::before { background: var(--orange); }

/* ---- Charts row ---- */

.two-col {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 20px;
}

.chart-card, .grade-card { padding: 20px 22px; }

.card-head { display: flex; align-items: flex-start; gap: 13px; }
.card-head-title { font-size: 17px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.card-head-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-head-badges { margin-left: auto; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

.pill {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill.purple { background: rgba(139, 92, 246, 0.16); color: #c4b5fd; }
.pill.green  { background: rgba(34, 197, 94, 0.14); color: #4ade80; }

.chart-box { position: relative; height: 300px; margin-top: 18px; }
.chart-fallback { color: var(--muted); font-size: 14px; padding: 40px 10px; text-align: center; }

/* ---- Grade analysis card ---- */

.grade-content { display: grid; grid-template-columns: 230px 1fr; gap: 20px; margin-top: 20px; align-items: center; }

.donut-box { position: relative; height: 230px; }

.grade-minis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini-stat {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 15px;
}
.mini-stat .lbl { font-size: 12.5px; color: var(--muted); }
.mini-stat .val { font-size: 20px; font-weight: 700; margin-top: 3px; }

.grade-dist { grid-column: 1 / -1; }
.grade-dist .lbl { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.dist-chips { display: flex; flex-wrap: wrap; gap: 14px; }
.dist-chip { text-align: center; }
.dist-chip .sq {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.dist-chip .cnt { font-size: 13px; color: var(--muted); margin-top: 5px; }

/* ---- Detailed results ---- */

.results-card { padding: 20px 22px; }

.results-head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.switch-label { font-size: 13.5px; color: var(--muted); }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s;
}
.switch input:checked + .slider { background: var(--purple); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.table-scroll { overflow-x: auto; margin-top: 16px; }

.results-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.results-table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  white-space: nowrap;
}
.results-table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14.5px;
  white-space: nowrap;
}
.results-table tr:last-child td { border-bottom: none; }
.results-table .num { text-align: right; }
.results-table td.code { color: var(--muted); font-size: 13.5px; }
.results-table td.name { color: #e8eaf2; font-weight: 500; white-space: normal; min-width: 220px; }

.results-table.collapsed .col-int { display: none; }

.grade-badge {
  display: inline-block;
  min-width: 32px;
  text-align: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.results-crumb { color: var(--muted); font-size: 18px; margin: 0 2px; }
.results-crumb strong { color: #a78bfa; font-weight: 700; letter-spacing: 0.04em; }

/* ============================================================
   FOOTER (shared)
   ============================================================ */

.site-footer {
  background: #0b0d17;
  color: #9aa0b5;
  text-align: center;
  padding: 38px 20px 42px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.made-with { color: #e2e8f0; font-size: 15.5px; }
.heart { color: #ef4444; }
.made-with a { color: #67e8f9; text-decoration: none; font-weight: 600; }
.made-with a:hover { text-decoration: underline; }

.social-icons { display: flex; justify-content: center; gap: 26px; margin: 20px 0 18px; }
.social-icons a { color: #8b90a7; transition: color 0.15s; }
.social-icons a:hover { color: #fff; }
.social-icons svg { width: 20px; height: 20px; fill: currentColor; }

.copyright { font-size: 14px; margin-bottom: 16px; }

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 14.5px;
}
.footer-links a { color: #7dd3fc; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-links .dot { color: #475569; }

/* Login page: footer spans full width and sticks to the bottom */
.login-body .site-footer {
  width: 100%;
  align-self: stretch;
  margin-top: auto;
}

/* ============================================================
   LEGAL / INFO PAGES
   ============================================================ */

.legal-topbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  align-items: center;
}
.legal-topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  transition: color 0.15s;
}
.legal-topbar .brand:hover { color: #c4b5fd; }

.legal-wrap { max-width: 860px; margin: 0 auto; padding: 8px 20px 44px; }
.legal-card { padding: 34px 36px 30px; }
.legal-card h1 { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.legal-updated { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.legal-card h2 { font-size: 17px; font-weight: 700; margin: 24px 0 8px; color: #e8eaf2; }
.legal-card p { font-size: 14.5px; line-height: 1.75; color: #b9bed2; margin-bottom: 10px; }
.legal-card ul { margin: 8px 0 12px 20px; color: #b9bed2; font-size: 14.5px; line-height: 1.85; }
.legal-card a { color: #7dd3fc; text-decoration: none; }
.legal-card a:hover { text-decoration: underline; }

.email-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
  margin-top: 6px;
  transition: background 0.15s;
}
.email-pill:hover { background: rgba(139, 92, 246, 0.24); text-decoration: none; }
.email-pill svg { width: 16px; height: 16px; }

@media (max-width: 560px) {
  .legal-card { padding: 26px 20px; }
  .legal-card h1 { font-size: 23px; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 980px) {
  .profile-card { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .grade-content { grid-template-columns: 1fr; }
  .donut-box { margin: 0 auto; }
}

@media (max-width: 760px) {
  .stats-row { grid-template-columns: 1fr; }
  .profile-head h1 { font-size: 24px; }
  .login-form-wrap { padding: 26px 22px 20px; }
}

@media (max-width: 560px) {
  .info-grid { grid-template-columns: 1fr; }
  .cgpa-value { font-size: 44px; }
  .profile-head .icon-chip { width: 48px; height: 48px; min-width: 48px; }
}
