/* iSurveillance VMS 4.0 - Design System & Core Styles */

:root {
  /* Colors */
  --bg-dark: #070b19;
  --bg-panel: rgba(14, 21, 46, 0.65);
  --bg-panel-solid: #0d1530;
  --border-glass: rgba(0, 242, 254, 0.12);
  --border-glass-hover: rgba(0, 242, 254, 0.3);
  
  --primary: #00f2fe;
  --primary-glow: rgba(0, 242, 254, 0.35);
  --secondary: #a55eea;
  
  /* Status Colors */
  --green: #10ac84;
  --green-glow: rgba(16, 172, 132, 0.3);
  --amber: #ff9f43;
  --amber-glow: rgba(255, 159, 67, 0.3);
  --red: #ee5253;
  --red-glow: rgba(238, 82, 83, 0.3);
  --blue: #2a96ff;
  
  /* Fonts & Weights */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: Consolas, Monaco, "Lucida Console", monospace;
  
  /* Dimensions */
  --sidebar-w: 280px;
  --topbar-h: 60px;
  --right-panel-w: 320px;
}

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

body {
  background-color: var(--bg-dark);
  color: #e2e8f0;
  font-family: var(--font-family);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(7, 11, 25, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 242, 254, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 242, 254, 0.4);
}

/* Glassmorphism utility */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-panel:hover {
  border-color: var(--border-glass-hover);
  box-shadow: 0 8px 32px 0 rgba(0, 242, 254, 0.08);
}

/* Layout Grid Shell */
.app-shell {
  display: grid;
  grid-template-areas: 
    "top top top"
    "side main event";
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-columns: var(--sidebar-w) 1fr var(--right-panel-w);
  width: 100vw;
  height: 100vh;
  position: relative;
  background-image: 
    radial-gradient(at 0% 0%, rgba(0, 242, 254, 0.03) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(165, 94, 234, 0.03) 0px, transparent 50%);
}

/* Topbar Header */
.topbar {
  grid-area: top;
  background: rgba(13, 21, 48, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

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

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #070b19;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 0 15px var(--primary-glow);
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ffffff, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.system-time {
  font-family: var(--font-mono);
  color: var(--primary);
  font-size: 14px;
  background: rgba(0, 242, 254, 0.06);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(0, 242, 254, 0.15);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-avatar {
  width: 18px;
  height: 18px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--green-glow);
}

/* Sidebar (Left Side Navigation) */
.sidebar {
  grid-area: side;
  background: rgba(10, 16, 38, 0.85);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  z-index: 90;
}

/* Right Panel (Shared Event Feed) */
.right-panel {
  grid-area: event;
  background: rgba(10, 16, 38, 0.85);
  backdrop-filter: blur(10px);
  border-left: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  padding: 15px;
  z-index: 90;
}

/* Main Content Workspace */
.main-viewport {
  grid-area: main;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  position: relative;
}

/* Pulse Animations */
@keyframes pulse-cyan {
  0% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(0, 242, 254, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0); }
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(238, 82, 83, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(238, 82, 83, 0); }
  100% { box-shadow: 0 0 0 0 rgba(238, 82, 83, 0); }
}

.pulse-cyan-node {
  animation: pulse-cyan 2s infinite;
}

.pulse-red-node {
  animation: pulse-red 1.5s infinite;
}

/* Dynamic glow badges */
.tech-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.badge-critical { background: rgba(238, 82, 83, 0.15); color: var(--red); border: 1px solid rgba(238, 82, 83, 0.3); }
.badge-warning { background: rgba(255, 159, 67, 0.15); color: var(--amber); border: 1px solid rgba(255, 159, 67, 0.3); }
.badge-info { background: rgba(0, 242, 254, 0.15); color: var(--primary); border: 1px solid rgba(0, 242, 254, 0.3); }
.badge-success { background: rgba(16, 172, 132, 0.15); color: var(--green); border: 1px solid rgba(16, 172, 132, 0.3); }

/* Shared High-performance Table Scroll Wrapper & Tables (VMS 4.0 Refactoring) */
.cctv-table-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.tech-table th {
  background: rgba(7, 11, 25, 0.85);
  color: var(--primary);
  font-weight: 700;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tech-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.tech-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.tech-table tr.active {
  background: rgba(0, 242, 254, 0.08);
}

.tech-table tr.active td {
  color: var(--primary);
  font-weight: bold;
}

.ellipsis-cell {
  max-width: 150px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.status-dot-cell {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.status-dot-cell.online { background: var(--green); }
.status-dot-cell.offline { background: var(--red); }
.status-dot-cell.maintenance { background: var(--amber); }

/* Vcloak for Vue compilation delay */
[v-cloak] {
  display: none !important;
}

.sidebar-tab-btn .badge {
  font-size: 11px;
  font-weight: 700;
  color: #ff9f43;
  text-shadow: 0 0 8px rgba(255, 159, 67, 0.4);
  background: rgba(255, 159, 67, 0.08);
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 159, 67, 0.2);
  transition: all 0.25s;
  font-family: var(--font-mono);
}

.sidebar-tab-btn:hover .badge {
  color: #ffb84d;
  background: rgba(255, 159, 67, 0.15);
  border-color: rgba(255, 159, 67, 0.35);
}

.sidebar-tab-btn.active .badge {
  color: #00f2fe;
  text-shadow: 0 0 8px var(--primary-glow);
  background: rgba(0, 242, 254, 0.15);
  border-color: rgba(0, 242, 254, 0.3);
}

/* Page transitions */
.fade-enter-active, .fade-leave-active {
  transition: opacity 0.25s ease;
}
.fade-enter-from, .fade-leave-to {
  opacity: 0;
}

/* Sidebar Tab switcher & Panes */
.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-glass);
}

.sidebar-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255,255,255,0.55);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.25s;
  
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
}

