:root {
  --color-primary: #0F172A;
  --color-secondary: #2e6ccf;
  --color-accent: #60a5fa;
  --color-bg-light: #f8fafc;
  --color-bg-card: #ffffff;
  --color-text-main: #334155;
  --color-text-muted: #64748b;
  --color-white: #ffffff;
  --color-border: #e2e8f0;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-elevated: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}


body {
  font-family: "Open Sans", "Helvetica Neue", sans-serif;
  background-color: var(--color-bg-light);
  color: var(--color-text-main);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-heading {
  font-family: "Poppins", sans-serif;
  color: var(--color-primary);
  font-weight: 600;
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-header {
  min-height: 4rem;
  height: 4rem;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 50;
  background: var(--color-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-main-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 4rem);
  height: calc(100dvh - 4rem);
  overflow: hidden;
}

#evacMap,
#evacuationMap {
  width: 100%;
  height: 100%;
  touch-action: pan-x pan-y pinch-zoom;
  overscroll-behavior: none;
}

.app-sidebar {
  width: 16.5rem;
  background: linear-gradient(180deg, #0b1329 0%, #0f172a 60%, #0b1326 100%);
  color: var(--color-white);
  flex-shrink: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: hidden;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
}

.app-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.25rem 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.app-sidebar-nav::-webkit-scrollbar,
.app-sidebar::-webkit-scrollbar {
  display: none;
  width: 0 !important;
  height: 0 !important;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  background-color: var(--color-bg-light);
  padding: 0;
}

@media (min-width: 640px) {
  .app-content {
    padding: 0;
  }
}


.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.75rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 0.25rem;
  position: relative;
}

.sidebar-link .nav-icon-box {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.sidebar-link.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 14px -2px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-link.active .nav-icon-box {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.sidebar-link.inactive {
  color: #94a3b8;
}

.sidebar-link.inactive:hover {
  background-color: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  transform: translateX(2px);
}

.sidebar-link.inactive:hover .nav-icon-box {
  color: #60a5fa;
  background: rgba(255, 255, 255, 0.06);
}


.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-primary);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--color-secondary);
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-primary);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}


.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background-color: #f1f5f9;
  padding: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.data-table tr:hover td {
  background-color: #f8fafc;
}


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
}

.btn-primary {
  background-color: var(--color-secondary);
  color: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.btn-outline:hover {
  background-color: #f1f5f9;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text-main);
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  border-color: var(--color-secondary);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}


.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 9999px;
  text-transform: uppercase;
}

.status-green {
  background: #dcfce7;
  color: #166534;
}

.status-orange {
  background: #ffedd5;
  color: #c2410c;
}

.status-red {
  background: #fee2e2;
  color: #991b1b;
}

.status-blue {
  background: #dbeafe;
  color: #1e40af;
}

.status-gray {
  background: #f1f5f9;
  color: #475569;
}

.placeholder-box {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-weight: 600;
  min-height: 300px;
}

/*  Responsiveness */
@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 60;
  }

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

  .app-content {
    padding-bottom: calc(24px + 64px);
  }
}

/* Pen Cursor when drawing Routes or Hazard Zones */
.map-pen-cursor,
.map-pen-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cdefs%3E%3Cfilter id='s' x='-20%25' y='-20%25' width='140%25' height='140%25'%3E%3CfeDropShadow dx='0' dy='1' stdDeviation='1' flood-color='%23000000' flood-opacity='0.5'/%3E%3C/filter%3E%3C/defs%3E%3Cg filter='url(%23s)'%3E%3Cpath d='M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z' fill='%232563eb' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='m15 5 4 4' stroke='%23ffffff' stroke-width='1.5'/%3E%3Ccircle cx='2' cy='22' r='2' fill='%23ef4444' stroke='%23ffffff' stroke-width='0.75'/%3E%3C/g%3E%3C/svg%3E") 2 22, crosshair !important;
}

/* ==========================================================================
   NIGHT / DARK MODE GLOBAL THEME
   ========================================================================== */
html.dark {
  --color-primary: #f8fafc;
  --color-bg-light: #0b1329;
  --color-bg-card: #0f172a;
  --color-text-main: #cbd5e1;
  --color-text-muted: #94a3b8;
  --color-white: #0f172a;
  --color-border: #1e293b;
  color-scheme: dark;
}

html.dark body {
  background-color: #0b1329;
  color: #cbd5e1;
}

html.dark .app-content,
html.dark main {
  background-color: #0b1329 !important;
  color: #cbd5e1;
}

html.dark .bg-slate-50,
html.dark .bg-slate-100 {
  background-color: #0f172a !important;
  color: #e2e8f0;
}

