:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border: rgba(148, 163, 184, 0.15);
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-secondary: #8b5cf6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100dvh;
  display: flex;
  overflow: hidden;
}

/* ============================================================
   🔒 SCI-FI HOLOGRAPHIC AUTH SCREEN (JARVIS HUD)
   ============================================================ */
:root {
  --cyan: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.35);
  --cyan-subtle: rgba(0, 240, 255, 0.12);
  --neon-blue: #3b82f6;
  --cyber-dark: #030712;
  --cyber-card: rgba(10, 15, 30, 0.88);
}

.auth-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #0a1128 0%, #030712 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  overflow-y: auto;
}

/* Sci-Fi Grid & Scanline Background */
.scifi-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(0, 240, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.scifi-scanline {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.6;
  animation: scanline 4s linear infinite;
  pointer-events: none;
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

.scifi-card {
  max-width: 420px;
  width: 100%;
  background: var(--cyber-card);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.12), inset 0 0 20px rgba(0, 240, 255, 0.05);
  position: relative;
  z-index: 10;
}

/* Hologram Arc Reactor */
.arc-reactor {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.arc-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px dashed var(--cyan);
}

.ring-outer {
  width: 86px; height: 86px;
  border-color: rgba(0, 240, 255, 0.4);
  border-style: dashed;
  animation: spinCw 10s linear infinite;
}

.ring-middle {
  width: 68px; height: 68px;
  border: 2px solid rgba(59, 130, 246, 0.6);
  border-top-color: transparent;
  animation: spinCcw 6s linear infinite;
}

.ring-inner {
  width: 50px; height: 50px;
  border: 2px dotted var(--cyan);
  animation: spinCw 4s linear infinite;
}

.arc-core {
  width: 32px; height: 32px;
  background: radial-gradient(circle, #ffffff 10%, var(--cyan) 60%, transparent 100%);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  animation: pulseCore 2s ease-in-out infinite;
}

@keyframes spinCw { 100% { transform: rotate(360deg); } }
@keyframes spinCcw { 100% { transform: rotate(-360deg); } }
@keyframes pulseCore {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px var(--cyan); }
  50% { transform: scale(1.15); box-shadow: 0 0 35px var(--cyan), 0 0 50px rgba(0,240,255,0.6); }
}

.scifi-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scifi-badge {
  font-size: 0.68rem;
  letter-spacing: 2px;
  color: var(--cyan);
  font-weight: 700;
  text-transform: uppercase;
  background: var(--cyan-subtle);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0, 240, 255, 0.3);
  display: inline-block;
  margin: 0 auto;
}

.scifi-title {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ffffff;
  text-shadow: 0 0 15px var(--cyan-glow);
  margin-top: 4px;
}

.scifi-subtitle {
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  color: #94a3b8;
  font-weight: 600;
}

/* PIN Display Slots */
.pin-display-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 4px 0;
}

.pin-input-hidden {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.pin-dots {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.pin-dot {
  width: 44px;
  height: 48px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.8);
  border: 1.5px solid rgba(0, 240, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--cyan);
  box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.05);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pin-dot.filled {
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 16px var(--cyan-glow), inset 0 0 8px var(--cyan-glow);
  color: #ffffff;
}

.pin-dot.active {
  border-color: #ffffff;
  animation: dotBlink 1s infinite;
}

@keyframes dotBlink { 50% { border-color: var(--cyan); } }

/* Sci-Fi Virtual Keypad (Touch / Android Friendly) */
.scifi-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 300px;
  margin: 6px auto;
}

.key-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 700;
  height: 52px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease-out;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  user-select: none;
}

.key-btn:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
  transform: translateY(-1px);
}

.key-btn:active {
  transform: scale(0.94);
  background: var(--cyan);
  color: #030712;
  box-shadow: 0 0 20px var(--cyan);
}

.key-btn.key-action {
  font-size: 0.9rem;
  letter-spacing: 1px;
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.5);
}

.key-btn.key-action:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}

/* Sci-Fi Auth Action Button */
.scifi-auth-btn {
  width: 100%;
  max-width: 300px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.85), rgba(59, 130, 246, 0.95));
  color: #030712;
  border: 1px solid #ffffff;
  padding: 13px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 0 20px var(--cyan-glow);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.scifi-auth-btn:hover {
  background: linear-gradient(135deg, #ffffff, var(--cyan));
  box-shadow: 0 0 30px var(--cyan);
  transform: translateY(-1px);
}

.scifi-auth-btn:active {
  transform: scale(0.97);
}

.scifi-mode-switch {
  margin-top: 2px;
}

.mode-link {
  background: none;
  border: none;
  color: var(--cyan);
  font-size: 0.78rem;
  cursor: pointer;
  letter-spacing: 1px;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.mode-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.scifi-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  text-align: center;
  letter-spacing: 2px;
  box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.05);
}

