/* ============================================================
   LUMI — style.css
   Futuristic AI OS Design System
   Dark mode, glassmorphism, neon accents, HUD aesthetic
   ============================================================ */

/* ── Fonts ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design Tokens ──────────────────────────────────────── */
:root {
  --bg-void: #020408;
  --bg-surface: rgba(8, 15, 30, 0.85);
  --bg-panel: rgba(10, 18, 38, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-hover: rgba(0, 212, 255, 0.06);

  --neon-cyan: #00d4ff;
  --neon-purple: #a855f7;
  --neon-green: #22c55e;
  --neon-amber: #f59e0b;
  --neon-pink: #f472b6;
  --neon-blue: #3b82f6;

  --text-primary: #e2eaf8;
  --text-secondary: rgba(180, 200, 240, 0.7);
  --text-muted: rgba(140, 160, 210, 0.45);
  --text-accent: var(--neon-cyan);

  --border-dim: rgba(0, 212, 255, 0.08);
  --border-glow: rgba(0, 212, 255, 0.25);
  --border-active: rgba(0, 212, 255, 0.5);

  --shadow-glow: 0 0 30px rgba(0, 212, 255, 0.15), 0 0 60px rgba(168, 85, 247, 0.08);
  --shadow-panel: 0 8px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.04);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --sidebar-w: 220px;
  --right-panel-w: 300px;
  --header-h: 58px;

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

  --transition-fast: 0.15s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-void);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  line-height: 1.6;
  transition: filter 0.8s ease, opacity 0.8s ease;
}

body.focus-saving-mode {
  filter: brightness(0.25) blur(2px);
}

body.lumi-ready .app-shell {
  opacity: 1;
  transform: translateY(0);
}

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

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

/* ── App Shell ──────────────────────────────────────────── */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-columns: var(--sidebar-w) 1fr var(--right-panel-w);
  height: 100vh;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* ── Header ─────────────────────────────────────────────── */
.app-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-dim);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 rgba(0, 212, 255, 0.06);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: white;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
  animation: logo-pulse 4s ease-in-out infinite;
}

@keyframes logo-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.4); }
  50% { box-shadow: 0 0 35px rgba(168, 85, 247, 0.6); }
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
  animation: blink-dot 2s ease-in-out infinite;
}

@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.header-time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 56px;
  text-align: right;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-dim);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  padding: 12px 0;
}

.sidebar-section {
  padding: 8px 12px 4px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  transition: all var(--transition-fast);
  user-select: none;
  position: relative;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-left-color: rgba(0, 212, 255, 0.3);
}

.nav-item.active {
  color: var(--neon-cyan);
  background: rgba(0, 212, 255, 0.06);
  border-left-color: var(--neon-cyan);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
}

.nav-icon { width: 18px; font-size: 1rem; flex-shrink: 0; }

.sidebar-bottom {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border-dim);
}

/* Chat history */
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.history-item:hover { background: var(--bg-hover); }

.history-icon { color: var(--text-muted); font-size: 0.7rem; }

.history-info { display: flex; flex-direction: column; overflow: hidden; }

.history-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Main Area ───────────────────────────────────────────── */
.main-area {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── View Panels ─────────────────────────────────────────── */
.view-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.view-panel.active { display: flex; }

/* ── Chat View ───────────────────────────────────────────── */
#view-chat {
  background: transparent;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-dim);
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.chat-header-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.chat-header-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.chat-header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  border-color: var(--border-glow);
  color: var(--neon-cyan);
  background: var(--bg-hover);
}

/* ── Chat Messages ───────────────────────────────────────── */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar { width: 4px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.2);
  border-radius: 2px;
}

/* Message bubbles */
.message-wrapper {
  display: flex;
  gap: 12px;
  max-width: 100%;
  animation: msg-appear 0.3s var(--transition-smooth);
}

