/* ============================================================
   base.css — Variables, Reset, Layout, Sidebar, Topbar
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  --navy-950: #050c1a;
  --navy-900: #0a1628;
  --navy-800: #0f2040;
  --navy-700: #1a3055;
  --navy-600: #1e3a6e;
  --navy-500: #2a5298;

  --teal-600: #0891b2;
  --teal-500: #06b6d4;
  --teal-400: #22d3ee;
  --teal-300: #67e8f9;

  --emerald-600: #059669;
  --emerald-500: #10b981;

  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-400: #fbbf24;

  --rose-700: #be123c;
  --rose-600: #e11d48;
  --rose-500: #f43f5e;
  --rose-100: #ffe4e6;

  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;

  --white: #ffffff;

  --sidebar-w: 260px;
  --header-h:  64px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1),  0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --transition: all 0.2s ease;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  background: var(--slate-100);
  color: var(--slate-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  border-right: 1px solid var(--navy-700);
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--navy-700);
}

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

.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--teal-500), var(--navy-500));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(6,182,212,0.3);
}

.brand-text h1 { font-size: 15px; font-weight: 700; letter-spacing: 0.5px; color: var(--white); }
.brand-text p  { font-size: 10px; color: var(--teal-400); letter-spacing: 1px; text-transform: uppercase; font-weight: 500; }

.sidebar-section { padding: 16px 12px 8px; }

.sidebar-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--navy-500);
  padding: 0 8px; margin-bottom: 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  cursor: pointer; color: var(--slate-400);
  font-weight: 500; font-size: 13.5px;
  transition: var(--transition); margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--navy-800); color: var(--white); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(6,182,212,0.2), rgba(42,82,152,0.2));
  color: var(--teal-400);
  border: 1px solid rgba(6,182,212,0.2);
}
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 16px; }

.nav-badge {
  margin-left: auto;
  background: var(--rose-600); color: white;
  font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}
.nav-badge.teal { background: var(--teal-600); }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--navy-700);
}

.user-card { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--teal-600), var(--navy-500));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white; flex-shrink: 0;
}

.user-info  { flex: 1; min-width: 0; }
.user-name  { font-size: 12px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 10px; color: var(--slate-400); }

/* ─── Main Content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.topbar-title    { font-size: 18px; font-weight: 700; color: var(--navy-800); }
.topbar-subtitle { font-size: 12px; color: var(--slate-500); margin-left: 4px; }
.topbar-spacer   { flex: 1; }

.topbar-info {
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; color: var(--slate-500);
}

.live-indicator { display: flex; align-items: center; gap: 5px; color: var(--emerald-500); font-weight: 500; }

.live-dot {
  width: 7px; height: 7px;
  background: var(--emerald-500); border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ─── Page Content ───────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }
.page         { display: none; }
.page.active  { display: block; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar-info  { display: none; }
}

/* ─── Misc utilities ─────────────────────────────────────────── */
.d-block   { display: block; }
.text-muted { color: var(--slate-500); }
.small     { font-size: 11px; }
.mt-2      { margin-top: 8px; }
.mb-3      { margin-bottom: 12px; }
.table-responsive { overflow-x: auto; }
.actions-cell     { white-space: nowrap; }

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

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

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--slate-100); }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }
