/* ==========================================================================
   GRADESPHERE - NEXT-GEN STUDENT PERFORMANCE HUB
   Aurora Mesh Gradient & Bento-Grid Modern Architecture
   ========================================================================== */

:root {
  /* Vibrant Aurora Mesh Dark Palette */
  --bg-space: #07090e;
  --bg-mesh-1: rgba(99, 102, 241, 0.18);
  --bg-mesh-2: rgba(236, 72, 153, 0.14);
  --bg-mesh-3: rgba(6, 182, 212, 0.14);
  --bg-mesh-4: rgba(16, 185, 129, 0.12);

  --bento-surface: rgba(17, 24, 39, 0.65);
  --bento-surface-hover: rgba(28, 38, 62, 0.85);
  --bento-glass: rgba(15, 23, 42, 0.7);
  --bento-border: rgba(255, 255, 255, 0.08);
  --bento-border-hover: rgba(99, 102, 241, 0.45);

  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-muted: #64748b;

  --accent-indigo: #6366f1;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  /* Gradients */
  --grad-aurora: linear-gradient(135deg, #6366f1 0%, #ec4899 50%, #06b6d4 100%);
  --grad-electric: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --grad-cyan: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --grad-emerald: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --grad-amber: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --grad-rose: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);

  /* UI Tokens */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-bento: 24px;
  --radius-full: 9999px;

  --shadow-bento: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --shadow-bento-hover: 0 20px 40px -10px rgba(0, 0, 0, 0.7), 0 0 25px rgba(99, 102, 241, 0.25);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.35);

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="light"] {
  --bg-space: #f1f5f9;
  --bg-mesh-1: rgba(99, 102, 241, 0.12);
  --bg-mesh-2: rgba(236, 72, 153, 0.08);
  --bg-mesh-3: rgba(6, 182, 212, 0.1);
  --bg-mesh-4: rgba(16, 185, 129, 0.08);

  --bento-surface: rgba(255, 255, 255, 0.8);
  --bento-surface-hover: #ffffff;
  --bento-glass: rgba(255, 255, 255, 0.9);
  --bento-border: rgba(0, 0, 0, 0.08);
  --bento-border-hover: rgba(99, 102, 241, 0.35);

  --text-main: #0f172a;
  --text-dim: #475569;
  --text-muted: #94a3b8;

  --shadow-bento: 0 10px 30px -5px rgba(0, 0, 0, 0.06), 0 0 1px 1px rgba(0, 0, 0, 0.04);
  --shadow-bento-hover: 0 20px 40px -10px rgba(0, 0, 0, 0.12), 0 0 25px rgba(99, 102, 241, 0.15);
}

/* ==========================================================================
   RESET & AURORA AMBIENT MESH BACKGROUND
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-space);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  transition: background-color var(--transition), color var(--transition);
}

/* Animated Flowing Aurora Mesh */
.aurora-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.aurora-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.65;
  animation: auroraFloat 18s ease-in-out infinite alternate;
}

.orb-1 {
  width: 650px;
  height: 650px;
  top: -150px;
  left: -100px;
  background: var(--bg-mesh-1);
}

.orb-2 {
  width: 550px;
  height: 550px;
  top: 30%;
  right: -150px;
  background: var(--bg-mesh-2);
  animation-duration: 22s;
}

.orb-3 {
  width: 500px;
  height: 500px;
  bottom: -100px;
  left: 20%;
  background: var(--bg-mesh-3);
  animation-duration: 25s;
}

@keyframes auroraFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
  100% { transform: translate(-30px, 40px) scale(0.95); }
}

.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   NAVBAR & BRANDING
   ========================================================================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2.2rem;
  background: var(--bento-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bento-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-sphere-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--grad-aurora);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  color: #ffffff;
  font-size: 1.4rem;
  position: relative;
  overflow: hidden;
}

