/* ============================================
   EduSim — Design System & Global Styles
   Dark-mode glassmorphism with neon accents
   ============================================ */

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

/* ---- CSS Custom Properties ---- */
:root {
  /* Base palette */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2035;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(17, 24, 39, 0.45);
  --bg-glass-hover: rgba(26, 32, 53, 0.65);

  /* Text */
  --text-primary: #f0f4ff;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #60a5fa;

  /* Neon accents */
  --neon-blue: #3b82f6;
  --neon-cyan: #22d3ee;
  --neon-purple: #a855f7;
  --neon-green: #10b981;
  --neon-orange: #f59e0b;
  --neon-red: #ef4444;
  --neon-pink: #ec4899;

  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #3b82f6 0%, #a855f7 50%, #ec4899 100%);
  --gradient-chem: linear-gradient(135deg, #10b981 0%, #22d3ee 100%);
  --gradient-phys: linear-gradient(135deg, #3b82f6 0%, #a855f7 100%);
  --gradient-anat: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
  --gradient-glass-border: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.02) 100%);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(59, 130, 246, 0.3);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.15), 0 0 60px rgba(59, 130, 246, 0.05);
  --shadow-glow-cyan: 0 0 20px rgba(34, 211, 238, 0.15);
  --shadow-glow-purple: 0 0 20px rgba(168, 85, 247, 0.15);

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

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;

  /* Z-index scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-modal: 200;
  --z-hud: 300;
  --z-notification: 400;
  --z-overlay: 500;
}

/* ---- 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;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: var(--neon-cyan);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--text-primary);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---- Utility Classes ---- */
.mono {
  font-family: 'JetBrains Mono', monospace;
}

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

.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
}

.glass-strong {
  background: var(--bg-glass-hover);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border-light);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Layout ---- */
.app-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* ---- Animated Background Canvas ---- */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---- Navigation ---- */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-hud);
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-normal) var(--ease-out);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  cursor: pointer;
}

.nav-logo .logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--neon-blue);
  border-radius: var(--radius-full);
}

/* ---- Hero Section ---- */
.hero-section {
  position: relative;
  z-index: var(--z-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 140px var(--space-xl) var(--space-3xl);
  min-height: 70vh;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--neon-blue);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-lg);
  animation: fadeInUp 0.6s var(--ease-out) both;
}

.hero-badge .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
  animation: pulse 2s ease-in-out infinite;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: var(--space-lg);
  animation: fadeInUp 0.6s var(--ease-out) 0.1s both;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.7;
  margin-bottom: var(--space-2xl);
  animation: fadeInUp 0.6s var(--ease-out) 0.2s both;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  animation: fadeInUp 0.6s var(--ease-out) 0.3s both;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-hero);
  color: white;
  box-shadow: var(--shadow-glow-blue);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.3), 0 0 80px rgba(59, 130, 246, 0.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--neon-blue);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 0.8rem;
}

/* ---- Stats Bar ---- */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: var(--space-3xl);
  padding: var(--space-2xl) var(--space-xl);
  position: relative;
  z-index: var(--z-base);
  animation: fadeInUp 0.6s var(--ease-out) 0.4s both;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: var(--space-xs);
}

/* ---- Simulation Cards Grid ---- */
.section-header {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl) var(--space-2xl);
  position: relative;
  z-index: var(--z-base);
}

.section-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--neon-cyan);
  margin-bottom: var(--space-md);
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-desc {
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  font-size: 1rem;
}

.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  padding: 0 var(--space-xl) var(--space-3xl);
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  z-index: var(--z-base);
}

.sim-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
}

/* Featured anatomy card spans full width */
.sim-card.featured {
  grid-column: 1 / -1;
  border: 1px solid rgba(239, 68, 68, 0.25);
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.08);
}

.sim-card.featured .sim-card-preview {
  height: 340px;
}

.sim-card.featured .sim-card-body {
  padding: var(--space-lg) var(--space-xl);
}

