/* Waldkauf-Viewer – Design im Look der Pfadfinderbildungsstätte Sager Schweiz */

:root {
  --orange: #f47920;
  --orange-dark: #d9641a;
  --amber: #f0ad4e;
  --green: #4caf50;
  --ink: #3d3a36;
  --muted: #8a857c;
  --line: #e6e1d8;
  --panel: #ffffff;
  --soft: #f6f3ee;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

#app { display: flex; height: 100vh; }

/* ---- Seitenleiste ---- */
#panel {
  width: 320px;
  flex: 0 0 320px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 18px;
  gap: 16px;
}

#panel header .logo { width: 100%; height: auto; display: block; }
#panel header .sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.stats { display: flex; gap: 8px; }
.stat {
  flex: 1;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
}
.stat span { display: block; font-size: 20px; font-weight: 700; line-height: 1.1; }
.stat small { display: block; font-size: 11px; font-weight: 600; color: var(--orange-dark); margin-top: 2px; }
.stat label { font-size: 11px; color: var(--muted); text-transform: uppercase; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.legend div { display: flex; align-items: center; gap: 7px; }
.sw {
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,.15);
}
.sw.frei       { background: var(--green); }
.sw.reserviert { background: var(--amber); }
.sw.vergeben   { background: var(--orange); }

.btn-info-cta {
  background: var(--orange);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-info-cta:hover { background: var(--orange-dark); }

.hint {
  background: #fdf1e6;
  border-left: 3px solid var(--orange);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.5;
}

#panel footer {
  margin-top: auto;
  font-size: 11px;
  color: var(--muted);
}

/* ---- Karte ---- */
#map { flex: 1; background: #e8e8e8; min-width: 0; }

/* ---- Hover-Tooltip ---- */
.hover-popup .maplibregl-popup-content {
  background: #ffffff;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12.5px;
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.hover-popup .maplibregl-popup-tip { display: none; }

.tip { display: flex; flex-direction: column; gap: 2px; }
.tip-id { font-weight: 700; font-size: 13px; }
.tip-status {
  display: inline-block;
  width: fit-content;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
}
.tip-status.status-frei       { background: #e6f4e7; color: #2e7d32; }
.tip-status.status-reserviert { background: #fcefda; color: #b9772a; }
.tip-status.status-vergeben   { background: #fde3d0; color: var(--orange-dark); }
.tip-owner { color: var(--orange-dark); font-weight: 600; }
.tip-free  { color: var(--muted); }
.tip-area  { color: var(--muted); font-size: 11px; }

/* ---- Mobile Top-Bar (Hamburger) ---- */
#topbar-mobile {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 20;
  gap: 10px;
}
#topbar-mobile .logo-mini { height: 36px; width: auto; }
.icon-btn {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0;
}
.icon-btn span {
  display: block;
  width: 18px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.icon-btn.info {
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
  color: var(--orange-dark);
}

#panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 25;
}

/* ---- Modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.modal-box {
  position: relative;
  background: #fff;
  max-width: 460px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 14px;
  padding: 28px 26px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  text-align: center;
}
.modal-logo { width: 200px; max-width: 60%; height: auto; margin: 0 auto 6px; display: block; }
.modal-box h1 {
  color: var(--orange-dark);
  font-size: 22px;
  margin: 6px 0 14px;
  line-height: 1.25;
}
.modal-box p { font-size: 14.5px; line-height: 1.55; margin: 8px 0; text-align: left; }
.modal-box .price {
  text-align: center;
  font-size: 18px;
  background: #fdf1e6;
  border-radius: 8px;
  padding: 10px;
  margin: 12px 0;
}
.donate {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0 16px;
  text-align: left;
}
.donate .donate-head {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--orange-dark);
  text-align: center;
}
.donate .lbl {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-right: 6px;
}
.donate .iban code {
  font-family: ui-monospace, "Consolas", monospace;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  word-break: break-all;
}
.donate .recipient { font-weight: 600; margin: 8px 0 6px; }
.modal-close {
  position: absolute;
  top: 8px; right: 10px;
  background: transparent;
  border: 0;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  width: 36px; height: 36px;
}
.modal-close:hover { color: var(--ink); }
.btn-primary {
  background: var(--orange);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
}
.btn-primary:hover { background: var(--orange-dark); }

/* ---- Responsive: Mobile (Off-Canvas-Drawer) ---- */
@media (max-width: 760px) {
  #app { flex-direction: column; }

  #topbar-mobile { display: flex; }

  #map {
    position: absolute;
    top: var(--topbar-h);
    left: 0; right: 0; bottom: 0;
    height: auto;
    width: 100%;
  }

  #panel {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: 86%;
    max-width: 340px;
    flex: none;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 30;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    border-right: 1px solid var(--line);
  }
  #app.panel-open #panel { transform: translateX(0); }
}
