/* Shkabuna Travel — mobile-first dark theme */
:root {
  --bg: #0e1116;
  --bg2: #151a22;
  --surface: #1b212b;
  --surface2: #222a36;
  --line: #2c3542;
  --text: #eef2f7;
  --muted: #93a0b4;
  --accent: #ff8a2a;
  --accent2: #ffb054;
  --good: #35d07f;
  --warn: #ffd166;
  --danger: #ff5c5c;
  --shadow: 0 6px 24px rgba(0, 0, 0, .45);
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--accent2); text-decoration: none; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 8px;
  background: linear-gradient(180deg, #171c25, #12151b);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-badge {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--accent), #ff5e3a);
  box-shadow: 0 4px 14px rgba(255, 122, 26, .35);
}
.brand-text h1 { margin: 0; font-size: 17px; letter-spacing: .4px; line-height: 1.15; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; font-size: 17px;
  background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center; flex: 0 0 auto;
}
.icon-btn:active { transform: scale(.94); }

/* ---------- filter bar ---------- */
.filterbar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  overflow-x: auto; overflow-y: hidden;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  scrollbar-width: none;
}
.filterbar::-webkit-scrollbar { display: none; }
.chips { display: flex; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px; border-radius: 999px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
  flex: 0 0 auto;
}
.chip.on { background: var(--chipc, var(--accent)); border-color: transparent; color: #10131a; font-weight: 700; }
.chip-sep { width: 1px; align-self: stretch; margin: 2px 3px; background: var(--line); flex: 0 0 auto; }
.chip-search { padding: 6px 10px; }
.search-input {
  flex: 0 0 150px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  font-size: 13px; outline: none;
}
.search-input:focus { border-color: var(--accent); }

/* ---------- screens ---------- */
main { flex: 1 1 auto; position: relative; min-height: 0; }
.screen { position: absolute; inset: 0; }
#map { width: 100%; height: 100%; background: #0c0f13; }
#screen-list { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 10px 18px; }

.map-fabs {
  position: absolute; right: 12px; bottom: 18px; z-index: 500;
  display: flex; flex-direction: column; gap: 10px;
}
.fab {
  width: 46px; height: 46px; border-radius: 50%; font-size: 20px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); display: grid; place-items: center;
}
.fab:active { transform: scale(.92); }

