/* ═══════════════════════════════════════════════════════════
   ROOT TOKENS & DESIGN SYSTEM
═══════════════════════════════════════════════════════════ */
:root {
  --bg-primary: #080c14;
  --bg-secondary: #0d1421;
  --bg-card: #111827;
  --bg-card-hover: #1a2540;
  --bg-sidebar: #080e1e;

  --border-color: rgba(255, 255, 255, 0.06);
  --border-active: rgba(99, 179, 237, 0.3);

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-gold: #fbbf24;

  --gradient-blue: linear-gradient(135deg, #1e3a5f 0%, #2d5aa0 100%);
  --gradient-red: linear-gradient(135deg, #4c1414 0%, #991b1b 100%);
  --gradient-orange: linear-gradient(135deg, #451a03 0%, #92400e 100%);
  --gradient-green: linear-gradient(135deg, #0c2d0c 0%, #166534 100%);
  --gradient-cyan: linear-gradient(135deg, #0c2335 0%, #155e75 100%);
  --gradient-purple: linear-gradient(135deg, #2e1065 0%, #6d28d9 100%);

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);

  --font-main: 'Cairo', 'Tajawal', sans-serif;
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  overflow: hidden;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════════════════ */
body {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-right 0.3s ease, opacity 0.3s ease;
  position: relative;
  z-index: 10;
}

/* Base Hidden State (both) */
.sidebar {
  margin-right: calc(var(--sidebar-width) * -1);
  opacity: 0;
  pointer-events: none;
}

/* Open/Visible State (both) */
.sidebar.open {
  margin-right: 0;
  opacity: 1;
  pointer-events: auto;
}

/* Desktop Specific Transitions */
@media (min-width: 901px) {
  .sidebar {
    transform: none !important;
    /* No translate on desktop, use margin */
  }
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */
.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 50px;
  height: 44px;
  background: none;
  border-radius: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  box-shadow: 0none;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

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

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 10px 8px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.08));
  opacity: 0;
  transition: opacity 0.2s;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.18), rgba(139, 92, 246, 0.12));
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.nav-item.active svg {
  color: #60a5fa;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
}

/* Sidebar open/collapsed state handling (Mobile remains using translate) */
/* Sidebar open/collapsed state handling (Mobile remains using translate) */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    margin-right: 0;
    transform: translateX(100%);
    opacity: 0;
    display: none;
    /* COMPLETELY hide until opened or dive-in */
    z-index: 5000;
    /* Lower than splash (9999) */
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  }

  .sidebar.open {
    display: flex !important;
    /* Show only when open */
    transform: translateX(0);
    opacity: 1;
    z-index: 100001 !important;
    /* Higher than everything when open */
    pointer-events: auto !important;
  }

  /* Overlay - Below Sidebar */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar.open+#sidebar-overlay {
    opacity: 1;
    pointer-events: auto !important;
  }
}

.update-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.update-badge svg {
  width: 14px;
  height: 14px;
  color: var(--accent-green);
}

/* ═══════════════════════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.topbar-title {
  flex: 1;
}

.topbar-title h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.btn-refresh {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.btn-refresh:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: rotate(90deg);
}

/* ═══════════════════════════════════════════════════════════
   LOADING OVERLAY
═══════════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  transition: opacity 0.4s;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  text-align: center;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner p {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   PAGES
═══════════════════════════════════════════════════════════ */
.page {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  gap: 24px;
  flex-direction: column;
  height: calc(100vh - 70px);
  /* Fill remaining workspace */
  min-height: 0;
}

.page.active {
  display: flex;
}

