/* Палитра статусов — единственный источник правды для CSS и JS */
:root {
    --c-ok:      #1a9850;   /* есть, подтверждено */
    --c-ok-soft: #91cf60;   /* есть, 1 отметка */
    --c-warn:    #fdae61;   /* мало / очередь */
    --c-bad:     #d73027;   /* пусто */
    --c-na:      #b8bfc9;   /* нет данных / устарело */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    padding: 10px 16px;
    background: #1a1d24;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

h1 { font-size: 20px; }

.tagline { font-size: 13px; color: #9aa3b2; flex: 1; }

#fuel-filter { display: flex; gap: 6px; }

#fuel-filter button {
    padding: 6px 14px;
    border: 1px solid #3a4150;
    border-radius: 16px;
    background: transparent;
    color: #cfd6e3;
    font-size: 13px;
    cursor: pointer;
}

#fuel-filter button.active {
    background: #2f81f7;
    border-color: #2f81f7;
    color: #fff;
}

#view-filter { display: flex; gap: 6px; }

#view-filter button {
    padding: 6px 14px;
    border: 1px solid #3a4150;
    border-radius: 16px;
    background: transparent;
    color: #cfd6e3;
    font-size: 13px;
    cursor: pointer;
}

#view-filter button.active {
    background: #1a9850;
    border-color: #1a9850;
    color: #fff;
}

#map { flex: 1; }

#net-banner {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    background: #b3261e;
    color: #fff;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.report-error { color: #b3261e; font-size: 12px; margin-top: 6px; }

/* Спиннер первой загрузки */
#loading {
    position: absolute;
    inset: 0;
    top: 60px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    color: #444;
}

.spinner {
    width: 34px;
    height: 34px;
    border: 4px solid #d6dbe3;
    border-top-color: #2f81f7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Пустое состояние: под фильтр ничего не попало */
#empty-hint {
    position: absolute;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(26, 29, 36, 0.88);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Подсветка выбранной АЗС (открыт попап) */
.selected-marker { z-index: 1000 !important; }

.selected-marker .pin {
    transform: rotate(-45deg) scale(1.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.selected-marker .dot-marker {
    transform: scale(1.6);
    opacity: 1;
}

#legend {
    position: absolute;
    bottom: 20px;
    left: 12px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.9;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}

.dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.dot.confirmed-available { background: var(--c-ok); }
.dot.single-available    { background: var(--c-ok-soft); }
.dot.low                 { background: var(--c-warn); }
.dot.empty               { background: var(--c-bad); }
.dot.nodata              { background: var(--c-na); }

/* ── Маркеры на карте ── */

/* Цветной пин-капля с колонкой */
.pin {
    width: 30px;
    height: 30px;
    background: var(--c);
    border: 2px solid #fff;
    border-radius: 50% 50% 50% 4px;   /* капля: один угол острый */
    transform: rotate(-45deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin span {
    transform: rotate(45deg);          /* эмодзи обратно в вертикаль */
    font-size: 14px;
    line-height: 1;
}

.pin:hover { filter: brightness(1.1); }

/* «Нет данных» — тихая маленькая точка */
.dot-marker {
    width: 10px;
    height: 10px;
    margin: 6px;   /* центр в 22px-контейнере: попадать пальцем проще */
    background: var(--c);
    border: 1.5px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    opacity: 0.75;
}

/* Пользователь: синяя пульсирующая точка */
.user-dot {
    width: 16px;
    height: 16px;
    background: #2f81f7;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(47, 129, 247, 0.45);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(47, 129, 247, 0.45); }
    70%  { box-shadow: 0 0 0 14px rgba(47, 129, 247, 0); }
    100% { box-shadow: 0 0 0 0 rgba(47, 129, 247, 0); }
}

.popup-card .dist { color: #2f81f7; font-size: 12px; white-space: nowrap; }

/* ── Карточка АЗС в попапе ── */
.popup-card h3 { font-size: 15px; margin-bottom: 2px; }
.popup-card .addr { color: #666; font-size: 12px; margin-bottom: 8px; }

.popup-card .fuel-row { font-size: 13px; margin: 3px 0; }
.popup-card .fuel-row .meta { color: #888; font-size: 12px; }

.popup-card .report-form { margin-top: 10px; border-top: 1px solid #e5e5e5; padding-top: 8px; }
.popup-card .report-form p { font-size: 12px; color: #555; margin-bottom: 5px; }

.status-buttons { display: flex; gap: 4px; flex-wrap: wrap; }

.status-buttons button {
    padding: 5px 9px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f7f7f7;
    cursor: pointer;
}

.status-buttons button:hover { background: #e8eefb; border-color: #2f81f7; }

.status-buttons button.selected,
.preset-row button.selected {
    background: #2f81f7;
    border-color: #2f81f7;
    color: #fff;
}

/* Второй шаг формы: опциональные очередь и лимит */
.report-details { margin-top: 8px; }

.preset-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 4px 0;
    font-size: 12px;
}

.preset-row span { min-width: 56px; color: #555; }

.preset-row button {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f7f7f7;
    cursor: pointer;
}

.send-btn {
    margin-top: 8px;
    width: 100%;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: #1a9850;
    color: #fff;
    cursor: pointer;
}

.send-btn:hover { background: #157a40; }

.report-thanks { color: #1a9850; font-size: 13px; margin-top: 6px; }

/* Бейджи уверенности в строках топлива */
.lvl {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 9px;
    vertical-align: middle;
    white-space: nowrap;
}

.lvl-ok  { background: #e3f4e8; color: #136c3a; }
.lvl-mid { background: #fff3d6; color: #8a6100; }
.lvl-old { background: #ececec; color: #777; }

#legend summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 2px;
}

/* ── Мобильный ── */
@media (max-width: 640px) {
    header { padding: 8px 10px; gap: 8px; }
    h1 { font-size: 17px; }
    .tagline { display: none; }   /* слоган — жертва маленького экрана */

    /* Фильтры — горизонтальная лента, кнопки крупнее под палец */
    #fuel-filter, #view-filter {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        max-width: 100%;
    }
    #fuel-filter button, #view-filter button {
        padding: 9px 14px;
        white-space: nowrap;
    }

    .status-buttons button { padding: 10px 12px; }
    .preset-row button { padding: 8px 10px; }

    #legend { font-size: 11px; line-height: 1.7; bottom: 26px; }
}
