/* ============================================================
   ATLAS — Map Poster Studio
   style.css
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --ui-bg:          #0d0d0f;
  --ui-surface:     #161619;
  --ui-surface2:    #1e1e23;
  --ui-border:      #2a2a32;
  --ui-accent:      #FFD700;
  --ui-accent2:     #ff6b35;
  --ui-text:        #e8e8f0;
  --ui-text-dim:    #6b6b80;
  --ui-text-faint:  #3a3a48;
  --ui-success:     #22d3a0;
  --ui-danger:      #ff4d6d;

  --sidebar-w:      320px;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  --font-display:   'Bebas Neue', sans-serif;
  --font-body:      'DM Sans', sans-serif;
  --font-mono:      'DM Mono', monospace;

  --transition:     0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--ui-bg);
  color: var(--ui-text);
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
body {
  display: flex;
  flex-direction: row;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--ui-bg);
  border-right: 1px solid var(--ui-border);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-border) transparent;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--ui-border); border-radius: 2px; }

/* ── Logo ── */
.logo-block {
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--ui-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--ui-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 42px;
  letter-spacing: 0.12em;
  color: var(--ui-accent);
  line-height: 1;
  text-shadow: 0 0 40px rgba(255, 215, 0, 0.25);
}

.logo-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--ui-text-dim);
  text-transform: uppercase;
}

/* ── Panel Sections ── */
.panel-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--ui-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ui-text-dim);
  display: block;
}

/* ── Search ── */
.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.city-input {
  flex: 1;
  background: var(--ui-surface2);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--ui-text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.city-input::placeholder { color: var(--ui-text-faint); }

.city-input:focus {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.btn-search {
  background: var(--ui-accent);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}

.btn-search:hover {
  background: #ffe747;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.35);
}

.btn-search:active { transform: translateY(0); }

.search-hint {
  font-size: 12px;
  color: var(--ui-text-dim);
  min-height: 16px;
  transition: color var(--transition);
}

.search-hint.error { color: var(--ui-danger); }
.search-hint.success { color: var(--ui-success); }

/* ── Preset Grid ── */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-btn {
  background: var(--ui-surface2);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--ui-text-dim);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition);
}

.preset-btn:hover {
  border-color: var(--ui-accent);
  color: var(--ui-text);
  transform: translateY(-1px);
}

.preset-btn.active {
  border-color: var(--ui-accent);
  background: rgba(255, 215, 0, 0.08);
  color: var(--ui-accent);
  box-shadow: 0 0 0 1px rgba(255,215,0,0.2);
}

.preset-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.08);
}

/* ── Layer Rows ── */
.layer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--ui-surface2);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), background var(--transition);
}

.layer-row:hover {
  border-color: rgba(255,215,0,0.2);
  background: #1e1e26;
}

.layer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.layer-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ui-text);
}

/* ── Toggle Switch ── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  transition: background var(--transition), border-color var(--transition);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--ui-text-dim);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}

.toggle-switch input:checked + .toggle-track {
  background: rgba(255, 215, 0, 0.15);
  border-color: var(--ui-accent);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(16px);
  background: var(--ui-accent);
}

/* ── Color Picker ── */
.color-picker {
  width: 32px;
  height: 32px;
  border: 2px solid var(--ui-border);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  padding: 2px;
  transition: border-color var(--transition), transform var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.color-picker::-webkit-color-swatch-wrapper { padding: 0; border-radius: 3px; }
.color-picker::-webkit-color-swatch { border: none; border-radius: 3px; }
.color-picker::-moz-color-swatch { border: none; border-radius: 3px; }

.color-picker:hover {
  border-color: var(--ui-accent);
  transform: scale(1.1);
}

/* ── Sliders ── */
.slider-row, .toggle-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.slider-label {
  font-size: 12px;
  color: var(--ui-text-dim);
  font-weight: 500;
}

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--ui-surface2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: background var(--transition);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ui-accent);
  border: 2px solid var(--ui-bg);
  box-shadow: 0 0 8px rgba(255,215,0,0.4);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px rgba(255,215,0,0.6);
}

