/* vtu sgpa calculator */

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

:root {
  --bg:           #0f1117;
  --surface:      #1a1d27;
  --surface2:     #22263a;
  --border:       #2e3350;
  --accent:       #6c63ff;
  --accent-hover: #574fd6;
  --accent-soft:  rgba(108,99,255,.13);
  --green:        #22c55e;
  --green-soft:   rgba(34,197,94,.12);
  --red:          #ef4444;
  --red-soft:     rgba(239,68,68,.12);
  --yellow:       #f59e0b;
  --text:         #e8eaf6;
  --text-muted:   #7b82a8;
  --text-faint:   #4a5080;
  --radius:       14px;
  --radius-sm:    8px;
  --shadow:       0 4px 32px rgba(0,0,0,.45);
  --shadow-card:  0 2px 16px rgba(0,0,0,.35);
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --transition:   .2s cubic-bezier(.4,0,.2,1);
}

/* ---- Base ---- */
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ---- Header ---- */
.site-header {
  background: rgba(26,29,39,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 24px;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.02em;
}
.logo span { color: var(--accent); }
.header-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(108,99,255,.3);
  padding: 2px 10px;
  border-radius: 100px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 72px 24px 48px;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, rgba(108,99,255,.12) 0%, transparent 70%);
}
.hero-emoji { font-size: 3rem; display: block; margin-bottom: 16px; }
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1.15;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 30%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 540px;
  margin: 0 auto;
}

/* ---- Layout ---- */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 28px 28px;
  margin-bottom: 20px;
}
.card-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-faint);
  margin-bottom: 18px;
}

/* ---- Step selectors ---- */
.selectors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .03em;
}
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 700;
  margin-right: 6px;
}

