/* /opt/nexia/web/static/css/nexia.css */

/* -- Variables -- */
:root {
  --nexia-primary:     #0EA5E9;
  --nexia-primary-dark:#0284C7;
  --nexia-accent:      #F59E0B;
  --bg-base:           #0F172A;
  --bg-panel:          #1E293B;
  --bg-card:           #263549;
  --bg-hover:          #2D3E56;
  --text-primary:      #F1F5F9;
  --text-secondary:    #94A3B8;
  --text-muted:        #64748B;
  --border:            #334155;
  --border-light:      #475569;
  --success:           #10B981;
  --warning:           #F59E0B;
  --danger:            #EF4444;
  --info:              #0EA5E9;
  --sidebar-width:     240px;
  --sidebar-bg:        #0D1929;
  --sidebar-active:    #0EA5E9;
  --font-sans:         'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:         'JetBrains Mono', 'Fira Code', monospace;
  --radius:            6px;
  --radius-lg:         10px;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

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

/* -- Sidebar -- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
}
.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo img { height: 32px; }
.sidebar-logo-text {
  font-size: 20px; font-weight: 700;
  color: var(--nexia-primary); letter-spacing: 3px;
}
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  letter-spacing: 1.5px; text-transform: uppercase; padding: 12px 16px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; color: var(--text-secondary);
  text-decoration: none; transition: all 0.15s;
  cursor: pointer; border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: rgba(14, 165, 233, 0.1);
  color: var(--nexia-primary); border-left-color: var(--nexia-primary);
}

/* -- Main content -- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1; display: flex; flex-direction: column;
}

/* -- Topbar -- */
.topbar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }

/* -- Tables -- */
.nexia-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.nexia-table thead th {
  background: var(--bg-panel); color: var(--text-muted);
  font-weight: 500; font-size: 11px; letter-spacing: 0.8px;
  text-transform: uppercase; padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  cursor: pointer; user-select: none;
}
.nexia-table thead th:hover { color: var(--text-primary); }
.nexia-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.nexia-table tbody tr:hover { background: var(--bg-hover); }
.nexia-table td { padding: 10px 14px; color: var(--text-primary); white-space: nowrap; }
.nexia-table td.mono { font-family: var(--font-mono); font-size: 12px; color: var(--nexia-primary); }

/* -- Badges -- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 500;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active   { background: rgba(16,185,129,.15); color: var(--success); }
.badge-inactive { background: rgba(100,116,139,.15); color: var(--text-muted); }
.badge-blocked  { background: rgba(239,68,68,.15);   color: var(--danger); }
.badge-warning  { background: rgba(245,158,11,.15);  color: var(--warning); }

/* -- KPI Cards -- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; padding: 24px;
}
.kpi-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  position: relative; overflow: hidden;
}
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.kpi-card.primary::before { background: var(--nexia-primary); }
.kpi-card.success::before { background: var(--success); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.danger::before  { background: var(--danger); }
.kpi-label { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text-primary); margin: 6px 0; font-variant-numeric: tabular-nums; }
.kpi-sub   { font-size: 12px; color: var(--text-secondary); }

/* -- Live indicator -- */
.live-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--success); font-weight: 500; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse-live 1.5s ease-in-out infinite; }
@keyframes pulse-live { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.85); } }

/* -- Forms -- */
.nexia-form .form-group { margin-bottom: 16px; }
.nexia-form label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.nexia-input, .nexia-select {
  width: 100%; background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-family: var(--font-sans); font-size: 13px; padding: 8px 12px;
  outline: none; transition: border-color 0.15s;
}
.nexia-input:focus, .nexia-select:focus { border-color: var(--nexia-primary); box-shadow: 0 0 0 3px rgba(14,165,233,.15); }

/* -- Buttons -- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; transition: all 0.15s; text-decoration: none;
}
.btn-primary { background: var(--nexia-primary); color: white; }
.btn-primary:hover { background: var(--nexia-primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger  { background: var(--danger); color: white; }
.btn-ghost   { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* -- Login page -- */
.login-container {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg-base);
}
.login-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px; width: 400px; max-width: 90vw;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { height: 48px; margin-bottom: 12px; }
.login-title { font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: 3px; }
.login-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.login-error { background: rgba(239,68,68,.1); color: var(--danger); padding: 8px 12px; border-radius: var(--radius); font-size: 12px; margin-bottom: 16px; display: none; }

/* -- Content area -- */
.content-area { padding: 24px; }

/* -- Responsive -- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
}
