/**
 * Calculadora de Média Escolar — Design System Premium
 * B20 Conteúdo Digital | v2.0
 * Dark Mode · Glassmorphism · GSAP-ready
 */

/* ============================================================
   GOOGLE FONTS IMPORT
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap');

/* ============================================================
   CSS DESIGN TOKENS
   ============================================================ */
:root {
  /* === Brand Colors === */
  --primary:        #7C3AED;
  --primary-light:  #A855F7;
  --primary-dark:   #5B21B6;
  --primary-glow:   rgba(124, 58, 237, 0.35);
  --accent:         #06B6D4;
  --accent-glow:    rgba(6, 182, 212, 0.3);

  /* === Semantic Colors === */
  --success:        #10B981;
  --success-bg:     rgba(16, 185, 129, 0.12);
  --success-glow:   rgba(16, 185, 129, 0.3);
  --warning:        #F59E0B;
  --warning-bg:     rgba(245, 158, 11, 0.12);
  --danger:         #F43F5E;
  --danger-bg:      rgba(244, 63, 94, 0.12);
  --info:           #3B82F6;

  /* === Surface Colors === */
  --bg:             #0A0A0F;
  --bg-2:           #0F0F18;
  --surface:        #13131F;
  --surface-2:      #1A1A2E;
  --surface-3:      #22223A;
  --nav-bg:         rgba(10, 10, 15, 0.85);
  --glass:          rgba(255, 255, 255, 0.04);
  --glass-border:   rgba(255, 255, 255, 0.08);
  --glass-hover:    rgba(255, 255, 255, 0.07);

  /* === Text Colors === */
  --text:           #F1F0FF;
  --text-2:         #C4C0E8;
  --text-muted:     #7B78A8;
  --text-subtle:    rgba(241, 240, 255, 0.35);

  /* === Gradients === */
  --gradient-primary:   linear-gradient(135deg, #7C3AED 0%, #A855F7 50%, #06B6D4 100%);
  --gradient-card:      linear-gradient(145deg, rgba(124,58,237,0.15) 0%, rgba(6,182,212,0.05) 100%);
  --gradient-success:   linear-gradient(135deg, #059669, #10B981);
  --gradient-warning:   linear-gradient(135deg, #D97706, #F59E0B);
  --gradient-danger:    linear-gradient(135deg, #E11D48, #F43F5E);
  --gradient-bg:        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124,58,237,0.15) 0%, transparent 60%),
                        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(6,182,212,0.08) 0%, transparent 60%),
                        #0A0A0F;

  /* === Spacing === */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* === Typography === */
  --font-sans:  'Inter', system-ui, sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  /* === Borders === */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* === Shadows === */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 30px var(--primary-glow);
  --shadow-glow-sm: 0 0 15px var(--primary-glow);

  /* === Transitions === */
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:    cubic-bezier(0.64, 0, 0.78, 0);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.3s var(--ease-out);
  --transition-fast: 0.15s var(--ease-out);
  --transition-slow: 0.5s var(--ease-out);

  /* === Z-index === */
  --z-base:    1;
  --z-nav:     100;
  --z-modal:   200;
  --z-toast:   300;
}

/* ============================================================
   LIGHT THEME TOKENS
   ============================================================ */
:root[data-theme="light"] {
  /* === Brand Colors (Adjusted for light bg) === */
  --primary:        #6D28D9;
  --primary-light:  #8B5CF6;
  --primary-dark:   #4C1D95;
  --primary-glow:   rgba(109, 40, 217, 0.25);
  --accent:         #0891B2;
  --accent-glow:    rgba(8, 145, 178, 0.2);

  /* === Semantic Colors === */
  --success:        #059669;
  --success-bg:     rgba(5, 150, 105, 0.1);
  --success-glow:   rgba(5, 150, 105, 0.2);
  --warning:        #D97706;
  --warning-bg:     rgba(217, 119, 6, 0.1);
  --danger:         #E11D48;
  --danger-bg:      rgba(225, 29, 72, 0.1);
  --info:           #2563EB;

  /* === Surface Colors === */
  --bg:             #F8FAFC;
  --bg-2:           #F1F5F9;
  --surface:        #FFFFFF;
  --surface-2:      #F8FAFC;
  --surface-3:      #E2E8F0;
  --nav-bg:         rgba(255, 255, 255, 0.9);
  --glass:          rgba(255, 255, 255, 0.75);
  --glass-border:   rgba(15, 23, 42, 0.08);
  --glass-hover:    rgba(255, 255, 255, 0.95);

  /* === Text Colors === */
  --text:           #0F172A;
  --text-2:         #334155;
  --text-muted:     #64748B;
  --text-subtle:    rgba(15, 23, 42, 0.35);

  /* === Shadows (Softer for light theme) === */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.12);
  --shadow-xl:  0 20px 48px rgba(0,0,0,0.15);

  /* === Gradients === */
  --gradient-card:      linear-gradient(145deg, rgba(124,58,237,0.08) 0%, rgba(6,182,212,0.03) 100%);
  --gradient-bg:        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124,58,237,0.12) 0%, transparent 60%),
                        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(6,182,212,0.08) 0%, transparent 60%),
                        #F8FAFC;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: var(--gradient-bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   ANIMATED BACKGROUND PARTICLES
   ============================================================ */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  animation: float-particle linear infinite;
  opacity: 0;
}