html.dark .bg-white {
  background-color: #0f172a !important;
  color: #f1f5f9;
}

html.dark .bg-slate-50\/60,
html.dark .bg-slate-50\/70,
html.dark .bg-slate-50\/80 {
  background-color: #131c35 !important;
}

html.dark .card {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
  color: #f1f5f9;
}

html.dark .text-blue-950,
html.dark .text-slate-900,
html.dark .text-slate-800,
html.dark h1,
html.dark h2,
html.dark h3,
html.dark h4 {
  color: #f8fafc !important;
}

html.dark .text-slate-700,
html.dark .text-slate-600 {
  color: #cbd5e1 !important;
}

html.dark .text-slate-500,
html.dark .text-slate-400 {
  color: #94a3b8 !important;
}

html.dark .border-slate-200,
html.dark .border-slate-200\/70,
html.dark .border-slate-200\/80,
html.dark .border-slate-200\/90,
html.dark .border-slate-100,
html.dark .border-slate-300 {
  border-color: #1e293b !important;
}

thead.sticky,
thead.sticky th {
  background-color: #f1f5f9;
  color: #1e293b !important;
  opacity: 1 !important;
}

html.dark thead.sticky,
html.dark thead.sticky th {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-bottom-color: #334155 !important;
  opacity: 1 !important;
}

html.dark .data-table th {
  background-color: #1e293b;
  color: #f8fafc;
  border-bottom-color: #334155;
}

html.dark .data-table td {
  border-bottom-color: #1e293b;
  color: #cbd5e1;
}

html.dark .data-table tr:hover td {
  background-color: #1e293b;
}

html.dark .form-control,
html.dark input[type="text"],
html.dark input[type="search"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark select,
html.dark textarea {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

html.dark .placeholder-box {
  background: #0f172a;
  border-color: #334155;
}

html.dark .app-sidebar {
  background: linear-gradient(180deg, #050b18 0%, #091024 60%, #050b18 100%);
  border-right-color: rgba(255, 255, 255, 0.05);
}

html.dark .bg-blue-50 {
  background-color: #172554 !important;
  color: #93c5fd !important;
}

html.dark .text-blue-900,
html.dark .text-blue-950 {
  color: #dbeafe !important;
}

/* Real-Time Emergency In-App Alert Severity Pulsing Glows */
@keyframes pulse-glow-red {
  0%, 100% {
    box-shadow: 0 0 20px 2px rgba(239, 68, 68, 0.7), 0 0 0 0 rgba(239, 68, 68, 0.6), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  }
  50% {
    box-shadow: 0 0 45px 8px rgba(239, 68, 68, 0.95), 0 0 0 18px rgba(239, 68, 68, 0), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  }
}

@keyframes pulse-glow-orange {
  0%, 100% {
    box-shadow: 0 0 18px 2px rgba(249, 115, 22, 0.65), 0 0 0 0 rgba(249, 115, 22, 0.55), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  }
  50% {
    box-shadow: 0 0 40px 6px rgba(249, 115, 22, 0.9), 0 0 0 16px rgba(249, 115, 22, 0), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  }
}

@keyframes pulse-glow-yellow {
  0%, 100% {
    box-shadow: 0 0 15px 2px rgba(234, 179, 8, 0.55), 0 0 0 0 rgba(234, 179, 8, 0.45), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  }
  50% {
    box-shadow: 0 0 35px 5px rgba(234, 179, 8, 0.8), 0 0 0 14px rgba(234, 179, 8, 0), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  }
}

@keyframes pulse-glow-blue {
  0%, 100% {
    box-shadow: 0 0 12px 2px rgba(59, 130, 246, 0.5), 0 0 0 0 rgba(59, 130, 246, 0.4), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  }
  50% {
    box-shadow: 0 0 30px 4px rgba(59, 130, 246, 0.75), 0 0 0 12px rgba(59, 130, 246, 0), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  }
}

@keyframes pulse-glow-green {
  0%, 100% {
    box-shadow: 0 0 12px 2px rgba(16, 185, 129, 0.5), 0 0 0 0 rgba(16, 185, 129, 0.4), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  }
  50% {
    box-shadow: 0 0 28px 4px rgba(16, 185, 129, 0.75), 0 0 0 12px rgba(16, 185, 129, 0), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  }
}

.glow-pulse-red {
  animation: pulse-glow-red 1.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.glow-pulse-orange {
  animation: pulse-glow-orange 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.glow-pulse-yellow {
  animation: pulse-glow-yellow 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.glow-pulse-blue {
  animation: pulse-glow-blue 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.glow-pulse-green {
  animation: pulse-glow-green 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-pulse-emergency {
  animation: pulse-glow-red 1.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}