/* =========================================================
   icxProc Control Panel - Main CSS Design System
   Version: 1.0.0 | OFFLINE USE ONLY
   ========================================================= */

/* ---------------------------------------------------------
   CSS CUSTOM PROPERTIES (Design Tokens)
   Αλλάξτε εδώ για να αλλάξετε τα χρώματα ολόκληρου του portal
   --------------------------------------------------------- */
:root {
  /* === PRIMARY PALETTE === */
  --color-primary:        #00c8ff;       /* Accent / Highlight */
  --color-primary-dark:   #0098cc;
  --color-primary-glow:   rgba(0, 200, 255, 0.18);

  --color-secondary:      #a259ff;       /* Purple accent */
  --color-secondary-glow: rgba(162, 89, 255, 0.18);

  /* === BACKGROUND LAYERS === */
  --bg-base:              #0c0e14;       /* Page background */
  --bg-surface:           #13161f;       /* Cards, panels */
  --bg-surface-2:         #1a1d28;       /* Secondary cards */
  --bg-glass:             rgba(19, 22, 31, 0.75);
  --bg-glass-hover:       rgba(26, 29, 40, 0.90);

  /* === BORDERS & DIVIDERS === */
  --border-color:         rgba(255, 255, 255, 0.07);
  --border-color-active:  rgba(0, 200, 255, 0.40);
  --border-radius-sm:     8px;
  --border-radius-md:     14px;
  --border-radius-lg:     20px;
  --border-radius-xl:     28px;

  /* === TEXT === */
  --text-primary:         #f0f4ff;
  --text-secondary:       #8891aa;
  --text-muted:           #50576e;
  --text-accent:          #00c8ff;

  /* === STATUS COLORS === */
  --color-success:        #00e676;
  --color-warning:        #ffab00;
  --color-danger:         #ff3d71;
  --color-info:           #00c8ff;

  --color-success-bg:     rgba(0, 230, 118, 0.10);
  --color-warning-bg:     rgba(255, 171, 0, 0.10);
  --color-danger-bg:      rgba(255, 61, 113, 0.10);
  --color-info-bg:        rgba(0, 200, 255, 0.10);

  /* === SIDEBAR === */
  --sidebar-width:        300px;
  --sidebar-collapsed:    100px;
  --sidebar-bg:           #10121a;
  --sidebar-border:       rgba(255, 255, 255, 0.06);

  /* === TOPBAR === */
  --topbar-height:        64px;
  --topbar-bg:            rgba(12, 14, 20, 0.92);

  /* === SHADOWS === */
  --shadow-sm:            0 2px 8px rgba(0,0,0,0.30);
  --shadow-md:            0 4px 24px rgba(0,0,0,0.45);
  --shadow-lg:            0 8px 48px rgba(0,0,0,0.55);
  --shadow-glow:          0 0 20px rgba(0, 200, 255, 0.20);
  --shadow-glow-strong:   0 0 36px rgba(0, 200, 255, 0.35);

  /* === TRANSITIONS === */
  --transition-fast:      all 0.15s ease;
  --transition-normal:    all 0.25s ease;
  --transition-slow:      all 0.40s cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* === FONT === */
  --font-family:          'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:            'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* === Z-INDEX LAYERS === */
  --z-sidebar:            100;
  --z-topbar:             200;
  --z-dropdown:           300;
  --z-modal:              400;
  --z-toast:              500;
}

/* =========================================================
   RESET & BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

body.sidebar-mobile-open {
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* =========================================================
   SCROLLBAR
   ========================================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(0,200,255,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,200,255,0.45); }

/* =========================================================
   LAYOUT - SHELL
   ========================================================= */
.icx-shell {
  display: flex;
  min-height: 100vh;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.icx-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: var(--transition-slow);
  overflow: hidden;
}

.icx-sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 100px;
  overflow: hidden;
}

.sidebar-logo img {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: brightness(1.2);
  transition: var(--transition-fast);
}

.icx-sidebar.collapsed .sidebar-logo img {
  width: 48px;
  max-width: 48px;
}

/* Status badges in sidebar */
.sidebar-status-panel {
  flex: 0 0 auto;
  padding: 14px 14px 8px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--border-radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition-normal);
}

.status-badge .badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
  transition: var(--transition-normal);
}

.status-badge.online .badge-dot  { background: var(--color-success); box-shadow: 0 0 8px var(--color-success); }
.status-badge.offline .badge-dot { background: var(--color-danger);  box-shadow: 0 0 8px var(--color-danger);  }
.status-badge.warn .badge-dot    { background: var(--color-warning); box-shadow: 0 0 8px var(--color-warning); }