/* ═══════════════════════════════════════════════════════════
   KPI CARDS
═══════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.kpi-grid.small {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: default;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 255, 255, 0.12);
}

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

.kpi-icon svg {
  width: 24px;
  height: 24px;
}

.kpi-card.primary .kpi-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.kpi-card.danger .kpi-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.kpi-card.warning .kpi-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.kpi-card.info .kpi-icon {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}

.kpi-card.success .kpi-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.kpi-card.purple .kpi-icon {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.kpi-body {
  flex: 1;
  min-width: 0;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
  transition: all 0.5s ease;
}

.kpi-card.primary .kpi-value {
  color: #60a5fa;
}

.kpi-card.danger .kpi-value {
  color: #f87171;
}

.kpi-card.warning .kpi-value {
  color: #fbbf24;
}

.kpi-card.info .kpi-value {
  color: #22d3ee;
}

.kpi-card.success .kpi-value {
  color: #34d399;
}

.kpi-card.purple .kpi-value {
  color: #a78bfa;
}

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

.kpi-glow {
  position: absolute;
  top: -20px;
  left: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  pointer-events: none;
}

.kpi-card.primary .kpi-glow {
  background: #3b82f6;
}

.kpi-card.danger .kpi-glow {
  background: #ef4444;
}

.kpi-card.warning .kpi-glow {
  background: #f59e0b;
}

.kpi-card.info .kpi-glow {
  background: #06b6d4;
}

.kpi-card.success .kpi-glow {
  background: #10b981;
}

.kpi-card.purple .kpi-glow {
  background: #8b5cf6;
}

/* ═══════════════════════════════════════════════════════════
   CHART CARDS
═══════════════════════════════════════════════════════════ */
.charts-grid {
  display: grid;
  gap: 20px;
}

.charts-grid.one-col {
  grid-template-columns: 1fr;
}

.charts-grid.two-col {
  grid-template-columns: 1fr 1fr;
}

.charts-grid.three-col {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 1100px) {
  .charts-grid.three-col {
    grid-template-columns: 1fr 1fr;
  }

  .charts-grid.two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {

  .charts-grid.three-col,
  .charts-grid.two-col {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.chart-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
}

.chart-card.tall {
  min-height: 400px;
}

.chart-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.chart-header h3 svg {
  width: 16px;
  height: 16px;
  color: var(--accent-blue);
}

.chart-body {
  flex: 1;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}

.chart-body.tall-chart {
  min-height: 350px;
}

.chart-body canvas {
  max-width: 100%;
  max-height: 100%;
}

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

.table-card.full-height {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.table-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.table-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.table-header h3 svg {
  width: 16px;
  height: 16px;
  color: var(--accent-cyan);
}

.table-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-main);
  outline: none;
  transition: all 0.2s;
  width: 220px;
  direction: rtl;
}

.search-input:focus {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}

.filter-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-main);
  outline: none;
  cursor: pointer;
  direction: rtl;
}

.table-wrapper {
  overflow: auto;
  max-height: 500px;
  /* Constrain height to trigger scroll */
  flex: 1;
  min-height: 200px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 2;
}

th {
  padding: 12px 14px;
  text-align: right;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: top;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-high {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.badge-medium {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.badge-low {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

/* ═══════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.page-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-main);
  transition: all 0.2s;
}

.page-btn:hover,
.page-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: white;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page.active>* {
  animation: fadeInUp 0.4s ease forwards;
}

.page.active>*:nth-child(1) {
  animation-delay: 0.05s;
}

.page.active>*:nth-child(2) {
  animation-delay: 0.10s;
}

.page.active>*:nth-child(3) {
  animation-delay: 0.15s;
}

.page.active>*:nth-child(4) {
  animation-delay: 0.20s;
}

.page.active>*:nth-child(5) {
  animation-delay: 0.25s;
}

/* ═══════════════════════════════════════════════════════════
   COUNT-UP ANIMATION
═══════════════════════════════════════════════════════════ */
.count-up {
  transition: all 0.5s;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    height: 100vh;
    transform: translateX(100%);
    z-index: 50;
  }

  .sidebar.open {
    transform: translateX(0);
  }

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

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

  .topbar {
    padding: 0 14px;
  }

  .page {
    padding: 14px;
  }
}

/* ═══════════════════════════════════════════════════════════
   NAV BADGE
═══════════════════════════════════════════════════════════ */
.nav-badge {
  font-size: 9px;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  margin-right: auto;
  margin-left: 4px;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* ═══════════════════════════════════════════════════════════
   MAP PAGE LAYOUT
═══════════════════════════════════════════════════════════ */
#page-mapview {
  overflow-y: auto;
  padding: 16px 20px;
  gap: 14px;
}

.map-controls-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.map-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.map-filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.map-layer-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.map-layer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: all 0.2s;
  white-space: nowrap;
}

.map-layer-btn svg {
  width: 14px;
  height: 14px;
}

.map-layer-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.map-layer-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(139, 92, 246, 0.2));
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.map-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-main);
  outline: none;
  cursor: pointer;
  direction: rtl;
  max-width: 180px;
  transition: all 0.2s;
}

.map-select:focus {
  border-color: rgba(59, 130, 246, 0.4);
}

.map-stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-right: auto;
  flex-wrap: wrap;
}