.particle:nth-child(1)  { width: 3px;  height: 3px;  background: var(--primary-light); left: 10%;  animation-duration: 20s; animation-delay: 0s; }
.particle:nth-child(2)  { width: 2px;  height: 2px;  background: var(--accent);        left: 25%;  animation-duration: 25s; animation-delay: 3s; }
.particle:nth-child(3)  { width: 4px;  height: 4px;  background: var(--primary);       left: 40%;  animation-duration: 18s; animation-delay: 6s; }
.particle:nth-child(4)  { width: 2px;  height: 2px;  background: var(--accent);        left: 60%;  animation-duration: 22s; animation-delay: 1s; }
.particle:nth-child(5)  { width: 3px;  height: 3px;  background: var(--primary-light); left: 75%;  animation-duration: 28s; animation-delay: 5s; }
.particle:nth-child(6)  { width: 2px;  height: 2px;  background: var(--primary);       left: 90%;  animation-duration: 19s; animation-delay: 8s; }
.particle:nth-child(7)  { width: 5px;  height: 5px;  background: var(--accent);        left: 15%;  animation-duration: 32s; animation-delay: 2s; }
.particle:nth-child(8)  { width: 2px;  height: 2px;  background: var(--primary-light); left: 50%;  animation-duration: 24s; animation-delay: 10s; }

@keyframes float-particle {
  0%   { transform: translateY(110vh) rotate(0deg);   opacity: 0; }
  5%   { opacity: 0.6; }
  95%  { opacity: 0.3; }
  100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

/* ============================================================
   LAYOUT WRAPPER
   ============================================================ */
.app-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   HEADER / NAVBAR
   ============================================================ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  transition: var(--transition);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  cursor: pointer;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-glow-sm);
  transition: var(--transition);
}

.logo-icon:hover {
  transform: scale(1.05) rotate(-5deg);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-text span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Desktop Nav */
.desktop-nav {
  display: none;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  border: none;
  background: transparent;
  cursor: pointer;
}

.nav-link:hover {
  color: var(--text);
  background: var(--glass);
}

.nav-link.active {
  color: var(--primary-light);
  background: rgba(124, 58, 237, 0.12);
}

.nav-link i {
  font-size: 0.9rem;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-icon {
  width: 38px;
  height: 38px;
  border: none;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--glass-hover);
  color: var(--text);
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: var(--shadow-glow-sm);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
main {
  flex: 1;
  padding-top: 64px;
  padding-bottom: 80px;
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* ============================================================
   PAGE SYSTEM (Multi-page navigation)
   ============================================================ */
.page {
  display: none;
  min-height: calc(100vh - 144px);
  padding: var(--space-8) 0;
}

.page.active {
  display: block;
  animation: page-enter 0.4s var(--ease-out) both;
}

.page.exit {
  animation: page-exit 0.3s var(--ease-in) both;
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes page-exit {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-20px); }
}

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: var(--z-nav);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  border: none;
  background: none;
  cursor: pointer;
  min-width: 60px;
  height: 100%;
}

.nav-item i {
  font-size: 1.4rem;
  transition: all 0.3s var(--ease-spring);
  z-index: 2;
}

.nav-item::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 44px;
  height: 44px;
  background: var(--primary);
  opacity: 0.15;
  border-radius: 50%;
  transition: transform 0.3s var(--ease-spring);
  z-index: 1;
}

