/* ═══════════════════════════════════════════════
   CIDADE DIGITAL — Design System
   Aesthetic: Government Network Control Panel
   Dark sidebar + clean white workspace
   ═══════════════════════════════════════════════ */

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

/* ─── Variables ─────────────────────────────── */
:root {
  --sidebar-w: 240px;

  --navy-900: #0b1120;
  --navy-800: #111827;
  --navy-700: #1f2937;
  --navy-600: #374151;

  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;

  --green-500: #10b981;
  --green-100: #d1fae5;
  --red-500:   #ef4444;
  --red-100:   #fee2e2;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;

  --white: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--gray-50);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy-800);
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid var(--navy-700);
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--navy-700);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-icon {
  width: 34px; height: 34px;
  background: var(--blue-500);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand-text {
  line-height: 1.2;
}

.sidebar-brand-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  display: block;
  letter-spacing: 0.02em;
}

.sidebar-brand-sub {
  font-size: 10px;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
}

/* Nav sections */
.sidebar-section {
  padding: 16px 0 8px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray-500);
  padding: 0 20px 6px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  text-decoration: none;
  border-radius: 0;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-nav-item:hover {
  color: var(--white);
  background: var(--navy-700);
  border-left-color: var(--blue-400);
}

.sidebar-nav-item.active {
  color: var(--white);
  background: rgba(59, 130, 246, 0.12);
  border-left-color: var(--blue-500);
}

.sidebar-nav-item i {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--navy-700);
  padding: 14px 20px;
}

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

.sidebar-user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--blue-500), #8b5cf6);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 10px;
  color: var(--gray-500);
  display: block;
  font-weight: 400;
}

.sidebar-logout {
  color: var(--gray-500);
  font-size: 15px;
  text-decoration: none;
  transition: color 0.15s;
  flex-shrink: 0;
}
.sidebar-logout:hover { color: var(--red-500); }

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

/* Top bar */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
}

.topbar-breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* ─── Cards ──────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
}

.card-header.primary {
  background: var(--navy-800);
  border-bottom: none;
  color: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
}

.card-body {
  padding: 20px;
}

/* Stat cards */
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.blue   { background: var(--blue-50);  color: var(--blue-500); }
.stat-icon.green  { background: var(--green-100); color: var(--green-500); }
.stat-icon.red    { background: var(--red-100);   color: var(--red-500); }
.stat-icon.amber  { background: var(--amber-100); color: var(--amber-500); }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── Buttons ────────────────────────────────── */
.btn {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}

.btn:focus { box-shadow: 0 0 0 3px rgba(59,130,246,.25); outline: none; }

.btn-primary {
  background: var(--blue-500);
  color: white;
  border-color: var(--blue-500);
}
.btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
}

.btn-outline-primary {
  background: transparent;
  color: var(--blue-500);
  border-color: var(--blue-500);
}
.btn-outline-primary:hover {
  background: var(--blue-50);
  color: var(--blue-500);
}

.btn-outline-secondary {
  background: transparent;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-outline-secondary:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  border-color: var(--gray-400);
}

.btn-outline-danger {
  background: transparent;
  color: var(--red-500);
  border-color: var(--red-500);
}
.btn-outline-danger:hover {
  background: var(--red-100);
  color: var(--red-500);
}

.btn-outline-warning {
  background: transparent;
  color: #b45309;
  border-color: var(--amber-500);
}
.btn-outline-warning:hover {
  background: var(--amber-100);
  color: #92400e;
}

.btn-outline-info {
  background: transparent;
  color: #0891b2;
  border-color: #0891b2;
}
.btn-outline-info:hover {
  background: #e0f2fe;
  color: #0891b2;
}

.btn-warning {
  background: var(--amber-500);
  color: white;
  border-color: var(--amber-500);
}
.btn-warning:hover { background: #d97706; border-color: #d97706; color: white; }

.btn-sm {
  font-size: 12px;
  padding: 4px 10px;
}

/* ─── Tables ─────────────────────────────────── */
.table {
  font-size: 13px;
  margin-bottom: 0;
}

.table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200) !important;
  padding: 10px 14px;
  white-space: nowrap;
}

