/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  background: var(--tg-theme-bg-color, #ffffff);
  color: var(--tg-theme-text-color, #222222);
}

/* ===== Map ===== */
#map {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* ===== Header ===== */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background: var(--tg-theme-bg-color, #ffffff);
  padding: 8px 12px 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

#header-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--tg-theme-text-color, #222222);
}

#legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.chip {
  font-size: 12px;
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 12px;
  background: rgba(0,0,0,0.06);
  white-space: nowrap;
}

#updated {
  font-size: 11px;
  color: #888;
  margin-top: 3px;
  min-height: 14px;
}

/* ===== Bottom Sheet ===== */
.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  background: var(--tg-theme-bg-color, #ffffff);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.18);
  max-height: 70vh;
  overflow-y: auto;
  padding: 12px 16px 24px;
  transition: transform 0.25s ease;
}

.sheet.hidden {
  transform: translateY(100%);
  pointer-events: none;
}

#sheet-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--tg-theme-text-color, #222222);
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}

#sheet-close:hover {
  background: rgba(0,0,0,0.07);
}

/* Sheet content typography */
.sheet-station-name {
  font-size: 17px;
  font-weight: 700;
  margin-top: 2px;
  padding-right: 36px;
  color: var(--tg-theme-text-color, #222222);
}

.sheet-station-meta {
  font-size: 13px;
  color: #666;
  margin-top: 2px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  margin-top: 14px;
  margin-bottom: 6px;
}

.status-row {
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--tg-theme-text-color, #222222);
}

.age-label {
  font-size: 12px;
  color: #999;
}

.fuel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  font-size: 14px;
  color: var(--tg-theme-text-color, #222222);
}

.fuel-row:last-child {
  border-bottom: none;
}

.fuel-name {
  width: 70px;
  font-weight: 600;
  flex-shrink: 0;
}

.report-count {
  font-size: 13px;
  color: #666;
  margin-top: 10px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:active {
  opacity: 0.75;
}

.btn-primary {
  background: #2196F3;
  color: #fff;
  width: 100%;
  margin-top: 14px;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid #2196F3;
  color: #2196F3;
  width: 100%;
  margin-top: 8px;
}

/* Плашка «нажмите на карте, откуда начинается очередь» */
.pick-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  z-index: 1300;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1f1f1f;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  max-width: calc(100vw - 32px);
}

.pick-hint.hidden {
  display: none;
}

.pick-hint button {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  min-height: 36px;
}

/* Предупреждение «только по картам» в карточке */
.serving-warn {
  color: #b71c1c;
  font-weight: 600;
}

/* «Оплата по приложению» — предупреждение мягче, это не блокер */
.serving-note {
  color: #e65100;
  font-weight: 600;
}

.serving-hint {
  font-size: 12px;
  color: #888;
  margin: 2px 0 6px;
}

/* Контрол «Кого заправляют?»: четыре кнопки — переносим в две строки */
#serving-ctrl {
  flex-wrap: wrap;
}

#serving-ctrl .seg-btn {
  flex: 1 1 45%;
}

/* Свёрнутый ручной выбор уровня очереди */
.collapse-toggle {
  background: none;
  border: none;
  color: #2196F3;
  font-size: 14px;
  padding: 6px 0;
  min-height: 36px;
  cursor: pointer;
  display: block;
}

.radio-group.collapsed {
  display: none;
}

/* Результат замера хвоста в форме */
.pick-result {
  font-size: 13px;
  color: #2e7d32;
  font-weight: 600;
  margin-top: 6px;
  min-height: 18px;
}

/* Рекламный блок в карточке АЗС */
.promo-block {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}

.promo-tag {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b0a26e;
  margin-bottom: 2px;
}

/* Подписи брендов у маркеров АЗС */
.brand-label {
  background: rgba(255, 255, 255, 0.88);
  border: none;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  color: #333;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
}