.nav-item:hover { color: var(--text-2); }
.nav-item.active { color: var(--primary); }
.nav-item.active i { transform: translateY(-2px) scale(1.1); }
.nav-item.active::after { transform: translate(-50%, -50%) scale(1); }

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  text-align: center;
  padding: var(--space-6) 0 var(--space-5);
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-4);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--space-6);
  animation: badge-pulse 3s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124,58,237,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(124,58,237,0); }
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: var(--space-5);
}

.hero h1 .gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-2);
  max-width: 520px;
  margin: 0 auto var(--space-8);
  line-height: 1.7;
}

/* ============================================================
   ACTION CARDS (Home)
   ============================================================ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-10);
}

.action-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  will-change: transform;
}

.action-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: var(--transition);
}

.action-card:hover {
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4), var(--shadow-glow);
}

.action-card:hover::before { opacity: 0.06; }

.action-card-inner {
  position: relative;
  z-index: 1;
}

.action-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  transition: var(--transition);
}

.action-card:hover .action-icon {
  transform: scale(1.15) rotate(-5deg);
}

.action-icon.purple { background: rgba(124, 58, 237, 0.2); }
.action-icon.cyan   { background: rgba(6, 182, 212, 0.2); }
.action-icon.green  { background: rgba(16, 185, 129, 0.2); }
.action-icon.amber  { background: rgba(245, 158, 11, 0.2); }

.action-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}

.action-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================================
   STATS OVERVIEW
   ============================================================ */
.stats-section {
  margin-bottom: var(--space-10);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: -0.01em;
}

.section-title .title-icon {
  font-size: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.stat-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-4);
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); }
.stat-card:hover::after { opacity: 1; }

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* ============================================================
   RECENT ACTIVITY
   ============================================================ */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.activity-item {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: var(--transition);
}

.activity-item:hover {
  border-color: rgba(124, 58, 237, 0.25);
  transform: translateX(4px);
}

.activity-dot {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.activity-info { flex: 1; }

.activity-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.activity-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.activity-grade {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-4);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.4;
  animation: float 3s ease-in-out infinite;
}

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

.empty-state h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: 0.85rem;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  margin-bottom: var(--space-8);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  transition: var(--transition);
  margin-bottom: var(--space-5);
}

.btn-back:hover {
  color: var(--text);
  background: var(--glass-hover);
  border-color: rgba(124, 58, 237, 0.3);
}

.page-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* ============================================================
   WIZARD / CALCULATOR STEPS
   ============================================================ */
.wizard-progress {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-8);
  gap: 0;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  position: relative;
}

.wizard-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--glass-border);
  transition: background 0.5s ease;
  z-index: 0;
}

.wizard-step.done:not(:last-child)::after,
.wizard-step.active:not(:last-child)::after {
  background: var(--primary);
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 2px solid var(--glass-border);
  color: var(--text-muted);
  transition: var(--transition-slow);
  position: relative;
  z-index: 1;
}

.wizard-step.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-glow-sm);
  transform: scale(1.1);
}

.wizard-step.done .step-circle {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.step-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: var(--transition);
}

.wizard-step.active .step-label {
  color: var(--primary-light);
}

.wizard-step.done .step-label {
  color: var(--success);
}

/* Step content panels */
.wizard-panel {
  display: none;
}

.wizard-panel.active {
  display: block;
  animation: panel-in 0.4s var(--ease-out) both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   CALC TYPE SELECTOR (Step 1)
   ============================================================ */
.calc-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.calc-type-card {
  background: var(--glass);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.calc-type-card:hover {
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.3), var(--shadow-glow);
}

.calc-type-card.selected {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.12);
  box-shadow: var(--shadow-glow);
}

.calc-type-card.selected .type-icon {
  transform: scale(1.2);
}

.type-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
  display: block;
  transition: var(--transition);
}

.calc-type-card h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.calc-type-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================================
   INFO BANNER
   ============================================================ */
.info-banner {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.info-banner i {
  color: var(--primary-light);
  font-size: 1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.info-banner-content h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: var(--space-1);
}

.info-banner-content p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.formula-tag {
  display: inline-block;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-sm);
  padding: 2px var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-top: var(--space-2);
}

