/* ═══════════════════════════════════════════════════
   BASE.CSS — Design Tokens, Reset, Typography
   NetworkSecurity IDS Dashboard
═══════════════════════════════════════════════════ */

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

/* ── Design Tokens ──────────────────────────────── */
:root,
:root[data-theme="dark"] {
  /* Dark Colors */
  --bg-primary:     transparent;
  --bg-secondary:   transparent;
  --bg-card:        rgba(19, 25, 41, 0.65);
  --bg-card-hover:  rgba(24, 32, 56, 0.85);
  --bg-sidebar:     rgba(13, 18, 32, 0.7);
  --bg-input:       rgba(26, 34, 53, 0.6);

  --border:         rgba(255,255,255,0.05);
  --border-active:  rgba(0,212,255,0.4);
  --bg-hover-subtle: rgba(255,255,255,0.04);
  --bg-hover-strong: rgba(255,255,255,0.06);

  --accent-cyan:    #00d4ff;
  --accent-blue:    #4f8ef7;
  --accent-green:   #00e676;
  --accent-red:     #ff4757;
  --accent-orange:  #ffa502;
  --accent-purple:  #a55eea;

  --text-primary:   #e8eaf0;
  --text-secondary: #7a8299;
  --text-muted:     #4a5270;

  --card-shadow:    none;

  /* Glow effects */
  --glow-cyan:   0 0 20px rgba(0,212,255,0.25);
  --glow-green:  0 0 20px rgba(0,230,118,0.25);
  --glow-red:    0 0 20px rgba(255,71,87,0.25);
  --glow-blue:   0 0 20px rgba(79,142,247,0.25);

  /* Buttons */
  --btn-primary-bg: var(--grad-cyan);
  --btn-primary-text: #000;
  --btn-primary-shadow: rgba(0,212,255,0.25);
}

:root[data-theme="light"] {
  /* Light Colors */
  --bg-primary:     transparent;
  --bg-secondary:   transparent;
  --bg-card:        rgba(255, 255, 255, 0.7);
  --bg-card-hover:  rgba(255, 255, 255, 0.9);
  --bg-sidebar:     rgba(255, 255, 255, 0.7);
  --bg-input:       rgba(241, 245, 249, 0.6);

  --border:         rgba(0,0,0,0.06);
  --border-active:  rgba(0,212,255,0.6);
  --bg-hover-subtle: rgba(0,0,0,0.04);
  --bg-hover-strong: rgba(0,0,0,0.06);

  --accent-cyan:    #0099ff;
  --accent-blue:    #2563eb;
  --accent-green:   #10b981;
  --accent-red:     #ef4444;
  --accent-orange:  #f59e0b;
  --accent-purple:  #8b5cf6;

  --text-primary:   #1e293b;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;

  --card-shadow:    0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);

  /* Thinner glow for light mode, or use standard shadows */
  --glow-cyan:   0 4px 14px rgba(0, 153, 255, 0.3);
  --glow-green:  0 4px 14px rgba(16, 185, 129, 0.3);
  --glow-red:    0 4px 14px rgba(239, 68, 68, 0.3);
  --glow-blue:   0 4px 14px rgba(37, 99, 235, 0.3);

  /* Buttons */
  --btn-primary-bg: linear-gradient(135deg, #0ea5e9, #3b82f6);
  --btn-primary-text: #ffffff;
  --btn-primary-shadow: rgba(59, 130, 246, 0.35);
}


:root {
  /* Gradients */
  --grad-cyan:   linear-gradient(135deg, #00d4ff, #4f8ef7);
  --grad-green:  linear-gradient(135deg, #00e676, #00bcd4);
  --grad-red:    linear-gradient(135deg, #ff4757, #c0392b);
  --grad-purple: linear-gradient(135deg, #a55eea, #4f8ef7);

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Border radius */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  /* Sidebar width */
  --sidebar-w:  260px;
  --topbar-h:   64px;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Font */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}


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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--grad-cyan);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--glow-cyan);
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.logo-subtitle {
  font-size: 10px;
  color: var(--accent-cyan);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) 0;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: var(--space-sm) var(--space-lg);
  margin-top: var(--space-md);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-lg);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
  margin: 1px 0;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(0,212,255,0.06);
}

.nav-item.active {
  color: var(--accent-cyan);
  background: rgba(0,212,255,0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--grad-cyan);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}

.system-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

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

/* ── Topbar ──────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  flex-direction: column;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-breadcrumb {
  font-size: 11px;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.topbar-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.badge-live {
  padding: 3px 10px;
  background: rgba(0,230,118,0.15);
  color: var(--accent-green);
  border: 1px solid rgba(0,230,118,0.3);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,230,118,0.3); }
  50%       { box-shadow: 0 0 0 4px rgba(0,230,118,0); }
}

/* ── Page Content ────────────────────────────────── */
.page-content {
  padding: var(--space-xl);
  flex: 1;
}

/* ── Grid Layouts ────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-1 { display: grid; grid-template-columns: 1fr; gap: var(--space-lg); }

/* ── Section Spacing ─────────────────────────────── */
.section { margin-bottom: var(--space-xl); }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ── Utility Classes ─────────────────────────────── */
.text-cyan   { color: var(--accent-cyan); }
.text-green  { color: var(--accent-green); }
.text-red    { color: var(--accent-red); }
.text-orange { color: var(--accent-orange); }
.text-muted  { color: var(--text-muted); }
.font-mono   { font-family: var(--font-mono); }
.mb-lg       { margin-bottom: var(--space-lg); }
.mb-xl       { margin-bottom: var(--space-xl); }
.gap-md      { gap: var(--space-md); }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Light mode specific sidebar improvements */
[data-theme="light"] .nav-item.active {
  background: var(--bg-hover-subtle);
  color: #0ea5e9;
  font-weight: 600;
}
[data-theme="light"] .nav-item:hover {
  background: var(--bg-hover-subtle);
}
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}
.nav-item.active .nav-icon {
  opacity: 1;
}

/* ── Animated Background ────────────────────────── */
.animated-mesh-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background-size: 200% 200%;
  animation: bgGradient 20s ease infinite;
}

:root[data-theme="dark"] .animated-mesh-bg {
  background-image: radial-gradient(circle at 15% 50%, rgba(0, 212, 255, 0.08), transparent 25%),
                    radial-gradient(circle at 85% 30%, rgba(165, 94, 234, 0.08), transparent 25%),
                    linear-gradient(135deg, #0a0e1a, #0b111e, #0e1422, #0d1220);
}

:root[data-theme="light"] .animated-mesh-bg {
  background-image: radial-gradient(circle at 15% 50%, rgba(0, 153, 255, 0.05), transparent 25%),
                    radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.05), transparent 25%),
                    linear-gradient(135deg, #f4f7f9, #eff3f6, #f8fafc, #f4f7f9);
}

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