.status-badge-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  font-size: 0.70rem;
}

.status-badge-value {
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}

.icx-sidebar.collapsed .status-badge .status-badge-label,
.icx-sidebar.collapsed .status-badge .status-badge-value { display: none; }
.icx-sidebar.collapsed .status-badge { justify-content: center; padding: 8px; }

/* Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

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

.nav-item.active {
  background: var(--color-primary-glow);
  color: var(--color-primary);
  border: 1px solid var(--border-color-active);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}

.nav-item i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.nav-item-text {
  opacity: 1;
  transition: var(--transition-fast);
  flex: 1;
}

.icx-sidebar.collapsed .nav-item-text { opacity: 0; width: 0; }
.icx-sidebar.collapsed .nav-item { justify-content: center; padding: 11px; }

/* Sidebar bottom */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Sidebar toggle btn */
.sidebar-toggle {
  position: fixed;
  top: 18px;
  left: calc(var(--sidebar-width) - 16px);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: calc(var(--z-sidebar) + 1);
  color: var(--text-secondary);
  font-size: 0.75rem;
  transition: var(--transition-slow);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.sidebar-toggle:hover {
  background: var(--color-primary-glow);
  color: var(--color-primary);
  border-color: var(--border-color-active);
}

.icx-sidebar.collapsed ~ .sidebar-toggle {
  left: calc(var(--sidebar-collapsed) - 16px);
}

/* =========================================================
   MAIN CONTENT AREA
   ========================================================= */
.icx-main {
  flex: 1;
  min-width: 0; /* let wide tables scroll inside their wrapper instead of widening the page */
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition-slow);
}

.icx-main.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* =========================================================
   TOPBAR
   ========================================================= */
.icx-topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: var(--z-topbar);
  gap: 16px;
}

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

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-title i {
  color: var(--color-primary);
  font-size: 1rem;
}

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

/* Language Toggle */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 4px;
  overflow: hidden;
}

.lang-btn {
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  letter-spacing: 0.5px;
}

.lang-btn.active {
  background: var(--color-primary);
  color: #000;
}

.lang-btn:hover:not(.active) {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

/* Settings gear dropdown */
.settings-dropdown-wrap {
  position: relative;
}

.settings-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.settings-btn:hover, .settings-btn.open {
  background: var(--color-primary-glow);
  color: var(--color-primary);
  border-color: var(--border-color-active);
}

.settings-btn.open i { transform: rotate(60deg); }
.settings-btn i { transition: transform 0.35s ease; }

.settings-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: var(--transition-fast);
  z-index: var(--z-dropdown);
}

.settings-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.settings-dropdown-header {
  padding: 12px 16px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

.settings-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: normal;
  word-break: break-word;
}

.settings-dropdown-item:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.settings-dropdown-item i {
  width: 18px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-primary);
}

.settings-dropdown-item.danger { color: var(--color-danger); }
.settings-dropdown-item.danger i { color: var(--color-danger); }
.settings-dropdown-item.danger:hover { background: var(--color-danger-bg); }

/* User info in topbar */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition-fast);
}

.topbar-user:hover {
  border-color: var(--border-color-active);
}

.topbar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}

.topbar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar-user-role {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* =========================================================
   PAGE CONTENT
   ========================================================= */
.icx-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header h1 i {
  font-size: 1.3rem;
  color: var(--color-primary);
}

.page-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* =========================================================
   STREAM GRID
   ========================================================= */
.streams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.stream-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: var(--transition-normal);
  position: relative;
}

.stream-card:hover {
  border-color: var(--border-color-active);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

/* Live badge */
.stream-card-live-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 2;
}

.stream-card-live-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: livePulse 1.4s infinite;
  flex-shrink: 0;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* AI Stream Button */
.stream-card-ai-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-primary);
  border: 1.5px solid transparent;
  background-image: linear-gradient(rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.6)), linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stream-card-ai-btn:hover {
  background-image: linear-gradient(rgba(0, 200, 255, 0.15), rgba(162, 89, 255, 0.15)), linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  box-shadow: 0 0 16px rgba(0, 200, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px) scale(1.03);
}

.stream-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #050608;
  position: relative;
  overflow: hidden;
}

.stream-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.stream-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  background: radial-gradient(ellipse at center, #111420 0%, #050608 70%);
}

.stream-preview-placeholder i {
  font-size: 2.5rem;
  opacity: 0.3;
}

.stream-preview-placeholder span {
  font-size: 0.75rem;
}

.stream-card-body {
  padding: 14px 16px;
}

.stream-card-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stream-card-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stream-card-meta i { font-size: 0.65rem; }

.stream-card-actions {
  display: flex;
  gap: 8px;
}