.map-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.map-stat svg {
  width: 14px;
  height: 14px;
  color: var(--accent-blue);
}

.map-stat strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* ─── MAP CONTAINER ─── */
.map-wrapper {
  position: relative;
  flex-shrink: 0;
  height: 520px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
}

.iraq-map {
  width: 100%;
  height: 100%;
  background: #0d1421;
}

/* Leaflet dark overrides */
.leaflet-container {
  background: #0d1421 !important;
  direction: ltr;
}

.leaflet-tile-pane {
  filter: brightness(0.55) saturate(0.5) hue-rotate(195deg);
}

.leaflet-control-zoom {
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: #111827 !important;
  color: #94a3b8 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.leaflet-control-zoom a:hover {
  background: #1a2540 !important;
  color: #e2e8f0 !important;
}

.leaflet-control-attribution {
  background: rgba(8, 12, 20, 0.7) !important;
  color: #475569 !important;
  font-size: 9px !important;
}

/* MarkerCluster dark theme */
.marker-cluster-small {
  background-color: rgba(59, 130, 246, 0.3) !important;
}

.marker-cluster-small div {
  background-color: rgba(59, 130, 246, 0.75) !important;
  color: #fff !important;
  font-weight: 700;
  font-family: var(--font-main);
}

.marker-cluster-medium {
  background-color: rgba(245, 158, 11, 0.3) !important;
}

.marker-cluster-medium div {
  background-color: rgba(245, 158, 11, 0.75) !important;
  color: #fff !important;
  font-weight: 700;
  font-family: var(--font-main);
}

.marker-cluster-large {
  background-color: rgba(239, 68, 68, 0.3) !important;
}

.marker-cluster-large div {
  background-color: rgba(239, 68, 68, 0.75) !important;
  color: #fff !important;
  font-weight: 700;
  font-family: var(--font-main);
}

/* Custom Leaflet popup */
.leaflet-popup-content-wrapper {
  background: #141e35 !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(59, 130, 246, 0.25) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
  font-family: var(--font-main) !important;
  direction: rtl;
}

.leaflet-popup-tip {
  background: #141e35 !important;
}

.leaflet-popup-content {
  margin: 14px 16px !important;
  font-size: 13px;
  line-height: 1.7;
}

.leaflet-popup-close-button {
  color: #64748b !important;
}

.leaflet-popup-close-button:hover {
  color: #e2e8f0 !important;
}

.popup-title {
  font-size: 15px;
  font-weight: 800;
  color: #60a5fa;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  color: #94a3b8;
  font-size: 12px;
  padding: 2px 0;
}

.popup-row span:last-child {
  color: #e2e8f0;
  font-weight: 600;
}

.popup-weapon {
  font-size: 11px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  padding: 4px 8px;
  margin-top: 6px;
}

/* ─── LEGEND ─── */
.map-legend {
  position: absolute;
  bottom: 30px;
  left: 14px;
  background: rgba(13, 20, 33, 0.93);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  z-index: 1000;
  backdrop-filter: blur(8px);
  min-width: 150px;
}

.legend-title {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 11px;
  color: #94a3b8;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ─── INFO SIDE PANEL ─── */
.map-info-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 250px;
  background: rgba(13, 20, 33, 0.96);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  z-index: 1000;
  backdrop-filter: blur(10px);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: translateX(280px);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-info-panel.open {
  transform: translateX(0);
}

.info-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(59, 130, 246, 0.1);
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

#infoPanelTitle {
  font-size: 14px;
  font-weight: 700;
  color: #93c5fd;
}

.info-close-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.info-close-btn:hover {
  color: #e2e8f0;
}

.info-close-btn svg {
  width: 16px;
  height: 16px;
}

.info-panel-body {
  padding: 14px;
}

.info-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.info-stat-row:last-child {
  border-bottom: none;
}

.info-stat-label {
  color: #64748b;
  font-size: 12px;
}

.info-stat-value {
  font-weight: 700;
  font-size: 14px;
}

.info-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.info-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ─── BOTTOM MINI CHARTS ─── */
.map-bottom-charts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  flex-shrink: 0;
}

.map-mini-chart .chart-body {
  min-height: 180px;
  padding: 10px;
}

/* ─── PRECISE MARKERS ─── */
.custom-marker-icon {
  background: transparent;
  border: none;
}

.marker-pin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 2px solid #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.marker-pin.specific {
  background: #10b981;
  /* Green for exact locations */
}