.sidebar-tab-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.02);
}

.sidebar-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(0, 242, 254, 0.05);
  text-shadow: 0 0 10px var(--primary-glow);
}

.sidebar-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 15px 10px;
}

.menu-group-title {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 8px 4px 8px;
  font-weight: bold;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 15px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: rgba(255,255,255,0.7);
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  font-family: var(--font-family);
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.05);
  color: #fff;
  transform: translateX(3px);
}

.nav-item.active {
  background: rgba(0, 242, 254, 0.08);
  border-color: var(--border-glass-hover);
  color: var(--primary);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.05);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.primary-color { color: var(--primary); }
.cyan-color { color: #00f2fe; }
.green-color { color: var(--green); }
.violet-color { color: var(--secondary); }
.amber-color { color: var(--amber); }
.red-color { color: var(--red); }

.nav-label-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 13px;
  font-weight: 600;
}

.nav-meta {
  font-size: 9px;
  opacity: 0.5;
}

/* Device Tree Sidebar */
.device-pane-layout {
  padding: 12px;
}

.search-box-container {
  margin-bottom: 10px;
}

.device-search {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  color: #fff;
  padding: 8px 12px;
  font-size: 12px;
  font-family: var(--font-family);
  transition: all 0.2s;
}

.device-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  outline: none;
}

.scope-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 12px;
}

.scope-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.55);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.scope-btn.active {
  background: rgba(0, 242, 254, 0.08);
  border-color: var(--primary);
  color: var(--primary);
}

.device-tree-container {
  flex: 1;
  overflow-y: auto;
}

.route-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: bold;
  color: rgba(255,255,255,0.4);
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.route-icon {
  font-size: 8px;
  color: var(--primary);
}

.camera-items-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 5px;
}

.camera-tree-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.camera-tree-item:hover {
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.04);
}

.camera-tree-item.selected {
  border-color: var(--amber);
  background: rgba(255, 159, 67, 0.05);
}

.camera-tree-item.active {
  background: rgba(0, 242, 255, 0.05);
  border-color: var(--primary);
}

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

.camera-tree-item.offline .status-dot {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.camera-tree-item.maintenance .status-dot {
  background: var(--amber);
}

.cam-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cam-title {
  font-size: 11px;
  font-weight: bold;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.cam-sub-meta {
  font-size: 9px;
  color: rgba(255,255,255,0.4);
}

.ext-badge {
  background: rgba(165, 94, 234, 0.15);
  border: 1px solid rgba(165, 94, 234, 0.3);
  color: var(--secondary);
  font-size: 8px;
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: 700;
}

/* Event Panel (Right Side) */
.event-pane-header {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.event-pane-header h3 {
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 0.5px;
}

.event-pane-header p {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  margin-top: 4px;
}

.event-filters-mini {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.event-filter-mini-btn {
  flex: 1;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.55);
  font-family: var(--font-family);
  font-size: 9px;
  padding: 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.event-filter-mini-btn:hover {
  background: rgba(255,255,255,0.05);
}

.event-filter-mini-btn.active {
  background: rgba(238, 82, 83, 0.1);
  border-color: var(--red);
  color: var(--red);
}

.mini-events-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-event-card {
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.04);
  border-left: 3px solid var(--primary);
  padding: 8px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s;
}

.mini-events-empty {
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 4px;
  color: rgba(255,255,255,0.48);
  font-size: 11px;
  line-height: 1.5;
  padding: 18px 10px;
  text-align: center;
}

.mini-event-card.critical { border-left-color: var(--red); }
.mini-event-card.warning { border-left-color: var(--amber); }
.mini-event-card.error { border-left-color: var(--red); }

.mini-event-card:hover {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.08);
}

.mini-event-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: bold;
}

.mini-event-title {
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.mini-event-time {
  font-size: 9px;
  color: rgba(255,255,255,0.4);
}

.mini-event-body {
  font-size: 10px;
  color: rgba(255,255,255,0.65);
  line-height: 1.4;
}

.mini-event-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  margin-top: 4px;
}

.mini-event-cam {
  color: var(--primary);
}

.mini-event-actions {
  display: flex;
  gap: 4px;
}

.mini-action-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 8px;
  cursor: pointer;
  font-family: var(--font-family);
  transition: all 0.2s;
}

