/* ═══════════════════════════════════════════════════
   CodeAI — Main Stylesheet
   Dark 3D Glassmorphism IDE Theme
   ═══════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --bg-void: #020408;
  --bg-deep: #060c14;
  --bg-base: #0a1220;
  --bg-surface: #0f1a2e;
  --bg-elevated: #142038;
  --bg-glass: rgba(15, 26, 46, 0.7);
  --bg-glass-light: rgba(20, 32, 56, 0.5);

  --neon-cyan: #00f5ff;
  --neon-blue: #0080ff;
  --neon-purple: #8b5cf6;
  --neon-green: #00ff88;
  --neon-orange: #ff6b2b;
  --neon-pink: #ff2d78;
  --neon-yellow: #ffd700;

  --text-primary: #e8f0fe;
  --text-secondary: #8ba3c7;
  --text-muted: #4a6080;
  --text-accent: #00f5ff;

  --border-subtle: rgba(0, 245, 255, 0.08);
  --border-glow: rgba(0, 245, 255, 0.25);
  --border-active: rgba(0, 245, 255, 0.6);

  --shadow-glow: 0 0 20px rgba(0, 245, 255, 0.15);
  --shadow-deep: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 1px rgba(0, 245, 255, 0.1);

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

  --font-display: 'Syne', sans-serif;
  --font-body: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --topbar-h: 52px;
  --sidebar-w: 220px;
  --right-panel-w: 320px;
  --terminal-h: 240px;
  --tabs-h: 38px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Particle Canvas ── */
#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Grid Overlay ── */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 245, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

/* ── App Shell ── */
.app-shell {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ══════════════════════════════════════
   TOP BAR
══════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  background: rgba(6, 12, 20, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  position: relative;
  z-index: 100;
}

.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
  opacity: 0.4;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* Logo */
.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-cube {
  width: 28px;
  height: 28px;
  position: relative;
  transform-style: preserve-3d;
  animation: cube-spin 8s linear infinite;
}

.cube-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 1px solid var(--neon-cyan);
  background: rgba(0, 245, 255, 0.05);
}
.cube-face.front  { transform: translateZ(14px); }
.cube-face.back   { transform: translateZ(-14px) rotateY(180deg); }
.cube-face.left   { transform: translateX(-14px) rotateY(-90deg); }
.cube-face.right  { transform: translateX(14px) rotateY(90deg); }
.cube-face.top    { transform: translateY(-14px) rotateX(90deg); }
.cube-face.bottom { transform: translateY(14px) rotateX(-90deg); }

.logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}
.logo-accent {
  color: var(--neon-cyan);
  text-shadow: 0 0 20px var(--neon-cyan);
}

.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

/* Status Pill */
.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 20px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--neon-green);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
}

.status-dot.pulse {
  animation: status-pulse 2s ease-in-out infinite;
}

/* File Breadcrumb */
.file-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 400px;
}

.breadcrumb-icon {
  color: var(--neon-cyan);
  font-size: 14px;
}

/* Nav Buttons */
.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-glow);
  color: var(--text-primary);
  box-shadow: var(--shadow-glow);
}

.nav-btn-fix {
  border-color: rgba(139, 92, 246, 0.3);
  color: #a78bfa;
}
.nav-btn-fix:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--neon-purple);
  color: #c4b5fd;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.nav-btn-run {
  border-color: rgba(0, 255, 136, 0.3);
  color: var(--neon-green);
}
.nav-btn-run:hover {
  background: rgba(0, 255, 136, 0.1);
  border-color: var(--neon-green);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.nav-btn-record {
  border-color: rgba(255, 45, 120, 0.3);
  color: var(--neon-pink);
}
.nav-btn-record:hover {
  background: rgba(255, 45, 120, 0.1);
  border-color: var(--neon-pink);
  box-shadow: 0 0 20px rgba(255, 45, 120, 0.2);
}

.nav-btn-upload {
  border-color: rgba(0, 245, 255, 0.3);
  color: var(--neon-cyan);
}
.nav-btn-upload:hover {
  background: rgba(0, 245, 255, 0.1);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.2);
}