.marker-pin.general {
  background: #3b82f6;
  /* Blue for general province */
  width: 12px;
  height: 12px;
  margin-top: 4px;
  margin-left: 4px;
}

.marker-pin svg {
  color: #fff;
}

.marker-pulse {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #10b981;
  opacity: 0;
  animation: markerPulse 2s infinite;
  z-index: 1;
}

@keyframes markerPulse {
  0% {
    transform: scale(0.6);
    opacity: 1;
  }

  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@media (max-width: 1100px) {
  .map-bottom-charts {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile Adjustments for Map and Telemetry */
@media (max-width: 700px) {
  .map-fullscreen {
    position: relative;
    height: calc(100vh - 100px);
    /* Leave room for some HUD elements */
  }

  .tac-hud-top {
    top: 10px;
    width: 95%;
  }

  .tac-dock {
    padding: 4px;
    gap: 4px;
    border-radius: 30px;
  }

  .dock-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .dock-label {
    display: none;
    /* Icon only on mobile */
  }

  .tac-telemetry-right {
    position: absolute;
    top: auto;
    bottom: 20px;
    right: 14px;
    left: 14px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    pointer-events: none;
    z-index: 1000;
  }

  .telemetry-card {
    flex: 1;
    padding: 8px;
    min-width: 0;
    backdrop-filter: blur(8px);
    background: rgba(13, 20, 33, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
  }

  .telemetry-card .tel-label {
    font-size: 9px;
  }

  .telemetry-card .tel-value {
    font-size: 14px;
    margin: 4px 0;
  }

  .telemetry-card .tel-sub {
    font-size: 7px;
    display: none;
  }

  .tac-dossier {
    width: 90%;
    right: 5%;
    bottom: 120px;
    height: 40vh;
  }

  .map-stats-bar {
    margin-right: 0;
  }
}

/* ═══════════════════════════════════════════════════════════
   THE APEX SENTINEL SPLASH SCREEN (Deep Tech Elegance)
═══════════════════════════════════════════════════════════ */
#landing-splash.apex-sentinel {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #01030a;
  /* Deep Void Black/Blue */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font-main);
  direction: rtl;
  /* Dark vignette focus */
  box-shadow: inset 0 0 250px rgba(0, 0, 0, 0.9);
}

/* Dive-in Transition Triggered by GSAP */
#landing-splash.dive-in {
  pointer-events: none;
}

/* City Background (baghdad.jpg) */
.sentinel-bg {
  position: absolute;
  inset: -5vw;
  opacity: 0.85;
  /* Clearly visible but with shadow depth */
  background-image:
    linear-gradient(rgba(1, 3, 10, 0.4), rgba(1, 3, 10, 0.85)),
    url('/static/baghdad.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: hue-rotate(190deg) brightness(1.1) contrast(1.15) saturate(0.9);
  /* Tactical Night Blue Tint */
  animation: bg-pan-baghdad 60s ease-in-out infinite alternate;
}

@keyframes bg-pan-baghdad {
  0% {
    transform: scale(1.05) translate(0, 0);
  }

  100% {
    transform: scale(1.1) translate(-2%, 2%);
  }
}

/* Ambient Data Nodes (The Flashes) */
.ambient-nodes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.8;
}

.node-pulse {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  opacity: 0;
}

.node-pulse::after {
  content: '';
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  border: 1px solid inherit;
  opacity: 0;
}

/* HUD Pulse Text */
.node-label {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  font-size: 11px;
  white-space: nowrap;
  font-family: var(--font-main);
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Base text color overrides for visibility */
.sovereignty .node-label {
  color: #fca5a5;
}

.airstrike .node-label {
  color: #fef08a;
}

.casualties .node-label {
  color: #fdba74;
}

.infrastructure .node-label {
  color: #d8b4fe;
}

/* 1. Sovereignty (Red) */
.sovereignty {
  background: #ef4444;
  box-shadow: 0 0 15px 4px rgba(239, 68, 68, 0.6);
  animation: uniform-pulse 8s infinite ease-in-out;
}

/* 2. Airstrike (Yellow) */
.airstrike {
  background: #fef08a;
  box-shadow: 0 0 15px 4px rgba(253, 224, 71, 0.7);
  animation: uniform-pulse 8s infinite ease-in-out;
  animation-delay: 1.5s;
}

/* 3. Casualties (Blood Orange) */
.casualties {
  background: #ea580c;
  box-shadow: 0 0 15px 4px rgba(234, 88, 12, 0.5);
  animation: uniform-pulse 8s infinite ease-in-out;
  animation-delay: 3s;
}

/* 4. Infrastructure (Deep Purple) */
.infrastructure {
  background: #a855f7;
  box-shadow: 0 0 15px 4px rgba(168, 85, 247, 0.4);
  animation: uniform-pulse 8s infinite ease-in-out;
  animation-delay: 4.5s;
}

@keyframes uniform-pulse {

  0%,
  100% {
    transform: scale(0.8);
    opacity: 0;
  }

  20%,
  80% {
    transform: scale(1.5);
    opacity: 1;
  }
}

/* ═══ UNIFIED SENTINEL ACTIONS ═══ */
.sentinel-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 35px;
  justify-content: center;
}

.btn-sentinel-wrap {
  perspective: 1000px;
  transition: transform 0.1s ease-out;
}

.btn-sentinel {
  height: 52px;
  padding: 0 35px;
  border-radius: 50px;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Primary Sentinel Button */
.btn-sentinel.primary {
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.4), rgba(124, 58, 237, 0.4));
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 0 15px rgba(255, 255, 255, 0.05);
}

