/**
 * Streets API Documentation - Specific Styles.
 *
 * This stylesheet contains styles specific to the Streets API documentation page, including map preview styling and any
 * custom components.
 */

/* ==========================================================================
   STREETS API SPECIFIC STYLES
   ========================================================================== */

/* ---- Streets Preview Container ---- */

#streets-preview {
  position: relative;
  padding: var(--space-md, 16px);
}

/* ---- Visualization Sections ---- */

.visualization-section {
  margin-bottom: var(--space-lg, 24px);
}

.visualization-section:last-child {
  margin-bottom: 0;
}

.visualization-section h3 {
  margin: var(--space-md, 16px) 0 var(--space-sm, 8px) 0;
  margin-top: 0; /* Override for first heading */
  padding: 0 0 var(--space-xs, 4px) 0;
  font-size: 1.2em;
  font-weight: 600;
  color: var(--color-text-primary, #333333);
  border-bottom: 1px solid var(--color-border-light, #e0e0e0);
}

.visualization-section:first-child h3 {
  margin-top: 0;
}

.visualization-description {
  margin-bottom: 15px;
}

.streets-map-section {
  height: 400px; /* Default height, can be overridden by JavaScript */
  border: 1px solid var(--color-border-light, #e0e0e0);
  border-radius: var(--border-radius, 4px);
  background-color: var(--color-neutral-white);
  overflow: hidden;
  position: relative;
}

/* ---- Loading Messages ---- */

.loading-message {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #666666;
  font-style: italic;
  background-color: #f8f9fa;
}

.loading-message::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid #e0e0e0;
  border-top: 2px solid var(--color-accent-link, #007bff);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#streets-map {
  height: 100%;
  width: 100%;
}

/* ---- Map Controls and Overlays ---- */

.region-title {
  background-color: var(--color-neutral-white);
  padding: 5px 10px;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgb(0 0 0 / 40%);
  font-size: 14px;
  line-height: 1.4;
}

.counter-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: var(--color-neutral-white);
  padding: 5px 10px;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgb(0 0 0 / 40%);
  font-size: 12px;
  font-weight: 500;
  color: #222222;
  z-index: 1000;
}

/* ---- Legend Styles ---- */

.legend {
  background-color: var(--color-neutral-white);
  padding: 6px 8px;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgb(0 0 0 / 40%);
  line-height: 18px;
  color: #555555;
  font-family: var(--font-sans);
}

.legend h4 {
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 600;
  color: #222222;
}

.legend-item {
  margin: 3px 0;
  display: flex;
  align-items: center;
}

.legend-line {
  border: 1px solid #cccccc;
  margin-right: 8px;
}

.legend-item span {
  font-size: 12px;
  color: #555555;
}

/* ---- Statistics Summary ---- */

.stats-summary {
  background-color: var(--color-neutral-white);
  padding: 6px 8px;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgb(0 0 0 / 40%);
  line-height: 16px;
  color: #555555;
  font-size: 12px;
  font-family: var(--font-sans);
}

.stats-summary h4 {
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 600;
  color: #222222;
}

.stats-summary div {
  margin: 2px 0;
}

/* ---- Street Popup Styles ---- */

.street-popup {
  font-family: var(--font-sans);
  max-width: 250px;
  line-height: 1.4;
}

.street-popup h4 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #222222;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 4px;
}

.street-popup p {
  margin: 4px 0;
  font-size: 13px;
  color: #555555;
}

.street-popup strong {
  color: #222222;
  font-weight: 500;
}

/* ---- No Streets Message ---- */

.no-streets-message {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-neutral-white);
  padding: 8px 12px;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgb(0 0 0 / 40%);
  font-size: 14px;
  color: #666666;
  z-index: 1000;
  white-space: nowrap;
}

/* ---- Download Section Enhancements ---- */

.download-buttons .download-btn[data-format="geopackage"] .format-icon {
  font-size: 1.5em;
}

.download-buttons .download-btn[data-format="geopackage"]:hover {
  background-color: #e8f4f8;
  border-color: #2196f3;
}

/* ---- Way Type Badges ---- */

.way-type-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  margin-right: 4px;
  line-height: 1.2;
}