/* Equal-width buttons inside stream card actions */
.stream-card-actions .icx-btn {
  flex: 1;
  justify-content: center;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.icx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--border-radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: var(--transition-fast);
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid transparent;
}

.icx-btn i { font-size: 0.85rem; }

.icx-btn-primary {
  background: var(--color-primary);
  color: #000;
  border-color: var(--color-primary);
}

.icx-btn-primary:hover {
  background: #00e5ff;
  box-shadow: 0 0 16px rgba(0,200,255,0.5);
  transform: translateY(-1px);
}

.icx-btn-secondary {
  background: var(--color-secondary);
  color: #fff;
  border-color: var(--color-secondary);
}

.icx-btn-secondary:hover {
  background: #b46fff;
  box-shadow: 0 0 16px rgba(162,89,255,0.5);
  transform: translateY(-1px);
}

.icx-btn-cyan {
  background: rgba(0, 210, 255, 0.15);
  color: #00d2ff;
  border-color: rgba(0, 210, 255, 0.4);
}

.icx-btn-cyan:hover {
  background: rgba(0, 210, 255, 0.28);
  box-shadow: 0 0 14px rgba(0, 210, 255, 0.35);
  transform: translateY(-1px);
  color: #fff;
}

.icx-btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.icx-btn-outline:hover {
  background: var(--color-primary-glow);
  transform: translateY(-1px);
}

.icx-btn-ghost {
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.icx-btn-ghost:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
}

.icx-btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.icx-btn-danger:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 16px rgba(255,61,113,0.4);
  transform: translateY(-1px);
}

.icx-btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.icx-btn-lg { padding: 13px 28px; font-size: 0.95rem; }
.icx-btn-full { width: 100%; }

.icx-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* =========================================================
   STAT/METRIC WIDGET
   ========================================================= */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.metric-widget::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--color-primary), transparent);
  opacity: 0;
  transition: var(--transition-fast);
}

.metric-widget:hover::before { opacity: 1; }
.metric-widget:hover { border-color: var(--border-color-active); }

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--color-info-bg);
  color: var(--color-info);
  flex-shrink: 0;
}

.metric-icon.warn  { background: var(--color-warning-bg); color: var(--color-warning); }
.metric-icon.ok    { background: var(--color-success-bg); color: var(--color-success); }
.metric-icon.crit  { background: var(--color-danger-bg);  color: var(--color-danger);  }

.metric-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.metric-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 2px;
}

/* Progress bar in metric */
.metric-bar {
  width: 100%;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--color-primary);
  transition: width 0.6s ease;
}

.metric-bar-fill.ok   { background: var(--color-success); }
.metric-bar-fill.warn { background: var(--color-warning); }
.metric-bar-fill.crit { background: var(--color-danger);  }

/* =========================================================
   GLASSMORPHISM CARD
   ========================================================= */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

/* =========================================================
   SECTION HEADER
   ========================================================= */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i { color: var(--color-primary); font-size: 0.9rem; }

/* =========================================================
   FOOTER
   ========================================================= */
.icx-footer {
  border-top: 1px solid var(--border-color);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}

.footer-metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
}

.footer-metric {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-metric i { font-size: 0.7rem; color: var(--color-primary); }

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 14px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3.5rem;
  opacity: 0.2;
  margin-bottom: 8px;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state-desc {
  font-size: 0.82rem;
  max-width: 320px;
  line-height: 1.6;
}

/* =========================================================
   LOADING SPINNER
   ========================================================= */
.icx-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(0,200,255,0.15);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   TOAST NOTIFICATIONS
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--border-radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  min-width: 260px;
  max-width: 360px;
  font-size: 0.85rem;
  color: var(--text-primary);
  pointer-events: all;
  animation: toastIn 0.3s ease;
  transition: var(--transition-fast);
}

.toast.removing { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn  { from { opacity: 0; transform: translateX(30px); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(30px); } }

.toast i { font-size: 1rem; flex-shrink: 0; }
.toast.info    { border-color: rgba(0,200,255,0.3);   }
.toast.info  i { color: var(--color-info);    }
.toast.success { border-color: rgba(0,230,118,0.3);   }
.toast.success i { color: var(--color-success); }
.toast.warning { border-color: rgba(255,171,0,0.3);   }
.toast.warning i { color: var(--color-warning); }
.toast.error   { border-color: rgba(255,61,113,0.3);  }
.toast.error i { color: var(--color-danger);  }

/* =========================================================
   MODAL
   ========================================================= */
.icx-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-fast);
}

.icx-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.icx-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: var(--transition-fast);
}