.btn-sentinel.primary:hover {
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.6), rgba(124, 58, 237, 0.6));
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.4);
}

/* Secondary Sentinel Button */
.btn-sentinel.secondary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.btn-sentinel.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-blue);
  color: white;
}

.btn-sentinel svg {
  width: 18px;
  height: 18px;
  color: var(--accent-blue);
}

.btn-shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: skewX(-20deg);
  animation: shimmer 4s infinite;
}

@keyframes shimmer {
  100% {
    left: 200%;
  }
}

/* ═══ HUD CINEMATIC LAYERS ═══ */
.sentinel-scanner {
  position: fixed;
  top: -50px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.4), transparent);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
  z-index: 10;
  pointer-events: none;
  animation: scan-vertical 15s linear infinite;
  opacity: 0.5;
}

@keyframes scan-vertical {
  0% {
    top: -10%;
  }

  100% {
    top: 110%;
  }
}

.sentinel-telemetry {
  position: fixed;
  font-family: monospace;
  font-size: 10px;
  color: var(--accent-blue);
  opacity: 0.4;
  z-index: 15;
  letter-spacing: 1px;
  pointer-events: none;
  text-transform: uppercase;
  padding: 20px;
}

.sentinel-telemetry.top-left {
  top: 0;
  left: 0;
}

.sentinel-telemetry.top-right {
  top: 0;
  right: 0;
}

.sentinel-telemetry.bottom-left {
  bottom: 0;
  left: 0;
}

.sentinel-telemetry.bottom-right {
  bottom: 0;
  right: 0;
}

/* ═══ THE TACTICAL DOSSIER OVERLAY ═══ */
.sentinel-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 2, 8, 0.9);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  transform: scale(1.1);
}

.sentinel-overlay.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.overlay-glass-container {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 50px;
  position: relative;
  overflow-y: auto;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
}

.overlay-close {
  position: absolute;
  top: 25px;
  left: 25px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.overlay-close:hover {
  background: #ef4444;
  color: white;
  transform: rotate(90deg);
}

.overlay-header {
  margin-bottom: 40px;
  text-align: center;
}

.header-tag {
  font-family: monospace;
  font-size: 11px;
  color: var(--accent-blue);
  letter-spacing: 2px;
  margin-bottom: 10px;
  opacity: 0.6;
}

.overlay-header h2 {
  font-size: 32px;
  font-weight: 800;
  color: white;
  margin-bottom: 15px;
}

.header-line {
  width: 60px;
  height: 4px;
  background: var(--accent-blue);
  margin: 0 auto;
  border-radius: 2px;
}

.overlay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.brief-card {
  padding: 25px;
  border-radius: 15px;
  transition: all 0.3s;
}

.brief-card.glass {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.brief-card.glass:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(96, 165, 250, 0.3);
  transform: translateY(-5px);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}

.card-content h3 {
  font-size: 16px;
  font-weight: 700;
  color: white;
  margin-bottom: 10px;
}

.card-content p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: justify;
}

