/* ---------- Root Design Tokens ---------- */
:root {
  --bg: #07111f;
  --bg-alt: rgba(10, 18, 34, 0.72);
  --panel: rgba(12, 19, 39, 0.64);
  --panel-strong: rgba(9, 14, 28, 0.9);
  --text: #ecf4ff;
  --muted: #9ab0d0;
  --line: rgba(145, 177, 255, 0.18);
  --accent: #4fd0ff;
  --accent-2: #8d6bff;
  --accent-3: #1cf0b8;
  --danger: #ff6b87;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius: 24px;
  --radius-sm: 16px;
  --transition: 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="light"] {
  --bg: #eef4ff;
  --bg-alt: rgba(255, 255, 255, 0.8);
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --text: #0e1630;
  --muted: #52627f;
  --line: rgba(52, 89, 160, 0.12);
  --shadow: 0 20px 60px rgba(44, 60, 95, 0.18);
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 208, 255, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(141, 107, 255, 0.2), transparent 26%),
    linear-gradient(160deg, #050912 0%, var(--bg) 45%, #050911 100%);
  overflow-x: hidden;
}

body.theme-light {
  background:
    radial-gradient(circle at top left, rgba(79, 208, 255, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(141, 107, 255, 0.16), transparent 28%),
    linear-gradient(160deg, #f7faff 0%, var(--bg) 100%);
}

button,
a,
input,
select {
  font: inherit;
}

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

button {
  border: 0;
  cursor: pointer;
}

main,
footer,
.topbar {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

/* ---------- Decorative Layers ---------- */
.theme-glow {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(36px);
  opacity: 0.8;
  pointer-events: none;
  z-index: 0;
}

.theme-glow-one {
  width: 180px;
  height: 180px;
  top: 10%;
  left: -40px;
  background: rgba(79, 208, 255, 0.22);
}

.theme-glow-two {
  width: 220px;
  height: 220px;
  right: -80px;
  bottom: 12%;
  background: rgba(141, 107, 255, 0.18);
}

.particle-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(191, 225, 255, 0.7);
  box-shadow: 0 0 10px rgba(79, 208, 255, 0.7);
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  from {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  to {
    transform: translateY(-120vh) translateX(40px);
    opacity: 0;
  }
}

/* ---------- Layout ---------- */
.topbar {
  position: sticky;
  top: 18px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 14, 28, 0.6);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

:root[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.72);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  color: white;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 28px rgba(79, 208, 255, 0.35);
}

.brand strong,
.section-heading h2,
.hero h1,
.info-panel h2 {
  font-family: "Space Grotesk", sans-serif;
}

.brand strong {
  display: block;
  font-size: 0.98rem;
}

.brand small {
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--muted);
}

.nav-links a {
  position: relative;
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  transform: scaleX(1);
}

.theme-toggle,
.primary-button,
.secondary-button,
.ghost-button,
.add-course-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border-radius: 999px;
  padding: 0 18px;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.theme-toggle,
.secondary-button,
.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.theme-toggle:hover,
.secondary-button:hover,
.ghost-button:hover,
.add-course-button:hover,
.primary-button:hover {
  transform: translateY(-2px);
}

.primary-button,
.add-course-button {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 18px 34px rgba(79, 208, 255, 0.22);
}

.primary-button:hover,
.add-course-button:hover {
  box-shadow: 0 22px 40px rgba(141, 107, 255, 0.3);
}

main {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 26px;
  padding: 22px 0 40px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 28px;
  align-items: center;
  padding: 32px;
  overflow: hidden;
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.84rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 1;
  max-width: 10ch;
}

.hero-text {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.7;
  margin: 18px 0 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
}

.hero-stats,
.metrics-grid,
.info-grid {
  display: grid;
  gap: 14px;
}

.hero-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 26px;
}

.stat-card,
.metric-card,
.info-panel article,
.result-card,
.validation-note,
.history-item,
.course-table th,
.course-table td {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.stat-card,
.metric-card {
  padding: 16px;
  border-radius: 18px;
}

.stat-card span,
.metric-card span,
.result-label,
.progress-header,
.history-meta,
.course-table th,
.course-table td {
  color: var(--muted);
}

.stat-card strong,
.metric-card strong {
  display: block;
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
}

.hero-visual {
  min-height: 100%;
  display: grid;
  place-items: center;
}

.orbit-card {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.orbit-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(79, 208, 255, 0.18);
  animation: spin 18s linear infinite;
}

.orbit-ring-one {
  inset: 10px;
}

.orbit-ring-two {
  inset: 36px;
  animation-direction: reverse;
}

.orbit-core {
  position: relative;
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.24), transparent 36%),
    linear-gradient(145deg, rgba(79, 208, 255, 0.12), rgba(141, 107, 255, 0.1)),
    rgba(9, 16, 33, 0.82);
  box-shadow: 0 0 60px rgba(79, 208, 255, 0.12);
}

.orbit-core span {
  color: var(--muted);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.orbit-core strong {
  display: block;
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.6rem, 6vw, 4rem);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 26px;
  align-items: start;
}

.dashboard-panel,
.analytics-panel,
.history-panel,
.info-panel {
  padding: 26px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-bottom: 16px;
}

.section-heading h2,
.info-panel h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.student-info-panel {
  margin-bottom: 16px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top right, rgba(79, 208, 255, 0.1), transparent 44%),
    rgba(255, 255, 255, 0.03);
}

.student-info-heading {
  margin-bottom: 14px;
}

.student-info-heading h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
}

.student-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.student-field {
  display: grid;
  gap: 8px;
}

.student-field span {
  color: var(--muted);
  font-size: 0.9rem;
}

.course-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.course-table th,
.course-table td {
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
}

.course-table th {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
}

