﻿/* ==========================================================================
   VeriWave Studio - Next-Generation Digital Learning & Verilog Platform
   Design System: Linear Elegance + Apple Simplicity + Modern EDA Power
   Primary: Futuristic Light Theme | Secondary: Cyberpunk Obsidian Dark Mode
   ========================================================================== */

:root {
  /* Color Palette - Futuristic Clean Light Theme (Primary) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-muted: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.85);

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #6366f1;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-primary-subtle: rgba(79, 70, 229, 0.08);
  --accent-indigo: #6366f1;
  --accent-blue: #0284c7;
  --accent-cyan: #06b6d4;
  --accent-emerald: #059669;
  --accent-emerald-subtle: rgba(5, 150, 105, 0.1);
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-purple: #7c3aed;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 30px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
}

/* Dark Theme Overrides */
body.dark-theme {
  --bg-app: #080c14;
  --bg-surface: #0f1522;
  --bg-subtle: #162032;
  --bg-muted: #223046;
  --bg-glass: rgba(15, 21, 34, 0.85);

  --border-subtle: #1f2c42;
  --border-medium: #2e415e;
  --border-focus: #38bdf8;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-primary-subtle: rgba(99, 102, 241, 0.15);
  --accent-indigo: #818cf8;
  --accent-blue: #38bdf8;
  --accent-cyan: #22d3ee;
  --accent-emerald: #10b981;
  --accent-emerald-subtle: rgba(16, 185, 129, 0.15);
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #c084fc;

  --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 14px 36px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.35);
}

/* Reset & Base Elements */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Background Subtle Circuit Mesh */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(99, 102, 241, 0.06) 1px, transparent 0);
  background-size: 24px 24px;
}

body.dark-theme .app-container {
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(56, 189, 248, 0.05) 1px, transparent 0);
}

/* ==========================================================================
   Top Navigation Bar
   ========================================================================== */
.top-nav {
  height: 54px;
  background-color: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 50;
  flex-shrink: 0;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.brand-icon-box {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.35);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-wrapper:hover .brand-icon-box {
  transform: scale(1.06);
}

.brand-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.brand-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  padding: 2px 7px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Nav Main Views Tabs */
.nav-views-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.nav-tab-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.5);
}

body.dark-theme .nav-tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  background-color: var(--bg-surface);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

/* Right Nav Controls */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(239, 68, 68, 0.1) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 11px;
  color: #b45309;
  cursor: default;
}

body.dark-theme .streak-pill {
  color: #f59e0b;
}

.xp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-primary-subtle);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 11px;
  color: var(--accent-primary);
}

.theme-toggle-btn {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
  transform: rotate(15deg);
}

/* Primary Action Buttons */
button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-medium);
}

.btn-simulate {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.3);
}

.btn-simulate:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-icon {
  background-color: transparent;
  color: var(--text-muted);
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.btn-icon:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

/* ==========================================================================
   Content Viewport (Switches between Dashboard, Curriculum, IDE, Circuit Lab)
   ========================================================================== */
.app-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  height: calc(100vh - 54px);
}