/* ═══ SENTINEL RESPONSIVE ═══ */
@media (max-width: 768px) {
  .sentinel-logo-container {
    width: 150px;
    margin-bottom: 20px;
  }

  .sentinel-desc {
    font-size: 13px;
    padding: 0 20px;
    line-height: 1.6;
  }

  .sentinel-actions {
    flex-direction: column;
    gap: 12px;
    width: 80%;
    margin-top: 25px;
  }

  .btn-sentinel-wrap {
    width: 100%;
  }

  .btn-sentinel {
    width: 100%;
    justify-content: center;
    padding: 0 15px;
    font-size: 13px;
    height: 48px;
  }

  .drone-sentinel-img {
    width: 250px;
    /* Smaller drone */
    top: 10%;
  }

  .sentinel-telemetry {
    font-size: 8px;
    padding: 10px;
  }

  /* Overlay Responsive */
  .overlay-glass-container {
    padding: 25px;
    max-height: 85vh;
  }

  .overlay-header h2 {
    font-size: 20px;
  }

  .overlay-grid {
    grid-template-columns: 1fr;
  }
}

/* Base Responsive Logic for Grids/KPIs */
@media (max-width: 480px) {
  .topbar {
    padding: 0 12px;
  }

  .topbar-title h1 {
    font-size: 15px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    /* 2 columns for better space */
    gap: 10px;
  }

  .kpi-card {
    padding: 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .kpi-icon {
    width: 32px;
    height: 32px;
  }

  .kpi-value {
    font-size: 18px;
  }

  .kpi-label {
    font-size: 10px;
  }

  .page {
    padding: 14px;
    gap: 14px;
  }

  .chart-header {
    padding: 12px;
  }

  .table-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    width: 100%;
  }
}

.brief-card.technical {
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.tech-row {
  display: flex;
  justify-content: space-between;
  font-family: monospace;
  font-size: 12px;
}

.tech-row span:first-child {
  color: var(--text-muted);
}

.tech-row .val {
  color: var(--accent-cyan);
  font-weight: bold;
}

/* Observer Drone */
.drone-sentinel-wrapper {
  position: absolute;
  top: 10%;
  right: -25%;
  width: 450px;
  z-index: 5;
  mix-blend-mode: screen;
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.9));
  transform-style: preserve-3d;
  /* GSAP will animate this */
}

.drone-sentinel-img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.drone-payload-flare {
  position: absolute;
  top: 60%;
  left: 35%;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 30px 10px rgba(239, 68, 68, 0.5);
  animation: drone-scan 3s infinite alternate;
}

@keyframes drone-scan {
  0% {
    opacity: 0.3;
  }

  100% {
    opacity: 1;
  }
}

/* Content Base */
.sentinel-content {
  position: relative;
  z-index: 10;
  max-width: 900px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Emblem - تكبير اللوغو وتحسين بروزه */
.sentinel-logo-container {
  width: 100%;
  max-width: 450px;
  /* تم زيادة الحجم من 320px إلى 450px */
  height: auto;
  margin: 0 auto 5px;
  /* تقليل المسافة السفلى جداً لأن اللوغو أصبح كبيراً */
  display: flex;
  justify-content: center;
  align-items: center;
  mix-blend-mode: normal;
}

.sh-sentinel-logo {
  width: 100%;
  /* تجعل الصورة تمتد لتملأ الـ 450px بالكامل */
  height: auto;
  object-fit: contain;
  /* زيادة قوة التوهج ليتناسب مع الحجم الجديد */
  filter: brightness(0) invert(1) drop-shadow(0 0 20px rgba(0, 242, 255, 0.5));
}

/* تقريب النص أكثر لمنع التشتت */
.sentinel-text-mask {
  margin-top: -25px;
  /* زيادة السحب للأعلى لأن اللوغو الكبير يترك فراغاً بصرياً */
}

.sentinel-title {
  font-size: 46px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -1px;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 1);
  margin: 0;
}

.sentinel-subtitle {
  font-size: 20px;
  font-weight: 400;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin: 0 0 35px 0;
  text-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
}

.sentinel-desc {
  font-size: 16px;
  color: #cbd5e1;
  line-height: 1.8;
  max-width: 650px;
  margin: 0 auto 50px auto;
  font-weight: 300;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
}

/* Magnetic Button Glassmorphism */
.btn-magnetic-container {
  display: inline-block;
  padding: 20px;
  /* Magnetic buffer zone */
  cursor: pointer;
}

