/* =============================================
   Admin Panel Styles
   ============================================= */

:root {
  --sidebar-width: 260px;
  --sidebar-bg: #0f172a;
  --topbar-h: 60px;
}

body.admin-body {
  background: #f1f5f9;
  overflow-x: hidden;
}

/* Sidebar */
.admin-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: #334155; }

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-user {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 0.5rem;
}

.sidebar-nav { padding: 0.5rem 0.75rem 2rem; flex: 1; }
.sidebar-nav .nav-section {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: #475569; padding: 1rem 0.75rem 0.4rem;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  color: #94a3b8; font-size: 0.875rem; font-weight: 500;
  border-radius: 8px; text-decoration: none;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}
.sidebar-nav .nav-link i { font-size: 1rem; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar-nav .nav-link.active { color: #fff; background: #1a3c5e; }
.sidebar-nav .nav-link .ms-auto { margin-left: auto; }

/* Main area */
.admin-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transition: margin-left 0.3s ease;
  background: #f1f5f9;
}

/* Wrap content with max-width constraint */
.admin-content-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  background: #f1f5f9;
}

/* Topbar */
.admin-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* Content */
.admin-content {
  padding: 1.75rem 2rem;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Page Title */
.admin-page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

/* Stat Cards */
.admin-stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all 0.3s ease;
}
.admin-stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }
.admin-stat-card .stat-icon-wrap {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.admin-stat-card .stat-val { font-size: 1.75rem; font-weight: 800; line-height: 1; color: #1e293b; }
.admin-stat-card .stat-lbl { font-size: 0.82rem; color: #64748b; font-weight: 500; }
.admin-stat-card .stat-trend { font-size: 0.78rem; font-weight: 600; }
.stat-icon-wrap.blue { background: rgba(37,99,235,0.1); color: #2563eb; }
.stat-icon-wrap.green { background: rgba(22,163,74,0.1); color: #16a34a; }
.stat-icon-wrap.orange { background: rgba(234,88,12,0.1); color: #ea580c; }
.stat-icon-wrap.purple { background: rgba(124,58,237,0.1); color: #7c3aed; }
.stat-icon-wrap.red { background: rgba(220,38,38,0.1); color: #dc2626; }
.stat-icon-wrap.teal { background: rgba(20,184,166,0.1); color: #14b8a6; }
.stat-icon-wrap.yellow { background: rgba(202,138,4,0.1); color: #ca8a04; }
.stat-icon-wrap.indigo { background: rgba(79,70,229,0.1); color: #4f46e5; }

/* Chart card */
.chart-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 1.5rem;
}
.chart-card .chart-title { font-size: 1rem; font-weight: 700; color: #1e293b; }

/* Data table card */
.data-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}
.data-card .data-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.data-card .data-card-header h6 { font-size: 1rem; font-weight: 700; color: #1e293b; margin: 0; }
.data-card .table th {
  background: #f8fafc;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
}
.data-card .table td { padding: 0.85rem 1rem; font-size: 0.875rem; border-bottom: 1px solid #f1f5f9; }
.data-card .table tr:last-child td { border-bottom: none; }

/* Avatar small */
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; font-size: 0.85rem; }
.avatar-xs { width: 26px; height: 26px; border-radius: 50%; font-size: 0.7rem; }

/* Occupancy bar */
.occupancy-bar { height: 8px; border-radius: 4px; background: #e2e8f0; overflow: hidden; }
.occupancy-bar-fill { height: 100%; border-radius: 4px; transition: width 1s ease; }

/* Priority indicators */
.priority-emergency { border-left: 4px solid #dc2626 !important; }
.priority-high { border-left: 4px solid #ea580c !important; }
.priority-medium { border-left: 4px solid #ca8a04 !important; }
.priority-low { border-left: 4px solid #64748b !important; }

/* Sidebar collapsed (mobile) */
.sidebar-collapsed .admin-sidebar { transform: translateX(-100%); }
.sidebar-collapsed .admin-main { margin-left: 0; }

/* Action buttons */
.btn-action { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 0.85rem; }

/* Form card */
.form-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 1.75rem;
}
.form-section-title {
  font-size: 0.9rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #1a3c5e; margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
}

/* Quick action buttons */
.quick-action {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 12px; text-decoration: none;
  color: #1e293b; font-size: 0.875rem; font-weight: 500;
  transition: all 0.2s ease;
}
.quick-action:hover { background: #f0f6ff; border-color: #1a3c5e; color: #1a3c5e; transform: translateX(4px); }
.quick-action i { font-size: 1.1rem; color: #1a3c5e; }

/* Dark mode admin */
[data-bs-theme="dark"] .admin-topbar { background: #1e293b; border-color: #334155; }
[data-bs-theme="dark"] body.admin-body { background: #0f172a; }
[data-bs-theme="dark"] .admin-stat-card,
[data-bs-theme="dark"] .chart-card,
[data-bs-theme="dark"] .data-card,
[data-bs-theme="dark"] .form-card { background: #1e293b; border-color: #334155; }
[data-bs-theme="dark"] .admin-stat-card .stat-val,
[data-bs-theme="dark"] .data-card .data-card-header h6 { color: #f1f5f9; }
[data-bs-theme="dark"] .data-card .table th { background: #0f172a; color: #94a3b8; border-color: #334155; }
[data-bs-theme="dark"] .data-card .table td { color: #e2e8f0; border-color: #1e293b; }
[data-bs-theme="dark"] .quick-action { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-bs-theme="dark"] .quick-action:hover { background: #0f172a; border-color: #2563eb; color: #93c5fd; }

@media (max-width: 992px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.show { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 1rem; }
}