.view-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow-y: auto;
  display: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.view-container.active-view {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   View 1: Dashboard Experience
   ========================================================================== */
.dashboard-layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 60px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Hero Banner */
.dash-hero {
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

body.dark-theme .dash-hero {
  background: linear-gradient(135deg, #131b2a 0%, #0d131f 100%);
  border-color: var(--border-subtle);
}

.dash-hero-content {
  max-width: 640px;
  z-index: 2;
}

.dash-greeting-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-primary);
  background: var(--accent-primary-subtle);
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.dash-hero h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.dash-hero p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.dash-hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-hero-art {
  position: relative;
  width: 220px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.circuit-chip-art {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, #6366f1 0%, #38bdf8 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(99, 102, 241, 0.35);
  animation: pulseGlow 4s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 16px 36px rgba(99, 102, 241, 0.35); }
  50% { transform: translateY(-4px) scale(1.03); box-shadow: 0 20px 42px rgba(99, 102, 241, 0.5); }
}

/* Key Metrics Stats Grid */
.dash-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.metric-icon-blue { background: rgba(2, 132, 199, 0.12); color: #0284c7; }
.metric-icon-emerald { background: rgba(5, 150, 105, 0.12); color: #059669; }
.metric-icon-purple { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.metric-icon-amber { background: rgba(217, 119, 6, 0.12); color: #d97706; }

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Section Titles */
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dash-section-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Featured Continue Learning Card */
.continue-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.continue-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #4f46e5 0%, #06b6d4 100%);
}

.continue-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.continue-module-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.continue-lesson-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.continue-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Curriculum Tracks Roadmap */
.modules-roadmap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.track-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.track-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-indigo);
  box-shadow: var(--shadow-md);
}

.track-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.track-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.track-status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: var(--bg-subtle);
  color: var(--text-muted);
}

.track-status-pill.status-completed {
  background-color: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
}

.track-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

.track-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.track-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

/* Achievements Showcase Grid */
.badges-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.badge-item-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.badge-item-card.locked {
  opacity: 0.55;
  filter: grayscale(0.7);
}

.badge-icon-display {
  font-size: 26px;
  width: 48px;
  height: 48px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.badge-text-info {
  display: flex;
  flex-direction: column;
}

.badge-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.badge-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   View 2: Interactive Curriculum & Lessons
   ========================================================================== */
.curriculum-layout {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Left Sidebar - Course Directory */
.course-sidebar {
  width: 320px;
  height: 100%;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

.sidebar-modules-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.sidebar-module-group {
  margin-bottom: 16px;
}

.sidebar-module-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-lesson-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

.sidebar-lesson-item:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.sidebar-lesson-item.active {
  background-color: var(--accent-primary-subtle);
  color: var(--accent-primary);
  font-weight: 600;
}

.lesson-check-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  flex-shrink: 0;
}

.sidebar-lesson-item.completed .lesson-check-icon {
  background-color: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #ffffff;
}

/* Center Right: Main Lesson Content Area */
.lesson-content-viewport {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  background-color: var(--bg-app);
  padding: 36px 48px 80px 48px;
}

.lesson-article {
  max-width: 820px;
  margin: 0 auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-sm);
}

.lesson-header-box {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 20px;
  margin-bottom: 28px;
}

.lesson-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.lesson-title-text {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1.3;
}

.lesson-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.lesson-body h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 28px 0 12px 0;
}

.lesson-body p {
  margin-bottom: 16px;
}

.styled-list {
  padding-left: 20px;
  margin-bottom: 20px;
}

.styled-list li {
  margin-bottom: 8px;
}

/* Callout Boxes */
.concept-callout {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  gap: 14px;
  margin: 20px 0;
}

.concept-callout.warning {
  border-left-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.06);
}

.callout-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.callout-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Architecture Block Diagrams */
.architecture-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 24px 0;
}

.diagram-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  box-shadow: var(--shadow-sm);
}

.diagram-box.module-box {
  border: 2px solid var(--accent-primary);
  background: var(--accent-primary-subtle);
  padding: 16px 24px;
}

.box-tag {
  font-size: 9px;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: 0.5px;
}

.diagram-arrow {
  color: var(--text-muted);
  font-size: 16px;
}

/* Lesson Code Card & Action */
.lesson-code-card {
  margin: 28px 0;
  background-color: #0c1017;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.lesson-code-header {
  height: 38px;
  background-color: #121824;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #1e293b;
}

.code-badge {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.lesson-code-block {
  padding: 18px;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}

/* Knowledge Check Quiz Card */
.lesson-quiz-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 36px;
}

.quiz-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-primary);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.quiz-question {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-opt-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
}

.quiz-opt-btn:hover {
  background-color: var(--bg-subtle);
  border-color: var(--accent-indigo);
}

.quiz-opt-btn.correct {
  background-color: var(--accent-emerald-subtle);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  font-weight: 700;
}

.quiz-opt-btn.incorrect {
  background-color: rgba(225, 29, 72, 0.08);
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}

.quiz-feedback {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.5;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: none;
}

.quiz-feedback.show-feedback {
  display: block;
}

/* Lesson Navigation Footer */
.lesson-nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   View 3: Verilog IDE Playground (Preserved & Elevated)
   ========================================================================== */