.btn-magnetic-gate {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  padding: 16px 45px;
  color: #e2e8f0;
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: transform 0.1s ease-out, background 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-magnetic-gate:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(59, 130, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* Shimmer passing through */
.btn-shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}

.btn-magnetic-gate:hover .btn-shimmer {
  animation: light-sweep 1.5s ease-in-out infinite;
}

@keyframes light-sweep {
  100% {
    left: 200%;
  }
}

/* ═══════════════════════════════════════════════════════════
   🛰️ APEX TACTICAL HUD (V3.0 REDESIGN)
   ═══════════════════════════════════════════════════════════ */

:root {
  --tac-bg: rgba(8, 12, 20, 0.75);
  --tac-border: rgba(255, 255, 255, 0.08);
  --tac-accent: #3b82f6;
  --tac-danger: #ef4444;
  --tac-warn: #f59e0b;
  --tac-blur: blur(16px);
  --tac-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

#page-mapview {
  display: none;
  background: #04080f;
  overflow: hidden;
  position: relative;
  padding: 0 !important;
  /* kill .page default padding */
  flex-direction: column;
}

#page-mapview.active {
  display: flex;
}

.map-fullscreen {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #020617;
}

/* iraq-map-env fills the entire .map-fullscreen */
.map-fullscreen .iraq-map-env {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.iraq-map-env {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #020617;
  z-index: 1;
}

/* --- Floating HUD Top (Dock) --- */
.tac-hud-top {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.tac-hdr-system {
  text-align: center;
}

.tac-hdr-title {
  font-family: 'Cairo';
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
}

.tac-badge {
  font-size: 0.65rem;
  padding: 3px 10px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: var(--tac-accent);
  border-radius: 4px;
  font-weight: 900;
  letter-spacing: 1px;
  animation: badge-flicker 4s infinite;
}

@keyframes badge-flicker {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.tac-dock {
  background: var(--tac-bg);
  backdrop-filter: var(--tac-blur);
  border: 1px solid var(--tac-border);
  border-radius: 100px;
  padding: 6px;
  display: flex;
  gap: 8px;
  box-shadow: var(--tac-shadow);
}

.dock-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 10px 20px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Cairo';
  font-weight: 700;
  font-size: 0.85rem;
}

.dock-btn svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.dock-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.dock-btn.active {
  background: var(--tac-accent);
  color: #fff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.dock-btn.active svg {
  opacity: 1;
}

.dock-label {
  display: inline-block;
}

/* --- Telemetry Sidebar (Right) --- */
.tac-telemetry-right {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 200px;
}

.telemetry-card {
  background: var(--tac-bg);
  backdrop-filter: var(--tac-blur);
  border: 1px solid var(--tac-border);
  border-right: 4px solid var(--tac-accent);
  padding: 18px 24px;
  border-radius: 12px;
  box-shadow: var(--tac-shadow);
  position: relative;
  overflow: hidden;
}

.telemetry-card.martyrs {
  border-right-color: var(--tac-danger);
}

.telemetry-card.wounded {
  border-right-color: var(--tac-warn);
}

.tel-label {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.tel-value {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  font-family: 'Cairo';
  line-height: 1;
}

.tel-sub {
  font-size: 0.6rem;
  color: rgba(148, 163, 184, 0.4);
  margin-top: 8px;
  font-family: monospace;
}

/* --- Tactical Playback HUD (Bottom Center) --- */
.tac-playback-hud {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  width: 90%;
  max-width: 1100px;
}

.ph-main {
  background: var(--tac-bg);
  backdrop-filter: var(--tac-blur);
  border: 1px solid var(--tac-border);
  border-radius: 20px;
  padding: 20px 30px;
  display: flex;
  align-items: center;
  gap: 30px;
  box-shadow: var(--tac-shadow);
}

.ph-play-pulse {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--tac-accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.ph-play-pulse:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
}

.ph-info {
  min-width: 180px;
}

.ph-date {
  font-family: 'Cairo';
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}

.ph-status {
  font-size: 0.6rem;
  color: #4ade80;
  font-family: monospace;
  margin-top: 4px;
}

.ph-slider-wrapper {
  flex: 1;
  position: relative;
  height: 60px;
  display: flex;
  align-items: center;
}

.ph-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  z-index: 10;
  cursor: pointer;
}

.ph-track-glow {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-50%);
  z-index: 1;
}

.ph-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 24px;
  width: 4px;
  background: var(--tac-accent);
  border-radius: 2px;
  box-shadow: 0 0 15px var(--tac-accent);
  cursor: pointer;
}

