/* benzinkarta.ru — дизайн-система. Светлая/тёмная тема, Apple-чистый вид, blur-навбар.
   Статусы топлива: yes=зелёный queue=жёлтый low=оранжевый no=красный limit=синий. */

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --text: #0b1015;
  --text-muted: #61707f;
  --border: #e3e7ec;
  --accent: #0a84ff;           /* iOS-синий */
  --accent-ink: #ffffff;
  --shadow: 0 8px 30px rgba(16,24,40,.12);
  --shadow-sm: 0 2px 10px rgba(16,24,40,.08);
  --radius: 16px;
  --radius-sm: 11px;
  --nav-h: 56px;

  --st-yes:   #2fbf5b;   /* есть */
  --st-queue: #f5c518;   /* очередь */
  --st-low:   #ff9500;   /* мало */
  --st-no:    #ff3b30;   /* нет */
  --st-limit: #0a84ff;   /* лимит */
  --st-unknown: #b6bfc9; /* нет данных */

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #05070c;
  --panel: #10151d;
  --panel-2: #171d27;
  --text: #eef2f6;
  --text-muted: #8b98a6;
  --border: #232b36;
  --accent: #0a84ff;
  --shadow: 0 10px 40px rgba(0,0,0,.5);
  --shadow-sm: 0 2px 12px rgba(0,0,0,.4);
  --st-unknown: #3a4451;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- навбар ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: var(--text); }
.brand .drop { width: 26px; height: 26px; }
.brand b { color: var(--accent); }
.nav .spacer { flex: 1; }
.nav-btn {
  height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--text); font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 7px;
}
.nav-btn:hover { background: var(--panel-2); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; padding: 0;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
}

/* ---------- карта ---------- */
.map-wrap { position: relative; width: 100%; height: calc(100vh - var(--nav-h)); height: calc(100dvh - var(--nav-h)); }
#map { position: absolute; inset: 0; }
.maplibregl-ctrl-attrib { font-size: 10px; }

/* фильтры-чипсы топлива */
.filters {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 10;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  pointer-events: none;
}
.filters > * { pointer-events: auto; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  height: 34px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--panel) 85%, transparent);
  backdrop-filter: blur(10px); color: var(--text); font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.chip.active { background: var(--accent); color: #fff; border-color: transparent; }

.search-box {
  height: 34px; display: flex; align-items: center; gap: 6px;
  padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 85%, transparent); backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm); min-width: 150px;
}
.search-box input { border: 0; background: transparent; color: var(--text); outline: none; width: 100%; font-size: 14px; }
.search-results {
  position: absolute; margin-top: 6px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  overflow: hidden; min-width: 200px; z-index: 30; display: none;
}
.search-results div { padding: 9px 13px; font-size: 14px; }
.search-results div:hover { background: var(--panel-2); }

/* плашка активности сообщества */
.activity {
  position: absolute; right: 12px; top: 12px; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  font-size: 13px; font-weight: 600; color: var(--text);
}
.activity .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--st-yes); flex: none;
  box-shadow: 0 0 0 0 rgba(47,191,91,.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(47,191,91,.55)} 70%{box-shadow:0 0 0 8px rgba(47,191,91,0)} 100%{box-shadow:0 0 0 0 rgba(47,191,91,0)} }
@media (max-width: 620px){ .activity{ top: 54px; right: 12px; height: 30px; font-size: 12px; } }

/* легенда */
.legend {
  position: absolute; left: 12px; bottom: 22px; z-index: 10;
  background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  padding: 9px 12px; font-size: 12px; display: flex; flex-direction: column; gap: 5px;
}
.legend .row { display: flex; align-items: center; gap: 7px; color: var(--text-muted); }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.dot.yes{background:var(--st-yes)} .dot.queue{background:var(--st-queue)} .dot.low{background:var(--st-low)}
.dot.no{background:var(--st-no)} .dot.limit{background:var(--st-limit)} .dot.unknown{background:var(--st-unknown)}

/* геолокация / зум-контролы справа снизу — оставляем нативные maplibre */
.geo-btn {
  position: absolute; right: 12px; bottom: 96px; z-index: 10;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel); color: var(--accent); font-size: 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}

/* FAB отметить */
.fab {
  position: absolute; right: 12px; bottom: 24px; z-index: 12;
  height: 54px; padding: 0 22px; border-radius: 999px; border: 0;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 10px 30px rgba(10,132,255,.45); display: inline-flex; align-items: center; gap: 9px;
}
.fab:active { transform: scale(.97); }

/* ---------- нижний лист (карточка станции / модалка метки) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; display: none; }
.sheet-backdrop.open { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--panel); border-radius: 22px 22px 0 0; box-shadow: var(--shadow);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.32,.72,0,1);
  max-height: 86vh; overflow-y: auto; padding: 6px 18px 24px;
}
.sheet.open { transform: translateY(0); visibility: visible; }
.sheet { visibility: hidden; }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 8px auto 12px; }
@media (min-width: 760px) {
  .sheet { left: auto; right: 16px; bottom: 16px; width: 400px; border-radius: 22px; max-height: calc(100dvh - 90px); }
}

.st-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.st-logo { width: 44px; height: 44px; border-radius: 12px; background: var(--panel-2); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.st-title { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.st-sub { color: var(--text-muted); font-size: 13px; }

.fuel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.fuel-cell {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; text-align: center;
  background: var(--panel-2);
}
.fuel-cell .fname { font-weight: 700; font-size: 14px; }
.fuel-cell .fstat { font-size: 12px; margin-top: 3px; display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); }

.st-actions { display: flex; gap: 8px; margin: 12px 0; }
.btn {
  flex: 1; height: 44px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 14px;
}
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }

.meta-row { display: flex; gap: 16px; color: var(--text-muted); font-size: 13px; margin: 6px 0 2px; }

.comments { margin-top: 14px; }
.comment { padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.comment .t { color: var(--text-muted); font-size: 11px; }

/* модалка выбора статуса */
.status-picker { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; margin: 10px 0; }
.status-opt {
  border: 2px solid var(--border); border-radius: 12px; padding: 12px 4px; text-align: center;
  background: var(--panel-2); font-size: 12px; font-weight: 600;
}
.status-opt.sel { border-color: var(--accent); }
.status-opt .big { display: block; width: 20px; height: 20px; border-radius: 50%; margin: 0 auto 6px; }

