/* ============================================================
   Hà Nội 3D Transit Map — Styles
   Mobile-first responsive design
   ============================================================ */

/* Reset & base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
}

/* Map container — full viewport */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ============================================================
   UI Overlay Panel
   ============================================================ */
#ui-panel {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  background: rgba(20, 20, 35, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 16px;
  color: #e8e8ec;
  font-size: 13px;
  line-height: 1.5;
  min-width: 210px;
  max-width: 260px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  transition: opacity 0.25s, transform 0.25s;
}

#ui-panel.collapsed {
  opacity: 0;
  transform: translateX(-110%);
  pointer-events: none;
}

/* Panel title */
#panel-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

/* Legend */
#legend {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.legend-swatch {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Time of day */
#time-control {
  margin-bottom: 10px;
}

#time-label {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

#time-buttons {
  display: flex;
  gap: 4px;
}

.time-btn {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: transparent;
  color: #c0c0cc;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.time-btn:hover {
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}

.time-btn.active {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.45);
  color: #fff;
  font-weight: 600;
}

/* Layer toggles */
#toggles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  color: #c0c0cc;
}

.toggle-item input[type="checkbox"] {
  accent-color: #4a9eff;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Panel toggle button (mobile) */
#panel-toggle {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 20;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(20, 20, 35, 0.85);
  color: #e8e8ec;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

/* ============================================================
   MapLibre popup overrides
   ============================================================ */
.maplibregl-popup-content {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  border: 1px solid rgba(0,0,0,0.08);
  max-width: 240px;
}

.maplibregl-popup-content strong {
  font-size: 14px;
  display: block;
  margin-bottom: 2px;
}

.maplibregl-popup-content .popup-line {
  font-size: 11px;
  color: #666;
}

.maplibregl-popup-close-button {
  font-size: 18px;
  padding: 2px 6px;
}

/* POI popup */
.poi-popup .poi-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.poi-popup .poi-desc {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
}

/* ============================================================
   Mobile responsive
   ============================================================ */
@media (max-width: 768px) {
  #ui-panel {
    top: 8px;
    left: 8px;
    padding: 10px 12px;
    min-width: 180px;
    max-width: 220px;
    font-size: 11px;
    border-radius: 12px;
  }

  #panel-title {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .legend-item {
    font-size: 11px;
    gap: 6px;
  }

  .time-btn {
    font-size: 10px;
    padding: 5px 3px;
  }

  .toggle-item {
    font-size: 11px;
  }

  #panel-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 400px) {
  #ui-panel {
    min-width: 160px;
    max-width: 185px;
    padding: 8px 10px;
    border-radius: 10px;
  }

  #panel-title {
    font-size: 12px;
  }

  .legend-item {
    font-size: 10px;
    gap: 4px;
  }
}
