/* ══════════════════════════════════════
   Map Viewport
   ══════════════════════════════════════ */

#viewport {
  flex: 1 1 0;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
  min-height: 0;
  min-width: 0;
}

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

/* Override MapLibre controls */
.maplibregl-ctrl-group {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
}

.maplibregl-ctrl-group button {
  width: 32px !important;
  height: 32px !important;
  border-color: var(--border-subtle) !important;
}

.maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--border-subtle) !important;
}

.maplibregl-ctrl-group button:hover {
  background: var(--bg-hover) !important;
}

.maplibregl-ctrl-attrib {
  background: rgba(10, 10, 15, 0.7) !important;
  color: var(--text-muted) !important;
  font-size: 9px !important;
}

.maplibregl-ctrl-attrib a {
  color: var(--text-secondary) !important;
}

/* Lift attribution above the timeline panel at the bottom */
.maplibregl-ctrl-bottom-right {
  bottom: calc(var(--timeline-height, 220px) + 4px) !important;
}

.maplibregl-ctrl-bottom-left {
  bottom: calc(var(--timeline-height, 220px) + 4px) !important;
}

/* ── Map Info Bar ── */
#map-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  z-index: 10;
  border-top: 1px solid var(--border-subtle);
}

.info-divider {
  color: var(--border-bright);
}

/* ── Style Selector ── */
#style-selector {
  position: absolute;
  bottom: 32px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 10;
}

.style-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  border: 2px solid transparent;
}

.style-btn span {
  font-size: 9px;
  color: var(--text-muted);
}

.style-btn:hover {
  background: var(--bg-elevated);
}

.style-btn.active {
  border-color: var(--accent-primary);
}

.style-btn.active span {
  color: var(--accent-primary);
}

.style-preview {
  width: 44px;
  height: 30px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.style-preview--streets {
  background: linear-gradient(135deg, #e8dcc8 0%, #c5d5a5 40%, #a8c8e0 70%, #b8cca0 100%);
}

.style-preview--dark {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.style-preview--light {
  background: linear-gradient(135deg, #f5f5f0 0%, #e8e8e0 50%, #d5dde0 100%);
}

.style-preview--positron {
  background: linear-gradient(135deg, #f0f0ea 0%, #ddddd5 50%, #c8c8c0 100%);
}

.style-preview--satellite {
  background: linear-gradient(135deg, #1a3a1a 0%, #2a5a3a 30%, #1a4a5a 60%, #3a3a2a 100%);
}

/* ══════════════════════════════════════
   Label Control Panel
   ══════════════════════════════════════ */

.label-control {
  position: absolute;
  bottom: 32px;
  left: 12px;
  z-index: 10;
}

/* Expanded panel */
.label-control .label-control-panel {
  background: rgba(15, 15, 22, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  min-width: 200px;
  max-width: 240px;
  box-shadow: var(--shadow-lg);
}

/* Mini button (collapsed state) */
.label-control-mini-btn {
  display: none;
  align-items: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(15, 15, 22, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  cursor: pointer;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
  padding: 0;
}

.label-control-mini-btn:hover {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.label-mini-arrow {
  display: none;
}

/* Collapsed state */
.label-control.collapsed .label-control-panel {
  display: none;
}

.label-control.collapsed .label-control-mini-btn {
  display: flex;
}

/* Minimize button in header */
.label-btn-minimize {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
}

.label-btn-minimize:hover {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.label-control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.label-control-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.label-control-actions {
  display: flex;
  gap: 4px;
}

.label-btn-all {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.label-btn-all:hover {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.label-control-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.label-control-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 3px 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.label-control-item:hover {
  background: var(--bg-hover);
}

.label-control-divider {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 4px 3px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
}

.label-cat-name {
  font-size: 11px;
  color: var(--text-secondary);
  flex: 1;
}

.label-cat-count {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Small toggle switch variant */
.toggle-switch-sm {
  width: 28px;
  height: 14px;
}

.toggle-switch-sm .toggle-slider::before {
  width: 10px;
  height: 10px;
  bottom: 2px;
  left: 2px;
}

.toggle-switch-sm input:checked + .toggle-slider::before {
  transform: translateX(14px);
}

/* ══════════════════════════════════════
   STYLE CUSTOMIZER PANEL
   ══════════════════════════════════════ */

.style-customizer-panel {
  position: absolute;
  bottom: 32px;
  right: 72px;
  width: 220px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 100;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

.style-customizer-panel.hidden { display: none; }

.sc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

.sc-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.sc-close {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.sc-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sc-presets {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  justify-content: center;
}

.sc-preset-btn {
  width: 28px;
  height: 24px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.sc-preset-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.15);
}

.sc-list {
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sc-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  transition: background var(--transition-fast);
}

.sc-item:hover { background: var(--bg-hover); }

.sc-icon { font-size: 11px; width: 16px; text-align: center; }

.sc-label {
  flex: 1;
  font-size: 10px;
  color: var(--text-secondary);
}

.sc-count {
  font-size: 8px;
  color: var(--text-muted);
  min-width: 14px;
  text-align: center;
}

.sc-toggle-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 11px;
  width: 22px;
  height: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 1;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.sc-toggle-btn:hover { background: var(--bg-hover); }

.sc-toggle-btn.sc-toggle-off {
  opacity: 0.3;
}

.sc-color-picker {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  background: none;
}

.sc-color-picker:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.sc-color-picker::-webkit-color-swatch-wrapper { padding: 1px; }
.sc-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.sc-footer {
  padding: 6px 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
}

.sc-reset-btn {
  font-size: 9px;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.sc-reset-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

/* ══════════════════════════════════════
   PATH TOOL — Vertex & Handle styles
   ══════════════════════════════════════ */

.path-vertex-marker {
  transition: transform 0.1s ease;
}

.path-vertex-marker:hover {
  transform: scale(1.3) rotate(45deg) !important;
}

.path-handle-dot:hover {
  transform: scale(1.4);
}

/* Custom style button special preview */
.style-preview--custom {
  background: conic-gradient(
    #e74c3c 0deg, #f39c12 60deg, #2ecc71 120deg,
    #3498db 180deg, #9b59b6 240deg, #e74c3c 360deg
  );
}