.field { margin: 10px 0; }
.field label { font-size: 13px; color: var(--text-muted); display: block; margin-bottom: 5px; }
.field select, .field input, .field textarea {
  width: 100%; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 15px; font-family: inherit;
}

/* тосты */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; z-index: 200; opacity: 0; transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- контентные страницы (SEO/статьи) ---------- */
.container { max-width: 900px; margin: 0 auto; padding: 24px 18px 60px; }
.container h1 { font-size: 30px; letter-spacing: -.03em; }
.container h2 { font-size: 22px; margin-top: 32px; }
.container p, .container li { line-height: 1.65; color: var(--text); font-size: 16px; }
.pill-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.pill-links a { padding: 7px 13px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-weight: 600; font-size: 14px; color: var(--text); }

/* ---------- футер ---------- */
.footer { background: var(--panel); border-top: 1px solid var(--border); padding: 30px 18px; }
.footer .cols { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 22px; }
.footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 0 0 10px; }
.footer a { display: block; color: var(--text); font-size: 14px; padding: 3px 0; }
.footer a:hover { color: var(--accent); }
.footer .copy { max-width: 1100px; margin: 22px auto 0; color: var(--text-muted); font-size: 12px; border-top: 1px solid var(--border); padding-top: 16px; }

.hidden { display: none !important; }

/* ============ карточка АЗС в стиле gdebenz ============ */
.st-head-txt { flex: 1; min-width: 0; }
.st-close { margin-left: auto; width: 34px; height: 34px; flex: none; }
.sec-lab { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: none;
  margin: 10px 0 8px; letter-spacing: .01em; }

/* большой блок статуса */
.status-card { border: 1px solid color-mix(in srgb, var(--sc) 30%, var(--border));
  background: color-mix(in srgb, var(--sc) 8%, var(--panel)); border-radius: 18px; padding: 16px; }
.sc-top { display: flex; gap: 13px; align-items: center; }
.sc-ic { width: 52px; height: 52px; border-radius: 14px; flex: none; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--sc) 18%, var(--panel)); }
.sc-big { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.sc-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* уверенность */
.conf { margin-top: 14px; }
.conf-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--text-muted); }
.conf-pct { font-size: 20px; font-weight: 800; }
.conf-bar { height: 9px; border-radius: 6px; background: color-mix(in srgb, var(--text-muted) 18%, transparent);
  margin: 7px 0 5px; overflow: hidden; }
.conf-bar i { display: block; height: 100%; border-radius: 6px; transition: width .4s; }
.conf-note { font-size: 12px; color: var(--text-muted); }

/* кнопки подтверждения */
.confirm-row { display: flex; gap: 8px; margin-top: 14px; }
.confirm-yes { background: #16a34a; color: #fff; border-color: transparent; }
.confirm-chg { background: var(--panel); }

/* «сейчас в наличии» */
.avail { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 14px 0 2px;
  background: color-mix(in srgb, var(--st-yes) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--st-yes) 22%, var(--border));
  border-radius: 12px; padding: 10px 12px; }
.avail-lab { font-size: 13px; color: var(--text-muted); margin-right: 2px; }
.fchip { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 8px;
  font-size: 13px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--border); }
.fchip.on { background: color-mix(in srgb, var(--st-yes) 16%, var(--panel)); border-color: transparent; color: #128a3e; }
.fchip.sm { height: 22px; padding: 0 8px; font-size: 11.5px; font-weight: 700; }

/* лента отметок */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 11px; padding: 11px 0; border-top: 1px solid var(--border); }
.tl-item:first-child { border-top: 0; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex: none; }
.tl-main { flex: 1; min-width: 0; }
.tl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.tl-age { margin-left: auto; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.tl-cmt { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* нижние кнопки */
.btn.big { width: 100%; height: 50px; font-size: 15px; font-weight: 700; margin-top: 16px; }
.btn.route { width: 100%; height: 46px; margin-top: 9px; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; background: var(--panel-2); }
.st-foot-row { display: flex; justify-content: space-between; margin-top: 12px; }
.link-btn { background: none; border: 0; color: var(--text-muted); font-size: 13px; font-weight: 600; padding: 6px 2px; }
.link-btn:hover { color: var(--accent); }

/* верхняя панель фильтров (пилюли) */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pill { height: 40px; padding: 0 15px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 7px; box-shadow: var(--shadow-sm); cursor: pointer; }
.pill span { font-size: 15px; }
.pill.active { background: color-mix(in srgb, var(--st-yes) 14%, var(--panel)); border-color: transparent; color: #128a3e; }

/* корректная работа атрибута hidden поверх display:flex */
.chips[hidden], .pill[hidden] { display: none !important; }
