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

:root {
  --bg-primary: #060b14;
  --bg-secondary: #0d1320;
  --bg-card: #111827;
  --bg-card-hover: #1a2235;
  --bg-input: #1a2235;
  --bg-glass: rgba(17, 24, 39, 0.8);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(16, 185, 129, 0.5);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --green-400: #34d399;
  --green-500: #10b981;
  --green-600: #059669;
  --green-700: #047857;
  --purple-400: #a78bfa;
  --purple-500: #8b5cf6;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --red-400: #f87171;
  --red-500: #ef4444;
  --yellow-400: #fbbf24;
  --yellow-500: #f59e0b;
  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5);
  --shadow-glow-green: 0 0 20px rgba(16,185,129,0.15);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --sidebar-width: 260px;
}

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

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

a { color: var(--green-400); text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: var(--radius-full); }

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

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--green-400), var(--cyan-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem; font-weight: 500;
  transition: all var(--transition-fast);
  text-decoration: none;
}

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

.nav-item.active {
  background: rgba(16,185,129,0.1);
  color: var(--green-400);
  box-shadow: inset 3px 0 0 var(--green-500);
}

.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

.connection-status {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; color: var(--text-muted);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red-500);
}

.status-dot.connected {
  background: var(--green-500);
  box-shadow: 0 0 8px var(--green-500);
  animation: pulse-dot 2s infinite;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 90;
  backdrop-filter: blur(10px);
}

.top-bar h1 {
  font-size: 1.4rem; font-weight: 700;
}

.top-bar-actions {
  display: flex; align-items: center; gap: 0.75rem;
}

.page-content {
  padding: 2rem;
  flex: 1;
}

/* ===== GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.25rem;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .sidebar { width: 72px; }
  .sidebar .sidebar-brand, .sidebar .nav-label, .sidebar .nav-item span { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 0.75rem; }
  .main-content { margin-left: 72px; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .groups-grid { grid-template-columns: 1fr; }
}

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