/* ══════════════════════════════════════
   WORKSPACE LAYOUT
══════════════════════════════════════ */
.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ══════════════════════════════════════
   LEFT SIDEBAR
══════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: rgba(6, 12, 20, 0.9);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-label {
  padding: 0 14px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* File List */
.file-list {
  padding: 0 8px;
}

.empty-files {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 10px;
  color: var(--text-muted);
  gap: 8px;
  text-align: center;
}

.empty-icon {
  opacity: 0.4;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.file-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.file-item.active {
  background: rgba(0, 245, 255, 0.08);
  color: var(--neon-cyan);
  border-color: rgba(0, 245, 255, 0.2);
}

.file-item-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.file-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-lang {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Action List */
.action-list {
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 12px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  width: 100%;
  font-family: var(--font-body);
}

.action-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
  transform: translateX(2px);
}

.action-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* Recordings List */
.recordings-list {
  padding: 0 8px;
}

.empty-recordings {
  padding: 12px 10px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.recording-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.recording-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
}

/* ══════════════════════════════════════
   CENTER PANEL
══════════════════════════════════════ */
.center-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Editor Tabs */
.editor-tabs {
  height: var(--tabs-h);
  min-height: var(--tabs-h);
  display: flex;
  align-items: center;
  background: rgba(6, 12, 20, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 8px;
  gap: 2px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  transition: all 0.15s ease;
  border: 1px solid transparent;
  border-bottom: none;
  position: relative;
  top: 1px;
}

.tab:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

.tab.active {
  color: var(--neon-cyan);
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  border-bottom-color: var(--bg-surface);
}

.tab-spacer { flex: 1; }

.editor-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.lang-badge {
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid rgba(0, 245, 255, 0.2);
  color: var(--neon-cyan);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Editor Container */
.editor-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}

/* Drop Zone */
.drop-zone {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  z-index: 10;
  transition: all 0.3s ease;
}

.drop-zone.drag-over {
  background: rgba(0, 245, 255, 0.03);
}

.drop-zone.drag-over::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--neon-cyan);
  border-radius: var(--radius-lg);
  animation: border-dash 1s linear infinite;
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 40px;
  max-width: 480px;
}

.drop-3d-icon {
  width: 80px;
  height: 80px;
  perspective: 200px;
  margin-bottom: 8px;
}

.drop-cube {
  width: 80px;
  height: 80px;
  transform-style: preserve-3d;
  animation: drop-cube-float 3s ease-in-out infinite;
  position: relative;
}

.dc-face {
  position: absolute;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 245, 255, 0.05);
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: var(--radius-md);
  color: var(--neon-cyan);
}

.drop-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.drop-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 340px;
}

.drop-supported {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.drop-supported span {
  padding: 3px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.drop-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.15), rgba(0, 128, 255, 0.15));
  border: 1px solid var(--neon-cyan);
  border-radius: var(--radius-md);
  color: var(--neon-cyan);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.1);
}

.drop-btn:hover {
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.25), rgba(0, 128, 255, 0.25));
  box-shadow: 0 0 30px rgba(0, 245, 255, 0.25);
  transform: translateY(-1px);
}

.drop-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* CodeMirror Wrapper */
.cm-wrapper {
  height: 100%;
  overflow: hidden;
}

.cm-wrapper .CodeMirror {
  height: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  background: #0a0f1a;
  color: #e8f0fe;
  border: none;
}

.cm-wrapper .CodeMirror-scroll {
  padding: 8px 0;
}

.cm-wrapper .CodeMirror-gutters {
  background: #060c14;
  border-right: 1px solid rgba(0, 245, 255, 0.08);
}

.cm-wrapper .CodeMirror-linenumber {
  color: #2a4060;
  font-size: 11px;
}

.cm-wrapper .CodeMirror-activeline-background {
  background: rgba(0, 245, 255, 0.04);
}

.cm-wrapper .CodeMirror-cursor {
  border-left: 2px solid var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
}