select, input[type="number"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .92rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237b82a8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
select:focus, input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.18);
}
select:disabled {
  opacity: .4;
  cursor: not-allowed;
}
select option { background: #1a1d27; }

/* ---- Subjects Table ---- */
#subjects-section { display: none; }

.subjects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.subjects-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.sem-label {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.subjects-table-wrap { overflow-x: auto; }

table.subjects-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.subjects-table thead tr {
  background: var(--surface2);
  border-radius: var(--radius-sm);
}
.subjects-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.subjects-table th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.subjects-table th:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.subjects-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.subjects-table tbody tr:last-child td { border-bottom: none; }
.subjects-table tbody tr { transition: background var(--transition); }
.subjects-table tbody tr:hover { background: rgba(108,99,255,.04); }

.subject-code {
  font-family: 'Courier New', monospace;
  font-size: .78rem;
  color: var(--accent);
  font-weight: 600;
}
.subject-name { color: var(--text); font-weight: 500; }
.subject-type {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 8px;
  border-radius: 4px;
}
.type-core    { background: rgba(99,179,237,.12); color: #63b3ed; }
.type-elective{ background: rgba(246,173,85,.12); color: #f6ad55; }

.credit-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .8rem;
  font-weight: 700;
}

.grade-select {
  min-width: 110px;
}
.grade-select option[value="10"] { color: #22c55e; }
.grade-select option[value="9"]  { color: #84cc16; }
.grade-select option[value="8"]  { color: #3b82f6; }
.grade-select option[value="7"]  { color: #a78bfa; }
.grade-select option[value="6"]  { color: #f59e0b; }
.grade-select option[value="5"]  { color: #fb923c; }
.grade-select option[value="4"]  { color: #f87171; }
.grade-select option[value="0"]  { color: var(--red); }

/* ---- Elective Group Section ---- */
.elective-group-header {
  padding: 8px 14px;
  background: rgba(246,173,85,.06);
  border-left: 2px solid #f6ad55;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .75rem;
  font-weight: 700;
  color: #f6ad55;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 12px 0 4px;
}
.elective-group-note {
  font-size: .72rem;
  color: var(--text-faint);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 8px;
}

/* ---- Result Bar ---- */
#result-section { display: none; }
.result-bar {
  background: linear-gradient(135deg, var(--surface2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.result-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 80% at 0% 50%, rgba(108,99,255,.08) 0%, transparent 70%);
  pointer-events: none;
}
.sgpa-display { flex: 0 0 auto; }
.sgpa-value {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1;
  background: linear-gradient(135deg, #fff 20%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sgpa-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-top: 4px;
}
.result-divider {
  width: 1px;
  height: 60px;
  background: var(--border);
  flex: 0 0 auto;
}
.result-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  flex: 1;
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-label {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.grade-chip {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  font-size: 1.6rem;
  font-weight: 900;
  border: 2px solid;
}
.grade-chip.A-plus  { border-color: #22c55e; color: #22c55e; background: rgba(34,197,94,.08); }
.grade-chip.A       { border-color: #84cc16; color: #84cc16; background: rgba(132,204,22,.08); }
.grade-chip.B       { border-color: #3b82f6; color: #3b82f6; background: rgba(59,130,246,.08); }
.grade-chip.C       { border-color: #a78bfa; color: #a78bfa; background: rgba(167,139,250,.08); }
.grade-chip.D       { border-color: #f59e0b; color: #f59e0b; background: rgba(245,158,11,.08); }
.grade-chip.E       { border-color: #fb923c; color: #fb923c; background: rgba(251,146,60,.08); }
.grade-chip.F       { border-color: var(--red); color: var(--red); background: var(--red-soft); }

/* ---- Grade reference ---- */
.grade-ref {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.grade-ref-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .82rem;
}
.grade-ref-item .gname { font-weight: 600; color: var(--text); }
.grade-ref-item .gpts  { color: var(--accent); font-weight: 700; font-size: .9rem; }

/* ---- Calculate button ---- */
.btn-calculate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 700;
  padding: 12px 28px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 16px rgba(108,99,255,.35);
}
.btn-calculate:hover  { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 24px rgba(108,99,255,.45); }
.btn-calculate:active { transform: translateY(0); }
.btn-calculate:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  padding: 11px 20px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-reset:hover { border-color: var(--accent); color: var(--accent); }

.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ---- Progress bar ---- */
.progress-wrap { margin-top: 12px; }
.progress-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.progress-track {
  height: 6px;
  background: var(--surface2);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border-radius: 100px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
  width: 0%;
}

/* ---- Legend ---- */
.legend {
  font-size: .78rem;
  color: var(--text-faint);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  line-height: 1.7;
}
.legend strong { color: var(--text-muted); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: .88rem;
  color: var(--text);
  box-shadow: var(--shadow);
  z-index: 999;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-faint);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.empty-state p { font-size: .9rem; }

/* ---- Header Nav (replaces inline styles) ---- */
.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.header-nav-link {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.header-nav-link:hover        { color: var(--accent); border-color: var(--accent); }
.header-nav-link--red:hover   { color: var(--red);    border-color: var(--red); }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  /* header — allow wrapping so nav drops below the logo row */
  .site-header { padding: 0 16px; }
  .header-inner {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    padding: 10px 0;
    row-gap: 8px;
    align-items: center;
  }
  .header-badge { font-size: .6rem; }
  .header-nav {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }
  .header-nav-link { font-size: .73rem; padding: 5px 9px; }

  /* hero */
  .hero { padding: 48px 20px 36px; }

  /* cards */
  .card { padding: 18px 14px; }

  /* selectors: single column */
  .selectors-grid { grid-template-columns: 1fr; }

  /* subjects table: hide the # and Type columns to free width */
  .subjects-table th:nth-child(1),
  .subjects-table td:nth-child(1),
  .subjects-table th:nth-child(4),
  .subjects-table td:nth-child(4) { display: none; }
  .subjects-table th, .subjects-table td { padding: 8px 8px; font-size: .82rem; }
  .subject-name  { font-size: .82rem; }
  .subject-code  { font-size: .72rem; }
  .grade-select  { min-width: 88px; font-size: .82rem; }

  /* result bar: stack vertically */
  .result-bar     { padding: 18px 14px; gap: 16px; flex-direction: column; align-items: flex-start; }
  .result-divider { width: 100%; height: 1px; }
  .result-stats   { gap: 14px; }
  .sgpa-value     { font-size: 2.8rem; }
  .grade-chip     { display: none; }

  /* action row — stack buttons full width */
  .action-row { flex-direction: column; gap: 10px; }
  .action-row .btn-calculate,
  .action-row .btn-reset { width: 100%; justify-content: center; }

  /* grade reference grid */
  .grade-ref { grid-template-columns: 1fr 1fr; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ---- Fade-in animation ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .4s ease both; }
.fade-up-1 { animation-delay: .05s; }
.fade-up-2 { animation-delay: .10s; }
.fade-up-3 { animation-delay: .15s; }

/* ── SEO article section ── */
.seo-article {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 64px 24px 80px;
}
.seo-article-inner {
  max-width: 780px;
  margin: 0 auto;
}
.seo-article-inner h2 {
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  font-weight: 900;
  letter-spacing: -.03em;
  margin-bottom: 18px;
  color: var(--text);
}
.seo-article-inner h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 32px 0 10px;
  color: var(--text);
}
.seo-article-inner p {
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 14px;
  font-size: .95rem;
}
.seo-article-inner ul,
.seo-article-inner ol {
  color: var(--text-muted);
  line-height: 1.85;
  padding-left: 22px;
  margin-bottom: 16px;
  font-size: .95rem;
}
.seo-article-inner li { margin-bottom: 7px; }
.seo-article-inner strong { color: var(--text); font-weight: 600; }
.seo-article-inner code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .85rem;
  color: var(--text);
}
