/* ==========================================================================
   Wrocław 3D — style aplikacji
   ========================================================================== */

:root {
  --bg: #10141c;
  --panel: rgba(16, 20, 28, 0.92);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #eef1f6;
  --text-dim: #9aa3b2;
  --accent: #e63946;        /* czerwień herbu Wrocławia */
  --accent-soft: rgba(230, 57, 70, 0.15);
  --gold: #f4c95d;
  --radius: 14px;
  --sidebar-width: 320px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  font-size: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
}

#map { position: absolute; inset: 0; }

/* --------------------------------------------------------------------------
   Ekran ładowania
   -------------------------------------------------------------------------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1b2230 0%, #0c0f16 100%);
  transition: opacity 0.6s ease, visibility 0.6s;
}
#loader.hidden { opacity: 0; visibility: hidden; }
.loader-inner { text-align: center; }
.loader-inner h1 { font-size: 2rem; letter-spacing: 0.08em; margin-top: 1.2rem; }
.loader-inner p { color: var(--text-dim); margin-top: 0.4rem; }
.loader-ring {
  width: 64px; height: 64px;
  margin: 0 auto;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Panel boczny
   -------------------------------------------------------------------------- */
#sidebar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  z-index: 20;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
#sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }

#sidebar-toggle {
  position: absolute;
  top: 12px;
  left: calc(var(--sidebar-width) + 12px);
  z-index: 21;
  width: 42px; height: 42px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s;
}
#sidebar-toggle:hover { background: rgba(255, 255, 255, 0.08); }
#sidebar.collapsed ~ #sidebar-toggle,
body.sidebar-collapsed #sidebar-toggle { left: 12px; }

.sidebar-header { padding: 1.3rem 1.2rem 0.9rem; }
.sidebar-header h1 { font-size: 1.45rem; display: flex; align-items: center; gap: 0.55rem; }
.sidebar-header .herb { height: 32px; width: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4)); }
.sidebar-header p { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.25rem; }

/* Wyszukiwarka */
.search-box { position: relative; padding: 0 1.2rem; }
#search-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
#search-input:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.09); }
#search-input::placeholder { color: var(--text-dim); }
#search-results {
  position: absolute;
  left: 1.2rem; right: 1.2rem;
  top: calc(100% + 4px);
  z-index: 30;
  list-style: none;
  background: #1c2331;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
#search-results li {
  padding: 0.6rem 0.85rem;
  font-size: 0.83rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
#search-results li:last-child { border-bottom: none; }
#search-results li:hover { background: var(--accent-soft); }
#search-results li.empty { color: var(--text-dim); cursor: default; }
#search-results li.empty:hover { background: none; }

/* Przyciski akcji */
.actions { padding: 0.9rem 1.2rem 0.2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.action-btn {
  flex: 1;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  white-space: nowrap;
}
.action-btn:hover { background: rgba(255, 255, 255, 0.1); }
.action-btn:active { transform: scale(0.97); }
.action-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.action-btn.primary:hover { background: #d32f3c; }
.action-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #ff8a94;
}

/* Suwaki */
.slider-group { padding: 0.9rem 1.2rem 0.3rem; display: flex; flex-direction: column; gap: 0.7rem; }
.slider-group label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.slider-group label span { float: right; color: var(--text); font-variant-numeric: tabular-nums; }
.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Lista zabytków */
.section-title {
  padding: 1rem 1.2rem 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
#landmark-list { list-style: none; padding: 0 0.7rem 0.5rem; }
#landmark-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
#landmark-list li:hover { background: rgba(255, 255, 255, 0.07); }
#landmark-list li.active { background: var(--accent-soft); }
#landmark-list .lm-icon {
  flex: 0 0 38px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}
#landmark-list .lm-name { font-size: 0.88rem; font-weight: 600; }
#landmark-list .lm-desc { font-size: 0.75rem; color: var(--text-dim); margin-top: 1px; }

.sidebar-footer {
  margin-top: auto;
  padding: 0.9rem 1.2rem 1.1rem;
  border-top: 1px solid var(--panel-border);
  font-size: 0.72rem;
  color: var(--text-dim);
}
.sidebar-footer a { color: var(--text-dim); }
.sidebar-footer .hint { margin-top: 0.5rem; line-height: 1.45; }
.sidebar-footer .copyright { margin-top: 0.5rem; text-align: center; }
.sidebar-header .c3s-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 0.6rem;
}
.sidebar-header .c3s-logo .mark {
  background: #d38c60;
  color: #1d1d1f;
  font-weight: 700;
  font-size: 0.68rem;
  padding: 3px 6px;
  border-radius: 5px;
}

