:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --dark: #0f172a;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

*::-webkit-scrollbar {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding-bottom: 40px;
}

body.dark-mode {
    --bg: #0b1120;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --border: #334155;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
}

/* En-tête bien dégagé (sans chevauchement) */
.app-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 22px 0;
    margin-bottom: 24px;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
}

.app-header p {
    color: #cbd5e1;
    font-size: 0.9rem;
    margin-top: 2px;
}

.btn-theme {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Panneau de recherche compact, aligné et espacé */
.search-panel {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: 980px;
    margin: 0 auto 24px auto;
}

.search-grid {
    display: grid;
    grid-template-columns: 2fr 1.1fr 1fr auto;
    gap: 14px;
    align-items: center;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

input,
select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    background: var(--card-bg);
    color: var(--text);
}

.city-group input {
    padding-right: 44px;
}

.btn-icon {
    position: absolute;
    right: 6px;
    background: var(--bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-primary {
    height: 44px;
    padding: 0 24px;
    margin-left: 4px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* Autocomplétion */
.suggestions-list {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    list-style: none;
    z-index: 1000;
    max-height: 240px;
    overflow-y: auto;
}

.suggestions-list li {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

.suggestions-list li:hover {
    background: rgba(16, 185, 129, 0.1);
}

/* Barre de tri et statut */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.status-text {
    font-size: 0.88rem;
    color: var(--text-light);
    font-weight: 600;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-controls select {
    width: auto;
    height: 34px;
    font-size: 0.85rem;
}

.btn-fav-filter {
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-fav-filter.active {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}

/* Grille Principale : Liste à gauche | Fiche détaillée au centre */
.results-layout-center {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 22px;
    align-items: start;
}

.stations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 75vh;
    overflow-y: auto;
}

.station-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.station-card:hover {
    border-color: var(--primary);
}

.station-card.selected-card {
    border: 2px solid var(--primary);
    background: rgba(16, 185, 129, 0.06);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.station-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-svg-badge {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.72rem;
    flex-shrink: 0;
    text-align: center;
    padding: 3px;
}

.station-title {
    font-weight: 700;
    font-size: 0.98rem;
}

.station-address {
    font-size: 0.82rem;
    color: var(--text-light);
}

.price-badge {
    background: #ecfdf5;
    color: #059669;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid #a7f3d0;
    white-space: nowrap;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Panneau Central : Fiche Technique Complète de la Station */
.center-stage {
    position: sticky;
    top: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.empty-detail {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 1rem;
}

.detail-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.detail-brand-block {
    display: flex;
    align-items: center;
    gap: 16px;
}

.detail-brand-block .brand-svg-badge {
    width: 64px;
    height: 64px;
    font-size: 0.95rem;
    border-radius: 14px;
}

/* Grille de tous les carburants de la station */
.fuels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.fuel-box {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--bg);
}

.fuel-box.active-fuel {
    border: 2px solid var(--primary);
    background: rgba(16, 185, 129, 0.08);
}

.fuel-box-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-light);
}

.fuel-box-price {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    margin: 4px 0;
}

.fuel-box-maj {
    font-size: 0.72rem;
    color: var(--text-light);
}

/* Badges des services */
.services-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.service-tag {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 160px;
    text-align: center;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.92rem;
}

.action-gps {
    background: #2563eb;
    color: white;
}

.action-street {
    background: #0f172a;
    color: white;
}

.action-map {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-star {
    background: none;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.loader {
    text-align: center;
    padding: 20px;
    font-weight: 600;
    color: var(--primary-dark);
}

@media (max-width: 860px) {
    .search-grid {
        grid-template-columns: 1fr;
    }

    .btn-primary {
        margin-left: 0;
        width: 100%;
    }

    .results-layout-center {
        grid-template-columns: 1fr;
    }

    .center-stage {
        position: static;
        order: -1;
    }
}

/* Panneau de recherche parfaitement aligné sur la largeur des 2 colonnes du dessous */
.search-panel {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 100%;
    margin: 0 0 24px 0;
}

/* Pastilles officielles des carburants (B7, E10, E5, E85, LPG) */
.fuel-pill-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.72rem;
    padding: 3px 7px;
    border-radius: 5px;
    letter-spacing: 0.3px;
    border: 1.5px solid currentColor;
    line-height: 1;
}

.fuel-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

/* Badges carburants compacts dans la liste des favoris au centre */
.fav-fuels-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.fav-fuel-mini {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 4px 9px;
    border-radius: 8px;
    font-size: 0.82rem;
}

.fav-fuel-mini.is-selected {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.08);
}

/* Alerte visuelle lorsque la date de MAJ a plus de 2 jours */
.maj-stale {
    color: #dc2626 !important;
    font-weight: 700;
}

/* Ligne secondaire sous le prix au litre : pastille carburant + coût total */
.fuel-cost-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.trip-cost-badge {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}


.secondary-search-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 14px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.secondary-search-row .input-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 0 0 175px;
    width: 175px;
    max-width: 175px;
    gap: 4px;
}

.secondary-search-row .input-group input {
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.secondary-search-row .input-group label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    white-space: nowrap;
    margin: 0;
    padding-left: 2px;
    text-align: left;
}

/* Adaptation mobile : évite tout débordement à droite */
@media (max-width: 600px) {
    .secondary-search-row {
        gap: 10px;
    }

    .secondary-search-row .input-group {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .secondary-search-row .input-group label {
        font-size: 0.68rem;
        white-space: normal;
        line-height: 1.2;
    }
}


/* Lien cliquable sur le titre principal sans modifier son apparence */
.app-title-link {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}

.app-title-link:hover {
    opacity: 0.88;
}