.mini-action-btn:hover {
  background: rgba(0, 242, 254, 0.08);
  border-color: var(--primary);
  color: #fff;
}

.mini-action-btn.primary {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.mini-action-btn.primary:hover {
  background: #ff6b6b;
  box-shadow: 0 0 5px var(--red-glow);
}

/* Floating Download Manager trigger */
.download-manager-wrapper {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
}

.download-trigger-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: #070b19;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
  position: relative;
  transition: transform 0.2s;
}

.download-trigger-btn:hover {
  transform: scale(1.08);
}

.dl-icon {
  width: 22px;
  height: 22px;
}

.dl-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: bold;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 5px var(--red-glow);
}

/* Download Panel main box */
.download-manager-panel {
  position: absolute;
  bottom: 60px;
  right: 0;
  width: 420px;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

.dl-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.dl-panel-header h3 {
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 0.5px;
}

.panel-close-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 18px;
  cursor: pointer;
}

.panel-close-btn:hover {
  color: #fff;
}

.dl-panel-body {
  display: flex;
  flex-direction: column;
}

.panel-section {
  background: rgba(0,0,0,0.25);
  border-radius: 4px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.03);
}

.section-title {
  font-size: 11px;
  color: var(--primary);
  font-weight: bold;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.watermark-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.color-picker-ctrl {
  background: transparent;
  border: none;
  width: 100%;
  height: 26px;
  cursor: pointer;
}

.watermark-preview-bar {
  margin-top: 10px;
  font-size: 9px;
  color: rgba(255,255,255,0.45);
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(0,0,0,0.3);
  padding: 4px 8px;
  border-radius: 3px;
}

.preview-text {
  font-family: var(--font-mono);
  text-shadow: 0 0 2px #000;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.clear-all-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 9px;
  cursor: pointer;
}

.clear-all-btn:hover {
  text-decoration: underline;
}

.dl-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.dl-job-item {
  background: rgba(255,255,255,0.01);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 3px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.job-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
}

.job-name {
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.job-size {
  color: rgba(255,255,255,0.4);
}

.progress-bar-container {
  height: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 1.5px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  box-shadow: 0 0 5px var(--primary-glow);
}

.dl-job-item.completed .progress-bar-fill {
  background: var(--green);
  box-shadow: 0 0 5px var(--green-glow);
}

.job-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: rgba(255,255,255,0.4);
}

.job-status-text {
  font-weight: bold;
}
.job-status-text.processing { color: var(--amber); }
.job-status-text.completed { color: var(--green); }


/* AI Assistant Chat Panel styles */
.chat-panel-layout {
  height: 380px;
  display: flex;
  flex-direction: column;
}
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  max-height: 250px;
  min-height: 200px;
}
.chat-message-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  max-width: 85%;
}
.chat-message-item.assistant {
  align-self: flex-start;
}
.chat-message-item.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.message-avatar {
  font-size: 14px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  flex-shrink: 0;
}
.message-bubble-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.message-sender {
  font-size: 9px;
  opacity: 0.5;
  color: rgba(255, 255, 255, 0.6);
}
.chat-message-item.user .message-sender {
  text-align: right;
}
.message-text {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1.4;
  color: #fff;
  word-break: break-all;
}
.chat-message-item.assistant .message-text {
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.2);
}
.chat-message-item.user .message-text {
  background: rgba(165, 94, 234, 0.12);
  border: 1px solid rgba(165, 94, 234, 0.25);
}
.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.chat-input-field {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: #fff;
  padding: 6px 10px;
  font-size: 11px;
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font-family);
}
.chat-input-field:focus {
  border-color: var(--primary);
}
.chat-send-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  border-radius: 4px;
  color: #070b19;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.chat-send-btn:hover {
  transform: scale(1.05);
}
.dl-badge-dot {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--primary-glow);
  animation: pulse-primary 2s infinite;
}
@keyframes pulse-primary {
  0% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(0, 242, 254, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0); }
}

