/* ──────────────────────────────────────────────
   TriSense Enterprise OS — Design System
   Cyber-industrial glassmorphism
   ────────────────────────────────────────────── */

:root {
  --bg-dark: hsl(230, 35%, 3%);
  --panel-bg: hsla(230, 25%, 6%, 0.85);
  --panel-border: hsla(190, 80%, 50%, 0.2);
  --glass-glow: hsla(190, 80%, 50%, 0.03);
  
  --accent-cyan: #00d2ff;
  --accent-azure: #0088ff;
  --accent-purple: #9d00ff;
  --accent-green: #00ffa2;
  --accent-amber: #ffcc00;
  
  --text-main: hsl(210, 30%, 98%);
  --text-muted: hsl(210, 15%, 70%);
  --font-header: 'Space Grotesk', sans-serif;
  --font-ui: 'Inter', sans-serif;
  --font-mono: 'Fira Code', monospace;
  --box-shadow: 0 12px 48px 0 rgba(0, 0, 0, 0.9);
  --base-blur: 50px;
}

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

body.enterprise-body {
  font-family: var(--font-ui);
  background: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  margin: 0;
  overflow: hidden;
  position: relative;
  line-height: 1.5;
}

/* Typography Lockdown */
h1, h2, h3, .brand-text, .nav-section, .tab-btn { font-family: var(--font-header); font-weight: 700; letter-spacing: -0.02em; }

/* Base Canvas for 3D Background */
.bg-canvas {
  position: fixed;
  top: 0; left: 0; 
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.15;
}

/* Layout Overhaul v6.1 */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  grid-template-rows: 1fr 35px;
  width: 100%;
  height: 100%;
  padding: 20px;
  gap: 20px;
  position: absolute;
  top: 0; left: 0;
  z-index: 1;
}

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(var(--base-blur));
  -webkit-backdrop-filter: blur(var(--base-blur));
  border: 1px solid var(--panel-border);
  box-shadow: var(--box-shadow);
  border-radius: 20px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Status Synchronizer */
.sync-badge {
  font-size: 0.6rem;
  font-weight: 800;
  background: var(--accent-green);
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  box-shadow: 0 0 10px hsla(160, 100%, 50%, 0.3);
}

.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }

/* Sidebar Refinements */
.sidebar { grid-row: 1 / 2; padding: 32px 24px; display: flex; flex-direction: column; overflow-y: auto; }
.brand { margin-bottom: 40px; display: flex; align-items: center; gap: 12px; }
.brand-text { font-size: 1.25rem; }
.brand .accent { color: var(--accent-cyan); }

.nav-section {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-azure);
  letter-spacing: 0.15em;
  margin-bottom: 12px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-section::after { content: ""; flex-grow: 1; height: 1px; background: linear-gradient(90deg, var(--panel-border), transparent); }

.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.nav-btn:hover {
  background: hsla(210, 100%, 50%, 0.05);
  border-color: hsla(190, 80%, 50%, 0.2);
  color: var(--text-main);
  transform: translateX(4px);
}

.nav-btn.active {
  background: hsla(190, 80%, 50%, 0.1);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 20px hsla(190, 80%, 50%, 0.15);
}

.sidebar-footer { margin-top: auto; padding-top: 24px; border-top: 1px solid var(--panel-border); }
.user-profile.small { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.user-profile.small .avatar { font-size: 1.5rem; filter: drop-shadow(0 0 10px var(--accent-azure)); }
.user-profile.small .user-name { font-size: 0.85rem; font-weight: 700; color: var(--text-main); }
.user-profile.small .user-role { font-size: 0.65rem; color: var(--accent-cyan); text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; }

.system-status { display: flex; align-items: center; gap: 8px; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.healthy { background: var(--accent-green); box-shadow: 0 0 10px var(--accent-green); }

/* Main Content (Center) */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  overflow: hidden;
}

.topbar { padding: 20px 30px; }
.engine-title { font-size: 1.5rem; color: var(--text-main); }

.center-console {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background: hsla(230, 35%, 3%, 0.95);
  border: 1px solid var(--panel-border);
  box-shadow: 0 0 60px hsla(0,0%,0%,0.8);
}

.terminal-body {
  flex-grow: 1;
  padding: 30px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Action Bar (Input Area) */
.action-bar {
  background: hsla(230, 20%, 12%, 0.95);
  border-top: 1px solid var(--panel-border);
  padding: 20px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-hub {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: hsla(0, 0%, 0%, 0.3);
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
}

.enterprise-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 8px 0;
  resize: none;
  outline: none;
}

.attachment-btn {
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.6;
  transition: 0.2s;
  padding-bottom: 4px;
}
.attachment-btn:hover { opacity: 1; color: var(--accent-cyan); }

/* Intelligence Hub (Right) */
.intelligence-hub {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-header {
  display: flex;
  border-bottom: 1px solid var(--panel-border);
}
.tab-btn {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: 0.2s;
}
.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom: 2px solid var(--accent-cyan);
  background: hsla(190, 80%, 50%, 0.05);
}

.tab-content {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
}

.media-gallery {
  border-top: 1px solid var(--panel-border);
  max-height: 40%;
}

.hub-footer {
  padding: 20px;
  border-top: 1px solid var(--panel-border);
}

/* Responsiveness */
@media (max-width: 1400px) {
  .app-container { grid-template-columns: 260px 1fr 0px; }
  .intelligence-hub { display: none !important; }
}

@media (max-width: 1100px) {
  .app-container { grid-template-columns: 1fr; }
  .sidebar { display: none !important; }
}

/* Preserved Utility classes */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.w-full { width: 100%; }
.mt-4 { margin-top: 16px; }
.hidden { display: none !important; }

/* Buttons & HUD */
.sentiment-hud { display: flex; flex-direction: column; align-items: flex-end; }
.hud-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; }
.hud-value { font-weight: 700; color: var(--accent-cyan); text-shadow: 0 0 10px var(--accent-cyan); }

.btn-primary {
  background: var(--accent-cyan);
  color: #000;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px hsla(190, 80%, 50%, 0.4); }

.telemetry-bar { grid-column: 1 / 4; display: flex; align-items: center; gap: 20px; padding: 0 16px; font-family: var(--font-mono); font-size: 0.7rem; border-top: 1px solid var(--panel-border); }
.telemetry-title { color: var(--accent-amber); font-weight: 700; flex-shrink: 0; }
.hud-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.hud-value { font-weight: 700; color: var(--accent-cyan); text-shadow: 0 0 10px var(--accent-cyan); }

/* Waveform Visualizer */
.waveform-wrapper {
  padding: 15px;
  background: hsla(0, 0%, 0%, 0.3);
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  margin-top: 10px;
}
.wave-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
}
.wave-bar {
  width: 4px;
  height: 10px;
  background: var(--accent-cyan);
  border-radius: 2px;
  animation: wavePulse 1.2s infinite ease-in-out;
}
.wave-bar:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; height: 30px; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; height: 15px; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; height: 25px; }

