/*
 * NetOps Portal — Main Stylesheet
 * Design: Dark-primary sidebar with clean white content area.
 * Palette: Deep navy (#0f172a) sidebar, electric blue (#3b82f6) accents,
 *          neutral slate grays for content, semantic status colors.
 * Typography: Inter (UI), JetBrains Mono (data/code)
 */

/* ─── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  /* Sidebar */
  --sidebar-bg: #0f172a;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 0px;
  --sidebar-border: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f8fafc;
  --sidebar-active-bg: rgba(59, 130, 246, 0.15);
  --sidebar-active-border: #3b82f6;
  --sidebar-hover-bg: rgba(255,255,255,0.05);

  /* Topbar */
  --topbar-height: 60px;
  --topbar-bg: #ffffff;
  --topbar-border: #e2e8f0;

  /* Content */
  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  /* Brand */
  --brand-blue: #3b82f6;
  --brand-blue-dark: #2563eb;
  --brand-green: #22c55e;
  --brand-red: #ef4444;
  --brand-orange: #f97316;
  --brand-purple: #a855f7;
  --brand-teal: #14b8a6;
  --brand-indigo: #6366f1;
  --brand-cyan: #06b6d4;
  --brand-amber: #f59e0b;
  --brand-slate: #64748b;

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

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

/* Dark mode overrides */
[data-bs-theme="dark"] {
  --topbar-bg: #1e293b;
  --topbar-border: #334155;
  --body-bg: #0f172a;
  --card-bg: #1e293b;
  --card-border: #334155;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
}

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

body {
  font-family: var(--font-ui);
  background: var(--body-bg);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── AUTHENTICATED LAYOUT ───────────────────────────────────────────────────── */
/* Sidebar */
.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: 1050;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: var(--topbar-height);
  flex-shrink: 0;
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--brand-blue);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-text { flex: 1; line-height: 1.2; }
.brand-name { display: block; color: #f8fafc; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-subtitle { display: block; color: var(--sidebar-text); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }

.sidebar-close {
  background: none; border: none;
  color: var(--sidebar-text); cursor: pointer;
  padding: 4px; border-radius: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-list {
  list-style: none;
  padding: 0; margin: 0;
}

.nav-item { padding: 2px 10px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-link:hover:not(.nav-link--disabled) {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-active);
}

.nav-link--active {
  background: var(--sidebar-active-bg) !important;
  color: #60a5fa !important;
  border-left: 2px solid var(--sidebar-active-border);
}

.nav-link--disabled {
  opacity: 0.4;
  cursor: default;
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge {
  font-size: 10px;
  background: rgba(255,255,255,0.1);
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
}

.user-avatar {
  width: 32px; height: 32px;
  background: var(--brand-blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info { flex: 1; min-width: 0; }
.user-name { color: #e2e8f0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--sidebar-text); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-logout {
  color: var(--sidebar-text);
  padding: 5px;
  border-radius: 6px;
  transition: all var(--transition);
  text-decoration: none;
  font-size: 15px;
  flex-shrink: 0;
}
.btn-logout:hover { color: var(--brand-red); background: rgba(239,68,68,0.15); }

/* Main Wrapper */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky; top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

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

.topbar-toggle {
  width: 36px; height: 36px;
  background: none; border: 1px solid var(--card-border);
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-secondary);
  transition: all var(--transition);
}
.topbar-toggle:hover { background: var(--body-bg); color: var(--text-primary); }

.breadcrumb { font-size: 13px; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
.breadcrumb-item a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-primary); font-weight: 500; }

.status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px; font-weight: 500;
  background: rgba(34,197,94,0.1);
  color: #15803d;
  border: 1px solid rgba(34,197,94,0.2);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand-green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.icon-btn {
  width: 36px; height: 36px;
  background: none; border: 1px solid var(--card-border);
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--body-bg); color: var(--text-primary); }

.badge-alert {
  position: absolute; top: -3px; right: -3px;
  width: 14px; height: 14px;
  padding: 0; font-size: 9px;
  background: var(--brand-red) !important;
  border: 2px solid var(--topbar-bg);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}

.user-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--card-border);
  border-radius: 8px; padding: 5px 10px;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  cursor: pointer; transition: all var(--transition);
}
.user-btn:hover { background: var(--body-bg); }