.cm-wrapper .CodeMirror-selected {
  background: rgba(0, 245, 255, 0.1) !important;
}

/* Diff View */
.diff-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.diff-header {
  display: flex;
  padding: 8px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
}

.diff-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 4px;
}

.diff-label.original {
  background: rgba(255, 45, 120, 0.1);
  color: var(--neon-pink);
  border: 1px solid rgba(255, 45, 120, 0.2);
}

.diff-label.fixed {
  background: rgba(0, 255, 136, 0.1);
  color: var(--neon-green);
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.diff-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Preview Panel */
.preview-panel {
  height: 100%;
  background: white;
}

.preview-panel iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Analysis Bar */
.analysis-bar {
  background: rgba(139, 92, 246, 0.08);
  border-top: 1px solid rgba(139, 92, 246, 0.2);
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  position: relative;
  overflow: hidden;
}

.analysis-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

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

.analysis-content {
  flex: 1;
  min-width: 0;
}

.analysis-title {
  font-size: 12px;
  font-weight: 600;
  color: #c4b5fd;
}

.analysis-detail {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.analysis-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.analysis-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid;
}

.analysis-btn.accept {
  background: rgba(0, 255, 136, 0.1);
  border-color: rgba(0, 255, 136, 0.3);
  color: var(--neon-green);
}
.analysis-btn.accept:hover {
  background: rgba(0, 255, 136, 0.2);
}

.analysis-btn.reject {
  background: rgba(255, 45, 120, 0.1);
  border-color: rgba(255, 45, 120, 0.3);
  color: var(--neon-pink);
}
.analysis-btn.reject:hover {
  background: rgba(255, 45, 120, 0.2);
}

.analysis-progress {
  height: 2px;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-cyan));
  animation: progress-scan 2s ease-in-out infinite;
}

/* ══════════════════════════════════════
   TERMINAL
══════════════════════════════════════ */
.terminal-panel {
  height: var(--terminal-h);
  min-height: var(--terminal-h);
  background: rgba(2, 4, 8, 0.98);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: height 0.3s ease;
}

.terminal-panel.collapsed {
  height: 38px;
  min-height: 38px;
}

.terminal-header {
  height: 38px;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: rgba(6, 12, 20, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  gap: 8px;
}

.terminal-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
}

.term-tab {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-body);
}

.term-tab:hover { color: var(--text-secondary); }

.term-tab.active {
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.08);
}

.terminal-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exec-status {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
}

.exec-status.running {
  background: rgba(0, 255, 136, 0.1);
  color: var(--neon-green);
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.exec-status.error {
  background: rgba(255, 45, 120, 0.1);
  color: var(--neon-pink);
  border: 1px solid rgba(255, 45, 120, 0.2);
}

.exec-status.success {
  background: rgba(0, 245, 255, 0.1);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 245, 255, 0.2);
}

.term-ctrl {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.term-ctrl:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-glow);
}

.terminal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
}

.term-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 1px 0;
}

.term-prompt {
  color: var(--neon-cyan);
  font-weight: 600;
  flex-shrink: 0;
  font-size: 11px;
}

.term-text { color: var(--text-secondary); word-break: break-all; }
.term-line.term-error .term-text { color: #ff6b8a; }
.term-line.term-success .term-text { color: var(--neon-green); }
.term-line.term-warning .term-text { color: var(--neon-yellow); }
.term-line.term-system .term-text { color: var(--text-muted); font-style: italic; }
.term-line.term-ai .term-prompt { color: var(--neon-purple); }
.term-line.term-ai .term-text { color: #c4b5fd; }

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-top: 1px solid var(--border-subtle);
}

.term-prompt-symbol {
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 14px;
  flex-shrink: 0;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  caret-color: var(--neon-cyan);
}

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

/* ══════════════════════════════════════
   RIGHT PANEL
══════════════════════════════════════ */
.right-panel {
  width: var(--right-panel-w);
  min-width: var(--right-panel-w);
  background: rgba(6, 12, 20, 0.9);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.right-tabs {
  display: flex;
  background: rgba(2, 4, 8, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 8px;
  gap: 2px;
  height: 40px;
  align-items: center;
}

.right-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-body);
}

.right-tab:hover { color: var(--text-secondary); }

.right-tab.active {
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.08);
}