/* ============================================================
   GRADES CONTAINER (Step 2)
   ============================================================ */
.grades-panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
}

.grades-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.grades-header h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.system-select {
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: var(--transition);
}

.system-select:focus {
  outline: none;
  border-color: var(--primary);
}

.grades-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.grade-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  transition: var(--transition);
  animation: row-in 0.3s var(--ease-spring) both;
}

@keyframes row-in {
  from { opacity: 0; transform: translateX(-10px) scale(0.97); }
  to   { opacity: 1; transform: translateX(0)    scale(1); }
}

.grade-row:hover { border-color: rgba(124, 58, 237, 0.25); }

.grade-row.weighted-row {
  grid-template-columns: auto 1fr 80px auto;
}

.grade-num {
  width: 28px;
  height: 28px;
  background: rgba(124, 58, 237, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-light);
  flex-shrink: 0;
}

.grade-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.grade-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grade-input {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  width: 100%;
  padding: 0;
  outline: none;
  transition: var(--transition);
}

.grade-input::placeholder { color: var(--text-subtle); font-weight: 400; }
.grade-input:focus { color: var(--primary-light); }

.weight-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.weight-input {
  background: var(--surface-3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  width: 100%;
  padding: var(--space-1) var(--space-2);
  outline: none;
  text-align: center;
  transition: var(--transition);
}

.weight-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.btn-remove-grade {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-remove-grade:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.grades-actions {
  margin-top: var(--space-4);
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Live preview bar */
.live-preview {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  transition: var(--transition);
}

.live-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.live-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  transition: all 0.3s var(--ease-spring);
}

.live-value.approved { color: var(--success); }
.live-value.recovery { color: var(--warning); }
.live-value.failed   { color: var(--danger); }

.live-badge {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition);
}

.live-badge.approved { background: var(--success-bg); color: var(--success); }
.live-badge.recovery { background: var(--warning-bg); color: var(--warning); }
.live-badge.failed   { background: var(--danger-bg); color: var(--danger); }

/* Needed grade inputs */
.needed-inputs {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  display: grid;
  gap: var(--space-5);
}

.needed-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.needed-input-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.needed-input-group input {
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  padding: var(--space-4);
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.needed-input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ============================================================
   RESULT CARD (Step 3)
   ============================================================ */
.result-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  opacity: 1;
}

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

.result-ring {
  width: 140px;
  height: 140px;
  margin: 0 auto var(--space-6);
  position: relative;
}

.result-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.result-ring-bg {
  fill: none;
  stroke: var(--glass-border);
  stroke-width: 8;
}

.result-ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.3;
  stroke-dashoffset: 339.3;
  transition: stroke-dashoffset 1.2s var(--ease-out);
}

.result-ring-fill.approved { stroke: url(#grad-success); }
.result-ring-fill.recovery { stroke: url(#grad-warning); }
.result-ring-fill.failed   { stroke: url(#grad-danger); }

.result-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.result-number {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
  transition: all 0.4s var(--ease-spring);
}

.result-status-text {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-status-text.approved { color: var(--success); }
.result-status-text.recovery { color: var(--warning); }
.result-status-text.failed   { color: var(--danger); }

.result-heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: var(--space-2);
}

.result-message {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: var(--space-6);
}

.result-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.result-detail {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
}

.result-detail-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.result-detail-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn:active::before { opacity: 0.1; }

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.5);
}

.btn-secondary {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-2);
}

.btn-secondary:hover {
  background: var(--glass-hover);
  border-color: rgba(124, 58, 237, 0.3);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--glass);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-bg);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 0.8rem;
  min-height: 36px;
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1rem;
  min-height: 52px;
  border-radius: var(--radius-lg);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--glass-border);
}

/* ============================================================
   SLIDER
   ============================================================ */
.slider-group {
  margin-bottom: var(--space-5);
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.slider-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
}

.slider-val {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-light);
  background: rgba(124, 58, 237, 0.12);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  min-width: 48px;
  text-align: center;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--gradient-primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-glow);
  transition: transform 0.2s var(--ease-spring);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--gradient-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px var(--primary-glow);
}

/* ============================================================
   SIMULATOR TABS
   ============================================================ */
