/* ============================================================
   DPC Algérie — Dashboard CSS
   Design: Dark Professional Theme
   ============================================================ */

/* ── Variables ── */
:root {
  --bg:           #0D1117;
  --bg-2:         #161B22;
  --bg-3:         #1C2128;
  --bg-4:         #21262D;
  --border:       #30363D;
  --border-light: #3D444D;

  --text-primary:   #E6EDF3;
  --text-secondary: #8B949E;
  --text-muted:     #656D76;

  --green:    #2EA043;
  --green-l:  #3FB950;
  --green-xl: #56D364;
  --red:      #DA3633;
  --red-l:    #F85149;
  --orange:   #E3B341;
  --orange-l: #F0A832;
  --blue:     #1F6FEB;
  --blue-l:   #388BFD;
  --purple:   #8B5CF6;
  --cyan:     #39D0D8;

  --dz-green: #2DCC70;
  --dz-red:   #C0392B;

  --sidebar-width: 240px;
  --topbar-height: 60px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
}

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

html { font-size: 14px; }

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

a { color: var(--blue-l); text-decoration: none; }
a:hover { color: var(--text-primary); }

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
}

.sidebar.collapsed {
  width: 60px;
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 70px;
}

.logo-shield {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--dz-green), #16a34a);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(45,204,112,0.35);
}

.logo-text {
  overflow: hidden;
  white-space: nowrap;
}
.logo-title   { display: block; font-weight: 700; font-size: 13px; color: var(--text-primary); }
.logo-subtitle{ display: block; font-size: 10px; color: var(--text-secondary); }

.sidebar-toggle-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover { color: var(--text-primary); background: var(--bg-4); }
.sidebar.collapsed .sidebar-toggle-btn i { transform: rotate(180deg); }

/* Nav */
.sidebar-nav { padding: 8px 0; }

.sidebar-nav ul { list-style: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  border-radius: 0;
}

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

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-3);
}

.nav-link.active {
  color: var(--dz-green);
  background: rgba(45,204,112,0.1);
  border-right: 3px solid var(--dz-green);
}

.nav-link.active i { color: var(--dz-green); }

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.nav-emergency { color: var(--red-l) !important; }
.nav-emergency:hover { background: rgba(218,54,51,0.1) !important; }
.nav-emergency i { color: var(--red-l) !important; }

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 12px 16px 4px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-footer .sidebar-status span,
.sidebar.collapsed .sidebar-version { display: none; }