.user-avatar-sm {
  width: 26px; height: 26px;
  background: var(--brand-blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; font-weight: 700;
}

/* Page Content */
.page-content {
  flex: 1;
  padding: 24px;
}

.messages-container { margin-bottom: 16px; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Page Footer */
.page-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--card-border);
  font-size: 12px;
  color: var(--text-muted);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
}

/* ─── KPI CARDS ──────────────────────────────────────────────────────────────── */
.kpi-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.kpi-card--sm { padding: 14px 16px; border-radius: 10px; }

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.kpi-card--sm .kpi-icon { width: 38px; height: 38px; font-size: 18px; border-radius: 9px; }

.kpi-body { flex: 1; min-width: 0; }
.kpi-value { font-size: 28px; font-weight: 800; line-height: 1; font-family: var(--font-mono); letter-spacing: -0.03em; }
.kpi-card--sm .kpi-value { font-size: 22px; }
.kpi-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); margin-top: 4px; }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* KPI Color Variants */
.kpi-card--blue .kpi-icon { background: rgba(59,130,246,0.1); color: var(--brand-blue); }
.kpi-card--green .kpi-icon { background: rgba(34,197,94,0.1); color: var(--brand-green); }
.kpi-card--red .kpi-icon { background: rgba(239,68,68,0.1); color: var(--brand-red); }
.kpi-card--orange .kpi-icon { background: rgba(249,115,22,0.1); color: var(--brand-orange); }
.kpi-card--purple .kpi-icon { background: rgba(168,85,247,0.1); color: var(--brand-purple); }
.kpi-card--teal .kpi-icon { background: rgba(20,184,166,0.1); color: var(--brand-teal); }
.kpi-card--indigo .kpi-icon { background: rgba(99,102,241,0.1); color: var(--brand-indigo); }
.kpi-card--cyan .kpi-icon { background: rgba(6,182,212,0.1); color: var(--brand-cyan); }
.kpi-card--amber .kpi-icon { background: rgba(245,158,11,0.1); color: var(--brand-amber); }
.kpi-card--slate .kpi-icon { background: rgba(100,116,139,0.1); color: var(--brand-slate); }

.kpi-card--blue .kpi-value { color: var(--brand-blue); }
.kpi-card--green .kpi-value { color: var(--brand-green); }
.kpi-card--red .kpi-value { color: var(--brand-red); }
.kpi-card--orange .kpi-value { color: var(--brand-orange); }
.kpi-card--purple .kpi-value { color: var(--brand-purple); }
.kpi-card--teal .kpi-value { color: var(--brand-teal); }
.kpi-card--indigo .kpi-value { color: var(--brand-indigo); }
.kpi-card--cyan .kpi-value { color: var(--brand-cyan); }
.kpi-card--amber .kpi-value { color: var(--brand-amber); }
.kpi-card--slate .kpi-value { color: var(--brand-slate); }

/* ─── CARDS ──────────────────────────────────────────────────────────────────── */
.card-netops {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}

.card-netops .card-header {
  background: transparent;
  border-bottom: 1px solid var(--card-border);
  padding: 14px 18px;
  font-weight: 600;
}

.card-netops .card-body { padding: 18px; }

.card-netops .card-footer {
  background: transparent;
  border-top: 1px solid var(--card-border);
  padding: 12px 18px;
}

.card-title { font-weight: 600; font-size: 14px; color: var(--text-primary); }

/* ─── ACTIVITY FEED ──────────────────────────────────────────────────────────── */
.activity-feed { padding: 8px 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--card-border);
  transition: background var(--transition);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: rgba(59,130,246,0.03); }
.activity-icon { width: 28px; flex-shrink: 0; font-size: 16px; margin-top: 1px; }
.activity-msg { font-size: 13.5px; color: var(--text-primary); }
.activity-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.activity-time { font-family: var(--font-mono); }

/* ─── STAT MINI ──────────────────────────────────────────────────────────────── */
.stat-mini {
  padding: 10px;
  border-radius: 8px;
}
.stat-mini-val { font-size: 20px; font-weight: 700; font-family: var(--font-mono); }
.stat-mini-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.stat-mini--blue { background: rgba(59,130,246,0.08); color: var(--brand-blue); }
.stat-mini--orange { background: rgba(249,115,22,0.08); color: var(--brand-orange); }
.stat-mini--green { background: rgba(34,197,94,0.08); color: var(--brand-green); }