.way-type-badge.residential {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.way-type-badge.primary {
  background-color: #fff3e0;
  color: #ef6c00;
  border: 1px solid #ffcc02;
}

.way-type-badge.secondary {
  background-color: #f3e5f5;
  color: #7b1fa2;
  border: 1px solid #e1bee7;
}

.way-type-badge.tertiary {
  background-color: #e3f2fd;
  color: #1976d2;
  border: 1px solid #bbdefb;
}

.way-type-badge.service {
  background-color: #fafafa;
  color: #424242;
  border: 1px solid #e0e0e0;
}

.way-type-badge.footway,
.way-type-badge.path {
  background-color: #f1f8e9;
  color: #558b2f;
  border: 1px solid #dcedc8;
}

/* ---- Responsive Adjustments ---- */

@media (width <= 768px) {
  .stats-summary,
  .legend {
    font-size: 11px;
  }

  .stats-summary h4,
  .legend h4 {
    font-size: 13px;
  }

  .counter-badge {
    bottom: 60px; /* Make room for legend on mobile */
    right: 5px;
    font-size: 11px;
    padding: 4px 8px;
  }

  .street-popup {
    max-width: 200px;
  }

  .street-popup h4 {
    font-size: 15px;
  }

  .street-popup p {
    font-size: 12px;
  }
}

@media (width <= 480px) {
  .region-title {
    font-size: 12px;
    padding: 4px 8px;
  }

  .no-streets-message {
    font-size: 13px;
    padding: 6px 10px;
  }
}

/* ---- Loading State for Preview ---- */

#streets-preview.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8f9fa;
  color: #666666;
  font-style: italic;
}

#streets-preview.loading::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid #e0e0e0;
  border-top: 2px solid var(--color-accent-link);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

/* ---- API Endpoint Examples ---- */

.endpoint-example {
  background-color: var(--color-bg-code);
  border: 1px solid var(--color-border-code);
  border-radius: var(--border-radius);
  padding: var(--space-sm);
  margin: var(--space-xs) 0;
  font-family: var(--font-mono);
  font-size: var(--code-font-size);
}

.endpoint-example a {
  color: var(--color-accent-link);
  text-decoration: none;
}

.endpoint-example a:hover {
  text-decoration: underline;
}

/* ---- Explore Street Button ---- */

.explore-street-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  background-color: var(--color-accent-link, #007bff);
  color: var(--color-neutral-white) !important;
  text-decoration: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  border: 1px solid var(--color-accent-link, #007bff);
  transition: background-color 0.2s ease;
}

.explore-street-btn:hover {
  background-color: #0056b3;
  border-color: #0056b3;
  text-decoration: none;
}

.explore-street-btn:focus {
  outline: 2px solid rgb(0 123 255 / 50%);
  outline-offset: 2px;
}

/* ---- Responsive adjustments for button ---- */

@media (width <= 480px) {
  .explore-street-btn {
    font-size: 11px;
    padding: 5px 10px;
  }
}

/* ---- Continuous Legend Styles ---- */

.continuous-legend {
  background-color: var(--color-neutral-white);
  padding: 8px 10px;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgb(0 0 0 / 40%);
  line-height: 1.4;
  color: #555555;
  font-family: var(--font-sans);
  max-width: 250px;
}

.continuous-legend h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #222222;
}

.gradient-container {
  border: 1px solid #cccccc;
  border-radius: 3px;
  overflow: hidden;
}

.legend-labels {
  margin-top: 2px;
}

.legend-tick {
  font-size: 10px;
  color: #666666;
  font-weight: 500;
}

.special-legend-item {
  border-top: 1px solid #eeeeee;
  padding-top: 5px;
  margin-top: 8px;
}

.legend-color {
  border: 1px solid #cccccc;
  border-radius: 1px;
}

/* ---- Responsive adjustments for continuous legends ---- */

@media (width <= 768px) {
  .continuous-legend {
    max-width: 180px;
    padding: 6px 8px;
  }

  .gradient-container {
    width: 160px !important;
  }

  .legend-labels {
    width: 160px !important;
  }

  .continuous-legend h4 {
    font-size: 13px;
  }

  .legend-tick {
    font-size: 9px;
  }
}