.scifi-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.scifi-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  color: #64748b;
  margin-top: 8px;
  text-transform: uppercase;
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulseCore 1.5s infinite;
}

/* ============================================================
   🖥️ APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100dvh;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 290px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 50;
}

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

.brand { display: flex; align-items: center; gap: 12px; }

.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 15px var(--accent-glow);
}

.brand-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.5px; }
.brand-subtitle { font-size: 0.75rem; color: var(--text-muted); }

.nav-tabs {
  display: flex;
  padding: 10px 15px;
  gap: 6px;
  border-bottom: 1px solid var(--border);
}

.nav-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.nav-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.new-chat-btn {
  margin: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: white;
  border: none;
  padding: 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: opacity 0.2s;
}

.new-chat-btn:hover { opacity: 0.92; }

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: all 0.2s;
}

.history-item:hover, .history-item.active { background: var(--bg-card); color: var(--text-main); }
.history-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }

.delete-conv-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; display: none;
}
.history-item:hover .delete-conv-btn { display: block; }
.delete-conv-btn:hover { color: var(--danger); }

.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.device-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc; padding: 4px 8px;
  border-radius: 12px; font-size: 0.75rem; font-weight: 600;
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* Topbar */
.topbar {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.mobile-menu-btn {
  display: none;
  background: none; border: none; color: var(--text-main); font-size: 1.4rem; cursor: pointer;
}

.topbar-title { font-size: 1rem; font-weight: 600; }

.topbar-status {
  display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted);
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* ============================================================
   🎙️ VOICE HUD (Header)
   ============================================================ */
.voice-hud {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: all 0.3s;
}

.voice-hud.active {
  border-color: var(--accent);
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 10px var(--accent-glow);
}

.voice-hud.speaking {
  border-color: var(--success);
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.12);
}

.voice-hud.awaiting {
  border-color: var(--warning);
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
  animation: hudPulse 1.5s infinite;
}

/* ============================================================
   🎙️ VOICE OVERLAY (Full-screen listening indicator)
   ============================================================ */
.voice-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 13, 22, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 40;
  gap: 20px;
  backdrop-filter: blur(8px);
}

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

.orb-center {
  font-size: 40px;
  z-index: 2;
}

.orb-rings {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: orbPulse 2s infinite;
}

.orb-rings::before, .orb-rings::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, 0.3);
  animation: orbPulse 2s 0.3s infinite;
}

.orb-rings::after {
  inset: -24px;
  border-color: rgba(99, 102, 241, 0.15);
  animation-delay: 0.6s;
}

.voice-overlay-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.voice-transcript {
  font-size: 0.9rem;
  color: var(--accent);
  font-style: italic;
  max-width: 400px;
  text-align: center;
  min-height: 1.5em;
}

/* ============================================================
   💬 CHAT MESSAGES
   ============================================================ */
.chat-window {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}

.empty-state {
  margin: auto; text-align: center; max-width: 460px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}

.empty-icon { font-size: 48px; margin-bottom: 6px; }
.empty-state h2 { font-size: 1.4rem; font-weight: 700; }
.empty-state p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; }

.prompt-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }

.prompt-chip {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main);
  padding: 8px 14px; border-radius: 20px; font-size: 0.82rem; cursor: pointer; transition: all 0.2s;
}
.prompt-chip:hover { background: var(--bg-card-hover); border-color: var(--accent); }

.message-row { display: flex; gap: 12px; max-width: 820px; width: 100%; margin: 0 auto; }
.message-row.user { justify-content: flex-end; }

.msg-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--bg-card);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  flex-shrink: 0; border: 1px solid var(--border);
}

.msg-bubble {
  max-width: 85%; padding: 14px 18px; border-radius: var(--radius-lg);
  font-size: 0.95rem; line-height: 1.6; position: relative; word-break: break-word;
}

.message-row.user .msg-bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: white; border-bottom-right-radius: 4px;
}

.message-row.model .msg-bubble {
  background: var(--bg-card); border: 1px solid var(--border);
  border-bottom-left-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.msg-bubble pre { background: #050811; padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; margin: 10px 0; font-size: 0.85rem; }
.msg-bubble code { background: rgba(255, 255, 255, 0.1); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 0.88em; }

.sources-panel {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.sources-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; margin-right: 4px; }
.source-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(99, 102, 241, 0.15); color: #c7d2fe;
  padding: 3px 8px; border-radius: 12px; font-size: 0.72rem;
  text-decoration: none; border: 1px solid rgba(99, 102, 241, 0.3); transition: all 0.2s;
}
.source-badge:hover { background: rgba(99, 102, 241, 0.3); }

/* ============================================================
   📝 INPUT BAR
   ============================================================ */
.input-container {
  padding: 12px 20px calc(14px + var(--safe-bottom));
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--border);
}