.right-tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.right-tab-content.active {
  display: flex;
}

/* ── AI Chat ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.chat-msg.user-msg {
  flex-direction: row-reverse;
}

.msg-avatar {
  flex-shrink: 0;
}

.ai-avatar-ring {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--bg-void);
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.3);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.msg-bubble {
  max-width: 85%;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  backdrop-filter: blur(10px);
}

.user-msg .msg-bubble {
  background: rgba(0, 245, 255, 0.06);
  border-color: rgba(0, 245, 255, 0.15);
}

.msg-header {
  font-size: 10px;
  font-weight: 600;
  color: var(--neon-cyan);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-time {
  color: var(--text-muted);
  font-weight: 400;
}

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

.msg-text ul {
  margin: 8px 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-text li {
  font-size: 11px;
}

.msg-text code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--neon-cyan);
}

.msg-text pre {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

/* Chat Input */
.chat-input-area {
  border-top: 1px solid var(--border-subtle);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(2, 4, 8, 0.8);
}

.chat-mode-selector {
  display: flex;
  gap: 4px;
}

.mode-btn {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-body);
}

.mode-btn:hover {
  border-color: var(--border-glow);
  color: var(--text-secondary);
}

.mode-btn.active {
  background: rgba(0, 245, 255, 0.1);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
  max-height: 120px;
  overflow-y: auto;
}

.chat-input:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.08);
}

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

.chat-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  border: none;
  color: var(--bg-void);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.4);
}

/* ── Video Panel ── */
.video-recorder-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px;
  gap: 12px;
}

.video-preview-area {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

#video-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 4, 8, 0.8);
}

.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-align: center;
}

.video-placeholder p {
  font-size: 11px;
}

.recording-indicator {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 45, 120, 0.4);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-pink);
  animation: rec-blink 1s ease-in-out infinite;
}

.rec-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--neon-pink);
  letter-spacing: 1px;
}

.rec-timer {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
}

.video-controls {
  display: flex;
  gap: 8px;
}

.vid-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid;
  font-family: var(--font-body);
}

.vid-record {
  background: rgba(255, 45, 120, 0.1);
  border-color: rgba(255, 45, 120, 0.3);
  color: var(--neon-pink);
}
.vid-record:hover:not(:disabled) {
  background: rgba(255, 45, 120, 0.2);
  box-shadow: 0 0 16px rgba(255, 45, 120, 0.2);
}

.vid-stop {
  background: rgba(255, 107, 43, 0.1);
  border-color: rgba(255, 107, 43, 0.3);
  color: var(--neon-orange);
}
.vid-stop:hover:not(:disabled) {
  background: rgba(255, 107, 43, 0.2);
}

.vid-screenshot {
  background: rgba(0, 245, 255, 0.1);
  border-color: rgba(0, 245, 255, 0.3);
  color: var(--neon-cyan);
}
.vid-screenshot:hover:not(:disabled) {
  background: rgba(0, 245, 255, 0.2);
}

.vid-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.video-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vid-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}

.vid-option input[type="checkbox"] {
  accent-color: var(--neon-cyan);
}

.saved-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.saved-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.no-recordings {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
}

.saved-recording-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.saved-recording-item:hover {
  border-color: var(--border-glow);
}

/* ── Insights Panel ── */
.insights-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.insight-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
}

.insight-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  backdrop-filter: blur(10px);
}

.insight-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.insight-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
}

.insight-metric:last-child { border-bottom: none; }

.insight-metric-label { color: var(--text-secondary); }
.insight-metric-value { color: var(--text-primary); font-family: var(--font-mono); }
.insight-metric-value.good { color: var(--neon-green); }
.insight-metric-value.warn { color: var(--neon-yellow); }
.insight-metric-value.bad  { color: var(--neon-pink); }