@keyframes msg-appear {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-wrapper.user { flex-direction: row-reverse; }

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

.avatar-user {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.avatar-lumi {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(0, 212, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

.lumi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  animation: lumi-pulse 2s ease-in-out infinite;
}

@keyframes lumi-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.75); opacity: 0.6; }
}

.message-body { display: flex; flex-direction: column; gap: 4px; max-width: 75%; }

.message-wrapper.user .message-body { align-items: flex-end; }

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}

.message-sender { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }
.message-time { font-size: 0.65rem; color: var(--text-muted); font-family: var(--font-mono); }

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.65;
  position: relative;
}

.message-wrapper.user .message-bubble {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(29, 78, 216, 0.15));
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-bottom-right-radius: 4px;
}

.message-wrapper.assistant .message-bubble {
  background: var(--bg-glass);
  border: 1px solid var(--border-dim);
  border-bottom-left-radius: 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.message-bubble.streaming::after {
  content: "▊";
  color: var(--neon-cyan);
  animation: cursor-blink 0.6s ease-in-out infinite;
  margin-left: 2px;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* AI Content Formatting */
.ai-content h2, .ai-content h3, .ai-content h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 10px 0 6px;
  color: var(--text-primary);
}

.ai-content p { margin: 6px 0; }
.ai-content strong { color: var(--neon-cyan); font-weight: 600; }
.ai-content em { color: var(--text-secondary); font-style: italic; }
.ai-content ul { padding-left: 18px; }
.ai-content li { margin: 3px 0; }

.inline-code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--neon-cyan);
}

.code-block {
  margin: 10px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-dim);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(0, 212, 255, 0.05);
  border-bottom: 1px solid var(--border-dim);
}

.code-lang {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--neon-cyan);
  letter-spacing: 0.05em;
}

.copy-btn {
  font-size: 0.7rem;
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-mono);
}

.copy-btn:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.code-block pre {
  background: rgba(0, 0, 0, 0.4);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: #e2e8f0;
}

/* Message actions */
.message-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.message-wrapper:hover .message-actions { opacity: 1; }

.message-actions button {
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.message-actions button:hover {
  border-color: var(--border-glow);
  color: var(--neon-cyan);
}

/* ── Typing Indicator ─────────────────────────────────────── */
#typing-indicator {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 20px 8px;
}

#typing-indicator.active { display: flex; }

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan);
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

.typing-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Interim Speech Text ──────────────────────────────────── */
#interim-text {
  padding: 6px 16px;
  font-size: 0.8rem;
  color: var(--neon-green);
  font-family: var(--font-mono);
  font-style: italic;
  opacity: 0;
  transition: opacity 0.2s;
  min-height: 24px;
}

/* ── Chat Input Area ──────────────────────────────────────── */
.chat-input-area {
  padding: 12px 16px 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-dim);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.quick-actions-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.quick-action {
  font-size: 0.72rem;
  padding: 4px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-dim);
  color: var(--text-secondary);
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.quick-action:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  background: rgba(0, 212, 255, 0.08);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.1);
}

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

.input-wrapper {
  flex: 1;
  position: relative;
}

#chat-input {
  width: 100%;
  min-height: 44px;
  max-height: 140px;
  padding: 11px 46px 11px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  resize: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  line-height: 1.5;
  outline: none;
}

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

#chat-input:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.08), 0 0 20px rgba(0, 212, 255, 0.05);
}

.char-counter {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 0.62rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  pointer-events: none;
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.25);
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
}

.send-btn:active { transform: scale(0.97); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.mic-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  color: var(--text-secondary);
}

.mic-btn:hover {
  border-color: var(--neon-green);
  color: var(--neon-green);
  background: rgba(34, 197, 94, 0.08);
}

.mic-btn.listening {
  border-color: var(--neon-green);
  color: var(--neon-green);
  background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
  animation: mic-pulse 1s ease-in-out infinite;
}

