/* ===== Топливо РФ — стили ===== */
:root {
  --bg: #1a1d29;
  --panel: #232736;
  --panel-2: #2b3042;
  --text: #eef0f6;
  --muted: #9aa1b5;
  --green: #2ecc71;
  --red: #e74c3c;
  --yellow: #f1c40f;
  --gray: #7f8798;
  --accent: #4d8dff;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body, #app { height: 100%; overflow: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ===== Верхняя панель ===== */
#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  background: linear-gradient(to bottom, rgba(26, 29, 41, 0.96), rgba(26, 29, 41, 0.82));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.brand-icon { font-size: 20px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.2px; }

.activity-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: #7bed9f;
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.35);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.share-btn {
  margin-left: auto;
  border: none;
  background: var(--panel);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 15px;
  cursor: pointer;
  flex: 0 0 auto;
}
.share-btn--nomargin { margin-left: 0; }

#search-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
#search-bar[hidden] { display: none; }
#search-bar input {
  flex: 1;
  border: 1px solid var(--panel-2);
  background: var(--panel);
  color: var(--text);
  border-radius: 11px;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
}
#search-bar input:focus { border-color: var(--accent); }
#search-bar button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 11px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#loading {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
#loading[hidden] { display: none; }
.loading-box {
  color: var(--muted);
  font-size: 15px;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.4; } }

#sheet-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  border: none;
  background: var(--panel-2);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
}

.st-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-right: 30px;
}
.st-head-text { flex: 1 1 auto; min-width: 0; }
.st-share {
  flex: 0 0 auto;
  border: 1px solid var(--panel-2);
  background: var(--bg);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 15px;
  cursor: pointer;
}

.nudge {
  margin-top: 12px;
  background: rgba(77, 141, 255, 0.12);
  border: 1px solid rgba(77, 141, 255, 0.35);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.4;
}

#intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.intro-card {
  max-width: 400px;
  background: var(--panel);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
}
.intro-title { font-size: 19px; font-weight: 800; margin-bottom: 10px; }
.intro-card p { font-size: 14.5px; line-height: 1.45; margin-bottom: 10px; }
.intro-note { color: var(--muted); font-size: 13px !important; }
.intro-card button {
  width: 100%;
  margin-top: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 0;
  border-radius: 12px;
  cursor: pointer;
}

.mode-badge {
  font-size: 11px;
  font-weight: 600;
  color: #ffd166;
  background: rgba(255, 209, 102, 0.15);
  border: 1px solid rgba(255, 209, 102, 0.4);
  padding: 2px 8px;
  border-radius: 999px;
}

.fuel-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.fuel-filter::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--panel-2);
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== Карта ===== */
#map {
  position: absolute;
  inset: 0;
  background: #0e1018;
}

/* ===== Легенда ===== */
#legend {
  position: absolute;
  left: 10px;
  bottom: calc(var(--safe-bottom) + 12px);
  z-index: 15;
  display: flex;
  gap: 10px;
  padding: 7px 12px;
  background: rgba(26, 29, 41, 0.88);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#legend span { display: flex; align-items: center; gap: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-yellow { background: var(--yellow); }
.dot-gray { background: var(--gray); }

/* ===== Геолокация ===== */
#geo-btn {
  position: absolute;
  right: 12px;
  bottom: calc(var(--safe-bottom) + 12px);
  z-index: 15;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--panel);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* ===== Bottom sheet ===== */
#sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 29;
  background: rgba(0, 0, 0, 0.35);
}

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  max-height: 78%;
  background: var(--panel);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.22s ease-out;
}
@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-grab {
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.sheet-grab span {
  width: 42px; height: 4px;
  border-radius: 2px;
  background: var(--gray);
  opacity: 0.5;
}

.sheet-content {
  overflow-y: auto;
  padding: 0 16px calc(var(--safe-bottom) + 20px);
}

/* ===== Карточка АЗС ===== */
.st-head { margin-bottom: 4px; }
.st-name { font-size: 18px; font-weight: 700; }
.st-addr { font-size: 13px; color: var(--muted); margin-top: 3px; }

.fuel-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }

.fuel-row {
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.fuel-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fuel-badge {
  flex: 0 0 auto;
  width: 44px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  padding: 6px 0;
  border-radius: 9px;
  background: var(--bg);
}
.fuel-badge.f92 { color: #6fd3ff; }
.fuel-badge.f95 { color: #7bed9f; }
.fuel-badge.f98 { color: #ffb86b; }
.fuel-badge.f100 { color: #ff8fd0; }
.fuel-badge.fdt { color: #cbb6ff; }

.fuel-status { flex: 1 1 auto; min-width: 0; }

.status-pill {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.status-pill.ok { color: var(--green); background: rgba(46, 204, 113, 0.14); }
.status-pill.no { color: var(--red); background: rgba(231, 76, 60, 0.14); }
.status-pill.unknown { color: var(--gray); background: rgba(127, 135, 152, 0.16); }

.status-time { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.status-time.stale { color: #ffb86b; }
.src-official { color: #6fd3ff; font-weight: 600; }

.vote-box {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.vote-btn {
  border: 1px solid var(--panel);
  background: var(--bg);
  color: var(--text);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s;
}
.vote-btn:active { transform: scale(0.94); }
.vote-btn.voted-up { border-color: var(--green); color: var(--green); }
.vote-btn.voted-down { border-color: var(--red); color: var(--red); }
.vote-btn[disabled] { opacity: 0.45; cursor: default; }
.vote-count { font-weight: 700; font-size: 12px; }

.report-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.report-btn {
  flex: 1;
  border: none;
  border-radius: 9px;
  padding: 7px 0;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: var(--bg);
}
.report-btn.rb-ok:hover { background: rgba(46, 204, 113, 0.2); }
.report-btn.rb-no:hover { background: rgba(231, 76, 60, 0.2); }

/* ===== Комментарии ===== */
.comments-title {
  font-size: 15px;
  font-weight: 700;
  margin: 18px 0 10px;
}

.comment {
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.comment-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.comment-author { font-weight: 600; }
.comment-text { font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.comments-empty { color: var(--muted); font-size: 13.5px; }

.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.comment-form input {
  flex: 1;
  border: 1px solid var(--panel-2);
  background: var(--bg);
  color: var(--text);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.comment-form input:focus { border-color: var(--accent); }
.comment-form button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 11px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== Тост ===== */
#toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 74px);
  transform: translateX(-50%);
  z-index: 50;
  background: rgba(20, 22, 32, 0.95);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

/* Балун Яндекс.Карт под тёмную тему не трогаем — используем свой sheet */

@media (min-width: 720px) {
  .sheet { left: auto; right: 16px; bottom: 16px; width: 400px; border-radius: 20px; max-height: 82%; }
  #legend { bottom: 20px; }
}