/* ---------- tab bar ---------- */
.tabbar {
  display: flex; flex: 0 0 auto;
  background: #12151b; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 0 7px; font-size: 19px; color: var(--muted); position: relative;
}
.tab span { font-size: 11px; letter-spacing: .3px; }
.tab.active { color: var(--accent); }
.tab.active::before {
  content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.tab-count {
  position: absolute; top: 4px; right: calc(50% - 34px);
  background: var(--accent); color: #10131a; font-style: normal; font-weight: 800;
  font-size: 10px; min-width: 17px; height: 17px; border-radius: 9px;
  display: grid; place-items: center; padding: 0 4px;
}

/* ---------- banner (list screen) ---------- */
.banner {
  background: linear-gradient(135deg, #1c2430, #171d27);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 10px;
}
.banner .b-day { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.banner .b-main { font-size: 16px; font-weight: 700; margin: 3px 0 2px; }
.banner .b-next { font-size: 12.5px; color: var(--muted); }
.banner .b-next b { color: var(--accent2); }
.b-src {
  float: right; font-size: 10.5px; padding: 3px 8px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--line); color: var(--muted);
}
.b-progress { height: 5px; background: var(--surface2); border-radius: 3px; margin-top: 9px; overflow: hidden; }
.b-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 3px; }

/* ---------- accordion ---------- */
.acc-divider {
  margin: 16px 4px 8px; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 10px;
}
.acc-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.acc-sec {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 8px; overflow: hidden;
}
.acc-sec.current { border-color: rgba(255, 138, 42, .55); box-shadow: 0 0 0 1px rgba(255, 138, 42, .25), var(--shadow); }
.acc-sec.passed { opacity: .62; }
.acc-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; text-align: left;
}
.acc-num {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 800;
  background: var(--surface2); border: 1px solid var(--line); color: var(--muted);
}
.acc-sec.current .acc-num { background: var(--accent); border-color: transparent; color: #10131a; }
.acc-title { flex: 1 1 auto; min-width: 0; }
.acc-title b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-title small { color: var(--muted); font-size: 11.5px; }
.acc-right { text-align: right; flex: 0 0 auto; }
.acc-right .dist { font-size: 12px; color: var(--accent2); font-weight: 700; display: block; }
.acc-right .cnt { font-size: 11px; color: var(--muted); }
.acc-chev { color: var(--muted); font-size: 12px; transition: transform .2s; margin-left: 2px; }
.acc-sec.open .acc-chev { transform: rotate(180deg); }
.acc-body { display: none; padding: 2px 8px 10px; }
.acc-sec.open .acc-body { display: block; }
.acc-empty { color: var(--muted); font-size: 12.5px; padding: 6px 8px 8px; }
.here-tag {
  font-size: 10px; font-weight: 800; letter-spacing: .6px; color: #10131a;
  background: var(--accent); border-radius: 6px; padding: 2px 6px; margin-left: 6px;
  vertical-align: 2px;
}

/* ---------- event card ---------- */
.ev {
  display: flex; gap: 10px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px; margin-top: 8px;
}
.ev-thumb {
  width: 86px; height: 86px; border-radius: 10px; flex: 0 0 auto;
  position: relative; overflow: hidden;
  background: linear-gradient(140deg, var(--c1, #333), var(--c2, #222));
  display: grid; place-items: center;
}
.ev-thumb::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120% 70% at 100% 0%, rgba(255,255,255,.16), transparent 55%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 8px, transparent 8px 16px);
}
.ev-thumb .em { font-size: 36px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); position: relative; }
.ev-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 2;
}
.ev-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ev-title { font-size: 14px; font-weight: 700; line-height: 1.25; }
.ev-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 2px; }
.badge {
  font-size: 10px; font-weight: 800; letter-spacing: .4px;
  padding: 2px 7px; border-radius: 6px;
}
.badge.now { background: var(--danger); color: #fff; }
.badge.match { background: rgba(53, 208, 127, .18); color: var(--good); border: 1px solid rgba(53,208,127,.4); }
.badge.miss { background: rgba(255, 209, 102, .15); color: var(--warn); border: 1px solid rgba(255,209,102,.35); }
.badge.live { background: rgba(124, 92, 255, .2); color: #b5a3ff; border: 1px solid rgba(124,92,255,.45); }
.badge.est { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.ev-meta { font-size: 11.8px; color: var(--muted); margin-top: 1px; }
.ev-meta b { color: var(--accent2); font-weight: 600; }
.ev-desc { font-size: 12.3px; color: #c3cddc; margin-top: 3px; }
.ev-foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 7px; }
.pill {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.pill.price { color: var(--good); }
.pill.price.free { color: #9be8c0; background: rgba(53,208,127,.12); border-color: rgba(53,208,127,.3); }
.ev-actions { margin-left: auto; display: flex; gap: 6px; }
.ev-act {
  width: 34px; height: 34px; border-radius: 10px; font-size: 15px;
  background: var(--surface2); border: 1px solid var(--line);
  display: grid; place-items: center;
}
.ev-act:active { transform: scale(.92); }

.list-footer { color: var(--muted); font-size: 11.5px; text-align: center; padding: 14px 8px 4px; }

/* ---------- map bits ---------- */
.stop-marker {
  width: 26px; height: 26px; border-radius: 50%;
  background: #1b212b; border: 2px solid var(--accent);
  color: var(--accent2); font-size: 11.5px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.stop-marker.passed { border-color: #56606f; color: #8b96a6; opacity: .8; }
.ev-marker {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 4px;
  background: var(--mc, #555); transform: rotate(0deg);
  display: grid; place-items: center; font-size: 15px;
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 3px 8px rgba(0,0,0,.5);
}
.user-dot { position: relative; width: 18px; height: 18px; }
.user-dot::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: #2f9bff; border: 2.5px solid #fff;
  box-shadow: 0 0 10px rgba(47,155,255,.9);
}
.user-dot::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 2px solid rgba(47,155,255,.55);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(.55); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.cluster-ico {
  background: var(--accent); color: #10131a; font-weight: 800;
  border-radius: 50%; display: grid; place-items: center;
  border: 3px solid rgba(255,255,255,.85); font-size: 12.5px;
  box-shadow: 0 3px 10px rgba(0,0,0,.5);
}

/* leaflet dark-ish popup */
.leaflet-popup-content-wrapper {
  background: var(--surface); color: var(--text);
  border-radius: 12px; box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 10px 12px; line-height: 1.4; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop { width: 218px; }
.pop .pt { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.pop .pm { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.pop .pm b { color: var(--accent2); }
.pop .pd { font-size: 12px; color: #c3cddc; }
.pop .pthumb {
  width: 100%; height: 86px; border-radius: 8px; margin-bottom: 6px;
  background: linear-gradient(140deg, var(--c1,#333), var(--c2,#222));
  display: grid; place-items: center; font-size: 30px; overflow: hidden; position: relative;
}
.pop .pthumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pop .pbtns { display: flex; gap: 6px; margin-top: 8px; }
.pop .pbtn {
  flex: 1; text-align: center; padding: 6px 4px; border-radius: 8px; font-size: 11.5px; font-weight: 700;
  background: var(--surface2); border: 1px solid var(--line); color: var(--text);
}
.pop .pbtn.primary { background: var(--accent); border-color: transparent; color: #10131a; }
.leaflet-control-attribution {
  background: rgba(14, 17, 22, .75) !important; color: #7d8899 !important; font-size: 9.5px !important;
}
.leaflet-control-attribution a { color: #9aa7ba !important; }
.leaflet-bar a { background: var(--surface); color: var(--text); border-bottom-color: var(--line); }
.leaflet-bar a:hover { background: var(--surface2); }

/* ---------- modal ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5, 7, 10, .66); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  width: 100%; max-width: 560px; max-height: 88dvh;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { overflow-y: auto; padding: 6px 16px calc(18px + var(--safe-b)); }
.set-group { padding: 14px 0 6px; border-bottom: 1px solid var(--line); }
.set-group:last-child { border-bottom: 0; }
.set-group h3 { margin: 0 0 8px; font-size: 14px; }
.radio { display: block; padding: 6px 2px; font-size: 13.5px; color: #cdd6e2; }
.radio b { color: var(--text); }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0; }
.select, .text-input {
  width: 100%; padding: 9px 12px; margin-top: 6px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; outline: none;
}
.text-input:focus, .select:focus { border-color: var(--accent); }
.row-btns { display: flex; gap: 8px; margin-top: 10px; }
.btn {
  padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 700;
  background: var(--surface2); border: 1px solid var(--line);
}
.btn:active { transform: scale(.97); }
.dates-editor { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.date-row { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; }
.date-row label { font-size: 12.5px; color: #cdd6e2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-row input {
  padding: 5px 6px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font-size: 12px; width: 118px;
  color-scheme: dark;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(74px + var(--safe-b)); transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 12.5px; z-index: 1200;
  box-shadow: var(--shadow); max-width: 86vw; text-align: center;
}

@media (min-width: 760px) {
  .modal-wrap { align-items: center; }
  .modal { border-radius: 18px; }
  #screen-list { padding: 14px 16vw 24px; }
}