.input-box {
  max-width: 820px; margin: 0 auto;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 28px; padding: 6px 12px 6px 18px;
  display: flex; align-items: center; gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-box:focus-within { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }

.chat-input {
  flex: 1; background: transparent; border: none; color: var(--text-main);
  font-size: 0.95rem; outline: none; resize: none; max-height: 120px; font-family: inherit;
}
.chat-input::placeholder { color: var(--text-muted); }

.icon-btn {
  background: transparent; border: none; color: var(--text-muted);
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; font-size: 1.1rem;
}
.icon-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.08); }

.icon-btn.hands-free-active {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: hudPulse 2s infinite;
}

.icon-btn.recording { color: var(--danger); animation: pulse 1.5s infinite; }

.send-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: white; border: none; width: 38px; height: 38px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.send-btn:hover { transform: scale(1.05); }

/* ============================================================
   ⚙️ PANELS, CARDS, FORMS
   ============================================================ */
.view-panel { display: none; flex: 1; padding: 24px; overflow-y: auto; max-width: 820px; margin: 0 auto; width: 100%; }
.view-panel.active { display: flex; flex-direction: column; gap: 20px; }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

.form-group { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-input, .form-textarea, .form-select {
  background: rgba(15, 23, 42, 0.6); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text-main);
  font-family: inherit; font-size: 0.9rem;
}
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--accent); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: white; border: none; padding: 10px 16px; border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer;
}

.sync-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.sync-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.sync-header { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); }
.sync-payload { font-size: 0.9rem; white-space: pre-wrap; word-break: break-all; }
.sync-actions { display: flex; gap: 6px; margin-top: 6px; }
.sync-btn { background: rgba(255,255,255,0.08); border: 1px solid var(--border); color: var(--text-main); font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; cursor: pointer; }

/* ============================================================
   🎨 ANIMATIONS
   ============================================================ */
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes hudPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes orbPulse {
  0% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.2; }
  100% { transform: scale(1); opacity: 0.6; }
}

/* ============================================================
   📱 RESPONSIVE (Mobile iOS / Android)
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { position: absolute; top: 0; bottom: 0; left: 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: block; }
  .voice-hud .voice-status-text { display: none; }
}

/* ============================================================
   📁 FILE SHARING UI
   ============================================================ */
.file-quality-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  margin-left: 8px;
}

/* Drag & Drop Zone */
.drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: rgba(15, 23, 42, 0.4);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 20px var(--accent-glow);
}

.drop-zone-inner { pointer-events: none; }
.drop-zone-icon { font-size: 42px; margin-bottom: 10px; }
.drop-zone-text { font-size: 1rem; font-weight: 600; color: var(--text-main); }
.drop-zone-subtext { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }

.drop-zone-active-overlay {
  position: absolute;
  inset: 0;
  background: rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  backdrop-filter: blur(4px);
  z-index: 5;
}

/* Upload Progress */
.upload-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  width: 0%;
  transition: width 0.3s;
  border-radius: 3px;
}

.upload-progress-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

/* File Gallery */
.file-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  min-height: 60px;
}

.file-gallery.list-view {
  grid-template-columns: 1fr;
}

.file-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s;
  cursor: default;
}

.file-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transform: translateY(-2px);
}

.file-card-preview {
  width: 100%;
  height: 130px;
  background: rgba(9, 13, 22, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.file-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-card-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-type-icon {
  font-size: 36px;
  opacity: 0.7;
}

.file-card-info {
  padding: 10px 12px;
}

.file-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.file-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.file-card-device {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.file-card-actions {
  display: flex;
  gap: 4px;
  padding: 6px 12px 10px;
}

.file-action-btn {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 0;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.file-action-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
}

.file-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
  color: #fca5a5;
}

/* List view file card */
.file-gallery.list-view .file-card {
  display: flex;
  align-items: center;
}

.file-gallery.list-view .file-card-preview {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 0;
}

.file-gallery.list-view .file-type-icon {
  font-size: 22px;
}

.file-gallery.list-view .file-card-info {
  flex: 1;
  padding: 8px 12px;
}

.file-gallery.list-view .file-card-actions {
  padding: 8px 12px;
  flex-direction: column;
  gap: 4px;
}

.file-view-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-view-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--accent);
}

/* File Preview Modal */
.file-preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(10px);
}

.file-preview-modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

