:root {
  --bg: #0d0e0f;
  --surface: #131516;
  --surface2: #1c1f22;
  --border: #2a2e33;
  --border2: #3a3f46;
  --gold: #c8a84b;
  --gold-dark: #8b6914;
  --gold-dim: #2a2000;
  --text: #e8e4dc;
  --text2: #a8a49c;
  --muted: #5a5a52;
  --green: #3d6b4a;
  --green-lt: #5a9e6e;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Barlow", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header {
  background: var(--surface);
  border-bottom: 2px solid var(--gold-dark);
  height: 62px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  flex-shrink: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
}

.logo-img {
  height: 46px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 50%;
}

.h-sep {
  width: 1px;
  height: 32px;
  background: var(--border2);
}

.h-title {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.h-sub {
  font-family: "Share Tech Mono", monospace;
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 2px;
  margin-top: 1px;
}

.h-count {
  margin-left: auto;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 1px;
}

.h-btn {
  background: var(--gold);
  border: none;
  color: #000;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 2px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}

.h-btn:hover {
  background: #d4b455;
}

.app {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* SIDEBAR */
.sidebar {
  width: 300px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  z-index: 500;
}

.filters {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.f-label {
  font-family: "Share Tech Mono", monospace;
  font-size: 8px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}

.search-wrap {
  position: relative;
  margin-bottom: 10px;
}

.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

.search {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px 7px 28px;
  font-family: "Barlow", sans-serif;
  font-size: 13px;
  border-radius: 2px;
  outline: none;
  transition: border-color .2s;
}

.search:focus {
  border-color: var(--gold);
}

.search::placeholder {
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: "Rajdhani", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .12s;
  user-select: none;
  background: transparent;
}

.chip:hover {
  border-color: var(--gold-dark);
  color: var(--text2);
}

.chip.on {
  background: var(--gold);
  border-color: var(--gold);
  color: #000;
}

.rlist {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.rcard {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  position: relative;
}

.rcard:hover {
  background: var(--surface2);
}

.rcard.sel {
  background: var(--surface2);
  border-left: 2px solid var(--gold);
  padding-left: 12px;
}

.rc-name {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
  padding-right: 46px;
}

.rc-city {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}

.rc-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.rc-star {
  position: absolute;
  right: 12px;
  top: 11px;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  color: var(--gold);
}

.tag {
  padding: 1px 5px;
  border-radius: 1px;
  font-family: "Share Tech Mono", monospace;
  font-size: 8px;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.t-p { background: #1a3226; color: #5eab74; }
.t-r { background: #1a2632; color: #5e8eab; }
.t-d { background: #32261a; color: #ab845e; }
.t-l { background: #261a32; color: #845eab; }
.t-c { background: #26261a; color: #abab5e; }
.t-b { background: var(--gold-dim); color: var(--gold); border: 1px solid var(--gold-dark); }

.nores {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* MAP */
.mapwrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

#map {
  width: 100%;
  height: 100%;
}

/* Leaflet dark override */
.leaflet-tile {
  filter: brightness(0.85) saturate(0.7) hue-rotate(180deg) invert(1) sepia(0.3) brightness(0.55);
}

.leaflet-container {
  background: #0d0e0f !important;
}

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface2) !important;
}

.leaflet-control-attribution {
  background: rgba(13,14,15,.8) !important;
  color: var(--muted) !important;
  font-size: 9px !important;
}

.leaflet-control-attribution a {
  color: var(--gold-dark) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 2px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,.7) !important;
  color: var(--text) !important;
}

.leaflet-popup-tip {
  background: var(--surface) !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  font-family: "Barlow", sans-serif !important;
}

/* Custom marker */
.bpp-marker {
  width: 32px;
  height: 32px;
  position: relative;
  cursor: pointer;
}

.bpp-marker-inner {
  width: 24px;
  height: 24px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  position: absolute;
  top: 0;
  left: 4px;
  border: 2px solid rgba(0,0,0,0.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: transform .15s;
}

.bpp-marker:hover .bpp-marker-inner {
  transform: rotate(-45deg) scale(1.15);
}

.bpp-marker-dot {
  width: 8px;
  height: 8px;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%) rotate(45deg);
}

/* Detail panel */
.detail {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  z-index: 600;
  max-height: 70%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
  box-shadow: -4px 0 20px rgba(0,0,0,.6);
}

.detail.open {
  transform: translateY(0);
}

.d-head {
  padding: 13px 15px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid var(--gold);
}

.d-name {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 17px;
  flex: 1;
  line-height: 1.2;
}

.d-city {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.d-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px;
  flex-shrink: 0;
  transition: color .12s;
}

.d-close:hover {
  color: var(--text);
}

.d-body {
  padding: 13px 15px;
}

.d-rating {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 30px;
  color: var(--gold);
  line-height: 1;
}

.d-stars {
  color: var(--gold);
  font-size: 13px;
}

.d-revs {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.d-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.d-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 8px;
  font-size: 12px;
}

.d-lbl {
  font-family: "Share Tech Mono", monospace;
  font-size: 8px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 60px;
  padding-top: 2px;
}

.d-val {
  color: var(--text2);
  flex: 1;
  line-height: 1.4;
}

.d-sec {
  font-family: "Share Tech Mono", monospace;
  font-size: 8px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 13px 0 7px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

.opinion {
  background: var(--surface2);
  border-left: 2px solid var(--gold-dark);
  padding: 8px 10px;
  margin-bottom: 7px;
  border-radius: 0 2px 2px 0;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
}

.o-auth {
  font-family: "Share Tech Mono", monospace;
  font-size: 9px;
  color: var(--gold);
  margin-top: 4px;
}

.d-btn {
  width: 100%;
  padding: 10px;
  background: var(--gold);
  border: none;
  color: #000;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  margin-top: 6px;
  transition: background .15s;
}

.d-btn:hover {
  background: #d4b455;
}

.d-map-btn {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: "Rajdhani", sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  margin-top: 6px;
  transition: all .15s;
  text-decoration: none;
  display: block;
  text-align: center;
}

.d-map-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Modal */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 440px;
  border-radius: 2px;
  overflow: hidden;
  max-height: 92vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
  box-shadow: 0 20px 60px rgba(0,0,0,.8);
}

.m-head {
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 3px solid var(--gold);
  background: var(--surface2);
}

.m-title {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.m-body {
  padding: 16px;
}

.fg {
  margin-bottom: 13px;
}

.fl {
  display: block;
  font-family: "Share Tech Mono", monospace;
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.fi, .fta, .fsel {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 11px;
  font-family: "Barlow", sans-serif;
  font-size: 13px;
  border-radius: 2px;
  outline: none;
  transition: border-color .2s;
}

.fi:focus, .fta:focus, .fsel:focus {
  border-color: var(--gold);
}

.fta {
  min-height: 78px;
  resize: vertical;
}

.fsel option {
  background: var(--surface2);
}

.fcbs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.cbl {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: border-color .12s;
}

.cbl:hover {
  border-color: var(--gold-dark);
}

.cbl input {
  accent-color: var(--gold);
}

.m-foot {
  padding: 11px 15px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--surface2);
}

.btn-c {
  padding: 7px 15px;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-family: "Rajdhani", sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border-radius: 2px;
}

.btn-c:hover {
  color: var(--text);
}

.btn-s {
  padding: 7px 18px;
  background: var(--gold);
  border: none;
  color: #000;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
}

.btn-s:hover {
  background: #d4b455;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--gold-dark);
  border-left: 3px solid var(--gold);
  color: var(--text);
  font-family: "Rajdhani", sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 2px;
  z-index: 3000;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Legend */
.legend {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(13,14,15,.92);
  border: 1px solid var(--border);
  padding: 11px 14px;
  border-radius: 2px;
  z-index: 500;
  backdrop-filter: blur(4px);
}

.leg-title {
  font-family: "Share Tech Mono", monospace;
  font-size: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.leg-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 5px;
}

.leg-row:last-child {
  margin-bottom: 0;
}

.leg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.leg-n {
  font-family: "Share Tech Mono", monospace;
  font-size: 9px;
  color: var(--muted);
  margin-left: auto;
  padding-left: 10px;
}

@media(max-width:700px) {
  body { overflow: auto; }
  .app { flex-direction: column; height: auto; overflow: visible; }
  .sidebar { width: 100%; height: auto; max-height: 260px; border-right: none; border-bottom: 1px solid var(--border); }
  .mapwrap { height: 65vw; min-height: 300px; flex: none; }
  .detail { width: 100%; max-height: 55vh; position: fixed; bottom: 0; left: 0; }
  .legend { display: none; }
  .h-title, .h-sub, .h-sep { display: none; }
}
/* ═══════════════════════════════════════════
   MOBILE OPTIMIZATIONS
   ═══════════════════════════════════════════ */

/* Bottom nav mobile */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 2px solid var(--gold-dark);
  z-index: 600;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: 56px;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: "Share Tech Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .12s;
  min-height: 56px;
}

.mobile-nav-btn.active {
  color: var(--gold);
  border-top: 2px solid var(--gold);
}

.mobile-nav-icon { font-size: 20px; line-height: 1; }

@media (max-width: 768px) {
  body { overflow: auto; }

  .app-body {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  /* Sidebar = lista — schowana domyślnie, widoczna gdy aktywna */
  .sidebar {
    width: 100%;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: none;
  }

  .sidebar.mobile-visible { display: flex; }

  /* Mapa zajmuje pełny ekran */
  .mapwrap {
    height: 55vh;
    min-height: 300px;
  }

  /* Filtry zawsze widoczne nad mapą */
  .filters {
    position: sticky;
    top: 0;
    z-index: 50;
  }

  /* Panel detali — full width od dołu */
  .detail {
    width: 100%;
    max-height: 60vh;
    position: fixed;
    bottom: 56px; /* nad mobile nav */
    left: 0;
    border-left: none;
    border-top: 2px solid var(--gold-dark);
  }

  .detail.open { transform: translateY(0); }

  /* Przyciski chip większe */
  .chip {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 40px;
  }

  /* Search input */
  .search { font-size: 16px; min-height: 44px; }

  /* Range cards */
  .rcard { padding: 14px; }
  .rname { font-size: 15px; }

  /* Legenda ukryta */
  .legend { display: none; }

  /* FAB — nad mobile nav */
  .fab {
    bottom: 70px;
    right: 16px;
    left: auto;
    transform: none;
  }

  /* Header */
  header { padding: 0 12px; }
  .logo-text, .logo-sub, .h-sep { display: none; }

  /* Dodaj strzelnicę btn w headerze schowany (jest FAB) */
  .h-btn { display: none; }

  /* Mobile nav widoczny */
  .mobile-nav { display: block; }

  /* D-body padding bottom żeby nie chować pod nav */
  .d-body { padding-bottom: 16px; }
  .rlist { padding-bottom: 8px; }
}

@media (max-width: 380px) {
  .chip { padding: 6px 9px; font-size: 12px; }
  .mapwrap { height: 45vh; }
}
