/* ============================================================
   HERMES MULTIAGENT HQ - 3D Virtual Command Center CSS
   Theme: Cyberpunk Dark Studio / Glassmorphism / Responsive
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-navy: #070B14;
  --panel-slate: #0F172A;
  --card-slate: #152033;
  --border-slate: #1E293B;
  --border-glow: rgba(59, 130, 246, 0.25);
  --accent-blue: #3B82F6;
  --accent-cyan: #06B6D4;
  --accent-green: #10B981;
  --accent-amber: #F59E0B;
  --accent-purple: #A855F7;
  --floor-teal: #0D262C;
  --header-h: 46px;
  --footer-h: 36px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-navy);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #F8FAFC;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  -webkit-user-select: none;
  user-select: none;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #070B14; }
::-webkit-scrollbar-thumb { background: #1E293B; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #334155; }

/* ============================================================
   APP ROOT LAYOUT
   ============================================================ */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* ============================================================
   1. TOP HEADER / NAVBAR
   ============================================================ */
#topHeader {
  height: var(--header-h);
  min-height: var(--header-h);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 50;
  gap: 10px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-svg-icon {
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
  animation: pulseDot 3s infinite ease-in-out;
}

.brand-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent-blue);
  box-shadow: 0 0 10px var(--accent-blue);
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.6; }
}

.brand-name {
  font-family: 'Fira Code', monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: #F8FAFC;
  white-space: nowrap;
}