.icx-modal-overlay.open .icx-modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-surface-2);
  transition: var(--transition-fast);
  font-size: 0.85rem;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

/* =========================================================
   FORM ELEMENTS
   ========================================================= */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.form-input {
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition-fast);
  outline: none;
  width: 100%;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

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

.form-input.error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px var(--color-danger-bg);
}

.form-error {
  font-size: 0.72rem;
  color: var(--color-danger);
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-error[hidden] {
  display: none;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* =========================================================
   ANIMATED GRADIENT BACKGROUND (hero/header)
   ========================================================= */
.gradient-orb {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
}

.gradient-orb-1 {
  top: -100px;
  right: -100px;
  background: var(--color-primary);
}

.gradient-orb-2 {
  bottom: -150px;
  left: 150px;
  background: var(--color-secondary);
}

/* =========================================================
   PAGE TABS
   ========================================================= */
.page-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 4px;
  margin-bottom: 20px;
  width: fit-content;
}

.page-tab {
  padding: 8px 18px;
  border-radius: var(--border-radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 7px;
}

.page-tab:hover { color: var(--text-primary); background: var(--bg-surface-2); }

.page-tab.active {
  background: var(--color-primary);
  color: #000;
}

.page-tab i { font-size: 0.8rem; }

/* =========================================================
   HEALTH WIDGETS (System Health page)
   ========================================================= */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.health-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.health-widget:hover {
  border-color: var(--border-color-active);
  box-shadow: var(--shadow-glow);
}

.health-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.health-widget-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.health-widget-icon.blue   { background: var(--color-info-bg);    color: var(--color-info);    }
.health-widget-icon.green  { background: var(--color-success-bg);  color: var(--color-success); }
.health-widget-icon.yellow { background: var(--color-warning-bg);  color: var(--color-warning); }
.health-widget-icon.red    { background: var(--color-danger-bg);   color: var(--color-danger);  }
.health-widget-icon.purple { background: var(--color-secondary-glow); color: var(--color-secondary); }

.health-widget-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
}

.health-widget-status-dot.ok   { background: var(--color-success); box-shadow: 0 0 8px var(--color-success); }
.health-widget-status-dot.warn { background: var(--color-warning); box-shadow: 0 0 8px var(--color-warning); }
.health-widget-status-dot.crit { background: var(--color-danger);  box-shadow: 0 0 8px var(--color-danger);  }

.health-widget-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.health-widget-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.health-widget-bar {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.health-widget-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.25,0.46,0.45,0.94);
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
}

.health-widget-bar-fill.ok   { background: linear-gradient(90deg, var(--color-success), #00c8a0); }
.health-widget-bar-fill.warn { background: linear-gradient(90deg, var(--color-warning), #ff8c00); }
.health-widget-bar-fill.crit { background: linear-gradient(90deg, var(--color-danger),  #ff0051); }

/* =========================================================
   TABLE
   ========================================================= */
.icx-table-wrap {
  overflow-x: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.icx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.icx-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.icx-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: middle;
}

.icx-table tr:last-child td { border-bottom: none; }
.icx-table tbody tr { transition: var(--transition-fast); }
.icx-table tbody tr:hover { background: var(--bg-surface-2); }

.icx-table td.text-primary { color: var(--text-primary); font-weight: 600; }

/* Badge/pill */
.icx-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.icx-badge.success { background: var(--color-success-bg); color: var(--color-success); }
.icx-badge.warning { background: var(--color-warning-bg); color: var(--color-warning); }
.icx-badge.danger  { background: var(--color-danger-bg);  color: var(--color-danger);  }
.icx-badge.info    { background: var(--color-info-bg);    color: var(--color-info);    }
.icx-badge.muted   { background: rgba(255,255,255,0.06);  color: var(--text-muted);    }

/* =========================================================
   VTC LAYOUT
   =========================================================  */
@keyframes vtcPulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.5); opacity: 0.6; }
}

.vtc-layout-grid {
  display: grid;
  grid-template-columns: minmax(300px, 350px) 1fr;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

/* ---------------------------------------------------------
   VTC PAGE LAYOUT
   --------------------------------------------------------- */

/* Two-column grid: join controls | participants panel */
.vtc-page-grid {
  display: grid;
  grid-template-columns: minmax(300px, 480px) 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 860px) {
  .vtc-page-grid {
    grid-template-columns: 1fr;
  }
}

/* Participant row inside the panel */
.vtc-participant-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--border-radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  transition: border-color 0.25s, background 0.25s;
  animation: vtcRowIn 0.3s ease;
}

.vtc-participant-row.is-local {
  border-color: var(--border-color-active);
  background: var(--color-primary-glow);
}

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

/* Avatar circle with initials */
.vtc-participant-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #000;
  flex-shrink: 0;
  letter-spacing: 0;
}

.vtc-participant-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vtc-participant-you {
  font-size: 0.7rem;
  color: var(--color-primary);
  font-weight: 700;
  border: 1px solid var(--border-color-active);
  border-radius: 4px;
  padding: 1px 7px;
  flex-shrink: 0;
}

.vtc-participant-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  flex-shrink: 0;
  animation: livePulse 1.5s ease infinite;
}

/* ---------------------------------------------------------
   VTC MOBILE PARTICIPANTS POPUP (full-screen overlay)
   --------------------------------------------------------- */

/* Floating action button (FAB) — shown on all devices when participants exist */
.vtc-popup-fab {
  display: none; /* overridden via JS when participants > 0 */
  position: fixed;
  bottom: 72px;
  right: 24px;
  z-index: 1200;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border: none;
  color: #000;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,200,255,0.45), 0 2px 8px rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: vtcFabIn 0.3s ease;
}

.vtc-popup-fab:hover,
.vtc-popup-fab:focus {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(0,200,255,0.6), 0 2px 10px rgba(0,0,0,0.4);
  outline: none;
}

.vtc-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--bg-base);
  letter-spacing: 0;
}