.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ui-accent);
  border: 2px solid var(--ui-bg);
  box-shadow: 0 0 8px rgba(255,215,0,0.4);
  cursor: pointer;
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ui-accent);
  min-width: 38px;
  text-align: right;
}

/* ── Zoom Row ── */
.zoom-row {
  display: flex;
  gap: 8px;
}

.btn-zoom {
  flex: 1;
  background: var(--ui-surface2);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  color: var(--ui-text);
  padding: 9px 10px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-zoom:hover {
  border-color: var(--ui-accent);
  color: var(--ui-accent);
  transform: translateY(-1px);
  background: rgba(255,215,0,0.06);
}

.btn-zoom:active { transform: translateY(0); }

/* ── Export ── */
.export-section {
  margin-top: auto;
  border-top: 1px solid var(--ui-border);
  border-bottom: none;
  position: sticky;
  bottom: 0;
  background: var(--ui-bg);
  padding-bottom: 24px;
}

.btn-export {
  width: 100%;
  background: var(--ui-accent);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}

.btn-export:hover {
  background: #ffe747;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(255, 215, 0, 0.4);
}

.btn-export:active { transform: translateY(0); box-shadow: none; }

.btn-export:disabled {
  background: var(--ui-surface2);
  color: var(--ui-text-dim);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.export-note {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ui-text-faint);
  text-align: center;
  letter-spacing: 0.08em;
}

/* ── MAP WRAPPER ── */
.map-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
}

.map-container {
  width: 100%;
  height: 100%;
  position: relative;
}

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

/* Remove MapLibre default UI branding look */
.maplibregl-ctrl-attrib { display: none !important; }
.maplibregl-ctrl-logo { display: none !important; }

/* ── Map overlay frame (decorative) ── */
.map-overlay-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  border: 2px solid rgba(255, 215, 0, 0.06);
  transition: box-shadow 0.4s ease;
}

.map-overlay-frame.glow-active {
  box-shadow: inset 0 0 80px rgba(255, 215, 0, 0.04),
              0 0 0 1px rgba(255, 215, 0, 0.12);
}

/* ── City Label Overlay ── */
.city-label-overlay {
  position: absolute;
  bottom: 28px;
  left: 32px;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeInUp 0.5s ease both;
}

.city-name-display {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 52px);
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1;
  text-shadow: 0 2px 20px rgba(0,0,0,0.9), 0 0 40px rgba(255,215,0,0.15);
}

.city-coords-display {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: rgba(255, 215, 0, 0.5);
  text-transform: uppercase;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading ── */
.map-loading {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 50;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--ui-text-dim);
  backdrop-filter: blur(4px);
  transition: opacity 0.4s ease;
}

.map-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--ui-border);
  border-top-color: var(--ui-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile Toggle Button ── */
.mobile-toggle {
  display: none;
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: rgba(13,13,15,0.92);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  color: var(--ui-text);
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all var(--transition);
}

.mobile-toggle:hover { border-color: var(--ui-accent); color: var(--ui-accent); }

/* ── Responsive ── */
@media (max-width: 768px) {
  body { flex-direction: column; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(var(--sidebar-w), 90vw);
    transform: translateX(-100%);
    box-shadow: 4px 0 40px rgba(0,0,0,0.7);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .map-wrapper {
    width: 100%;
    height: 100vh;
  }

  .mobile-toggle {
    display: flex;
  }

  .city-label-overlay {
    bottom: 20px;
    left: 20px;
  }

  .preset-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Sidebar Overlay backdrop for mobile ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}

.sidebar-backdrop.active { display: block; }

/* ── Map canvas filter wrapper ── */
#map canvas {
  transition: filter 0.3s ease;
}