.sim-card.featured .sim-card-title {
  font-size: 1.5rem;
}

.sim-card.featured .sim-card-desc {
  font-size: 1rem;
  max-width: 700px;
}

/* Mini cards for secondary simulations */
.sim-card.mini .sim-card-preview {
  height: 160px;
}

.sim-card.mini .sim-card-desc {
  font-size: 0.85rem;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.sim-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow-blue);
}

.sim-card.chemistry:hover {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: var(--shadow-glow-cyan);
}

.sim-card.physics:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: var(--shadow-glow-blue);
}

.sim-card.anatomy:hover {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.2);
}

/* Model loading progress bar */
.model-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 30, 0.92);
  z-index: 100;
  gap: var(--space-md);
}

.model-loading-overlay .loading-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.model-loading-bar {
  width: 240px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}

.model-loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ef4444, #f97316);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.sim-card-preview {
  position: relative;
  height: 220px;
  overflow: hidden;
}

.sim-card-preview canvas {
  width: 100%;
  height: 100%;
}

.sim-card-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.15;
}

.sim-card.chemistry .sim-card-gradient {
  background: var(--gradient-chem);
}
.sim-card.physics .sim-card-gradient {
  background: var(--gradient-phys);
}
.sim-card.anatomy .sim-card-gradient {
  background: var(--gradient-anat);
}

.sim-card-badge {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.sim-card.chemistry .sim-card-badge {
  background: rgba(16, 185, 129, 0.2);
  color: var(--neon-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.sim-card.physics .sim-card-badge {
  background: rgba(59, 130, 246, 0.2);
  color: var(--neon-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.sim-card.anatomy .sim-card-badge {
  background: rgba(239, 68, 68, 0.2);
  color: var(--neon-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.sim-card-body {
  padding: var(--space-lg);
}

.sim-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.sim-card-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.sim-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sim-card-tags {
  display: flex;
  gap: var(--space-xs);
}

.sim-tag {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.sim-card-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-fast) var(--ease-out);
  font-size: 1rem;
}

.sim-card:hover .sim-card-action {
  background: var(--neon-blue);
  border-color: var(--neon-blue);
  color: white;
}

/* ---- Simulation View (Full Screen) ---- */
.simulation-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  background: var(--bg-primary);
  display: none;
  flex-direction: column;
}

.simulation-view.active {
  display: flex;
  animation: fadeIn 0.3s var(--ease-out);
}

.sim-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: var(--z-hud);
}

.sim-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sim-back-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-fast) var(--ease-out);
  font-size: 1.1rem;
}

.sim-back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-light);
}

.sim-toolbar-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.sim-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sim-canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#sim-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- HUD Overlay ---- */
.hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: var(--z-hud);
}

.hud-panel {
  pointer-events: auto;
  position: absolute;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  min-width: 200px;
}

.hud-panel-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.hud-top-left {
  top: var(--space-md);
  left: var(--space-md);
}

.hud-top-right {
  top: var(--space-md);
  right: var(--space-md);
}

.hud-bottom-left {
  bottom: var(--space-md);
  left: var(--space-md);
}

.hud-bottom-right {
  bottom: var(--space-md);
  right: var(--space-md);
}

.hud-top-center {
  top: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  min-width: 340px;
}

/* Anatomy search bar */
.anatomy-search-container {
  display: flex;
  gap: 6px;
}

.anatomy-search-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.anatomy-search-input:focus {
  border-color: var(--primary);
}

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

.anatomy-search-btn {
  padding: 8px 16px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.anatomy-search-btn:hover {
  background: var(--primary-hover);
}

/* ---- Controls Panel ---- */
.control-group {
  margin-bottom: var(--space-md);
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.control-value {
  font-family: 'JetBrains Mono', monospace;
  color: var(--neon-cyan);
  font-size: 0.75rem;
}

.control-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
}

.control-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-blue);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.control-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.control-btn-group {
  display: flex;
  gap: var(--space-xs);
}

