/* ParkSpot map UI — layer selector, mode badges, offline storage, pin styling */

.map-mode-toggle {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 450;
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.88);
  color: #34c97a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.map-mode-toggle.is-offline {
  color: #f5a623;
}

.map-layer-btn {
  position: absolute;
  right: max(12px, var(--safe-right));
  bottom: calc(max(12px, var(--safe-bottom)) + var(--map-ctrl-stack) * var(--map-ctrl-size) + (var(--map-ctrl-stack) - 1) * var(--map-ctrl-gap) + 12px);
  z-index: 501;
  width: var(--map-ctrl-size);
  height: var(--map-ctrl-size);
  background: #1a1a2e;
  border: none;
  border-radius: 10px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.map-layer-btn:hover {
  background: #2a2a4e;
}

.map-controls-right {
  position: absolute;
  right: max(12px, var(--safe-right));
  bottom: max(12px, var(--safe-bottom));
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--map-ctrl-gap);
}

#gpsAccuracyBtn,
#nav-recenter,
.accuracy-btn,
.gps-btn {
  position: absolute;
  right: max(12px, var(--safe-right));
  top: 12px;
  bottom: unset !important;
  z-index: 502;
  width: var(--map-ctrl-size);
  height: var(--map-ctrl-size);
}

.map-satellite-badge,
.map-offline-badge,
.map-cache-label {
  position: absolute;
  left: 12px;
  z-index: 440;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  pointer-events: none;
}

.map-satellite-badge { bottom: 88px; }
.map-offline-badge { top: 48px; }
.map-cache-label {
  bottom: 120px;
  font-weight: 500;
  font-size: 10px;
  opacity: 0.9;
}

.map-offline-badge.hidden,
.map-satellite-badge.hidden,
.map-cache-label.hidden { display: none; }

.map-no-tiles-msg {
  position: absolute;
  inset: 0;
  z-index: 430;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: rgba(11, 15, 26, 0.55);
  pointer-events: none;
}

.map-no-tiles-msg.hidden { display: none; }

.map-layer-sheet {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.map-layer-sheet.open {
  pointer-events: auto;
  opacity: 1;
}

.map-layer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.map-layer-card {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface, #fff);
  border-radius: 16px 16px 0 0;
  padding: 0 0 env(safe-area-inset-bottom, 0);
  max-height: 70vh;
  overflow: auto;
}

.map-layer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

.map-layer-header button {
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.map-layer-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.map-layer-opt.selected {
  background: rgba(79, 142, 247, 0.08);
}

.map-layer-opt-icon { font-size: 22px; flex-shrink: 0; }

.map-layer-opt-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.map-layer-opt-body small {
  color: var(--text-muted, #64748b);
  font-size: 12px;
}

.map-layer-tag {
  font-style: normal;
  font-size: 11px;
  color: #f5a623;
}

.map-layer-check,
.map-layer-lock {
  font-size: 16px;
  flex-shrink: 0;
}

.car-pin {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(0, 0, 0, 0.35);
}

.car-pin img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
}

.nav-mode-tabs.offline-nav-modes .nav-mode-tab[data-mode="driving"],
.nav-mode-tabs.offline-nav-modes .nav-mode-tab[data-mode="cycling"] {
  display: none;
}

.layer-selector-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #1a1a2e;
  border-radius: 16px 16px 0 0;
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: none;
  flex-direction: column;
  gap: 8px;
}

.layer-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #ffffff;
  font-weight: 600;
  font-size: 16px;
}

.layer-selector-header button {
  border: none;
  background: none;
  color: #8888aa;
  font-size: 20px;
  cursor: pointer;
}

.layer-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 12px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  cursor: pointer;
  color: #e8e8f0;
}

.layer-option.selected {
  background: rgba(37, 99, 235, 0.2);
  outline: 1px solid rgba(37, 99, 235, 0.4);
}

.layer-option-icon { font-size: 22px; flex-shrink: 0; }

.layer-option-title {
  font-weight: 600;
  font-size: 15px;
  color: #e8e8f0;
}

.layer-option-desc {
  font-size: 12px;
  color: #8888aa;
}