@keyframes wavePulse {
  0%, 100% { transform: scaleY(1); opacity: 0.5; }
  50% { transform: scaleY(1.8); opacity: 1; }
}

/* Action Cards (Buttons) */
.action-cards {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}
.action-card-btn {
  background: hsla(190, 80%, 40%, 0.1);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.action-card-btn:hover {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 15px var(--accent-cyan);
}

/* Multimodal Gallery */
.media-gallery {
  margin-top: 20px;
  padding: 20px;
  background: hsla(0, 0%, 0%, 0.3);
  border-radius: 12px;
  border: 1px dashed var(--panel-border);
}
.gallery-header { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; letter-spacing: 0.05em; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.gallery-item {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  cursor: pointer;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.gallery-item:hover img { transform: scale(1.1); filter: brightness(1.2); }
.gallery-item::after {
  content: "⬇ Export";
  position: absolute;
  bottom: 0; left: 0; width: 100%;
  padding: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.6rem;
  text-align: center;
  opacity: 0;
  transition: 0.2s;
}
.gallery-item:hover::after { opacity: 1; }

.sequence-timeline {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.timeline-shot {
  flex-shrink: 0;
  width: 80px;
  height: 45px;
  background: hsla(0,0%,100%,0.05);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* History Sidebar */
.history-list { flex-grow: 1; overflow-y: auto; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.history-item {
  padding: 10px;
  border-radius: 8px;
  background: hsla(0,0%,0%,0.2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.2s;
}
.history-item:hover { background: hsla(0,0%,100%,0.05); border-color: var(--panel-border); }
.hist-time { font-size: 0.65rem; color: var(--accent-purple); font-family: var(--font-mono); }
.hist-title { font-size: 0.8rem; font-weight: 500; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.export-actions { padding-top: 16px; border-top: 1px solid var(--panel-border); }
.btn-outline {
  background: transparent; border: 1px solid var(--panel-border); color: var(--text-main); padding: 10px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: 0.2s;
}
.btn-outline:not(:disabled):hover { border-color: var(--accent-cyan); color: var(--accent-cyan); box-shadow: 0 0 10px hsla(190,80%,50%,0.2); }
.btn-outline:disabled { opacity: 0.4; cursor: not-allowed; }

/* IDE Console */
.ide-console {
  background: hsla(240, 20%, 5%, 0.95);
  border-top: 1px solid var(--panel-border);
  height: 180px;
  display: flex;
  flex-direction: column;
}
.console-tab {
  background: hsla(240, 20%, 15%, 0.8);
  padding: 6px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-amber);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--accent-amber);
  width: fit-content;
}
.console-logs {
  flex-grow: 1;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  overflow-y: auto;
  line-height: 1.4;
}
.log-line { margin-bottom: 4px; border-left: 2px solid transparent; padding-left: 8px; }
.log-line.info { color: var(--text-muted); }
.log-line.success { color: var(--accent-green); border-left-color: var(--accent-green); }
.log-line.error { color: var(--accent-red); border-left-color: var(--accent-red); background: hsla(0, 100%, 50%, 0.05); }

/* Existing fixes preserved */
.terminal-body { scroll-behavior: smooth; }
.stream-content { opacity: 1; transition: opacity 0.3s; }
.telemetry-bar { grid-column: 1 / 4; position: static; height: 100%; }
