/* Map Navigation SVG, Hover, Legends, and Tooltips */

.map-container-wrapper {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-height: 480px;
}

.map-svg {
  width: 100%;
  max-width: 650px;
  height: auto;
  aspect-ratio: 1.33;
}

/* SVG State paths styling */
.state-path {
  cursor: pointer;
  stroke: #FFFFFF;
  stroke-width: 1.5;
  stroke-linejoin: round;
  fill: #E5E7EB; /* Default safe fallback background */
  transition: fill var(--transition-fast), stroke var(--transition-fast), stroke-width var(--transition-fast);
}

/* Base coverage and data-driven choropleth shades */
.state-path {
  fill: #2DD4BF; /* Default data fill */
  stroke: #FFFFFF;
  stroke-width: 1.2;
}

/* Multi-tier Green Choropleth Shading */
.state-path[data-shade="tier-5"],
.state-path[data-coverage="tier-5"] {
  fill: #044E3F; /* Deep Forest Emerald - Top Tier */
  stroke: #022c24;
}

.state-path[data-shade="tier-4"],
.state-path[data-coverage="high"],
.state-path[data-coverage="tier-4"] {
  fill: #0D9488; /* Rich Emerald Teal */
  stroke: #042F2E;
}

.state-path[data-shade="tier-3"],
.state-path[data-coverage="medium"],
.state-path[data-coverage="tier-3"] {
  fill: #2DD4BF; /* Vibrant Medium Mint */
  stroke: #0d9488;
}

.state-path[data-shade="tier-2"],
.state-path[data-coverage="low"],
.state-path[data-coverage="tier-2"] {
  fill: #5EEAD4; /* Soft Mint */
  stroke: #14b8a6;
}

.state-path[data-shade="tier-1"],
.state-path[data-coverage="tier-1"] {
  fill: #A7F3D0; /* Light Mint Tint */
  stroke: #2dd4bf;
}

.state-path[data-shade="tier-0"],
.state-path[data-coverage="nodata"],
.state-path[data-coverage="unverified"],
.state-path[data-coverage="unavailable"] {
  fill: #E2E8F0; /* Clean Slate Neutral - Pending Verification */
  stroke: #CBD5E1;
  stroke-width: 1;
}

.state-path[data-coverage="warning"] {
  fill: #FDE68A; /* Soft Amber Warning */
  stroke: #F59E0B;
}

/* Hover and active states - must be !important to override state colors */
.state-path:hover {
  fill: #10B981 !important; /* Vibrant Emerald Hover */
  stroke: #064E3B !important;
  stroke-width: 2.5 !important;
}

.state-path.active {
  fill: #064E3B !important; /* Brand Dark Forest Green Active */
  stroke: #34D399 !important;
  stroke-width: 3.5 !important;
  filter: drop-shadow(0 4px 10px rgba(6, 78, 59, 0.4));
}

/* Tooltip styles */
.map-tooltip {
  position: absolute;
  background-color: rgba(15, 23, 42, 0.95);
  color: var(--text-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 500;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity var(--transition-fast);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  width: max-content;
}

.tooltip-title {
  font-weight: 700;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.25rem;
  margin-bottom: 0.25rem;
  color: var(--accent-emerald);
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 0.2rem;
}

.tooltip-val {
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Map Legend */
.map-legend {
  display: none; /* Replaced by floating legend inside container */
}

/* Floating Legend styled from screenshots */
.map-floating-legend {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-card);
  z-index: 10;
  width: 220px;
  pointer-events: none;
}

.floating-legend-title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
}

.floating-legend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 0.35rem;
}

.floating-legend-row:last-child {
  margin-bottom: 0;
}

.legend-square {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.legend-square.tier-5 { background-color: #044E3F; }
.legend-square.high, .legend-square.tier-4 { background-color: #0D9488; }
.legend-square.medium, .legend-square.tier-3 { background-color: #2DD4BF; }
.legend-square.low, .legend-square.tier-2 { background-color: #5EEAD4; }
.legend-square.tier-1 { background-color: #A7F3D0; }
.legend-square.nodata { background-color: #E2E8F0; }
.legend-square.warning { background-color: #FDE68A; }
.legend-square.active { background-color: #064E3B; border: 1.5px solid #34D399; }
