/* Gasolineras — El Abeto (mapa en vivo)
   Paleta compartida con el histórico: verde pino #2E4A35 · verde claro #4A7A5C ·
   crema #F4F1EA · texto #1E1E1E. Los colores de precio (#16834a / #e88922 / #b42318)
   se reservan SOLO para los datos (surtidores, bloques barato/medio/caro). */

:root {
    color-scheme: light;
    --pine: #2E4A35;
    --pine-light: #4A7A5C;
    --cream: #F4F1EA;
    --ink: #1E1E1E;
    --ink-muted: #6b7280;
    --line: #e5e0d5;
    --card: #ffffff;
    --price-cheap: #16834a;
    --price-mid: #e88922;
    --price-expensive: #b42318;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(30, 30, 30, 0.06), 0 4px 14px rgba(30, 30, 30, 0.06);
}

* {
    box-sizing: border-box;
}

html,
body {
    /* Cabecera arriba, app central, pie abajo. El scroll queda dentro del listado. */
    height: 100%;
    height: 100dvh;
    margin: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--cream);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--pine-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Cabecera común ---- */
.site-header {
    background: var(--pine);
    color: #fff;
    flex: 0 0 auto;
    z-index: 60;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.08rem;
    letter-spacing: -0.01em;
    text-decoration: none;
    white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-sub { font-weight: 500; opacity: 0.85; }
.main-nav { display: flex; gap: 4px; }
.nav-link {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.12); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255, 255, 255, 0.18); color: #fff; font-weight: 600; }

/* ---- App (mapa + ranking) ---- */
.app-shell {
    flex: 1 1 auto;
    min-height: 0;
    padding: 10px;
    overflow: hidden;
}

.map-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    height: 100%;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
    box-shadow: var(--shadow);
}

#map {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.results {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-left: 1px solid var(--line);
    background: #fbfaf6;
}

.results header {
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--line);
}

.fuel-control {
    display: block;
    margin: 0;
}

.fuel-control select {
    width: 100%;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.fuel-control select:focus {
    border-color: var(--pine-light);
    outline: none;
}

.status,
p {
    margin: 0;
    color: var(--ink-muted);
    font-size: 11.5px;
    line-height: 1.3;
}

.price-summary {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    overflow: hidden;
    border-radius: 8px;
}

.price-summary td {
    padding: 5px 4px;
    color: #fff;
    text-align: center;
}

.price-summary span,
.price-summary strong {
    display: block;
}

.price-summary span {
    font-size: 9.5px;
    font-weight: 700;
}

.price-summary strong {
    margin-top: 2px;
    font-size: 12.5px;
}

.summary-min { background: var(--price-cheap); }
.summary-avg { background: var(--price-mid); }
.summary-max { background: var(--price-expensive); }

#stationList {
    display: grid;
    gap: 6px;
    align-content: start;
    min-height: 0;
    margin: 0;
    padding: 8px;
    overflow: auto;
    list-style: none;
}

.station button {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    width: 100%;
    min-height: 58px;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(30, 30, 30, 0.04);
}

.station button:hover,
.station button:focus {
    border-color: var(--pine-light);
    outline: none;
}

.position {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--pine);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
}

.details {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.details strong,
.details span,
.details small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.details strong { font-size: 12.5px; }
.details span { color: #334155; font-size: 11.5px; }
.details small { color: #667789; font-size: 10.5px; }

.price {
    font-size: 14.5px;
    font-weight: 700;
    color: #9b2c2c;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ---- Globo (infowindow) ---- */
.popup {
    display: grid;
    gap: 6px;
    min-width: 250px;
    max-width: 310px;
    padding: 2px 2px 4px;
    color: var(--ink);
    font-size: 12px;
    line-height: 1.25;
}

.popup-title {
    color: #111827;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}

.popup-price {
    display: inline-block;
    width: max-content;
    margin: 2px 0 4px;
    padding: 4px 8px;
    border-radius: 8px;
    background: #f8e8e7;
    color: #9b2c2c;
    font-size: 19px;
    font-weight: 800;
    line-height: 1;
}

.popup-address { color: #334155; font-size: 12px; }
.popup-place,
.popup-hours { color: #667789; font-size: 12px; }

.gm-style .gm-style-iw-c { border-radius: 10px; }
.gm-style .gm-style-iw-d { overflow: auto !important; }

.popup-updated {
    color: #9ca3af;
    font-size: 11px;
    font-style: italic;
    margin-top: 2px;
}

small.updated {
    color: #9ca3af;
    font-size: 10px;
    font-style: italic;
}

.popup-stats {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 10px;
    border: 1px solid var(--pine-light);
    border-radius: 8px;
    color: var(--pine-light);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.popup-stats:hover,
.popup-stats:focus {
    background: var(--pine-light);
    color: #fff;
    text-decoration: none;
}

/* ---- Pie: letra minima (aviso de fuente + enlace al ministerio) ---- */
.site-footer {
    flex: 0 0 auto;
    text-align: center;
    padding: 2px 8px;
    color: var(--ink-muted);
    font-size: 0.6rem;      /* 9.6px */
    line-height: 1.15;
    background: var(--card);
    border-top: 1px solid var(--line);
}
/* La regla global `p` (11.5px / 12px en movil) no debe mandar aqui. */
.site-footer p { font-size: inherit; line-height: inherit; }
.site-footer a { color: var(--pine-light); }

/* Tablet: entre 620px y 1024px */
@media (max-width: 1024px) and (min-width: 621px) {
    .map-panel { grid-template-columns: minmax(0, 1fr) 320px; }
    .station button { min-height: 68px; padding: 8px; }
    .details strong { font-size: 13px; }
}

/* Movil: menos de 620px */
@media (max-width: 620px) {
    .header-inner { flex-wrap: wrap; }
    .main-nav { width: 100%; justify-content: center; }

    .app-shell { padding: 0; }

    .map-panel {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 68%) minmax(0, 32%);
        height: 100%;
        min-height: 0;
        border: 0;
        border-radius: 0;
    }

    #map { height: 100%; min-height: 0; }

    .results {
        max-height: none;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .results header { padding: 10px 12px 8px; }

    h1 { font-size: 18px; margin: 0 0 4px; }

    .fuel-control { margin: 6px 0; gap: 4px; }
    .fuel-control select { min-height: 36px; font-size: 14px; }

    .status,
    p { font-size: 12px; }

    .price-summary strong { font-size: 12px; }

    #stationList { gap: 6px; padding: 8px; }

    .station button {
        grid-template-columns: 28px minmax(0, 1fr) auto;
        gap: 8px;
        min-height: 64px;
        padding: 8px;
    }

    .position { width: 26px; height: 26px; font-size: 12px; }
    .details strong { font-size: 13px; }
    .details span { font-size: 12px; }
    .details small { font-size: 11px; }
    .price { font-size: 14px; }

    .popup { min-width: 200px; max-width: 260px; }
    .popup-title { font-size: 15px; }
    .popup-price { font-size: 20px; }
}