.ph-speed select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--tac-border);
  color: #fff;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

/* --- Tactical Dossier (Info Panel) --- */
.tac-dossier {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 320px;
  max-height: calc(100% - 60px);
  background: var(--tac-bg);
  backdrop-filter: var(--tac-blur);
  border: 1px solid var(--tac-border);
  border-radius: 14px;
  z-index: 1000;
  box-shadow: var(--tac-shadow);
  display: flex;
  flex-direction: column;
  transform: translateX(-120%);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.tac-dossier.open {
  transform: translateX(0);
}

.dossier-header {
  padding: 20px;
  border-bottom: 1px solid var(--tac-border);
  display: flex;
  align-items: center;
  gap: 15px;
}

.d-hdr-icon {
  width: 40px;
  height: 40px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tac-accent);
}

.d-hdr-title {
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  flex: 1;
}

.d-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
}

.dossier-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.dossier-footer {
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.2);
  font-family: monospace;
  font-size: 0.6rem;
  color: #64748b;
  border-top: 1px solid var(--tac-border);
}

/* Dossier Row Styles */
.ds-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.ds-label {
  color: #94a3b8;
  font-size: 0.85rem;
}

.ds-val {
  color: #fff;
  font-weight: 700;
  font-family: 'Cairo';
}

/* --- Markers & Pulses --- */
.marker-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--tac-accent);
  box-shadow: 0 0 10px var(--tac-accent);
  position: relative;
  transition: all 0.3s;
}

/* Pulsing Crosshair for Strategic Targets */
.marker-pin.specific {
  background: var(--tac-danger);
  border-color: #fff;
  width: 18px;
  height: 18px;
  animation: tactical-pulse 1.5s infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-pin.specific::after {
  content: '';
  width: 30px;
  height: 30px;
  border: 1px dashed rgba(255, 77, 77, 0.5);
  border-radius: 50%;
  position: absolute;
  animation: rotate-radar 10s linear infinite;
}

@keyframes tactical-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    transform: scale(1);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    transform: scale(1.1);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    transform: scale(1);
  }
}

@keyframes rotate-radar {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* --- Legend & Neon Swatches --- */
.tac-legend {
  position: absolute;
  top: 150px;
  left: 30px;
  z-index: 80;
  background: var(--tac-bg);
  backdrop-filter: var(--tac-blur);
  border: 1px solid var(--tac-border);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sw-neon {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}

/* --- Intelligence UI Elements --- */
.intel-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.intel-hdr {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
}

.ds-val.target-name {
  color: #f87171;
}

.ds-val.formation {
  color: #60a5fa;
  font-size: 0.8rem;
}


/* --- Bottom Complementary Analysis Dock --- */
.tac-bottom-dock {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 0 20px 20px;
}

.bd-card {
  background: var(--tac-bg);
  backdrop-filter: var(--tac-blur);
  border: 1px solid var(--tac-border);
  border-radius: 16px;
  padding: 20px;
}

.bd-hdr {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 800;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bd-hdr::before {
  content: '';
  width: 4px;
  height: 12px;
  background: var(--tac-accent);
  border-radius: 2px;
}

.bd-chart {
  height: 120px;
}

/* Mobile Adjustments for Map Telemetry */
@media (max-width: 700px) {
  .tac-telemetry-right {
    position: absolute;
    top: auto;
    bottom: 20px;
    right: 14px;
    left: 14px;
    width: auto;
    display: flex;
    flex-direction: row;
    gap: 8px;
    pointer-events: none;
    z-index: 1000;
  }

  .telemetry-card {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border-right: none !important;
    border-left: 3px solid var(--tac-accent);
    background: rgba(13, 20, 33, 0.9) !important;
  }

  .telemetry-card.martyrs {
    border-left-color: var(--tac-danger);
  }

  .telemetry-card.wounded {
    border-left-color: var(--tac-warn);
  }

  .tel-label {
    font-size: 8px;
    margin-bottom: 2px;
  }

  .tel-value {
    font-size: 1.2rem;
    line-height: 1.2;
  }

  .tel-sub {
    display: none;
  }

  .tac-hud-top {
    top: 10px;
    width: 95%;
  }

  .tac-hdr-title {
    font-size: 0.9rem;
    gap: 6px;
  }

  .tac-dock {
    padding: 4px;
    gap: 4px;
    border-radius: 30px;
  }

  .dock-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .dock-label {
    display: none;
  }
}