.file-preview-modal img, .file-preview-modal video, .file-preview-modal audio {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.file-preview-modal-info {
  margin-top: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.file-preview-modal-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

/* ============================================================
   🎙️ ARC REACTOR VOICE CORE & WAVEFORM (HOLOGRAPHIC HUD)
   ============================================================ */
.arc-reactor.arc-large {
  width: 140px;
  height: 140px;
  margin: 10px auto 16px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.arc-reactor.arc-large:hover {
  transform: scale(1.06);
}

.arc-reactor.arc-large:active {
  transform: scale(0.96);
}

.arc-reactor.arc-large .ring-outer {
  width: 136px;
  height: 136px;
  border-width: 3px;
  box-shadow: 0 0 25px var(--cyan-glow);
}

.arc-reactor.arc-large .ring-middle {
  width: 106px;
  height: 106px;
  border-width: 3px;
}

.arc-reactor.arc-large .ring-inner {
  width: 76px;
  height: 76px;
  border-width: 2.5px;
}

.arc-reactor.arc-large .arc-core {
  width: 48px;
  height: 48px;
  font-size: 24px;
}

/* Listening Mode Glowing State */
.arc-reactor.listening .ring-outer {
  border-color: #ffffff;
  animation: spinCw 3s linear infinite;
  box-shadow: 0 0 40px var(--cyan);
}

.arc-reactor.listening .ring-middle {
  border-color: var(--cyan);
  animation: spinCcw 2s linear infinite;
}

.arc-reactor.listening .arc-core {
  background: radial-gradient(circle, #ffffff 30%, var(--cyan) 80%, transparent 100%);
  animation: pulseCore 0.8s ease-in-out infinite;
  box-shadow: 0 0 40px var(--cyan), 0 0 60px rgba(0,240,255,0.8);
}

/* Voice Waveform Visualizer */
.voice-wave-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  margin-bottom: 8px;
}

.voice-bar {
  width: 4px;
  height: 12px;
  background: var(--cyan);
  border-radius: 4px;
  box-shadow: 0 0 8px var(--cyan);
  animation: soundWave 1.2s ease-in-out infinite;
}

.voice-bar:nth-child(2) { animation-delay: 0.2s; height: 24px; }
.voice-bar:nth-child(3) { animation-delay: 0.4s; height: 32px; }
.voice-bar:nth-child(4) { animation-delay: 0.1s; height: 20px; }
.voice-bar:nth-child(5) { animation-delay: 0.3s; height: 16px; }
.voice-bar:nth-child(6) { animation-delay: 0.5s; height: 28px; }
.voice-bar:nth-child(7) { animation-delay: 0.25s; height: 18px; }
.voice-bar:nth-child(8) { animation-delay: 0.45s; height: 26px; }

@keyframes soundWave {
  0%, 100% { transform: scaleY(0.4); opacity: 0.6; }
  50% { transform: scaleY(1.3); opacity: 1; box-shadow: 0 0 16px var(--cyan); }
}

/* ============================================================
   🔒 AES-256 ENCRYPTED VOICE BADGE
   ============================================================ */
.voice-cipher-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 5px 14px;
  border-radius: 20px;
  margin: 6px 0 8px;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
  text-transform: uppercase;
}

.cipher-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: pulseCore 1.5s infinite;
}

/* ============================================================
   🚀 HOLOGRAPHIC HUD TELEMETRY & FUTURISTIC UPGRADES
   ============================================================ */
.hud-telemetry-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 8px 0 14px;
}

.hud-pill {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.7rem;
  letter-spacing: 1.2px;
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.08);
  backdrop-filter: blur(8px);
}

.hud-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.hud-pill-dot.green { background: #10b981; box-shadow: 0 0 8px #10b981; }
.hud-pill-dot.cyan  { background: #00f0ff; box-shadow: 0 0 8px #00f0ff; }
.hud-pill-dot.gold  { background: #fbbf24; box-shadow: 0 0 8px #fbbf24; }
.hud-pill-dot.blue  { background: #60a5fa; box-shadow: 0 0 8px #60a5fa; }

/* Enhanced 4th Planetary Ring for Arc Reactor */
.arc-reactor.arc-large .ring-planetary {
  position: absolute;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  border: 1px dotted rgba(0, 240, 255, 0.28);
  animation: spinCcw 18s linear infinite;
}

.arc-reactor.listening .ring-planetary {
  border-color: rgba(0, 240, 255, 0.6);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.25);
}

/* Cybernetic Message Bubbles */
.message-row.model .msg-bubble {
  border-left: 3px solid var(--cyan);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(6, 12, 28, 0.95));
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.08);
}

.message-row.user .msg-bubble {
  border-right: 3px solid #60a5fa;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
}

/* Futuristic Omnibar Glow */
.input-box {
  border-color: rgba(0, 240, 255, 0.25);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.06);
}
.input-box:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.25);
}