/* ══════════════════════════════════════
   FAB UPLOAD
══════════════════════════════════════ */
.fab-upload {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  color: var(--bg-void);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 245, 255, 0.4);
  z-index: 200;
  transition: all 0.2s ease;
}

.fab-upload:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(0, 245, 255, 0.6);
}

/* ══════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-deep);
  font-size: 12px;
  color: var(--text-primary);
  pointer-events: all;
  animation: toast-in 0.3s ease;
  max-width: 320px;
}

.toast.success { border-color: rgba(0, 255, 136, 0.3); }
.toast.error   { border-color: rgba(255, 45, 120, 0.3); }
.toast.info    { border-color: rgba(0, 245, 255, 0.3); }
.toast.warning { border-color: rgba(255, 215, 0, 0.3); }

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-text { flex: 1; }

/* ══════════════════════════════════════
   LOADING OVERLAY
══════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(2, 4, 8, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  animation: spinner-rotate 1.5s linear infinite;
}

.spinner-ring:nth-child(1) {
  border-top-color: var(--neon-cyan);
  animation-duration: 1.2s;
}

.spinner-ring:nth-child(2) {
  inset: 10px;
  border-right-color: var(--neon-purple);
  animation-duration: 1.8s;
  animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
  inset: 20px;
  border-bottom-color: var(--neon-green);
  animation-duration: 2.4s;
}

.spinner-core {
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--bg-void);
  font-family: var(--font-display);
}

.loading-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.loading-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ══════════════════════════════════════
   SCROLLBARS
══════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.15);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 245, 255, 0.3);
}

/* ══════════════════════════════════════
   UTILITY
══════════════════════════════════════ */
.hidden { display: none !important; }
.glow-cyan { text-shadow: 0 0 20px var(--neon-cyan); }
.glow-green { text-shadow: 0 0 20px var(--neon-green); }
.glow-purple { text-shadow: 0 0 20px var(--neon-purple); }

/* Typing cursor */
.typing-cursor::after {
  content: '▋';
  animation: cursor-blink 0.8s step-end infinite;
  color: var(--neon-cyan);
}

/* Code highlight in chat */
.code-block-wrapper {
  position: relative;
  margin: 8px 0;
}

.code-block-lang {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

/* Error highlight in editor */
.cm-error-line {
  background: rgba(255, 45, 120, 0.08) !important;
  border-left: 2px solid var(--neon-pink) !important;
}

.cm-fix-line {
  background: rgba(0, 255, 136, 0.06) !important;
  border-left: 2px solid var(--neon-green) !important;
}

/* ── Dynamic File List Items (rendered by app.js) ── */
.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid transparent;
  position: relative;
}

.file-item:hover { background: var(--bg-elevated); border-color: var(--border-subtle); }
.file-item.active { background: rgba(0,245,255,0.08); color: var(--neon-cyan); border-color: rgba(0,245,255,0.2); }

.file-icon { font-size: 14px; flex-shrink: 0; }

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.file-name {
  font-family: var(--font-mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.file-close {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.file-item:hover .file-close { opacity: 1; }
.file-close:hover { background: rgba(255,45,120,0.2); color: var(--neon-pink); }

/* Toast variants */
.toast-success { border-color: rgba(0,255,136,0.3); }
.toast-error   { border-color: rgba(255,45,120,0.3); }
.toast-info    { border-color: rgba(0,245,255,0.3); }
.toast-warning { border-color: rgba(255,215,0,0.3); }

.toast-icon { font-size: 14px; flex-shrink: 0; }
.toast-msg  { flex: 1; font-size: 12px; }

/* Drag active state */
.drop-zone.drag-active::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--neon-cyan);
  border-radius: var(--radius-lg);
  animation: border-dash 1s linear infinite;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .right-panel { display: none; }
  .fab-upload { display: flex; }
  :root { --terminal-h: 180px; }
}

@media (max-width: 600px) {
  .topbar-center { display: none; }
  .nav-btn span { display: none; }
}