.playground-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.ide-top-controls {
  height: 44px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 20;
}

.ide-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ide-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-subtle);
  margin: 0 4px;
}

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  width: 32px;
  height: 18px;
  background-color: var(--bg-muted);
  border-radius: 10px;
  transition: background-color 0.2s;
}

.toggle-switch.active {
  background-color: var(--accent-emerald);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.active .toggle-knob {
  transform: translateX(14px);
}

/* Form Selects */
select {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

select:hover {
  border-color: var(--border-medium);
}

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

/* Main Split Workspace */
.main-workspace {
  display: flex;
  flex: 1;
  height: calc(100% - 44px - 26px);
  overflow: hidden;
  position: relative;
}

/* Left Pane: Code Editor */
.editor-pane {
  width: 44%;
  min-width: 300px;
  max-width: 70%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  position: relative;
}

.pane-toolbar {
  height: 36px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  user-select: none;
  flex-shrink: 0;
}

.pane-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-container {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #0d121c;
}

.line-numbers {
  width: 44px;
  padding: 12px 6px 12px 0;
  background-color: #0d121c;
  color: #475569;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  text-align: right;
  user-select: none;
  border-right: 1px solid #1e293b;
  overflow: hidden;
}

.code-textarea {
  flex: 1;
  height: 100%;
  padding: 12px;
  background: transparent;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  border: none;
  outline: none;
  resize: none;
  white-space: pre;
  overflow: auto;
  tab-size: 2;
}

.editor-status-bar {
  height: 28px;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.status-badge-ok {
  color: var(--accent-emerald);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.status-badge-error {
  color: var(--accent-rose);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}

/* Resizer Splitter */
.resizer {
  width: 5px;
  background-color: var(--border-subtle);
  cursor: col-resize;
  position: relative;
  z-index: 10;
  transition: background-color 0.15s;
}

.resizer:hover, .resizer.dragging {
  background-color: var(--accent-indigo);
}

/* Right Pane: Waveform Studio */
.waveform-pane {
  flex: 1;
  min-width: 360px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-surface);
  position: relative;
  overflow: hidden;
}

.waveform-toolbar {
  height: 36px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  user-select: none;
  flex-shrink: 0;
}

.marker-info-box {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  background-color: var(--bg-surface);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.marker-label { color: var(--text-muted); }
.marker-val-m1 { color: #d97706; font-weight: 600; }
.marker-val-m2 { color: #e11d48; font-weight: 600; }
.marker-val-delta { color: #4f46e5; font-weight: 700; }

body.dark-theme .marker-val-m1 { color: #f59e0b; }
body.dark-theme .marker-val-m2 { color: #f43f5e; }
body.dark-theme .marker-val-delta { color: #38bdf8; }

.waveform-canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-surface);
}

/* Bottom Drawer (Console & Diagnostics) */
.bottom-drawer {
  height: 150px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: height 0.2s ease;
}

.bottom-drawer.collapsed {
  height: 28px;
}

.drawer-header {
  height: 28px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  user-select: none;
}

.drawer-tabs {
  display: flex;
  align-items: center;
  height: 100%;
}

.drawer-tab {
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.drawer-tab:hover {
  color: var(--text-primary);
}

.drawer-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background-color: var(--accent-primary-subtle);
}

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  background-color: #0b0f17;
}

.console-line { margin-bottom: 3px; color: #94a3b8; }
.console-info { color: #38bdf8; }
.console-success { color: #34d399; }
.console-error { color: #f87171; }

/* Truth Table */
.state-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.state-table th {
  background-color: #1a2332;
  color: #94a3b8;
  padding: 4px 8px;
  text-align: left;
  border: 1px solid #263346;
  position: sticky;
  top: 0;
}

.state-table td {
  padding: 3px 8px;
  border: 1px solid #1a2332;
  color: #e2e8f0;
}

.state-table tr:hover td {
  background-color: rgba(56, 189, 248, 0.08);
}

/* App Status Bar */
.app-status-bar {
  height: 26px;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-muted);
  user-select: none;
  flex-shrink: 0;
}

/* ==========================================================================
   View 4: Circuit Lab (Interactive Schematic & Truth Tables)
   ========================================================================== */
.circuit-lab-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.circuit-lab-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.circuit-selector-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.circuit-selector-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--text-primary);
}

.circuit-selector-btn.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.circuit-lab-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.circuit-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 18px;
}

.circuit-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-primary);
  letter-spacing: 0.5px;
}

.circuit-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 4px 0;
}

.circuit-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.circuit-workbench {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

/* Schematic Panel */
.schematic-panel {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.schematic-diagram {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}

.diagram-inputs, .diagram-outputs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.schematic-switch-row, .schematic-out-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Logic Switches */
.logic-switch {
  width: 72px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-medium);
  background-color: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.logic-switch:hover {
  transform: scale(1.04);
}

.logic-switch.switch-high {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
}

.logic-switch.switch-low {
  background-color: var(--bg-surface);
  color: var(--text-muted);
}

.switch-label { font-weight: 700; font-size: 12px; }
.switch-val { font-family: var(--font-mono); font-weight: 800; font-size: 14px; }

/* Schematic Wires */
.schematic-wire {
  width: 50px;
  height: 3px;
  background-color: var(--border-medium);
  transition: background-color 0.2s, box-shadow 0.2s;
}

.schematic-wire.wire-high {
  background-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

/* Gate Center Graphic */
.diagram-gate-symbol {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-body {
  width: 90px;
  height: 90px;
  border: 3px solid var(--border-medium);
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.gate-body.gate-active {
  border-color: #4f46e5;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.35);
}

.gate-symbol-text {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.gate-type-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-primary);
}

/* Logic Probes */
.logic-probe {
  width: 72px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-weight: 700;
  border: 2px solid transparent;
}

.logic-probe.probe-high {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(2, 132, 199, 0.4);
}

.logic-probe.probe-low {
  background-color: var(--bg-subtle);
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.probe-label { font-size: 12px; }
.probe-val { font-family: var(--font-mono); font-size: 15px; font-weight: 800; }

.schematic-instructions {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
}

/* Truth Table in Lab */
.panel-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.lab-truth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.lab-truth-table th, .lab-truth-table td {
  padding: 8px 12px;
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.lab-truth-table th {
  background-color: var(--bg-subtle);
  font-weight: 700;
}

.lab-truth-table th.th-out {
  color: var(--accent-primary);
}

.lab-truth-table tr.tr-active {
  background-color: var(--accent-primary-subtle);
  font-weight: 700;
  color: var(--accent-primary);
  border-left: 3px solid var(--accent-primary);
}

.lab-code-snippet {
  background-color: #0c1017;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

/* ==========================================================================
   Modals, Popovers & Toasts
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  width: 440px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input, .form-group select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--border-focus);
}

.modal-footer {
  padding: 12px 18px;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Floating Popover */
.wave-popover {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  width: 270px;
}

.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.popover-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
}

.popover-body { display: flex; flex-direction: column; gap: 8px; }
.popover-body label { font-size: 11px; color: var(--text-secondary); }

.popover-row { display: flex; align-items: center; gap: 6px; }

.popover-row input, .popover-body input[type="text"] {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  outline: none;
  width: 100%;
}

.quick-presets { display: flex; gap: 4px; margin-top: 4px; }

.quick-presets button {
  flex: 1;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 10px;
  padding: 4px 0;
  justify-content: center;
}

.quick-presets button:hover {
  background-color: var(--accent-primary-subtle);
  color: var(--accent-primary);
}

.popover-footer { display: flex; justify-content: flex-end; gap: 6px; margin-top: 12px; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 32px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.toast {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  animation: slideToast 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success { border-left: 4px solid var(--accent-emerald); }
.toast-error { border-left: 4px solid var(--accent-rose); }
.toast-info { border-left: 4px solid var(--accent-indigo); }

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

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .dash-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .modules-roadmap-grid { grid-template-columns: 1fr; }
  .badges-showcase-grid { grid-template-columns: 1fr; }
  .circuit-workbench { grid-template-columns: 1fr; }
  .course-sidebar { width: 240px; }
  .main-workspace { flex-direction: column; }
  .editor-pane { width: 100% !important; height: 50%; }
  .waveform-pane { height: 50%; }
}