.course-table td {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.course-input,
.credit-input,
.grade-select,
.student-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--text);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(145, 177, 255, 0.18);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.course-input::placeholder {
  color: rgba(154, 176, 208, 0.62);
}

.course-input:focus,
.credit-input:focus,
.grade-select:focus,
.student-input:focus {
  border-color: rgba(79, 208, 255, 0.76);
  box-shadow: 0 0 0 4px rgba(79, 208, 255, 0.12);
}

.field-invalid {
  border-color: rgba(255, 107, 135, 0.86) !important;
  box-shadow: 0 0 0 4px rgba(255, 107, 135, 0.12);
}

.remove-course-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #ffd4dc;
  background: rgba(255, 107, 135, 0.12);
  border: 1px solid rgba(255, 107, 135, 0.18);
  transition: transform var(--transition), background var(--transition);
}

.remove-course-button:hover {
  transform: scale(1.04);
  background: rgba(255, 107, 135, 0.18);
}

.course-points {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.02rem;
  color: var(--text);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.analytics-panel {
  display: grid;
  gap: 16px;
}

.result-card {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(79, 208, 255, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(10, 17, 34, 0.96), rgba(22, 27, 47, 0.72));
  animation: pulseGlow 4.5s ease-in-out infinite;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: linear-gradient(120deg, rgba(79, 208, 255, 0.35), rgba(141, 107, 255, 0.25), transparent 64%);
  opacity: 0.45;
  filter: blur(18px);
}

.result-card > * {
  position: relative;
  z-index: 1;
}

.result-card strong {
  display: block;
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.4rem, 6vw, 3.8rem);
}

.result-student {
  display: inline-block;
  margin-bottom: 8px;
  color: #cfe3ff;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  opacity: 0.92;
}

.result-student.reveal-student {
  animation: studentReveal 500ms ease;
}

@keyframes studentReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 0.92;
    transform: translateY(0);
  }
}

.classification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 12px 16px;
  border-radius: 999px;
  color: white;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 16px 26px rgba(141, 107, 255, 0.22);
}

@keyframes pulseGlow {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.metrics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card {
  padding: 18px;
  border-radius: 18px;
}

.metric-card strong {
  font-size: 1.5rem;
}

.progress-section {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  box-shadow: 0 0 18px rgba(79, 208, 255, 0.35);
  transition: width 600ms ease;
}

.validation-note {
  border-radius: 18px;
  padding: 16px 18px;
  color: var(--muted);
}

.stacked-panels {
  display: grid;
  gap: 26px;
}

.history-count {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.history-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.history-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.history-item {
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.history-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.history-gpa {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.9rem;
}

.history-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.history-actions button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.history-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
}

@media (min-width: 1200px) {
  main,
  footer,
  .topbar {
    width: min(1360px, calc(100% - 48px));
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(420px, 0.8fr);
    gap: 34px;
  }

  .stacked-panels {
    gap: 30px;
    min-width: 0;
  }

  .dashboard-panel,
  .analytics-panel,
  .history-panel,
  .info-panel {
    min-width: 0;
  }

  .analytics-panel {
    align-content: start;
  }

  .result-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px;
    overflow: visible;
  }

  .result-card > div {
    min-width: 0;
  }

  .result-card strong {
    line-height: 0.95;
    word-break: break-word;
  }

  .result-student {
    max-width: 100%;
    word-break: break-word;
  }

  .classification-badge {
    flex-shrink: 0;
    justify-self: end;
  }

  .progress-header {
    flex-wrap: wrap;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.info-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.info-panel article {
  padding: 18px;
  border-radius: 18px;
}

.info-panel h3 {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
}

.info-panel p,
.footer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at left top, rgba(79, 208, 255, 0.14), transparent 36%),
    radial-gradient(circle at right bottom, rgba(141, 107, 255, 0.14), transparent 44%),
    rgba(8, 14, 28, 0.7);
  box-shadow: 0 0 32px rgba(79, 208, 255, 0.12);
}

.footer-branding {
  display: grid;
  gap: 8px;
}

.footer-credit {
  color: #dfeeff;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.footer-rights {
  color: var(--muted);
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 260px;
  max-width: 340px;
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(8, 13, 25, 0.88);
  box-shadow: var(--shadow);
  animation: slideIn 240ms ease, fadeOut 220ms ease 3.8s forwards;
}

.toast.success {
  border-color: rgba(28, 240, 184, 0.24);
}

.toast.error {
  border-color: rgba(255, 107, 135, 0.28);
}

.toast.info {
  border-color: rgba(79, 208, 255, 0.28);
}

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

@keyframes fadeOut {
  to {
    transform: translateX(12px);
    opacity: 0;
  }
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  animation: reveal 700ms ease forwards;
}

.reveal:nth-child(2) {
  animation-delay: 90ms;
}

.reveal:nth-child(3) {
  animation-delay: 180ms;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero,
  .dashboard-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 280px;
  }
}

@media (max-width: 800px) {
  .topbar {
    border-radius: 28px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .hero,
  .dashboard-panel,
  .analytics-panel,
  .history-panel,
  .info-panel {
    padding: 20px;
  }

  .hero-stats,
  .metrics-grid,
  .student-info-grid {
    grid-template-columns: 1fr;
  }

  .result-card,
  .history-top,
  .section-heading,
  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  main,
  footer,
  .topbar {
    width: min(100% - 18px, 1180px);
  }

  .hero h1 {
    max-width: 100%;
  }

  .hero-actions,
  .form-actions,
  .history-actions {
    width: 100%;
  }

  .hero-actions > *,
  .form-actions > *,
  .history-actions > * {
    width: 100%;
  }

  .toast-container {
    right: 10px;
    left: 10px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}