/* Sidebar & Right Panel Collapse transition & layout modifiers (VMS 4.0 Grid) */
.app-shell {
  transition: grid-template-columns 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 64px 1fr var(--right-panel-w);
}

.app-shell.event-panel-collapsed {
  grid-template-columns: var(--sidebar-w) 1fr 0px;
}

.app-shell.sidebar-collapsed.event-panel-collapsed {
  grid-template-columns: 64px 1fr 0px;
}

/* Collapsed Sidebar styles (solving icon preservation requirement!) */
.sidebar.collapsed {
  width: 64px;
}

.sidebar.collapsed .sidebar-tabs {
  display: none !important;
}

.sidebar.collapsed .menu-group-title {
  display: none !important;
}

.sidebar.collapsed .nav-label-group {
  display: none !important;
}

.sidebar.collapsed .sidebar-pane {
  padding: 15px 4px;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-nav {
  gap: 12px;
  align-items: center;
}

.sidebar.collapsed .nav-item {
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.sidebar.collapsed .nav-item:hover {
  transform: scale(1.05);
}

.sidebar.collapsed .nav-icon {
  margin: 0;
  width: 24px;
  height: 24px;
  opacity: 0.8;
}

.sidebar.collapsed .nav-icon svg {
  width: 20px;
  height: 20px;
}

/* Transition properties on layouts */
.sidebar, .right-panel {
  transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
              opacity 0.25s ease,
              padding 0.3s ease;
}

/* Sidebar Toggle Buttons in Topbar Brand */
.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  margin-right: 8px;
  transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
  background: rgba(0, 242, 254, 0.1);
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary-glow);
}

/* Event Toggle Pill in Topbar Right */
.event-toggle-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.65);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-family: var(--font-family);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.event-toggle-btn:hover, .event-toggle-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  background: rgba(0, 242, 254, 0.05);
}

/* Right Panel close and head layouts */
.event-pane-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.right-panel-close-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 3px;
}

.right-panel-close-btn:hover {
  color: var(--red);
  background: rgba(238, 82, 83, 0.1);
}

/* Collapsible Tree View Nesting & Premium Styling */
.route-group {
  margin-bottom: 6px;
}

.route-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
  padding: 8px 10px;
  background: rgba(0, 242, 254, 0.05);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  border-bottom: none !important;
}

.route-header:hover {
  background: rgba(0, 242, 254, 0.12);
  color: #fff;
}

.area-group-container {
  padding-left: 10px;
  border-left: 1px solid rgba(0, 242, 254, 0.1);
  margin-top: 4px;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.area-group {
  margin-bottom: 2px;
}

.area-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.area-header:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
}

.area-icon {
  font-size: 8px;
  color: var(--amber);
}

.badge-count {
  margin-left: auto;
  font-size: 9px;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

.route-header:hover .badge-count,
.area-header:hover .badge-count {
  background: rgba(0, 242, 254, 0.2);
  color: var(--primary);
}

.area-group .camera-items-list {
  padding-left: 12px;
  margin-top: 2px;
}

/* Accessibility Focus States for Keyboard Navigation */
.nav-item:focus-visible,
.sidebar-tab-btn:focus-visible,
.layout-btn:focus-visible,
.scope-btn:focus-visible,
.mini-action-btn:focus-visible,
.btn-primary:focus-visible,
.btn-primary-large:focus-visible,
.play-btn:focus-visible,
.select-ctrl:focus,
.input-ctrl:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 10px var(--primary-glow) !important;
}/* Centralized View Header Design System Token
   Ensures 100% perfect title size, weight, alignment, height, and spacing across all views. */
.view-header.compact {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  margin-top: 0 !important;
  margin-bottom: 12px !important;
  padding: 0 0 8px 0 !important;
  border-bottom: 1px solid rgba(0, 242, 254, 0.08) !important;
  box-sizing: border-box !important;
  background: transparent !important;
}

.view-header.compact h2 {
  font-size: 20px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  letter-spacing: 0.5px !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  white-space: nowrap !important;
}

.view-header.compact h2 .subtitle {
  font-size: 11px !important;
  font-family: var(--font-mono) !important;
  color: var(--primary) !important;
  opacity: 0.85 !important;
  margin-left: 8px !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
}