.mic-btn.speaking {
  border-color: var(--neon-purple);
  color: var(--neon-purple);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 35px rgba(34, 197, 94, 0.5); }
}

/* ── Voice Waveform ───────────────────────────────────────── */
.voice-waveform-wrapper {
  padding: 4px 0;
  height: 36px;
}

#voice-waveform {
  width: 100%;
  height: 36px;
  border-radius: 4px;
}

/* ── Right Panel ─────────────────────────────────────────── */
.right-panel {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-dim);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow-y: auto;
  overflow-x: hidden;
}

.right-panel::-webkit-scrollbar { width: 3px; }
.right-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.15);
  border-radius: 2px;
}

/* ── AI Orb ──────────────────────────────────────────────── */
.orb-section {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-dim);
}

.orb-wrapper {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#orb-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.orb-particle {
  position: absolute;
  border-radius: 50%;
  background: var(--neon-cyan);
  transform: translate(-50%, -50%);
  animation: particle-orbit linear infinite;
  box-shadow: 0 0 4px currentColor;
}

@keyframes particle-orbit {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
  20% { opacity: 1; }
  80% { opacity: 0.6; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(360deg); }
}

#ai-orb {
  --orb-glow: #00d4ff;
  --orb-glow-size: 20px;
  --orb-scale: 1;
  --orb-pulse-speed: 2000ms;

  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,
    rgba(0, 212, 255, 0.25) 0%,
    rgba(168, 85, 247, 0.15) 40%,
    rgba(0, 0, 0, 0.4) 100%);
  border: 1.5px solid rgba(0, 212, 255, 0.35);
  box-shadow:
    0 0 var(--orb-glow-size) var(--orb-glow),
    inset 0 0 30px rgba(0, 212, 255, 0.05);
  cursor: pointer;
  transform: scale(var(--orb-scale));
  transition: transform 0.5s var(--transition-spring),
              box-shadow 0.4s ease,
              border-color 0.4s ease;
  animation: orb-breathe var(--orb-pulse-speed) ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 1;
}

@keyframes orb-breathe {
  0%, 100% { transform: scale(var(--orb-scale)); }
  50% { transform: scale(calc(var(--orb-scale) * 1.04)); }
}

.orb-eyes {
  display: flex;
  gap: 14px;
  position: relative;
  top: -4px;
}

.orb-eye {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  transition: all 0.15s ease;
}

.orb-eye.blink { transform: scaleY(0.1); }

.orb-mouth {
  width: 22px;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 6px rgba(0, 212, 255, 0.4);
  position: relative;
  top: -2px;
}

#ai-orb[data-state="speaking"] .orb-mouth {
  animation: mouth-talk 0.2s ease-in-out infinite alternate;
}

@keyframes mouth-talk {
  from { transform: scaleY(1); }
  to { transform: scaleY(2.5); }
}

#orb-status {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.05em;
}

/* ── Webcam Panel ────────────────────────────────────────── */
.webcam-section {
  padding: 14px;
  border-bottom: 1px solid var(--border-dim);
}

.panel-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-label::before {
  content: "◈";
  color: var(--neon-cyan);
  font-size: 0.5rem;
}

.webcam-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border-dim);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1), inset 0 0 40px rgba(0,0,0,0.5);
}

.webcam-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg,
    rgba(0, 212, 255, 0.05) 0%,
    transparent 60%,
    rgba(168, 85, 247, 0.03) 100%);
  z-index: 1;
  pointer-events: none;
}

/* HUD corner brackets */
.webcam-frame::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: calc(var(--radius-lg) - 4px);
  z-index: 2;
  pointer-events: none;
  background: transparent;
}

#webcam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror */
  border-radius: var(--radius-lg);
}

#gesture-canvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  transform: scaleX(-1);
}