/* ─── MODULE STATUS LIST ─────────────────────────────────────────────────────── */
.module-status-list { padding: 4px 0; }
.module-status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--card-border);
  font-size: 13.5px;
}
.module-status-item:last-child { border-bottom: none; }

/* ─── PROGRESS ───────────────────────────────────────────────────────────────── */
.progress-netops {
  height: 8px;
  border-radius: 4px;
  background: var(--card-border);
}

/* ─── TABLE ──────────────────────────────────────────────────────────────────── */
.table-netops {
  font-size: 13.5px;
  margin: 0;
}
.table-netops thead th {
  background: var(--body-bg);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  padding: 10px 16px;
  border-bottom: 1px solid var(--card-border);
}
.table-netops tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--card-border);
}
.table-netops tbody tr:last-child td { border-bottom: none; }
.table-netops tbody tr:hover { background: rgba(59,130,246,0.03); }

/* ─── AVATARS ────────────────────────────────────────────────────────────────── */
.avatar-sm {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-indigo));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.avatar-lg {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-indigo));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 32px;
}

/* ─── ROLES CHECKLIST ────────────────────────────────────────────────────────── */
.role-checklist {
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
}
.role-check-item {
  padding: 11px 14px;
  border-bottom: 1px solid var(--card-border);
  margin: 0;
  transition: background var(--transition);
}
.role-check-item:last-child { border-bottom: none; }
.role-check-item:hover { background: rgba(59,130,246,0.04); }
.role-check-item label { cursor: pointer; }

/* ─── LOGIN PAGE ─────────────────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.login-page {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.login-brand-panel {
  width: 45%;
  background: linear-gradient(155deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  padding: 48px;
  position: relative;
  overflow: hidden;
}
.login-brand-panel::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(99,102,241,0.3), transparent 70%);
  border-radius: 50%;
}
.login-brand-panel::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -80px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(59,130,246,0.2), transparent 70%);
  border-radius: 50%;
}

.login-brand-content { flex: 1; position: relative; z-index: 1; }

.login-logo {
  width: 64px; height: 64px;
  background: rgba(99,102,241,0.2);
  border: 1px solid rgba(99,102,241,0.4);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: #818cf8;
  margin-bottom: 28px;
}

.login-brand-name {
  font-size: 36px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.login-brand-tagline {
  color: #94a3b8;
  font-size: 15px;
  margin: 0 0 48px;
}

.login-features { display: flex; flex-direction: column; gap: 16px; }
.login-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #cbd5e1;
  font-size: 14px;
}
.login-feature i {
  font-size: 20px;
  color: #818cf8;
  width: 24px;
}

.login-brand-footer {
  font-size: 12px;
  color: #475569;
  position: relative; z-index: 1;
}

.login-form-panel {
  flex: 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.login-form-inner {
  width: 100%;
  max-width: 400px;
}

.login-form-header {
  margin-bottom: 32px;
}
.login-form-header h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0 0 6px;
}
.login-form-header p {
  color: #64748b;
  font-size: 14px;
  margin: 0;
}

.login-form-footer {
  margin-top: 24px;
  text-align: center;
}

/* ─── MOBILE RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.sidebar--open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }
  .sidebar-overlay.overlay--visible { display: block; }
  .main-wrapper { margin-left: 0; }
}

@media (max-width: 767px) {
  .login-brand-panel { display: none; }
  .login-form-panel { padding: 32px 24px; }
  .page-content { padding: 16px; }
  .kpi-value { font-size: 22px; }
}

/* ─── UTILITIES ──────────────────────────────────────────────────────────────── */
.font-mono { font-family: var(--font-mono) !important; }

/* Bootstrap override: make form controls match design */
.form-control, .form-select {
  font-size: 14px;
  border-color: var(--card-border);
  border-radius: 8px;
  padding: 8px 12px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.btn { border-radius: 8px; font-weight: 500; font-size: 14px; }
.btn-primary { background: var(--brand-blue); border-color: var(--brand-blue); }
.btn-primary:hover { background: var(--brand-blue-dark); border-color: var(--brand-blue-dark); }

.dropdown-menu {
  border-radius: 10px;
  border-color: var(--card-border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  font-size: 13.5px;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.sidebar::-webkit-scrollbar-thumb { background: #1e293b; }
