/**
 * PolicyPath Interactive Insurance Cost Map Styles
 */

.insurance-map-container {
  width: 100%;
  max-width: 1000px;
  margin: 2rem auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.insurance-map-svg {
  width: 100%;
  height: auto;
  display: block;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.state {
  transition: fill 0.2s ease, stroke-width 0.1s ease;
}

.state:hover {
  filter: brightness(0.9);
}

/* Controls */
.map-controls {
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.map-controls label {
  font-weight: 600;
  color: #495057;
  margin: 0;
}

.map-metric-select {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: #fff;
  color: #495057;
  cursor: pointer;
  min-width: 180px;
}

.map-metric-select:focus {
  outline: none;
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Legend */
.map-legend {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.legend-title {
  font-weight: 600;
  font-size: 1rem;
  color: #212529;
  margin-bottom: 0.75rem;
  text-align: center;
}

.legend-scale {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.legend-gradient {
  width: 200px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(to right,
    #1a9850,  /* Green - low/good */
    #91cf60,
    #d9ef8b,
    #fee08b,
    #fc8d59,
    #d73027   /* Red - high/bad */
  );
  border: 1px solid #dee2e6;
}

.legend-min,
.legend-max {
  font-size: 0.875rem;
  font-weight: 500;
  color: #495057;
  white-space: nowrap;
}

.legend-avg {
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #6c757d;
}

/* Tooltip */
.map-tooltip {
  position: absolute;
  padding: 0.75rem 1rem;
  background: rgba(33, 37, 41, 0.95);
  color: #fff;
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.5;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 200px;
}

.map-tooltip strong {
  font-size: 1rem;
  display: block;
  margin-bottom: 0.25rem;
  color: #fff;
}

/* Loading and Error States */
.map-loading,
.map-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  color: #6c757d;
  font-size: 1rem;
}

.map-error {
  color: #dc3545;
}

/* Responsive */
@media (max-width: 768px) {
  .insurance-map-container {
    margin: 1rem auto;
  }

  .map-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .map-controls label {
    text-align: center;
  }

  .map-metric-select {
    width: 100%;
  }

  .legend-gradient {
    width: 150px;
  }

  .legend-min,
  .legend-max {
    font-size: 0.75rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .insurance-map-svg {
    background: #2d3238;
    border-color: #495057;
  }

  .map-controls,
  .map-legend {
    background: #2d3238;
    border-color: #495057;
  }

  .map-controls label,
  .legend-title {
    color: #e9ecef;
  }

  .map-metric-select {
    background: #343a40;
    border-color: #495057;
    color: #e9ecef;
  }

  .legend-min,
  .legend-max {
    color: #adb5bd;
  }

  .legend-avg {
    color: #adb5bd;
  }

  .map-loading,
  .map-error {
    background: #2d3238;
    border-color: #495057;
    color: #adb5bd;
  }
}

/* Theme-aware dark mode (for HBS theme) */
[data-bs-theme="dark"] .insurance-map-svg {
  background: #2d3238;
  border-color: #495057;
}

[data-bs-theme="dark"] .map-controls,
[data-bs-theme="dark"] .map-legend {
  background: #2d3238;
  border-color: #495057;
}

[data-bs-theme="dark"] .map-controls label,
[data-bs-theme="dark"] .legend-title {
  color: #e9ecef;
}

[data-bs-theme="dark"] .map-metric-select {
  background: #343a40;
  border-color: #495057;
  color: #e9ecef;
}

[data-bs-theme="dark"] .legend-min,
[data-bs-theme="dark"] .legend-max,
[data-bs-theme="dark"] .legend-avg {
  color: #adb5bd;
}

[data-bs-theme="dark"] .map-loading,
[data-bs-theme="dark"] .map-error {
  background: #2d3238;
  border-color: #495057;
  color: #adb5bd;
}