.cam-hud {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cam-hud-line {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: rgba(0, 212, 255, 0.7);
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 5px;
  border-radius: 3px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}

.cam-start-btn {
  padding: 8px 18px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(168, 85, 247, 0.1));
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: var(--neon-cyan);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.cam-start-btn:hover {
  background: rgba(0, 212, 255, 0.15);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

/* Status rows */
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.cam-status, .presence-status, .voice-status {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-dim);
}

.cam-status.online { color: var(--neon-green); border-color: rgba(34, 197, 94, 0.2); }
.presence-status.present { color: var(--neon-cyan); border-color: rgba(0, 212, 255, 0.2); }
.presence-status.away { color: var(--text-muted); }

#motion-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-purple);
  box-shadow: 0 0 6px var(--neon-purple);
  transition: opacity 0.3s;
}

/* ── Gesture Section ─────────────────────────────────────── */
.gesture-section {
  padding: 14px;
  border-bottom: 1px solid var(--border-dim);
}

#gesture-label {
  display: inline-block;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  padding: 6px 12px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-md);
  color: var(--neon-purple);
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}

#gesture-label.visible {
  opacity: 1;
  transform: translateY(0);
}

#gesture-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gesture-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-glass);
  animation: msg-appear 0.2s ease;
}

.gesture-time {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
}

/* ── Voice Status Section ────────────────────────────────── */
.voice-section {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-status {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-status.listening { color: var(--neon-green); }
.voice-status.speaking { color: var(--neon-purple); }
.voice-status.idle { color: var(--text-muted); }

/* ── Focus Saving Notification ───────────────────────────── */
#focus-saving-notif {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 9999;
  background: rgba(2, 4, 8, 0.92);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: var(--radius-xl);
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s ease;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 0 80px rgba(0, 212, 255, 0.15), 0 0 40px rgba(0,0,0,0.8);
}

#focus-saving-notif.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.focus-notif-icon {
  font-size: 2.5rem;
  animation: float-icon 3s ease-in-out infinite;
}

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

.focus-notif-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.focus-notif-text strong {
  color: var(--neon-cyan);
  font-family: var(--font-display);
  font-size: 1rem;
  display: block;
  margin-bottom: 4px;
}

/* ── Coding View ─────────────────────────────────────────── */
#view-coding {
  display: none;
  flex-direction: row;
  height: 100%;
}

#view-coding.active { display: flex; }

.code-sidebar {
  width: 180px;
  background: rgba(0,0,0,0.3);
  border-right: 1px solid var(--border-dim);
  padding: 12px 0;
  flex-shrink: 0;
  overflow-y: auto;
}

.file-explorer-title {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 4px 12px 10px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-mono);
}

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

.file-item.active { color: var(--neon-cyan); }

.code-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.code-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--border-dim);
  flex-wrap: wrap;
}

.lang-tabs { display: flex; gap: 4px; }

.lang-tab {
  padding: 4px 12px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-tab:hover, .lang-tab.active {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  background: rgba(0, 212, 255, 0.06);
}

.code-action-btn {
  padding: 4px 12px;
  font-size: 0.72rem;
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition-fast);
}

.code-action-btn:hover {
  border-color: var(--neon-purple);
  color: var(--neon-purple);
  background: rgba(168, 85, 247, 0.06);
}

.run-btn {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.08));
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--neon-green);
  font-weight: 600;
  padding: 4px 16px;
}

.run-btn:hover {
  border-color: var(--neon-green);
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}

.code-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.code-editor-area {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: rgba(0, 0, 0, 0.35);
}

.code-editor-area::-webkit-scrollbar { width: 4px; }
.code-editor-area::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.15);
  border-radius: 2px;
}

#code-editor {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.75;
  color: #abb2bf;
  white-space: pre;
  outline: none;
  min-height: 200px;
  caret-color: var(--neon-cyan);
}

.terminal-panel {
  height: 160px;
  background: rgba(0, 0, 0, 0.6);
  border-top: 1px solid var(--border-dim);
  overflow: auto;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-dim);
}

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.term-clear-btn {
  font-size: 0.65rem;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-muted);
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all var(--transition-fast);
}