/* --------------------------------------------------------------------------
   Pasek statusu
   -------------------------------------------------------------------------- */
#status-bar {
  position: absolute;
  bottom: 0; right: 0;
  z-index: 15;
  display: flex;
  gap: 1.1rem;
  padding: 0.35rem 0.9rem;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-top-left-radius: 10px;
  border: 1px solid var(--panel-border);
  border-right: none; border-bottom: none;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
#status-bar span { white-space: nowrap; }

/* --------------------------------------------------------------------------
   Znaczniki i dymki MapLibre
   -------------------------------------------------------------------------- */
.landmark-marker {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 50% 50% 50% 4px;
  transform: rotate(0deg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.15s;
}
.landmark-marker:hover { transform: scale(1.15); }

.maplibregl-popup-content {
  background: #1c2331 !important;
  color: var(--text) !important;
  border-radius: 12px !important;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow) !important;
  padding: 0.9rem 1rem !important;
  font-family: inherit !important;
  max-width: 280px;
}
.maplibregl-popup-tip { border-top-color: #1c2331 !important; border-bottom-color: #1c2331 !important; }
.maplibregl-popup-close-button { color: var(--text-dim) !important; font-size: 1.2rem; right: 4px; top: 2px; }
.popup-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.3rem; }
.popup-desc { font-size: 0.8rem; color: var(--text-dim); line-height: 1.45; }
.popup-meta { margin-top: 0.5rem; font-size: 0.75rem; color: var(--gold); }

/* Kontrolki MapLibre w ciemnej skórce */
.maplibregl-ctrl-group {
  background: var(--panel) !important;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow) !important;
}
.maplibregl-ctrl-group button { background: transparent !important; }
.maplibregl-ctrl-group button:hover { background: rgba(255, 255, 255, 0.08) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.9); }
.maplibregl-ctrl-attrib {
  background: rgba(16, 20, 28, 0.75) !important;
  color: var(--text-dim) !important;
  font-size: 0.68rem;
}
.maplibregl-ctrl-attrib a { color: var(--text-dim) !important; }
.maplibregl-ctrl-scale {
  background: rgba(16, 20, 28, 0.6) !important;
  color: var(--text) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}

/* --------------------------------------------------------------------------
   Ikony SVG w przyciskach i na liście zabytków
   -------------------------------------------------------------------------- */
.action-btn { display: flex; align-items: center; justify-content: center; gap: 0.45rem; }
.action-btn svg { width: 15px; height: 15px; flex: none; }
#landmark-list .lm-icon svg { width: 19px; height: 19px; color: var(--gold); }
#tour-controls button { display: flex; align-items: center; justify-content: center; }
#tour-controls button svg { width: 20px; height: 20px; }

/* --------------------------------------------------------------------------
   Pasek sterowania wycieczką (na mapie, u dołu)
   -------------------------------------------------------------------------- */
#tour-controls {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  gap: 0.55rem;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
#tour-controls[hidden] { display: none; }
#tour-controls button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background 0.2s;
}
#tour-controls button:hover { background: rgba(255, 255, 255, 0.08); }
#tour-controls button.active { background: var(--accent-soft); border-color: var(--accent); }

/* --------------------------------------------------------------------------
   Wersja mobilna
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  :root { --sidebar-width: min(86vw, 320px); }
  #status-bar { display: none; }
}