.control-btn {
  flex: 1;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
  text-align: center;
}

.control-btn:hover,
.control-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--neon-blue);
  color: var(--neon-blue);
}

/* ---- Info Panel ---- */
.info-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  font-size: 0.8rem;
}

.info-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.info-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--neon-green); }
.info-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--neon-blue); }
.info-icon.orange { background: rgba(245, 158, 11, 0.15); color: var(--neon-orange); }
.info-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--neon-red); }
.info-icon.purple { background: rgba(168, 85, 247, 0.15); color: var(--neon-purple); }

.info-text {
  color: var(--text-secondary);
}

.info-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ---- Dashboard Section ---- */
.dashboard-section {
  position: relative;
  z-index: var(--z-base);
  padding: var(--space-3xl) var(--space-xl);
  max-width: 1280px;
  margin: 0 auto;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.dash-metric {
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-normal) var(--ease-out);
}

.dash-metric:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.dash-metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

.dash-metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dash-metric-change {
  font-size: 0.75rem;
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.dash-metric-change.positive { color: var(--neon-green); }
.dash-metric-change.negative { color: var(--neon-red); }

.chart-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.chart-card {
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
}

.chart-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.chart-container {
  position: relative;
  height: 250px;
}

/* ---- Notification Toast ---- */
.toast-container {
  position: fixed;
  top: 80px;
  right: var(--space-lg);
  z-index: var(--z-notification);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--bg-glass-hover);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 300px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.4s var(--ease-spring);
  transition: all var(--duration-normal) var(--ease-out);
}

.toast.dismissing {
  animation: slideOutRight 0.3s var(--ease-out) forwards;
}

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

.toast.success .toast-icon { background: rgba(16, 185, 129, 0.15); color: var(--neon-green); }
.toast.warning .toast-icon { background: rgba(245, 158, 11, 0.15); color: var(--neon-orange); }
.toast.error .toast-icon { background: rgba(239, 68, 68, 0.15); color: var(--neon-red); }
.toast.info .toast-icon { background: rgba(59, 130, 246, 0.15); color: var(--neon-blue); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.85rem;
}

.toast-message {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.toast-close {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--duration-fast) var(--ease-out);
  font-size: 0.8rem;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ---- Loading Screen ---- */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s var(--ease-out);
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--neon-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-lg);
}

.loader-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ---- Footer ---- */
.main-footer {
  position: relative;
  z-index: var(--z-base);
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* ---- Tutorial Overlay ---- */
.tutorial-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-overlay);
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s var(--ease-out);
}

.tutorial-overlay.hidden {
  display: none;
}

.tutorial-card {
  max-width: 420px;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  background: var(--bg-glass-hover);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border-light);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.tutorial-step {
  font-size: 0.7rem;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
}

.tutorial-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.tutorial-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}

/* ---- Chemical Equation Bar ---- */
.equation-bar {
  pointer-events: auto;
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  animation: fadeInUp 0.4s var(--ease-out);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.equation-bar .eq-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding-right: 10px;
  border-right: 1px solid var(--border-subtle);
}

.equation-bar .eq-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.equation-bar .eq-text .reactant {
  color: var(--neon-green);
  transition: color 0.3s ease;
}

.equation-bar .eq-text .product {
  color: var(--neon-cyan);
  transition: color 0.3s ease;
}

.equation-bar .eq-text .arrow {
  color: var(--neon-orange);
  font-size: 1.2rem;
  margin: 0 6px;
}

.equation-bar .eq-text .plus {
  color: var(--text-muted);
  margin: 0 4px;
}

.equation-bar .eq-text sub {
  font-size: 0.7em;
  vertical-align: sub;
}

.equation-bar .eq-type {
  font-size: 0.65rem;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 4px;
}