.brand-sphere-logo::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.4) 50%, transparent 60%);
  transform: rotate(45deg);
  animation: shine 4s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%) rotate(45deg); }
  20%, 100% { transform: translateX(100%) rotate(45deg); }
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-name {
  background: linear-gradient(135deg, #0f172a 30%, #4338ca 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  margin-left: 0.4rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* ==========================================================================
   NAVIGATION BENTO PILL TABS
   ========================================================================== */
.bento-nav-strip {
  padding: 0.85rem 2.2rem;
  background: rgba(10, 14, 23, 0.45);
  border-bottom: 1px solid var(--bento-border);
  overflow-x: auto;
}

[data-theme="light"] .bento-nav-strip {
  background: rgba(241, 245, 249, 0.7);
}

.bento-tabs {
  display: flex;
  gap: 0.55rem;
  max-width: 1440px;
  margin: 0 auto;
}

.bento-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  background: var(--bento-surface);
  border: 1px solid var(--bento-border);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.bento-tab-btn:hover {
  color: var(--text-main);
  border-color: var(--bento-border-hover);
  transform: translateY(-1px);
}

.bento-tab-btn.active {
  color: #ffffff;
  background: var(--grad-electric);
  border-color: transparent;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.4);
}

/* ==========================================================================
   BENTO GRID SYSTEM
   ========================================================================== */
.main-wrapper {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 2.2rem 4rem;
}

.tab-pane {
  display: none;
  animation: bentoFade 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.tab-pane.active {
  display: block;
}

@keyframes bentoFade {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.4rem;
}

.bento-card {
  background: var(--bento-surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--bento-border);
  border-radius: var(--radius-bento);
  padding: 1.75rem;
  box-shadow: var(--shadow-bento);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.bento-card:hover {
  transform: translateY(-4px);
  border-color: var(--bento-border-hover);
  box-shadow: var(--shadow-bento-hover);
}

/* Bento Column Spans */
.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-7  { grid-column: span 7; }
.col-6  { grid-column: span 6; }
.col-5  { grid-column: span 5; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }

/* Bento Hero Spotlight */
.hero-bento {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(236, 72, 153, 0.08) 50%, rgba(6, 182, 212, 0.12) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

/* ==========================================================================
   CIRCULAR RADIAL GPA GAUGE
   ========================================================================== */
.radial-gpa-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radial-svg {
  transform: rotate(-90deg);
  width: 140px;
  height: 140px;
}

.radial-bg-circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
}

.radial-bar-circle {
  fill: none;
  stroke: url(#aurora-stroke-grad);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 377;
  stroke-dashoffset: 60;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.radial-center-text {
  position: absolute;
  text-align: center;
}

.radial-number {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
}

.radial-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
}

/* ==========================================================================
   METRIC TILES & KPI BADGES
   ========================================================================== */
.bento-kpi-value {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-main);
}

.bento-kpi-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.pill-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pill-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.pill-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* ==========================================================================
   BUTTONS, INPUTS & FORMS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1.35rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-aurora {
  background: var(--grad-aurora);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-aurora:hover {
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
}

.btn-surface {
  background: var(--bento-surface);
  color: var(--text-main);
  border: 1px solid var(--bento-border);
}

.btn-surface:hover {
  background: var(--bento-surface-hover);
  border-color: var(--bento-border-hover);
  transform: translateY(-2px);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bento-surface);
  border: 1px solid var(--bento-border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--bento-surface-hover);
  border-color: var(--bento-border-hover);
  transform: translateY(-2px);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
}

.form-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
}

.form-input, .form-select {
  width: 100%;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(10, 14, 23, 0.7);
  border: 1px solid var(--bento-border);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  transition: var(--transition);
  outline: none;
}

[data-theme="light"] .form-input, [data-theme="light"] .form-select {
  background: #ffffff;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* ==========================================================================
   CUSTOM TABLES & DATA LISTS
   ========================================================================== */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.bento-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.bento-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--bento-border);
}

.bento-table td {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--bento-border);
  color: var(--text-main);
}

.bento-table tbody tr {
  transition: background var(--transition);
}

.bento-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

/* ==========================================================================
   LEADERBOARD PODIUM CARDS
   ========================================================================== */
.podium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.podium-card {
  border-radius: var(--radius-bento);
  padding: 1.5rem;
  text-align: center;
  position: relative;
  background: var(--bento-surface);
  border: 1px solid var(--bento-border);
  backdrop-filter: blur(20px);
}

.podium-card.rank-1 {
  border-color: rgba(234, 179, 8, 0.4);
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.12) 0%, var(--bento-surface) 100%);
  transform: translateY(-6px);
}

.podium-card.rank-2 {
  border-color: rgba(148, 163, 184, 0.4);
}

.podium-card.rank-3 {
  border-color: rgba(217, 119, 6, 0.4);
}

.podium-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

/* ==========================================================================
   PRINT TRANSCRIPT SHEET
   ========================================================================== */
.transcript-card {
  background: #ffffff;
  color: #0f172a;
  padding: 3rem;
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  max-width: 900px;
  margin: 0 auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .navbar, .bento-nav-strip, .no-print, .aurora-bg {
    display: none !important;
  }
  .transcript-card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .tab-pane {
    display: none !important;
  }
  #tab-transcript {
    display: block !important;
  }
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-bento {
  background: var(--bento-surface);
  border: 1px solid var(--bento-border-hover);
  border-radius: var(--radius-bento);
  width: 100%;
  max-width: 540px;
  padding: 2rem;
  box-shadow: var(--shadow-bento-hover);
  animation: modalPop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* Responsive Grid */
@media (max-width: 1024px) {
  .col-8, .col-7, .col-6, .col-5, .col-4, .col-3 {
    grid-column: span 12;
  }
}

@media (max-width: 768px) {
  .navbar { padding: 1rem 1.25rem; }
  .bento-nav-strip { padding: 0.75rem 1.25rem; }
  .main-wrapper { padding: 1.25rem 1.25rem 3rem; }
}