@keyframes vtcFabIn {
  from { transform: scale(0.5) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1)   rotate(0deg);   opacity: 1; }
}

/* Full-screen popup overlay */
.vtc-mobile-popup {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: #080a0f;
  display: flex;
  flex-direction: column;
  animation: vtcPopupIn 0.28s cubic-bezier(0.22,1,0.36,1);
}

@keyframes vtcPopupIn {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header bar of the popup */
.vtc-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(10,14,20,0.95);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  gap: 12px;
}

.vtc-popup-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.vtc-popup-title i {
  color: var(--color-primary);
  font-size: 1rem;
}

.vtc-popup-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--color-primary-glow);
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0 6px;
  border: 1px solid rgba(0,200,255,0.25);
}

.vtc-popup-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-secondary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.vtc-popup-close:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* Call stage: remote gallery + floating self-view */
.vtc-call-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #080a0f;
}

/* Gallery: equal tiles, last row centred. Tile size (--tile-w/--tile-h) is computed in vtc.js:
   landscape screens get the largest 16:9 tiles that fit (Teams/Zoom gallery),
   portrait screens get tiles that fill the screen (WhatsApp/Signal mobile). */
.vtc-mobile-grid {
  --vtc-gap: 8px;
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-content: safe center; /* keep first row reachable when the gallery scrolls */
  justify-content: center;
  gap: var(--vtc-gap);
  padding: var(--vtc-gap);
  overflow-y: auto;
}

.vtc-mobile-cell {
  position: relative;
  flex: 0 0 auto;
  width: var(--tile-w, 100%);
  height: var(--tile-h, 100%);
  overflow: hidden;
  border-radius: 12px;
  background: #000;
}

.vtc-mobile-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Name tag: always visible, bottom-left (standard in every call app) */
.vtc-tile-name {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 2;
}

/* Tile actions: top-right, shown on hover (desktop) or tap (touch) */
.vtc-tile-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 2;
}

.vtc-mobile-cell.show-actions .vtc-tile-actions { opacity: 1; }

.vtc-tile-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
}