.sidebar.collapsed .logo-shield { margin: 0 auto; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .sidebar-toggle-btn { display: block; margin: 0 auto; }
.sidebar.collapsed .sidebar-logo { justify-content: center; }

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online  { background: var(--green-xl); box-shadow: 0 0 6px var(--green-xl); }
.status-dot.offline { background: var(--red-l); }

.sidebar-version {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ════════════════════════════════════════════
   MAIN WRAPPER
════════════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.main-wrapper.sidebar-collapsed {
  margin-left: 60px;
}

/* ════════════════════════════════════════════
   TOPBAR
════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.page-breadcrumb i { color: var(--dz-green); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-datetime {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.topbar-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.topbar-avatar i { color: var(--dz-green); }

/* ════════════════════════════════════════════
   PAGES
════════════════════════════════════════════ */
.page {
  display: none;
  padding: 24px;
  flex: 1;
  animation: fadeIn 0.2s ease;
}

.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

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

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

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

/* ════════════════════════════════════════════
   CARDS
════════════════════════════════════════════ */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header h3 i { color: var(--dz-green); }

/* ════════════════════════════════════════════
   STATS GRID
════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 1400px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover { transform: translateY(-2px); border-color: var(--border-light); }

.stat-total   .stat-icon { color: #fff; background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.stat-today   .stat-icon { color: #fff; background: linear-gradient(135deg, #8B5CF6, #6D28D9); }
.stat-pending .stat-icon { color: #fff; background: linear-gradient(135deg, #F59E0B, #D97706); }
.stat-progress.stat-icon, .stat-progress .stat-icon { color: #fff; background: linear-gradient(135deg, #F97316, #EA580C); }
.stat-resolved.stat-icon, .stat-resolved .stat-icon { color: #fff; background: linear-gradient(135deg, #10B981, #059669); }
.stat-critical.stat-icon, .stat-critical .stat-icon { color: #fff; background: linear-gradient(135deg, #EF4444, #DC2626); }

.stat-total::before    { background: #3B82F6; }
.stat-today::before    { background: #8B5CF6; }
.stat-pending::before  { background: #F59E0B; }
.stat-progress::before { background: #F97316; }
.stat-resolved::before { background: #10B981; }
.stat-critical::before { background: #EF4444; }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
  font-weight: 500;
}

/* ════════════════════════════════════════════
   DASHBOARD BODY
════════════════════════════════════════════ */
.dashboard-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 18px;
  margin-bottom: 24px;
}

@media (max-width: 1100px) { .dashboard-body { grid-template-columns: 1fr; } }

.mini-map {
  height: 320px;
  background: var(--bg-3);
}

.map-legend {
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-3);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

/* Recent list */
.recent-list {
  padding: 8px 0;
  overflow-y: auto;
  max-height: 380px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.recent-item:hover { background: var(--bg-3); }
.recent-item:last-child { border-bottom: none; }

.recent-type-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.recent-info { flex: 1; min-width: 0; }
.recent-ref  { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.recent-desc {
  font-size: 11px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}

.recent-meta {
  text-align: right;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════
   CHARTS
════════════════════════════════════════════ */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

@media (max-width: 900px) { .charts-row { grid-template-columns: 1fr; } }

.chart-card { padding: 16px; }

.chart-card canvas {
  max-height: 240px;
}

/* Statistics page */
.stats-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.chart-card-lg { padding: 18px; }
.chart-card-full {
  grid-column: 1 / -1;
  padding: 18px;
}

.chart-container { position: relative; }
.chart-tall { height: 260px; }
.chart-container canvas { width: 100% !important; height: 100%; }

@media (max-width: 900px) { .stats-charts-grid { grid-template-columns: 1fr; } }

/* ════════════════════════════════════════════
   FILTERS
════════════════════════════════════════════ */
.filters-card {
  padding: 16px;
  margin-bottom: 16px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-group {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}

.filter-group i {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.filter-group input {
  padding-left: 30px;
}

.filter-search { min-width: 260px; }

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
}

input:focus, textarea:focus {
  border-color: var(--blue-l);
  box-shadow: 0 0 0 3px rgba(31,111,235,0.15);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

.filter-select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238B949E' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.filter-select:focus { border-color: var(--blue-l); }

.w-full { width: 100%; }

/* ════════════════════════════════════════════
   TABLE
════════════════════════════════════════════ */
.table-card { margin-bottom: 24px; }

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.table-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table thead {
  background: var(--bg-3);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
}

.data-table th:hover { color: var(--text-primary); }

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

.data-table tbody tr {
  transition: background var(--transition);
  cursor: pointer;
}

.data-table tbody tr:hover { background: var(--bg-3); }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-loading {
  text-align: center;
  padding: 40px !important;
  color: var(--text-secondary);
}

.table-empty {
  text-align: center;
  padding: 50px !important;
  color: var(--text-muted);
}

/* ── Pagination ── */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.page-btn {
  min-width: 32px; height: 32px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  padding: 0 8px;
}

.page-btn:hover    { background: var(--bg-4); color: var(--text-primary); }
.page-btn.active   { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ════════════════════════════════════════════
   BADGES
════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Status */
.badge-pending    { background: rgba(245,158,11,0.15);  color: #F59E0B;  }
.badge-assigned   { background: rgba(59,130,246,0.15);  color: #60A5FA;  }
.badge-in_progress{ background: rgba(249,115,22,0.15);  color: #FB923C;  }
.badge-resolved   { background: rgba(16,185,129,0.15);  color: #34D399;  }
.badge-closed     { background: rgba(107,114,128,0.15); color: #9CA3AF;  }

/* Priority */
.badge-critical   { background: rgba(239,68,68,0.15);   color: #F87171;  }
.badge-high       { background: rgba(249,115,22,0.15);  color: #FB923C;  }
.badge-normal     { background: rgba(245,158,11,0.15);  color: #FCD34D;  }
.badge-low        { background: rgba(16,185,129,0.15);  color: #34D399;  }

/* Type colors */
.type-car_accident  { background: rgba(248,81,73,0.12);  color: #F85149; }
.type-forest_fire   { background: rgba(249,115,22,0.12); color: #FB923C; }
.type-home_fire     { background: rgba(239,68,68,0.12);  color: #F87171; }
.type-flood         { background: rgba(59,130,246,0.12); color: #60A5FA; }
.type-earthquake    { background: rgba(245,158,11,0.12); color: #FCD34D; }
.type-gas_leak      { background: rgba(52,211,153,0.12); color: #6EE7B7; }
.type-drowning      { background: rgba(34,211,238,0.12); color: #67E8F9; }
.type-industrial    { background: rgba(156,163,175,0.12);color: #D1D5DB; }
.type-medical       { background: rgba(139,92,246,0.12); color: #C4B5FD; }
.type-other         { background: rgba(167,139,250,0.12);color: #C4B5FD; }

/* ════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--dz-green);
  color: #000;
  font-weight: 600;
}
.btn-primary:hover { background: #27ae60; box-shadow: 0 0 12px rgba(45,204,112,0.3); }

.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-3); color: var(--text-primary); }

.btn-sm { padding: 6px 10px; font-size: 11.5px; }

.btn-icon {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 34px; height: 34px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
}
.btn-icon:hover { color: var(--text-primary); background: var(--bg-4); }

/* ════════════════════════════════════════════
   MAPS
════════════════════════════════════════════ */
.map-container {
  position: relative;
  overflow: visible;
}

#fullMap {
  height: calc(100vh - var(--topbar-height) - 180px);
  min-height: 500px;
  border-radius: 0;
}

.map-overlay-legend {
  position: absolute;
  bottom: 30px;
  left: 16px;
  background: rgba(22,27,34,0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
}

.map-counter {
  position: absolute;
  top: 16px; right: 16px;
  background: rgba(22,27,34,0.9);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 1000;
}

/* ════════════════════════════════════════════
   MODAL
════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  margin: auto;
}

.modal-sm { max-width: 520px; }

@keyframes slideIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-type-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-ref {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  font-family: monospace;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--bg-4); color: var(--red-l); }

.modal-body { padding: 22px; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Incident detail grid */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 600px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-field { display: flex; flex-direction: column; gap: 4px; }
.detail-field label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.detail-field .detail-value { font-size: 13px; color: var(--text-primary); }
.detail-field.full { grid-column: 1 / -1; }

.detail-map {
  height: 200px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.modal-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.status-update-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

/* ════════════════════════════════════════════
   FORM
════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ════════════════════════════════════════════
   TOAST
════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  font-size: 13px;
}

@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

.toast.success { border-left: 3px solid var(--green-xl); }
.toast.error   { border-left: 3px solid var(--red-l); }
.toast.info    { border-left: 3px solid var(--blue-l); }
.toast.warning { border-left: 3px solid var(--orange-l); }

.toast i { font-size: 16px; }
.toast.success i { color: var(--green-xl); }
.toast.error   i { color: var(--red-l); }
.toast.info    i { color: var(--blue-l); }
.toast.warning i { color: var(--orange-l); }

/* ════════════════════════════════════════════
   MISC
════════════════════════════════════════════ */
.loading-placeholder {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 13px;
}

.refresh-spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Leaflet dark theme override */
.leaflet-tile { filter: brightness(0.7) saturate(0.8) contrast(1.1); }
.leaflet-container { background: #1a1f2e; }
.leaflet-popup-content-wrapper {
  background: var(--bg-2) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow) !important;
}
.leaflet-popup-tip { background: var(--bg-2) !important; }
.leaflet-popup-close-button { color: var(--text-secondary) !important; }

/* ════════════════════════════════════════════
   GALERIE PHOTOS
════════════════════════════════════════════ */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-3);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.photo-thumb:hover img { transform: scale(1.05); }

.photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  color: #fff;
  font-size: 18px;
  opacity: 0;
}

.photo-thumb:hover .photo-overlay {
  background: rgba(0,0,0,0.45);
  opacity: 1;
}

.photo-error img { display: none; }
.photo-error::after {
  content: '\f03e';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--text-muted);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* ── Lightbox ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}

#lightbox.open { display: block; }

.lb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
  cursor: zoom-out;
}

.lb-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#lbImg {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  pointer-events: auto;
  object-fit: contain;
}

.lb-close {
  position: fixed;
  top: 16px; right: 20px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  z-index: 1;
  transition: background 0.2s;
}
.lb-close:hover { background: rgba(255,255,255,0.2); }

.lb-nav {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  z-index: 1;
  transition: background 0.2s;
}
.lb-nav:hover { background: rgba(255,255,255,0.2); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-counter {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  pointer-events: auto;
}

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .main-wrapper { margin-left: 0 !important; }

  .mobile-menu-btn { display: flex !important; }

  .topbar-datetime { display: none; }

  .page { padding: 16px; }

  .page-header { flex-direction: column; gap: 10px; }

  .dashboard-body { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  #fullMap { height: 400px; }
}
