/* ==========================================================================
   Pese Sul Gaz -- Main Stylesheet
   Brand palette:
     Primary navy:   #1a2744
     Teal:           #2db5a0
     Gold:           #f0c040
     Red:            #e05050
     Background:     #f4f6f8
     Text:           #1a1a1a
   ========================================================================== */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: "Chakra Petch", -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1a1a1a;
    background-color: #f4f6f8;
    min-height: 100vh;
}

a {
    color: #2db5a0;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}

/* --------------------------------------------------------------------------
   2. Header
   -------------------------------------------------------------------------- */
.site-header {
    background-color: #1a2744;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-inner {
    display: flex;
    align-items: center;
    height: 56px;
    gap: 16px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s, background-color 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.nav-link.active {
    color: #ffffff;
    background-color: rgba(45, 181, 160, 0.25);
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.lang-active {
    color: #2db5a0;
}

.lang-link {
    color: rgba(255, 255, 255, 0.5);
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.2s;
}

.lang-link:hover {
    color: #ffffff;
    text-decoration: none;
}

/* Hamburger -- hidden on desktop */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 110;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

/* --------------------------------------------------------------------------
   3. Price Board
   -------------------------------------------------------------------------- */
.price-board {
    background: linear-gradient(135deg, #1a2744 0%, #163a3a 100%);
    padding: 32px 16px;
    text-align: center;
    color: #ffffff;
}

.price-board-inner {
    max-width: 960px;
    margin: 0 auto;
}

.price-board-logo {
    height: 140px;
    width: auto;
    margin: 0 auto 12px;
}

.price-board-tagline {
    font-family: "Orbitron", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.price-board-source {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 24px;
}

.price-panels {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.price-panel {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-top: 3px solid #2db5a0;
    padding: 16px 24px;
    min-width: 160px;
    text-align: center;
}

.price-panel-label {
    display: block;
    font-family: "Orbitron", sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.price-panel-value {
    display: block;
    font-size: 2rem;
    font-family: "Orbitron", "SF Mono", "Fira Code", monospace;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.price-panel-trend {
    display: block;
    font-size: 0.85rem;
    margin-top: 4px;
    font-weight: 600;
}

.trend-up {
    color: #e05050;
}

.trend-down {
    color: #4caf50;
}

.trend-stable {
    color: rgba(255, 255, 255, 0.5);
}

/* --------------------------------------------------------------------------
   4. Stats Tabs
   -------------------------------------------------------------------------- */
.stats-section {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
}

.stats-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 16px;
}

.stats-tab {
    flex: 1;
    text-align: center;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: "Orbitron", sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: #666666;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.stats-tab:hover {
    color: #1a1a1a;
}

.stats-tab.active {
    color: #2db5a0;
    border-bottom-color: #2db5a0;
}

.back-link {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2db5a0;
    margin-bottom: 8px;
}

.back-link:hover {
    color: #259a88;
}

.brand-stations-title {
    font-size: 1.15rem;
    color: #1a2744;
    margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   5. Data Table
   -------------------------------------------------------------------------- */
.data-table {
    width: 100%;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border-collapse: collapse;
    overflow: hidden;
}

.data-table thead th {
    font-family: "Orbitron", sans-serif;
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 500;
    color: #888888;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid #f0f0f0;
}

.data-table tbody td {
    padding: 10px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid #f4f4f4;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:nth-child(even) {
    background-color: #f8fafa;
}

.data-table tbody tr:hover {
    background-color: #eef5f4;
}

.data-table tbody tr[data-href] {
    cursor: pointer;
}

.price-cell {
    font-family: "Orbitron", "SF Mono", "Fira Code", monospace;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-align: center;
    width: 1%;
    white-space: nowrap;
    padding-left: 20px;
    padding-right: 20px;
}

th.price-cell {
    text-align: center;
}

.rank-cell {
    text-align: center;
    width: 1%;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   6. Footer
   -------------------------------------------------------------------------- */
.site-footer {
    background-color: #1a2744;
    color: #888888;
    text-align: center;
    padding: 24px 16px;
    font-size: 0.85rem;
    margin-top: 48px;
}

.site-footer a {
    color: #aaaaaa;
}

.site-footer a:hover {
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   7. Bottom Nav (PWA)
   -------------------------------------------------------------------------- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #1a2744;
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    padding-left: 16px;
    padding-right: 16px;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.65rem;
    text-decoration: none;
    transition: color 0.2s;
    gap: 2px;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: #2db5a0;
    text-decoration: none;
}

.nav-icon {
    width: 22px;
    height: 22px;
}

@media (display-mode: standalone) and (max-width: 768px) {
    .site-header {
        display: none;
    }

    .site-footer {
        display: none;
    }

    .bottom-nav {
        display: flex;
    }
}

/* --------------------------------------------------------------------------
   11. Stations Page
   -------------------------------------------------------------------------- */
.stations-page {
    padding-top: 32px;
    padding-bottom: 16px;
}

.stations-page h1 {
    font-family: "Orbitron", sans-serif;
    font-size: 1.75rem;
    color: #1a2744;
    margin-bottom: 16px;
}

.location-bar {
    margin-bottom: 24px;
}

.search-box {
    position: relative;
    margin-bottom: 8px;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
}

.search-dropdown:empty {
    display: none;
}

.search-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid #f4f4f4;
    font-size: 0.95rem;
    color: #1a1a1a;
    cursor: pointer;
    font-family: inherit;
}

.search-item:hover {
    background-color: #f0faf8;
    color: #2db5a0;
}

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

.location-status {
    font-size: 0.85rem;
    color: #666666;
    padding: 4px 0;
}

.location-ok {
    color: #2db5a0;
    font-weight: 600;
}

.location-denied {
    color: #e05050;
}

.location-loading {
    color: #888888;
}

.distance-cell {
    text-align: center;
    white-space: nowrap;
    font-size: 0.85rem;
    color: #666666;
}

.no-results {
    text-align: center;
    color: #888888;
    padding: 32px 16px;
    font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   12. Station Detail Page
   -------------------------------------------------------------------------- */
.station-detail {
    padding-top: 32px;
    padding-bottom: 32px;
}

.station-header h1 {
    font-family: "Orbitron", sans-serif;
    font-size: 1.75rem;
    color: #1a2744;
    margin-bottom: 4px;
}

.station-brand {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2db5a0;
    margin-bottom: 16px;
}

.station-address-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.station-address p {
    margin: 0;
    color: #444444;
    line-height: 1.5;
}

.btn-directions {
    flex-shrink: 0;
    gap: 6px;
}

.btn-directions svg {
    width: 18px;
    height: 18px;
}

.station-prices {
    margin-bottom: 32px;
}

.station-prices h2,
.station-chart h2 {
    font-family: "Orbitron", sans-serif;
    font-size: 1.15rem;
    color: #1a2744;
    margin-bottom: 16px;
}

.price-panels-wrapper {
    background: linear-gradient(135deg, #1a2744 0%, #163a3a 100%);
    border-radius: 8px;
    padding: 24px 16px;
}

.station-chart {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 24px 16px;
    margin-bottom: 24px;
}

#price-chart {
    max-height: 350px;
}

.station-last-update {
    text-align: center;
    font-size: 0.85rem;
    color: #888888;
    margin-top: 16px;
}

/* --------------------------------------------------------------------------
   8. Responsive
   -------------------------------------------------------------------------- */

/* -- Tablet / Mobile -- */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .header-nav {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background-color: #1a2744;
        flex-direction: column;
        padding: 8px 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .header-nav.open {
        display: flex;
    }

    .nav-link {
        padding: 12px 24px;
        border-radius: 0;
        font-size: 1rem;
    }

    .price-panels {
        gap: 12px;
    }

    .price-panel {
        min-width: 140px;
        padding: 12px 16px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    .station-address-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-directions {
        width: 100%;
    }
}

/* -- Portrait: hide Super/Diesel columns -- */
@media (max-width: 768px) and (orientation: portrait) {
    .gas-col-extra {
        display: none;
    }
}

/* -- Small phone -- */
@media (max-width: 480px) {
    .price-panels {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .price-panel {
        width: 100%;
        max-width: 280px;
        min-width: auto;
    }

    .price-panel-value {
        font-size: 1.6rem;
    }

    .stats-tab {
        font-size: 0.82rem;
        padding: 10px 8px;
    }
}

/* --------------------------------------------------------------------------
   9. About Page
   -------------------------------------------------------------------------- */
.about-page {
    padding: 32px 16px;
    max-width: 720px;
    margin: 0 auto;
}

.about-page h1 {
    font-family: "Orbitron", sans-serif;
    font-size: 1.75rem;
    color: #1a2744;
    margin-bottom: 24px;
}

.about-content h2 {
    font-size: 1.15rem;
    color: #1a2744;
    margin-top: 24px;
    margin-bottom: 8px;
}

.about-content p {
    color: #444444;
    line-height: 1.7;
    margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   10. Alerts Page
   -------------------------------------------------------------------------- */
.alerts-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 16px;
}

.alerts-page h1 {
    font-family: "Orbitron", sans-serif;
    font-size: 1.75rem;
    color: #1a2744;
    margin-bottom: 24px;
}

.coming-soon {
    text-align: center;
    padding: 80px 16px;
}

.coming-soon h1 {
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.coming-soon p {
    color: #444444;
    line-height: 1.7;
    margin-bottom: 12px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.coming-soon-footer {
    margin-top: 32px;
    font-weight: 600;
    color: #2db5a0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    line-height: 1.4;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: #2db5a0;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #259a88;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #1a1a1a;
}

.btn-secondary:hover {
    background-color: #cccccc;
}

.form-select,
.form-input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: 0.95rem;
    border: 1px solid #cccccc;
    border-radius: 6px;
    background-color: #ffffff;
    color: #1a1a1a;
    transition: border-color 0.2s;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: #2db5a0;
    box-shadow: 0 0 0 3px rgba(45, 181, 160, 0.15);
}

.threshold-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.threshold-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: box-shadow 0.2s;
}

.threshold-item:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   11. Map Page
   -------------------------------------------------------------------------- */
.map-page {
    padding-bottom: 0;
}

.map-bar {
    padding-top: 24px;
    padding-bottom: 16px;
}

.map-bar h1 {
    font-family: "Orbitron", sans-serif;
    font-size: 1.75rem;
    color: #1a2744;
    margin-bottom: 8px;
}

#station-map {
    width: 100%;
    height: calc(100vh - 180px);
    min-height: 400px;
}

.map-price-pin {
    background: none;
    border: none;
}

.map-price-pin span {
    display: inline-block;
    background-color: #1a2744;
    color: #ffffff;
    font-family: "Orbitron", "SF Mono", monospace;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid #2db5a0;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    font-family: "Chakra Petch", sans-serif;
}

.leaflet-popup-content {
    font-size: 0.9rem;
    line-height: 1.5;
}

.leaflet-popup-content a {
    color: #2db5a0;
    font-weight: 600;
}

@media (display-mode: standalone) and (max-width: 768px) {
    #station-map {
        height: calc(100vh - 180px - 56px);
    }
}