.online-badge {
  font-size: 10px;
  font-weight: 600;
  color: #f5a623;
  margin-left: 6px;
}

.satellite-badge {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  color: #00E5FF;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  pointer-events: none;
  display: none;
}

.satellite-badge.hidden,
#satelliteActiveBadge.hidden { display: none !important; }

/* ── Offline Maps Storage — dark theme ── */
.offline-maps-screen,
#offlineMapsScreen,
[data-screen="offline-maps"],
.offline-storage-panel {
  background: #0d0d1a;
  min-height: 100%;
  color: #e8e8f0;
  font-family: inherit;
}

.offline-storage-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(100%, 420px);
  z-index: 8500;
  transform: translateX(100%);
  transition: transform 0.25s;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 16px);
  overflow-y: auto;
}

.offline-storage-panel.open {
  transform: translateX(0);
}

.offline-maps-header,
.offline-storage-header {
  background: #13132a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px 16px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.offline-maps-title,
.offline-storage-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 4px 0;
  flex: 1 1 100%;
}

.offline-maps-subtitle {
  font-size: 13px;
  color: #8888aa;
  margin: 0;
  flex: 1 1 100%;
}

#offline-storage-close {
  background: none;
  border: none;
  color: #8888aa;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
}

.storage-summary-card {
  background: #13132a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  margin: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.storage-used-label {
  font-size: 12px;
  color: #8888aa;
  margin-bottom: 4px;
}

.storage-used-value {
  font-size: 28px;
  font-weight: 700;
  color: #4ade80;
}

.storage-used-unit {
  font-size: 14px;
  color: #8888aa;
  margin-left: 4px;
}

#totalOfflineStorage {
  font-size: 28px;
  font-weight: 700;
  color: #4ade80;
}

.offline-section-label {
  font-size: 12px;
  font-weight: 600;
  color: #8888aa;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 16px 8px;
  margin-top: 8px;
}

.offline-spot-row,
.offline-storage-row {
  background: #13132a;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  margin: 0 16px 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.offline-spot-row .spot-name,
.offline-storage-name {
  font-size: 15px;
  font-weight: 500;
  color: #e8e8f0;
  flex: 1;
}

.offline-spot-row .spot-size,
.offline-storage-size {
  font-size: 13px;
  color: #8888aa;
  margin-right: 10px;
  white-space: nowrap;
}

.offline-spot-row button,
.offline-dl-spot {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.offline-spot-row button:hover,
.offline-dl-spot:hover {
  background: #1d4ed8;
}

.offline-spot-row button.delete-btn,
.offline-del-spot {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.offline-spot-row button.delete-btn:hover,
.offline-del-spot:hover {
  background: rgba(239, 68, 68, 0.25);
}

.download-progress-panel {
  background: #13132a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  margin: 0 16px 16px;
  padding: 18px 20px;
}

.download-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

#downloadLabel {
  font-size: 15px;
  font-weight: 500;
  color: #e8e8f0;
}

.cancel-download-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}

.progress-bar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #4ade80);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.progress-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

#downloadPct {
  font-size: 20px;
  font-weight: 700;
  color: #4ade80;
}

#downloadTileCount {
  font-size: 12px;
  color: #8888aa;
}

#downloadZoomLabel {
  font-size: 12px;
  color: #8888aa;
}

.download-est-size {
  font-size: 12px;
  color: #8888aa;
  margin-top: 8px;
}

.offline-empty-state,
.offline-empty {
  text-align: center;
  padding: 48px 32px;
  color: #8888aa;
}

.offline-empty-state p,
.offline-empty {
  font-size: 15px;
  color: #8888aa;
  margin: 0;
}

.offline-storage-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 16px 16px;
}

.offline-storage-actions .btn-primary {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.offline-storage-actions .btn-ghost {
  background: transparent;
  color: #8888aa;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

.offline-storage-totals {
  padding: 0 16px;
  color: #8888aa;
}

.offline-storage-totals p {
  color: #8888aa;
  margin: 0;
}

.photo-preview-box.hidden { display: none !important; }