.brand-label::before {
  display: none; /* без стрелки-хвостика у ярлыка */
}

/* Кнопка «где я» */
#btn-locate {
  position: fixed;
  right: 12px;
  bottom: 96px;
  z-index: 1000;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  font-size: 20px;
  cursor: pointer;
}

#btn-locate:active {
  transform: scale(0.94);
}

/* Поиск мест */
#search-box {
  position: relative;
  margin: 6px 0 4px;
}

#search-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 15px;
  background: #fff;
  color: #222;
  outline: none;
  box-sizing: border-box;
}

#search-input:focus {
  border-color: #2196F3;
}

#search-results {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  z-index: 1400;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  max-height: 40vh;
  overflow-y: auto;
}

#search-results.hidden {
  display: none;
}

.search-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 10px 12px;
  font-size: 14px;
  color: #222;
  cursor: pointer;
  min-height: 44px;
}

.search-item:active {
  background: rgba(33, 150, 243, 0.08);
}

.search-item-sub {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.search-empty {
  padding: 12px;
  font-size: 13px;
  color: #888;
}

.search-group-title {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #999;
}

.search-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: baseline;
  border: 1.5px solid #fff;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.35);
}

.btn-submit {
  background: #43a047;
  color: #fff;
  flex: 1;
}

.btn-back {
  background: rgba(0,0,0,0.07);
  color: var(--tg-theme-text-color, #222222);
  flex: 1;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* ===== Recent reports list ===== */
.reports-list {
  margin-top: 4px;
}

.report-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  font-size: 13px;
  color: var(--tg-theme-text-color, #222222);
}

.report-item:last-child {
  border-bottom: none;
}

.report-time {
  font-size: 11px;
  color: #aaa;
  margin-bottom: 2px;
}

.report-comment {
  font-size: 12px;
  color: #777;
  margin-top: 2px;
  font-style: italic;
}

/* ===== Form ===== */
.form-section-title {
  font-size: 14px;
  font-weight: 700;
  margin-top: 14px;
  margin-bottom: 8px;
  color: var(--tg-theme-text-color, #222222);
}

/* Queue radio group */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 10px;
  border: 2px solid rgba(0,0,0,0.1);
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
  color: var(--tg-theme-text-color, #222222);
}

.radio-label input[type="radio"] {
  accent-color: #2196F3;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.radio-label:has(input:checked) {
  border-color: #2196F3;
  background: rgba(33,150,243,0.07);
}

/* Fuel segment controls */
.fuel-segment-row {
  margin-bottom: 10px;
}

.fuel-segment-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--tg-theme-text-color, #222222);
}

.segment-ctrl {
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(0,0,0,0.1);
}

.seg-btn {
  flex: 1;
  min-height: 44px;
  border: none;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  color: var(--tg-theme-text-color, #222222);
  transition: background 0.15s, color 0.15s;
  padding: 0 4px;
}

.seg-btn + .seg-btn {
  border-left: 2px solid rgba(0,0,0,0.1);
}

.seg-btn.active-yes {
  background: #43a047;
  color: #fff;
}

.seg-btn.active-no {
  background: #e53935;
  color: #fff;
}

.seg-btn.active-unknown {
  background: #9e9e9e;
  color: #fff;
}

/* Comment textarea */
.comment-field {
  width: 100%;
  min-height: 72px;
  border-radius: 10px;
  border: 2px solid rgba(0,0,0,0.1);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  color: var(--tg-theme-text-color, #222222);
  background: var(--tg-theme-bg-color, #ffffff);
  margin-top: 4px;
}

.comment-field:focus {
  outline: none;
  border-color: #2196F3;
}

.validation-hint {
  color: #e53935;
  font-size: 13px;
  margin-top: 6px;
  display: none;
}

.validation-hint.visible {
  display: block;
}

/* ===== Toasts ===== */
#toasts {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}

.toast {
  background: rgba(30,30,30,0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}
