:root {
    --base-color: #fc8ed2;
    --hover-color: #ff9900;
    --highlight-random: #ffb300;
    --text-color: #222;
    --background-color: #f8f8f8;
    --background: #fff;
    --foreground: #222;
    --accent: #0078d7; 
    --card-bg: #f5f5f5;
    --map-bg: #fff; /* Default map background */
    --state-outline-bg: #fff; /* Default state outline background */
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #181a1b;
    --foreground: #f5f6fa;
    --accent: #4fc3f7;
    --card-bg: #23272a;
    --map-bg: #23272a; /* Dark mode map background */
    --state-outline-bg: #23272a; /* Dark mode state outline background */
  }
}

/* Complimentary contrast for dashboard background, header, and footer */
body {
    /* background: linear-gradient(135deg, #e3f0ff 0%, #f0f4f9 100%); */
    min-height: 100vh;
    margin: 0;
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    background: var(--background);
    color: var(--foreground);
    transition: background 0.3s, color 0.3s;
}
/* Manual override classes */
body.light-mode {
  --background: #fff;
  --foreground: #222;
  --accent: #0078d7;
  --card-bg: #f5f5f5;
  --header-gradient: linear-gradient(90deg, #1976d2 0%, #43e97b 100%);
  --footer-gradient: linear-gradient(90deg, #43e97b 0%, #1976d2 100%);
  --map-bg: #fff;
  --state-outline-bg: #fff;
}
body.dark-mode {
  --background: #181a1b;
  --foreground: #f5f6fa;
  --accent: #4fc3f7;
  --card-bg: #23272a;
  --header-gradient: linear-gradient(90deg, #23272a 0%, #181a1b 100%);
  --footer-gradient: linear-gradient(90deg, #181a1b 0%, #23272a 100%);
  --map-bg: #23272a;
  --state-outline-bg: #23272a;
}

header {
    background: var(--background);
    background-image: var(--header-gradient, linear-gradient(90deg, #1976d2 0%, #43e97b 100%));
    color: #fff;
    padding: 1.5rem 2rem 1.2rem 2rem;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    box-shadow: 0 2px 12px rgba(25, 118, 210, 0.08);
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 0.03em;
}

footer {
    background: var(--background);
    background-image: var(--footer-gradient, linear-gradient(90deg, #43e97b 0%, #1976d2 100%));
    color: #fff;
    padding: 1.1rem 2rem 1.1rem 2rem;
    border-bottom-left-radius: 1.5rem;
    border-bottom-right-radius: 1.5rem;
    box-shadow: 0 -2px 12px rgba(67,233,123, 0.08);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.county {
    fill: var(--base-color);
    stroke: var(--text-color);
    stroke-width: 1.5;
    transition: fill 0.2s;
    cursor: pointer;
}
.county:hover,
.county:focus,
.county.highlight-city-key {
    fill: var(--highlight-random) !important;
    outline: 2px solid var(--text-color);
    z-index: 2;
}

.county-label, .city-number {
    font-size: 0.9em;
    pointer-events: all;
    cursor: pointer;
    fill: var(--text-color);
    user-select: none;
    transition: fill 0.2s, transform 0.2s;
}

.county-label:hover, .city-number:hover {
    transform: scale(1.3);
    z-index: 2;
}

#tooltip {
    position: fixed;
    display: none;
    pointer-events: none;
    z-index: 9999;
    background: rgba(255,255,255,0.97);
    border: 1px solid var(--text-color);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-color);
    font-size: 1em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-width: 120px;
    max-width: 220px;
    transition: opacity 0.15s;
    left: 30px !important;
    right: auto !important;
    top: 80px !important; /* Reduced from 320px */
    margin-left: 0;
    margin-right: 0;
}

.city-key-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
    margin-left: 80px; /* Reduced from 320px */
    margin-top: 16px;  /* Reduced from 80px */
}

/* Vibrant county-specific styles */
.county_names {
    fill: var(--text-color);
    font-family: 'DejaVu Sans Condensed', Arial, sans-serif;
    font-size: 1.1em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-width: 180px;
    pointer-events: none;
    transition: opacity 0.15s;
}

img, svg {
  width: 80%;
  height: 40%; /* Reduced from 75% to 40% */
  display: block;
  margin: 0 auto;
}
.city-key-column {
    background: var(--base-color);
    /* Example: font-weight, color, etc. */
    fill: var(--text-color);
    font-family: 'DejaVu Sans Condensed', Arial, sans-serif;
    position: relative;
    left: 60px; /* Move city key to the right */
    display: inline-block;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .city-key-entry {
    cursor: pointer;
    transition: fill 0.2s;
  }

  .city-key-entry:hover {
    fill: var(--hover-color);
  }

.highlight-city-key {
    fill: var(--highlight-random) !important;
    font-weight: bold;
    text-decoration: underline;
    /* You can adjust color/effect as desired */
}

.county-number {
    cursor: pointer;
    fill: var(--text-color);
    font-weight: bold;
    transition: fill 0.2s, transform 0.2s;
}
.county-number:hover {
    fill: var(--hover-color);
    transform: scale(1.3);
    z-index: 2;
}

.dashboard-shell {
    background: linear-gradient(120deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
}
.dashboard-shell:hover {
    box-shadow: 0 12px 40px rgba(25, 118, 210, 0.18), 0 2px 12px rgba(67,233,123,0.13);
}
.dashboard-header {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 0.5em 1em;
  background: linear-gradient(90deg, #023269 25%, #1976d2 50%, #003057 100%);
  min-height: 48px;
}
.dashboard-header-logo {
  width: 36px;
  height: 36px;
  background: #e0e0e0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  margin-right: 0.5em;
}
.dashboard-header h1 {
  font-size: 1.2em;
  margin: 0;
  font-weight: 600;
  color: #f2f9fe;
}
.dashboard-header .dashboard-header-subtitle {
  font-size: 0.95em;
  font-weight: 400;
  margin-top: 0.1em;
  color: #003057;
}
@media (max-width: 600px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3em;
    padding: 0.4em 0.7em;
  }
  .dashboard-header h1 {
    font-size: 1em;
  }
  .dashboard-header-logo {
    width: 28px;
    height: 28px;
    font-size: 1em;
  }
  .dashboard-header .dashboard-header-subtitle {
    font-size: 0.8em;
  }
}
.dashboard-footer {
    background: #fff;
    box-shadow: 0 -2px 12px 0 rgba(25, 118, 210, 0.10);
    text-shadow: 0 1px 6px rgba(25, 118, 210, 0.13);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 2px solid #e0e7ef;
    padding: 1rem 2rem;
    border-radius: 1.2rem 1.2rem 0 0;
    margin: 0 0 1.2rem 0;
    color: #1976d2;
    font-size: 1.1em;
    font-weight: 600;
}
.dashboard-main {
    display: flex;
    flex-direction: row;
    gap: 2.5rem;
    flex: 1 1 auto;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 2.5rem 2rem 2.5rem;
    background: linear-gradient(120deg, #f8fafc 0%, #e3f0ff 100%);
    border-radius: 1.2rem;
    margin: 0.5rem 1rem 0.5rem 1rem;
    box-shadow: 0 2px 8px rgba(60, 80, 120, 0.10);
    border: 1px solid #e0e7ef;
    transition: box-shadow 0.2s;
}

.card, .panel, .info-box {
  background: var(--card-bg);
  color: var(--foreground);
}

button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.5em 1em;
  cursor: pointer;
  transition: background 0.2s;
}
button:hover, .btn:hover {
  background: #005fa3;
}

.map-frame {
    background: var(--map-bg, #fff);
    border-radius: 1.5rem;
    box-shadow: 0 6px 32px rgba(25, 118, 210, 0.16), 0 1.5px 8px rgba(25, 118, 210, 0.09);
    border: 2.5px solid #e0e7ef;
    padding: 2.2rem 2.2rem 2.2rem 2.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 600px;
    min-height: 600px;
    max-width: 900px;
    margin: 0;
    position: relative;
}

.side-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  background: var(--panel-bg, #fff);
  box-shadow: -2px 0 8px rgba(0,0,0,0.08);
  z-index: 2000;
  overflow-y: auto;
  transition: transform 0.3s ease;
  transform: translateX(0); /* Ensure visible by default */
  display: block !important; /* Force visibility */
}
@media (max-width: 600px) {
  .side-panel {
    width: 100vw;
    height: 40vh;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
    border-radius: 12px 12px 0 0;
    transform: translateY(0); /* Ensure visible on mobile */
  }
}
@media (max-width: 900px) {
    .side-panel {
        min-width: 180px;
        max-width: 98vw;
        width: 60vw;
        padding: 1rem 0.5rem;
        border-radius: 0.7rem;
    }
}
@media (max-width: 600px) {
    .side-panel {
        min-width: 100px;
        max-width: 100vw;
        width: 98vw;
        padding: 0.5rem 0.2rem;
        border-radius: 0.5rem;
        max-height: 45vh;
        overflow-y: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        margin: 0 auto;
        z-index: 10002;
    }
    .dashboard-main, .map-container, svg {
        max-width: 100vw !important;
        max-height: 60vh !important;
        height: 60vh !important;
        margin: 0 auto !important;
        display: block;
    }
    body {
        padding-bottom: 0 !important;
    }
}

@media (max-width: 600px) {
  .map-container, .map-container svg {
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    max-height: 45vh !important;
    display: block;
    margin: 0 auto !important;
  }
  .dashboard-main {
    padding: 0.5em 0.2em !important;
  }
}

#custom-alert-close {
    position: absolute;
    left: 0.7rem;
    top: 0.7rem;
    width: 2.1rem;
    height: 2.1rem;
    background: #e53935;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
    z-index: 2;
    font-family: inherit;
    font-weight: bold;
    transition: background 0.15s;
}
#custom-alert-close:focus {
    outline: 2px solid #fff;
    outline-offset: 1px;
}
#custom-alert-close:hover {
    background: #b71c1c;
}
@media (max-width: 600px) {
  #tooltip {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
  .map-container + #tooltip {
    /* Ensure tooltip/modal appears below the map */
    margin-top: 1em;
  }
}

/* Light/dark mode override classes */
body.light-mode {
  --background: #fff;
  --foreground: #222;
  --accent: #0078d7;
  --card-bg: #f5f5f5;
}
body.dark-mode {
  --background: #181a1b;
  --foreground: #f5f6fa;
  --accent: #4fc3f7;
  --card-bg: #23272a;
}

body.light-mode header, body.light-mode footer {
    background: var(--background);
    background-image: linear-gradient(90deg, #1976d2 0%, #43e97b 100%);
}
body.dark-mode header, body.dark-mode footer {
    background: var(--background);
    background-image: linear-gradient(90deg, #23272a 0%, #181a1b 100%);
}

.state-outline {
  background: var(--state-outline-bg, #fff);
  transition: background 0.3s;
}