.header-sep { color: #334155; font-size: 14px; }

.header-select {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #E2E8F0;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}
.header-select:hover { border-color: var(--accent-blue); }

.header-chips {
  display: none;
  align-items: center;
  gap: 8px;
}

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

.btn-header-action {
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #E2E8F0;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-header-action:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #38BDF8;
  color: #FFF;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.chip {
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.chip-default { background: rgba(30, 41, 59, 0.6); color: #94A3B8; }
.chip-live {
  background: rgba(6, 78, 59, 0.7);
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
  font-weight: 700;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 6px #34D399;
  animation: pulseDot 1.5s infinite;
}
.mobile-live { display: flex; }

/* ============================================================
   2. MAIN WORKSPACE (Desktop: 3 Column, Mobile: Full Canvas)
   ============================================================ */
#mainWorkspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

/* SIDE PANELS (Desktop only) */
.side-panel {
  display: none;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
}

.left-panel { border-right: 1px solid rgba(255, 255, 255, 0.07); width: 300px; }
.right-panel { border-left: 1px solid rgba(255, 255, 255, 0.07); width: 360px; }

.panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
  flex-shrink: 0;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.panel-badge {
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 7px;
  border-radius: 4px;
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tab-group { display: flex; gap: 6px; }
.tab-btn {
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748B;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn.active {
  background: rgba(30, 41, 59, 0.9);
  color: var(--accent-blue);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.btn-clear {
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  color: #94A3B8;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-clear:hover { color: #FFF; border-color: #475569; }

/* ============================================================
   3. CENTER CANVAS (Three.js 3D Viewport)
   ============================================================ */
#centerCanvas {
  flex: 1;
  position: relative;
  background: var(--bg-navy);
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

#threeCanvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#bubbleContainer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
}

.canvas-label {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  color: #64748B;
  letter-spacing: 1px;
  pointer-events: none;
}

/* ============================================================
   4. FLOATING GLASSMORPHISM MOBILE DOCK (Modern Bottom Bar)
   ============================================================ */
.mobile-dock {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 20px rgba(59, 130, 246, 0.15);
  border-radius: 9999px;
  padding: 6px 10px;
  z-index: 45;
  align-items: center;
  gap: 6px;
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 18px;
  border-radius: 9999px;
  background: transparent;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.dock-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
}

.dock-svg {
  stroke: #94A3B8;
  transition: all 0.25s ease;
}

.dock-btn.active .dock-svg {
  stroke: #38BDF8;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.7));
}

.dock-indicator {
  position: absolute;
  bottom: -4px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent-blue);
  box-shadow: 0 0 8px var(--accent-blue);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  transform: scale(0.5);
}

.dock-label {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  font-weight: 600;
  margin-top: 3px;
  letter-spacing: 0.5px;
}

.dock-btn.active {
  color: #FFF;
  background: rgba(59, 130, 246, 0.22);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.25);
}
.dock-btn.active .dock-indicator {
  opacity: 1;
  transform: scale(1);
}

/* ============================================================
   5. MOBILE SLIDE-UP GLASS DRAWERS
   ============================================================ */
.mobile-drawer {
  position: fixed;
  top: auto;
  bottom: 0;
  left: 0; right: 0;
  height: 72vh;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.8);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
  padding-bottom: 80px; /* Space for floating dock */
}
.mobile-drawer.open {
  transform: translateY(0);
}

.drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-indicator {
  width: 32px; height: 4px;
  border-radius: 9999px;
  background: #334155;
  display: block;
}

.drawer-close {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #CBD5E1;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.drawer-close:hover { background: #334155; color: #FFF; }

/* ============================================================
   6. BOTTOM FOOTER TOOLBAR (Desktop)
   ============================================================ */
#bottomBar {
  height: var(--footer-h);
  min-height: var(--footer-h);
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 50;
  gap: 10px;
}

.footer-left, .footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-sm {
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  padding: 3px 9px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #CBD5E1;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-sm:hover { background: #334155; color: #FFF; }

.speed-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  color: #64748B;
}
.speed-ctrl input[type="range"] {
  width: 60px;
  height: 3px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}
.val-blue { color: var(--accent-blue); font-weight: 600; }

.telemetry {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  color: #34D399;
}
.dot-green {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px #10B981;
}

.clock {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #E2E8F0;
}

/* ============================================================
   7. TRACK CARDS & ACTIVITY FEED CARDS
   ============================================================ */
.track-card {
  background: rgba(21, 32, 51, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.track-card:hover {
  border-color: var(--accent-blue);
  background: rgba(30, 41, 59, 0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.12);
}

.track-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.track-meta { min-width: 0; }
.track-name {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #F1F5F9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-script {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  color: #64748B;
  margin-top: 2px;
}

.badge-tag {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.track-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.feed-card {
  background: rgba(21, 32, 51, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--accent-blue);
  border-radius: 6px;
  padding: 10px 12px;
  animation: fadeIn 0.25s ease-out;
}
.feed-card.incident_report { border-left-color: var(--accent-purple); }
.feed-card.solution_suggestion { border-left-color: var(--accent-green); }
.feed-card.script_notice { border-left-color: var(--accent-amber); }

/* Status badge variants */
.status-working {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
  animation: pulseWorking 1.5s infinite;
}
@keyframes pulseWorking {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-clear {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.status-scheduled {
  background: rgba(6, 182, 212, 0.15);
  color: #22D3EE;
  border: 1px solid rgba(6, 182, 212, 0.4);
}
.status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.feed-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.feed-title {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #E2E8F0;
}
.feed-time {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  color: #64748B;
}
.feed-body {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #94A3B8;
  line-height: 1.55;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   8. SPEECH BUBBLES (HUD Style 3D -> 2D Projected)
   ============================================================ */
.speech-bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(59, 130, 246, 0.6);
  color: #F8FAFC;
  padding: 6px 12px;
  border-radius: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  line-height: 1.45;
  max-width: 250px;
  min-width: 80px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7), 0 0 12px rgba(59, 130, 246, 0.25);
  pointer-events: none;
  transition: opacity 0.15s, border-color 0.2s;
  z-index: 35;
  text-align: left;
}
.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(15, 23, 42, 0.94);
}
.speech-bubble .role-tag {
  color: #60A5FA;
  font-weight: 700;
  margin-right: 5px;
  display: inline-block;
}
.speech-bubble.working {
  border-color: #10B981;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7), 0 0 16px rgba(16, 185, 129, 0.45);
}
.speech-bubble.working .role-tag { color: #34D399; }

/* Fullscreen Command Deck Mode (Landscape & Desktop) */
#app.mode-fullscreen .side-panel {
  display: none !important;
}
#app.mode-fullscreen #centerCanvas {
  flex: 1 !important;
  width: 100vw !important;
}
#app.mode-fullscreen .mobile-dock {
  display: flex !important;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 56px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-msg {
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(16, 185, 129, 0.3);
  color: #F8FAFC;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInToast 0.3s ease-out;
}
@keyframes slideInToast {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   RESPONSIVE BREAKPOINTS (Mobile & Tablet vs Desktop)
   ============================================================ */

/* Mobile & Tablet Portrait (< 1024px) */
@media (max-width: 1023px) {
  .header-chips { display: none !important; }
  .mobile-live { display: flex !important; }
  .side-panel { display: none !important; }
  #bottomBar { display: none !important; }

  #centerCanvas {
    flex: 1;
    width: 100vw;
    height: calc(100dvh - var(--header-h));
    min-height: 50vh;
  }

  .mobile-dock { display: flex; }

  .speech-bubble {
    font-size: 9px;
    padding: 3px 8px;
  }
}

/* Desktop & Wide Screens (>= 1024px) */
@media (min-width: 1024px) {
  .mobile-live { display: none !important; }
  .header-chips { display: flex !important; }
  .side-panel { display: flex !important; }
  #bottomBar { display: flex !important; }
  .mobile-dock { display: none !important; }
  .mobile-drawer { display: none !important; }
}

@media (min-width: 1440px) {
  .left-panel { width: 330px; }
  .right-panel { width: 420px; }
}

@media (max-width: 480px) {
  .brand-name { font-size: 11px; }
  .header-select { max-width: 130px; font-size: 9px; }
  .canvas-label { display: none; }
}