.vtc-tile-btn-rec { color: #ff5555; border-color: rgba(220,50,50,0.45); font-size: 0.75rem; }
.vtc-tile-btn-rec.is-recording { color: #fff; background: var(--color-danger); }
.vtc-tile-btn.is-off { color: var(--color-danger); }

.vtc-tile-error {
  display: none;
  position: absolute;
  inset: 0;
  align-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.7);
  color: #ff4d4f;
  font-size: 0.85rem;
  text-align: center;
  z-index: 3;
}

/* Shown when you are in the call alone */
.vtc-call-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.vtc-call-empty i { font-size: 2.2rem; opacity: 0.4; }
.vtc-call-empty[hidden] { display: none; }

/* Self-view picture-in-picture, bottom-right */
.vtc-self-pip {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: clamp(140px, 18vw, 260px);
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1d24;
  border: 2px solid rgba(255,255,255,0.18);
  box-shadow: 0 6px 24px rgba(0,0,0,0.55);
  z-index: 5;
}

.vtc-self-pip[hidden] { display: none; }

.vtc-self-pip video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Front camera is mirrored like every call app */
.vtc-self-pip.is-mirrored video { transform: scaleX(-1); }
.vtc-self-pip.is-cam-off video { visibility: hidden; }
.vtc-self-pip .vtc-tile-name { left: 6px; bottom: 6px; font-size: 0.7rem; padding: 2px 8px; }

/* In-call control bar */
.vtc-call-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-shrink: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: rgba(10,14,20,0.95);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.vtc-call-controls[hidden] { display: none; }

.vtc-call-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.vtc-call-btn:hover { background: rgba(255,255,255,0.2); }
.vtc-call-btn.is-off { background: #fff; color: #111; }
.vtc-call-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.vtc-call-btn-leave { background: var(--color-danger); }
.vtc-call-btn-leave:hover { background: var(--color-danger); filter: brightness(1.15); }

/* Phones / portrait: tighter gallery, 3:4 self-view, smaller controls */
@media (orientation: portrait), (max-width: 600px) {
  .vtc-mobile-grid { --vtc-gap: 4px; }
  .vtc-mobile-cell { border-radius: 8px; }
  .vtc-self-pip {
    width: clamp(90px, 26vw, 140px);
    aspect-ratio: 3 / 4;
    right: 12px;
    bottom: 12px;
  }
  .vtc-call-controls { gap: 12px; padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .vtc-call-btn { width: 48px; height: 48px; font-size: 1.05rem; }
}

/* Live indicator dot in label */
.vtc-mobile-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-danger);
  box-shadow: 0 0 6px var(--color-danger);
  animation: vtcPulse 1.2s ease infinite;
  flex-shrink: 0;
}

/* =========================================================
   COMING SOON / PLACEHOLDER PAGE
   ========================================================= */
.coming-soon-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 16px;
  padding: 40px;
}

.coming-soon-icon {
  font-size: 4rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.coming-soon-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
}

.coming-soon-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 380px;
  line-height: 1.7;
}