.term-clear-btn:hover {
  border-color: var(--neon-amber);
  color: var(--neon-amber);
}

#terminal-output {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

.term-line { display: block; }
.term-prompt { color: var(--neon-cyan); margin-right: 8px; }
.term-success { color: var(--neon-green); }
.term-error { color: #f87171; }
.term-dim { color: var(--text-muted); }

/* ── Toast Notifications ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: rgba(10, 18, 38, 0.95);
  border: 1px solid var(--border-dim);
  font-size: 0.82rem;
  color: var(--text-secondary);
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  max-width: 320px;
  box-shadow: var(--shadow-panel);
}

.toast.visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-success { border-color: rgba(34, 197, 94, 0.3); }
.toast-info { border-color: rgba(0, 212, 255, 0.3); }
.toast-warning { border-color: rgba(245, 158, 11, 0.3); }
.toast-error { border-color: rgba(248, 113, 113, 0.3); }

.toast-icon { font-size: 0.9rem; }
.toast-success .toast-icon { color: var(--neon-green); }
.toast-info .toast-icon { color: var(--neon-cyan); }
.toast-warning .toast-icon { color: var(--neon-amber); }
.toast-error .toast-icon { color: #f87171; }

/* ── Scrollbar Utility ───────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.15); border-radius: 2px; }

/* ── Cam error state ──────────────────────────────────────── */
.cam-error {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Responsive Adjustments ──────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --right-panel-w: 260px;
    --sidebar-w: 190px;
  }
}

@media (max-width: 800px) {
  .app-shell {
    grid-template-columns: 50px 1fr;
    grid-template-rows: var(--header-h) 1fr;
  }
  .right-panel { display: none; }
  .nav-item span:not(.nav-icon) { display: none; }
  .sidebar-section { display: none; }
  :root { --sidebar-w: 50px; }
}

/* ── Launcher / Shortcuts ───────────────────────────────── */
.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 0 6px;
}

.shortcut-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dim);
  background: var(--bg-glass);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  font-size: 0.75rem;
  color: var(--text-secondary);
  user-select: none;
}

.shortcut-chip:hover {
  background: var(--bg-hover);
  border-color: var(--border-glow);
  color: var(--text-primary);
  transform: translateX(2px);
}

.shortcut-icon {
  font-size: 0.85rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

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

.shortcut-remove {
  opacity: 0;
  background: none;
  border: none;
  color: rgba(248, 113, 113, 0.7);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 2px;
  line-height: 1;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.shortcut-chip:hover .shortcut-remove {
  opacity: 1;
}

.shortcut-add-btn {
  width: 100%;
  margin-top: 4px;
  padding: 6px;
  background: none;
  border: 1px dashed var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
}

.shortcut-add-btn:hover {
  border-color: var(--border-glow);
  color: var(--neon-cyan);
  background: var(--bg-hover);
}

.sidebar-tip {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 2px 8px;
  letter-spacing: 0.02em;
  line-height: 1.8;
  opacity: 0.75;
}

.sidebar-tip::before {
  content: "›";
  margin-right: 5px;
  color: var(--neon-cyan);
  opacity: 0.5;
}

/* Add shortcut modal */
.shortcut-modal {
  position: absolute;
  left: calc(var(--sidebar-w) + 8px);
  top: auto;
  z-index: 200;
  width: 260px;
}

.shortcut-modal-inner {
  background: rgba(10, 18, 38, 0.97);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 20px rgba(0, 212, 255, 0.1);
  backdrop-filter: blur(20px);
}

.sc-input {
  width: 100%;
  background: rgba(0, 212, 255, 0.04);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 8px 10px;
  outline: none;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

.sc-input:focus {
  border-color: var(--border-active);
  background: rgba(0, 212, 255, 0.07);
}

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