.table td {
  padding: 11px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.table tbody tr:hover td {
  background: var(--gray-50);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-bordered { border: 1px solid var(--gray-200); }
.table-bordered th, .table-bordered td { border: none; }

/* ─── Badges ─────────────────────────────────── */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.bg-success { background: var(--green-100) !important; color: #065f46 !important; }
.bg-danger  { background: var(--red-100)   !important; color: #991b1b !important; }
.bg-warning { background: var(--amber-100) !important; color: #92400e !important; }
.bg-secondary { background: var(--gray-100) !important; color: var(--gray-500) !important; }
.bg-primary { background: var(--blue-100)  !important; color: #1d4ed8 !important; }

/* ─── Forms ──────────────────────────────────── */
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control, .form-select {
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
  outline: none;
}

.form-control::placeholder { color: var(--gray-400); }

code, .font-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  color: #7c3aed;
}

/* ─── Alerts ─────────────────────────────────── */
.alert {
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: none;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success {
  background: var(--green-100);
  color: #065f46;
}
.alert-danger {
  background: var(--red-100);
  color: #991b1b;
}
.alert-warning {
  background: var(--amber-100);
  color: #92400e;
}
.alert-dismissible .btn-close { filter: none; opacity: 0.5; }

/* ─── Tabs ───────────────────────────────────── */
.nav-tabs {
  border-bottom: 1px solid var(--gray-200);
  gap: 2px;
}

.nav-tabs .nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  transition: all 0.15s;
}

.nav-tabs .nav-link:hover {
  color: var(--gray-900);
  border-bottom-color: var(--gray-300);
  background: transparent;
}

.nav-tabs .nav-link.active {
  color: var(--blue-500);
  border-bottom-color: var(--blue-500);
  background: transparent;
  font-weight: 600;
}

/* ─── Status indicators ──────────────────────── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.online  { background: var(--green-500); box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
.status-dot.offline { background: var(--gray-400); }

/* ─── Page header ────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.page-header-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* ─── Login page ─────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
  background: var(--gray-50);
}

.login-panel-left {
  background: var(--navy-800);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.login-panel-left::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(59,130,246,.2) 0%, transparent 70%);
  pointer-events: none;
}

.login-panel-left::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -80px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(139,92,246,.15) 0%, transparent 70%);
  pointer-events: none;
}

.login-left-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  z-index: 1;
}

.login-left-icon {
  width: 44px; height: 44px;
  background: var(--blue-500);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: white;
}

.login-left-name {
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.login-left-tagline {
  font-size: 11px;
  color: var(--gray-500);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-left-content {
  z-index: 1;
}

.login-left-headline {
  font-size: 32px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
  margin-bottom: 14px;
}

.login-left-headline span {
  color: var(--blue-400);
}

.login-left-desc {
  font-size: 14px;
  color: var(--gray-400);
  line-height: 1.7;
  max-width: 380px;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--gray-400);
}

.login-feature i {
  color: var(--blue-400);
  width: 16px;
}

.login-panel-right {
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  border-left: 1px solid var(--gray-200);
}

.login-form-wrapper {
  width: 100%;
  max-width: 360px;
}

.login-form-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.login-form-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ─── Grid utilities ─────────────────────────── */
.g-3  { gap: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-2 { margin-bottom: 8px  !important; }
.mt-3 { margin-top: 12px    !important; }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 1024px) {
  .login-wrapper { grid-template-columns: 1fr; }
  .login-panel-left { display: none; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

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

/* ─── Misc ───────────────────────────────────── */
.table-responsive { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--gray-200); }
.fw-bold { font-weight: 600 !important; }
.text-muted { color: var(--text-muted) !important; }
hr { border-color: var(--gray-200); }
