/* static/css/weather.css */

.igo-weather-layout {
  padding-top: 24px;
  padding-bottom: 64px;
}

.igo-weather-header {
  margin-bottom: 24px;
}

.igo-weather-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.igo-weather-subtitle {
  font-size: 1.1rem;
  color: var(--igo-text-secondary, #6b7280);
}

.igo-weather-map-wrapper {
  position: relative;
  width: 100%;
  /* Responsive height strategy */
  height: clamp(450px, 70vh, 800px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  background: #e5e7eb; /* Placeholder color before map loads */
}

/* Base map container */
.igo-weather-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* 
  OVERLAYS 
  Ensure they do not cause horizontal overflow
*/

/* Layers Control */
.igo-weather-layers {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  /* Mobile scrolling */
  max-width: calc(100% - 100px); /* Leaves 50px on each side for MapLibre controls */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Hide scrollbar for cleaner look */
}

.igo-weather-layers::-webkit-scrollbar {
  display: none;
}

[dir="rtl"] .igo-weather-layers {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.igo-layer-btn {
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.igo-layer-btn:hover {
  background: #f3f4f6;
}

.igo-layer-btn.active {
  background: #10b981; /* primary green */
  color: #fff;
  border-color: #10b981;
}

/* Legend */
.igo-weather-legend {
  position: absolute;
  bottom: 80px; /* Above timeline */
  left: 16px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  width: min(300px, calc(100% - 32px));
}

[dir="rtl"] .igo-weather-legend {
  left: auto;
  right: 16px;
}

.igo-legend-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #4b5563;
}

.igo-legend-gradient {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.igo-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #6b7280;
}

/* Timeline */
.igo-weather-timeline {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  /* Mobile handling */
  width: max-content;
  max-width: calc(100% - 32px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.igo-weather-timeline::-webkit-scrollbar {
  display: none;
}

.igo-timeline-btn {
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #4b5563;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.igo-timeline-btn:hover:not(:disabled) {
  background: #f3f4f6;
  color: #111827;
}

.igo-timeline-btn.active {
  background: #111827;
  color: #fff;
}

.igo-timeline-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Custom Marker Overlay */
.igo-weather-marker {
  width: 12px;
  height: 12px;
  pointer-events: none; /* Let map pan through whitespace */
}

.igo-weather-marker-dot {
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  cursor: pointer;
  background-color: #9ca3af;
  transition: background-color 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
}

.igo-weather-marker-value {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.95);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Mobile specific tweaks */
@media (max-width: 768px) {
  .igo-weather-map-wrapper {
    height: clamp(500px, 80vh, 700px); /* Taller proportion on mobile */
  }

  .igo-weather-layers {
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px;
    max-width: calc(100% - 90px); /* 45px on each side */
  }

  [dir="rtl"] .igo-weather-layers {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .igo-layer-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .igo-weather-legend {
    bottom: 70px;
    left: 12px;
  }

  [dir="rtl"] .igo-weather-legend {
    left: auto;
    right: 12px;
  }

  .igo-weather-timeline {
    bottom: 12px;
    padding: 6px;
  }

  .igo-timeline-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
}