.coming-soon-note {
  margin-top: 16px;
  padding: 12px 20px;
  border-radius: var(--border-radius-md);
  background: var(--color-info-bg);
  border: 1px solid rgba(0,200,255,0.2);
  color: var(--color-info);
  font-size: 0.82rem;
  max-width: 380px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
  .icx-sidebar {
    top: var(--topbar-height);
    width: min(78vw, 280px);
    height: calc(100vh - var(--topbar-height));
    max-width: 280px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .icx-sidebar.collapsed {
    width: min(78vw, 280px);
  }
  .icx-sidebar.mobile-open {
    transform: translateX(0);
  }
  .icx-main,
  .icx-main.sidebar-collapsed {
    margin-left: 0;
  }
  .sidebar-toggle { display: none; }
  .mobile-menu-btn {
    display: flex !important;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }
  .topbar-user {
    display: flex;
    padding: 4px;
    gap: 0;
    min-width: 36px;
    justify-content: center;
    flex-shrink: 0;
    flex: 0 0 36px;
  }
  .topbar-user-name,
  .topbar-user-role {
    display: none;
  }
  .topbar-user-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.68rem;
  }
  .icx-topbar {
    padding: 12px 14px;
    height: auto;
    min-height: var(--topbar-height);
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  .topbar-left,
  .topbar-right {
    width: auto;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .topbar-left {
    flex: 0 0 auto;
    min-width: auto;
    align-items: center;
  }
  .topbar-right {
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-left: auto;
    gap: 6px;
    min-width: 0;
  }
  .topbar-title {
    font-size: 1rem;
    flex: 1;
    min-width: 0;
  }
  .topbar-title {
    display: none;
  }
  .settings-dropdown-wrap {
    margin-left: 0;
    flex-shrink: 0;
  }
  .settings-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }
  .lang-toggle { flex-shrink: 0; }
  .lang-btn {
    padding: 5px 10px;
  }
  .sidebar-logo {
    min-height: 82px;
    padding: 10px 12px;
    overflow: visible;
  }
  .sidebar-logo img {
    width: auto;
    max-width: 118px;
    max-height: 40px;
  }
  .icx-sidebar.mobile-open .sidebar-logo img,
  .icx-sidebar:not(.collapsed) .sidebar-logo img {
    width: auto;
    max-width: 118px;
  }
  .settings-dropdown {
    position: fixed;
    top: 74px;
    left: 12px;
    right: 12px;
    width: auto;
    min-width: 0;
    max-width: none;
  }
  .icx-content {
    padding: 20px;
    min-width: 0;
  }
  .page-header,
  .health-grid,
  .streams-grid,
  .metrics-row,
  .glass-card,
  .health-widget,
  .stream-card {
    min-width: 0;
    max-width: 100%;
  }
  .streams-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
  .health-grid  { grid-template-columns: 1fr; }
  .metrics-row  { grid-template-columns: 1fr; }
  .vtc-layout-grid { grid-template-columns: 1fr; }
  /* On tablet/mobile: hide the desktop participants glass-card (FAB takes over) */
  #page-vtc .vtc-layout-grid > .glass-card:last-child {
    display: none;
  }
  .icx-footer {
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .icx-sidebar,
  .icx-sidebar.collapsed,
  .icx-sidebar.mobile-open {
    top: var(--topbar-height);
    width: min(78vw, 280px);
    height: calc(100vh - var(--topbar-height));
    max-width: 280px;
  }
  .icx-topbar {
    height: auto;
    min-height: var(--topbar-height);
    padding: 12px 14px;
    flex-wrap: nowrap;
    align-items: center;
  }
  .topbar-left,
  .topbar-right {
    width: auto;
  }
  .topbar-right {
    gap: 6px;
    justify-content: flex-end;
  }
  .topbar-user {
    min-width: 36px;
    padding: 4px;
    flex: 0 0 36px;
  }
  .topbar-user-name,
  .topbar-user-role {
    display: none;
  }
  .topbar-user-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.68rem;
  }
  .mobile-menu-btn,
  .settings-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }
  .lang-btn {
    padding: 5px 9px;
  }
  .icx-content { padding: 16px; }
  .sidebar-logo {
    min-height: 72px;
    padding: 8px 10px;
    overflow: visible;
  }
  .sidebar-logo img,
  .icx-sidebar.mobile-open .sidebar-logo img,
  .icx-sidebar:not(.collapsed) .sidebar-logo img {
    width: auto;
    max-width: 104px;
    max-height: 34px;
  }
  .streams-grid { grid-template-columns: 1fr; }
  .health-grid  { grid-template-columns: 1fr; }
  .metrics-row  { grid-template-columns: 1fr; }
  .settings-dropdown {
    position: fixed;
    top: calc(var(--topbar-height) + 10px);
    left: 14px;
    right: 14px;
    width: auto;
    min-width: 0;
    max-width: none;
  }
  .icx-footer { flex-direction: column; align-items: flex-start; }
  .footer-metrics {
    justify-content: flex-start;
    gap: 12px;
  }
  .stream-card-actions {
    flex-direction: column;
  }
  .stream-card-actions .icx-btn {
    width: 100%;
  }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .health-grid  { grid-template-columns: 1fr; }
  .metrics-row  { grid-template-columns: 1fr; }
  .icx-topbar   { 
    padding: 10px 10px;
    height: auto; 
    flex-wrap: nowrap; 
    gap: 6px;
  }
  .topbar-left,
  .topbar-right {
    gap: 4px;
  }
  .lang-btn {
    padding: 5px 8px;
    font-size: 0.72rem;
  }
  .lang-toggle {
    width: auto;
  }
  .mobile-menu-btn,
  .settings-btn {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
  }
  .topbar-user {
    min-width: 32px;
    padding: 3px;
    flex: 0 0 32px;
  }
  .topbar-user-avatar {
    width: 22px;
    height: 22px;
    font-size: 0.64rem;
  }
  .settings-dropdown {
    top: 62px;
    left: 10px;
    right: 10px;
  }
  .sidebar-logo {
    min-height: 68px;
    padding: 8px;
  }
  .sidebar-logo img,
  .icx-sidebar.mobile-open .sidebar-logo img,
  .icx-sidebar:not(.collapsed) .sidebar-logo img {
    max-width: 96px;
    max-height: 30px;
  }
  .page-tabs    { width: 100%; overflow-x: auto; }
  .page-header h1 {
    font-size: 1.25rem;
  }
  .page-header p {
    font-size: 0.82rem;
  }
  .icx-content {
    padding: 14px;
  }
}

/* Mobile menu button (hidden on desktop) */
.mobile-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: var(--color-primary-glow);
  color: var(--color-primary);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: calc(var(--z-sidebar) - 1);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-fast);
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* =========================================================
   UTILITY CLASSES
   ========================================================= */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8   { margin-top: 8px;  }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-primary-color { color: var(--color-primary); }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 0.82rem; }
.text-xs      { font-size: 0.72rem; }
.font-bold    { font-weight: 700; }
.font-mono    { font-family: var(--font-mono); }
.hidden       { display: none !important; }

/* Fade-in animation for page transitions */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.animate-in {
  animation: fadeInUp 0.4s ease forwards;
}

/* Animated gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary), var(--color-primary));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}

/* =========================================================
   PRELOADER
   ========================================================= */
.icx-preloader {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 9999;
  transition: opacity 0.4s ease;
}

.icx-preloader.hidden {
  opacity: 0;
  pointer-events: none;
}

.preloader-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  animation: preloaderPulse 1.5s ease infinite;
}