.equation-bar .eq-type.exo {
  background: rgba(239, 68, 68, 0.15);
  color: var(--neon-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.equation-bar .eq-type.endo {
  background: rgba(59, 130, 246, 0.15);
  color: var(--neon-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.equation-bar.reacting {
  border-color: var(--neon-orange);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15), 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ---- 3D Floating Labels ---- */
.anatomy-label {
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  padding: 4px 10px 4px 8px;
  background: rgba(10, 14, 26, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  transform: translateY(-8px);
}

.anatomy-label:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--neon-blue);
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.anatomy-label .label-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--neon-blue);
  flex-shrink: 0;
}

.anatomy-label .label-line {
  position: absolute;
  bottom: -16px;
  left: 50%;
  width: 1px;
  height: 14px;
  background: linear-gradient(to bottom, rgba(59, 130, 246, 0.5), rgba(59, 130, 246, 0));
  transform: translateX(-50%);
}

.anatomy-label.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--neon-blue);
  color: var(--neon-blue);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.25);
}

/* ---- Click Tooltip (appears at clicked body part) ---- */
.anatomy-click-tooltip {
  position: fixed;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  z-index: 1000;
  pointer-events: none;
  transform: translate(-50%, -100%);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(59, 130, 246, 0.15);
  white-space: nowrap;
}

.anatomy-click-tooltip.visible {
  opacity: 1;
  transform: translate(-50%, -100%) translateY(-4px);
}

/* Connector line pointing down to the click point */
.anatomy-click-tooltip::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 12px;
  background: linear-gradient(to bottom, rgba(59, 130, 246, 0.6), rgba(59, 130, 246, 0));
}

/* Small triangle at the bottom */
.anatomy-click-tooltip::before {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: rgba(10, 14, 26, 0.9);
  border-right: 1px solid rgba(59, 130, 246, 0.4);
  border-bottom: 1px solid rgba(59, 130, 246, 0.4);
}

.anatomy-click-tooltip .tooltip-emoji {
  font-size: 1.1rem;
}

.anatomy-click-tooltip .tooltip-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f0f4ff;
  letter-spacing: 0.02em;
}

.anatomy-click-tooltip .tooltip-type {
  font-size: 0.65rem;
  font-weight: 500;
  color: rgba(59, 130, 246, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 4px;
}

/* ---- Learning Objectives Panel ---- */
.objectives-panel {
  pointer-events: auto;
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  min-width: 320px;
  max-width: 520px;
  animation: fadeInUp 0.4s var(--ease-out);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.objectives-panel .obj-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.objectives-panel .obj-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.objectives-panel .obj-progress {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--neon-cyan);
  font-family: 'JetBrains Mono', monospace;
}

.objectives-panel .obj-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  margin-bottom: 8px;
  overflow: hidden;
}

.objectives-panel .obj-bar-fill {
  height: 100%;
  background: var(--gradient-hero);
  border-radius: 2px;
  transition: width 0.5s var(--ease-spring);
}

.objectives-panel .obj-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.objectives-panel .obj-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 3px 0;
  transition: color 0.3s ease;
}

.objectives-panel .obj-item.completed {
  color: var(--neon-green);
}

.objectives-panel .obj-item .obj-check {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  flex-shrink: 0;
  transition: all 0.3s var(--ease-spring);
}

.objectives-panel .obj-item.completed .obj-check {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--neon-green);
  color: var(--neon-green);
}

@keyframes objectiveComplete {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.objectives-panel .obj-item.just-completed .obj-check {
  animation: objectiveComplete 0.4s var(--ease-spring);
}

/* ---- Keyframes ---- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

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

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.2); }
  50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.4); }
}

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

@media (max-width: 768px) {
  .sim-grid {
    grid-template-columns: 1fr;
  }
  .stats-bar {
    gap: var(--space-xl);
    flex-wrap: wrap;
  }
  .nav-links {
    display: none;
  }
  .hero-title {
    font-size: 2rem;
  }
  .hero-actions {
    flex-direction: column;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