.tab-nav {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: var(--space-6);
  gap: 4px;
}

.tab-btn {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: calc(var(--radius-lg) - 4px);
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-glow-sm);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: panel-in 0.3s var(--ease-out) both;
}

/* ============================================================
   HISTORY & TIMELINE
   ============================================================ */
.history-controls {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 180px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: var(--space-3) var(--space-4);
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.filter-select {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: var(--space-3) var(--space-4);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:focus {
  border-color: var(--primary);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.history-item {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: var(--transition);
  animation: row-in 0.3s var(--ease-out) both;
}

.history-item:hover {
  border-color: rgba(124, 58, 237, 0.25);
  transform: translateX(4px);
}

.history-type-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.history-info {
  flex: 1;
}

.history-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.history-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-grade {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin-right: var(--space-2);
}

.history-actions {
  display: flex;
  gap: var(--space-1);
}

/* ============================================================
   LEARN CONTENT
   ============================================================ */
.learn-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.content-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: var(--transition);
}

.content-card:hover {
  border-color: rgba(124, 58, 237, 0.2);
}

.content-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.content-card p {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: var(--space-3);
}

.formula-block {
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  line-height: 1.6;
  overflow-x: auto;
  margin: var(--space-3) 0;
}

.tip-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tip-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 0.875rem;
  color: var(--text-2);
  padding: var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.tip-list li:hover {
  background: var(--surface-3);
}

/* ============================================================
   FAQ
   ============================================================ */
.faq-item {
  border-bottom: 1px solid var(--glass-border);
}

.faq-question {
  width: 100%;
  padding: var(--space-4) var(--space-2);
  background: transparent;
  border: none;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  transition: var(--transition);
}

.faq-question:hover { color: var(--text); }

.faq-icon {
  width: 24px;
  height: 24px;
  background: rgba(124, 58, 237, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease-spring), background 0.2s;
}

.faq-question[aria-expanded="true"] .faq-icon {
  transform: rotate(45deg);
  background: rgba(124, 58, 237, 0.25);
}

.faq-answer {
  padding: 0 var(--space-2) var(--space-4);
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ============================================================
   EXERCISES & QUIZ
   ============================================================ */
.exercise-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  transition: var(--transition);
}

.exercise-question {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: var(--space-5);
}

.exercise-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.exercise-option {
  background: var(--surface-2);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.exercise-option:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-light);
  background: rgba(124, 58, 237, 0.08);
}

.exercise-option.correct {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

.exercise-option.incorrect {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}

.exercise-option:disabled { cursor: not-allowed; }

.exercise-feedback {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.6;
  animation: panel-in 0.3s var(--ease-out) both;
}

/* Quiz Progress */
.quiz-progress-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.quiz-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-section {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
}

.settings-section h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--glass-border);
  gap: var(--space-4);
}

.setting-row:last-child { border-bottom: none; }

.setting-info {
  flex: 1;
}

.setting-info label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.setting-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.setting-input {
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: var(--space-2) var(--space-3);
  outline: none;
  width: 100px;
  text-align: center;
  transition: var(--transition);
}

.setting-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s var(--ease-spring);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: var(--space-3) var(--space-5);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.4s var(--ease-spring);
  z-index: var(--z-toast);
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  backdrop-filter: blur(20px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-out);
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.calc-option {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-4);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: var(--space-3);
  text-align: left;
}

.calc-option:hover {
  border-color: rgba(124, 58, 237, 0.4);
  background: rgba(124, 58, 237, 0.08);
  transform: translateX(4px);
}

.calc-option-icon {
  font-size: 1.5rem;
  width: 42px;
  height: 42px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  font-size: 0.78rem;
  color: var(--text-subtle);
  border-top: 1px solid var(--glass-border);
}

.app-footer a {
  color: var(--primary-light);
  text-decoration: none;
  transition: var(--transition-fast);
}

.app-footer a:hover { color: var(--accent); }

/* ============================================================
   CONFETTI / CELEBRATION
   ============================================================ */
.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  top: -10px;
  border-radius: 2px;
  pointer-events: none;
  z-index: var(--z-toast);
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center { text-align: center; }
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gap-3 { gap: var(--space-3); }
.mt-4  { margin-top: var(--space-4); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.hidden { display: none !important; }
.flex   { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .particle { display: none; }
}