@keyframes preloaderPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50%       { transform: scale(1.08); filter: brightness(1.3) drop-shadow(0 0 16px var(--color-primary)); }
}

.preloader-bar {
  width: 200px;
  height: 2px;
  background: rgba(255,255,255,0.05);
  border-radius: 1px;
  overflow: hidden;
}

.preloader-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 1px;
  animation: preloaderFill 1.5s ease forwards;
}

@keyframes preloaderFill {
  0%   { width: 0%; }
  60%  { width: 75%; }
  100% { width: 100%; }
}

/* =========================================================
   SEARCH BAR
   ========================================================= */
.icx-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 0 14px;
  transition: var(--transition-fast);
  min-width: 200px;
}

.icx-search:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.icx-search i {
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.icx-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 9px 0;
}

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

/* Quick fix: ensure Inter font fallback works nicely */
body { font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif; }

/* =========================================================
   SSL CERTIFICATE (certs.js) - active certificate card + replace modal
   ========================================================= */
.cert-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.cert-card-header h3 { margin: 0; }
.cert-card-header p { font-size: 0.85rem; color: var(--text-secondary); margin: 4px 0 0 0; }
.cert-card-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cert-card-actions .icx-btn { display: inline-flex; align-items: center; gap: 8px; }

.cert-msg { margin: 8px 0; color: var(--text-secondary); }
.cert-msg-error { color: var(--color-danger); }

.cert-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-surface);
}
.cert-summary-icon { font-size: 1.6rem; color: var(--color-primary); }
.cert-summary-title { min-width: 0; flex: 1; }
.cert-cn { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); word-break: break-all; }
.cert-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.cert-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--border-color);
  color: var(--text-secondary);
}
.cert-badge-active      { background: var(--color-primary-glow); color: var(--color-primary); }
.cert-badge-pending     { background: var(--color-warning-bg); color: var(--color-warning); }
.cert-badge-revoked     { background: var(--color-danger-bg); color: var(--color-danger); }
.cert-badge-exp-ok      { background: var(--color-success-bg); color: var(--color-success); }
.cert-badge-exp-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.cert-badge-exp-danger  { background: var(--color-danger-bg); color: var(--color-danger); }

.cert-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px 24px;
  margin: 18px 0 0 0;
}
.cert-detail { min-width: 0; }
.cert-detail-wide { grid-column: 1 / -1; }
.cert-detail dt { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 3px; }
.cert-detail dd { margin: 0; color: var(--text-primary); word-break: break-word; }
.cert-detail dd.cert-mono { font-family: var(--font-mono); font-size: 0.8rem; word-break: break-all; }

/* Modal */
.cert-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 12, 16, 0.8);
  backdrop-filter: blur(5px);
}
.cert-modal { width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 28px; }
.cert-modal h3 { margin: 0 0 14px 0; }
.cert-modal .form-error { margin-top: 4px; }
.cert-modal-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  margin-bottom: 18px;
  border-radius: 6px;
  background: var(--color-warning-bg);
  color: var(--color-warning);
  font-size: 0.85rem;
}
.cert-modal-notice i { margin-top: 2px; }
.cert-modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}
.cert-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.cert-tab:hover { color: var(--text-primary); }
.cert-tab.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 700; }
.cert-tab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.cert-upload-hint { font-size: 0.85rem; color: var(--text-secondary); margin: 0 0 14px 0; }
.cert-file-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px dashed var(--border-color-active);
  border-radius: 6px;
  background: var(--bg-surface);
}
.cert-file-picker:focus-within { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.cert-file-picker input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.cert-file-icon { font-size: 1.4rem; color: var(--color-primary); }
.cert-file-icon-key { color: var(--color-warning); }
.cert-file-name { flex: 1; min-width: 0; font-size: 0.85rem; color: var(--text-primary); word-break: break-all; }
.cert-modal-error {
  display: none;
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--color-danger-bg);
  color: var(--color-danger);
  font-size: 0.85rem;
}
.cert-modal-buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; margin-top: 24px; }
.cert-modal-buttons .icx-btn { display: inline-flex; align-items: center; gap: 8px; }
#cert-modal-submit.is-busy { opacity: 0.6; cursor: progress; }

@media (max-width: 600px) {
  .cert-card-actions, .cert-card-actions .icx-btn { width: 100%; justify-content: center; }
  .cert-modal { padding: 20px 16px; }
  .cert-modal .form-row-2 { grid-template-columns: 1fr; gap: 0; }
  .cert-modal-buttons .icx-btn { flex: 1; justify-content: center; }
  .cert-details { grid-template-columns: 1fr; }
}
