/**
 * BGFI Agences Map - Styles CSS
 * Version: 1.4.0
 */

/* ═══════════════════════════════════════════════════════════════════
   CONTENEUR PRINCIPAL
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-agences-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffffff;
    color: #222;
}

.bgfi-agences-container * {
    box-sizing: border-box;
}

.bgfi-agences-container .leaflet-container {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ═══════════════════════════════════════════════════════════════════
   ZONE 2 — BARRE DE RECHERCHE ET ACTIONS
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-search-bar {
    padding: 16px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

/* ── 1. Sélecteur de ville ─────────────────────────────────────── */

.bgfi-city-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 140px;
    max-width: 200px;
    height: 48px;
    background: #ffffff;
    border: 1px solid #E1E5EA;
    border-radius: 9px !important;
    overflow: hidden;
}

.bgfi-city-select-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}

.bgfi-city-select {
    width: 100%;
    height: 100%;
    padding: 0 32px 0 32px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: transparent;
    border: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.bgfi-city-select:focus {
    outline: 2px solid #023059;
    outline-offset: -2px;
}

/* Flèche chevron custom (après le select) */
.bgfi-city-select-wrap::after {
    content: '▾';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #999;
    pointer-events: none;
}

/* ── 2. Champ de recherche ─────────────────────────────────────── */

.bgfi-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 240px;
    min-width: 200px;
    max-width: 300px;
    height: 48px;
    overflow: hidden;
    
}

.bgfi-agences-container .bgfi-search-input {
    width: 100%;
    height: 100%;
    padding: 0 44px 0 14px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: #ffffff;
    border: 1px solid #E1E5EA;
    border-radius: 9px !important;
    outline: none;
    transition: border-color 0.2s;
}

.bgfi-agences-container .bgfi-search-input::placeholder {
    color: #aaa;
    font-size: 13px;
}

.bgfi-agences-container .bgfi-search-input:focus {
    border-color: #023059;
    box-shadow: 0 0 0 2px rgba(2, 48, 89, 0.1);
}

.bgfi-agences-container .bgfi-search-submit,
.bgfi-search-submit {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 16px;
    cursor: pointer;
    color: #777 !important;
    box-shadow: none !important;
    outline: none !important;
    transition: color 0.15s;
    padding: 0 !important;
}

.bgfi-agences-container .bgfi-search-submit:hover,
.bgfi-search-submit:hover {
    background: none !important;
    background-color: transparent !important;
    color: #023059 !important;
}

/* ── 3-5. Boutons d'action (Ma position, Agence, DAB) ─────────── */

.bgfi-agences-container .bgfi-action-btn,
.bgfi-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 14px;
    background: #ffffff !important;
    border: 1px solid #E1E5EA !important;
    border-radius: 9px !important;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #023059 !important;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: none !important;
    outline: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 1.3 !important;
}

.bgfi-agences-container .bgfi-action-btn:hover,
.bgfi-action-btn:hover {
    background: #f7f9fb !important;
    border-color: #CDD3DA !important;
    color: #023059 !important;
}

.bgfi-agences-container .bgfi-action-btn:focus,
.bgfi-action-btn:focus {
    outline: 2px solid #023059 !important;
    outline-offset: 2px;
}

.bgfi-action-btn-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
}

.bgfi-action-btn-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.3;
    text-align: left;
}

.bgfi-action-btn-title {
    font-size: 13px;
    font-weight: 600;
    color: #023059;
}

/* ── Groupe de boutons secondaires (desktop: inline dans le flex) ── */

.bgfi-action-btn-group {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.bgfi-action-btn-sub {
    font-size: 11px;
    font-weight: 400;
    color: #999;
}

/* ── Geo status (conservé, positionné sous la barre) ──────────── */

.bgfi-search-bar .bgfi-geo-status {
    width: 100%;
    flex-basis: 100%;
    font-size: 12px;
    margin: 0;
    min-height: 0;
    color: #023059;
}

.bgfi-search-bar .bgfi-geo-status[hidden] {
    display: none;
}

.bgfi-search-bar .bgfi-geo-status--error {
    color: #a82a2a;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════
   ZONE 3 + 4 — ZONE PRINCIPALE (RÉSULTATS + CARTE)
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-main-area {
    display: grid;
    grid-template-columns: 30% 70%;
    gap: 0;
    height: 500px;
    border-top: 1px solid #eef1f4;
    border-bottom: 1px solid #eef1f4;
}

/* ── Zone 3 : Panneau des résultats ─────────────────────────────── */

.bgfi-results-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #eef1f4;
    background: #ffffff;
    overflow: hidden;
}

.bgfi-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #eef1f4;
    background: #fafbfc;
    flex-shrink: 0;
}

.bgfi-results-count {
    font-size: 14px;
    font-weight: 600;
    color: #023059;
}

.bgfi-service-filter {
    padding: 5px 28px 5px 10px;
    font-size: 13px;
    font-family: inherit;
    color: #555;
    background: #ffffff;
    border: 1px solid #E1E5EA;
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.bgfi-service-filter:focus {
    outline: 2px solid #023059;
    outline-offset: 1px;
}

.bgfi-results-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    margin: 0;
    background: #ffffff;
}

/* ── Zone 4 : Carte ─────────────────────────────────────────────── */

.bgfi-map-col {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f5f0e6;
    border-radius: 0 8px 8px 0;
}

.bgfi-map-col .bgfi-map {
    height: 100% !important;
    width: 100%;
    min-height: 400px;
    flex: 1;
    background: #f5f0e6;
    cursor: grab;
    outline: none;
}

/* ═══════════════════════════════════════════════════════════════════
   ZONE 5 — LÉGENDE
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-legend {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0;
    padding: 14px 24px;
    background: #ffffff;
    border-top: 1px solid #eef1f4;
    min-height: 48px;
    overflow-x: auto;
}

.bgfi-legend-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    flex-shrink: 0;
}

.bgfi-legend-marker {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    color: #fff;
    line-height: 1;
    margin-top: 1px;
}

/* ... colors ... */

.bgfi-legend-marker--agency {
    background: #0367A6;
}

.bgfi-legend-marker--siege {
    background: #023059;
}

.bgfi-legend-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    white-space: nowrap;
}

.bgfi-legend-label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.bgfi-legend-sub {
    font-size: 11px;
    font-weight: 400;
    color: #aaa;
    line-height: 1.3;
}

.bgfi-legend-marker--dab {
    background: #00897B;
}

.bgfi-legend-marker--premium {
    background: #E8A838;
}

.bgfi-legend-marker--business {
    background: #5C6BC0;
}

.bgfi-legend-marker--cash {
    background: #43A047;
}

.bgfi-legend-label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.bgfi-legend-sep {
    display: block;
    width: 1px;
    height: 50px;
    background: #D9DDE2;
    margin: 0 12px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   MESSAGE D'INFORMATION
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-info-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    font-size: 11px;
    color: #888;
    background: #fafbfc;
    border-top: 1px solid #eef1f4;
}

.bgfi-info-icon {
    flex-shrink: 0;
    font-size: 13px;
    color: #aaa;
}

/* ═══════════════════════════════════════════════════════════════════
   ONGLETS (conservés de l'ancienne version)
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-tabs {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 16px 20px;
    background: transparent;
    user-select: none;
    border-bottom: 1px solid #eef1f4;
}

.bgfi-tab {
    position: relative;
    padding: 6px 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #8A8A8A;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1.4;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    outline: none;
}

.bgfi-tab:hover {
    color: #023059;
}

.bgfi-tab--active {
    color: #023059;
    font-weight: 600;
}

/* Indicateur horizontal sous l'onglet actif */
.bgfi-tab--active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 3px;
    background: #023059;
    border-radius: 2px;
}

/* Séparateur vertical entre Agences et DAB */
.bgfi-tab:last-child::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 28px;
    background: #D9DDE2;
    pointer-events: none;
}

.bgfi-tab-content {
    display: none;
}

.bgfi-tab-content--active {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   ITEMS DE LA LISTE — FORMAT COMPACT
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-agency-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
    background: #ffffff;
    color: #333;
    border-bottom: 1px solid #f0f2f5;
    min-height: 54px;
}

.bgfi-agency-item:hover {
    background: #f7f9fb;
}

.bgfi-agency-item.active,
.bgfi-agency-item[aria-selected="true"] {
    background: #f0f4f8;
    border-left: 3px solid #023059;
}

/* ── Icône du résultat ──────────────────────────────────────────── */

.bgfi-result-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 6px;
    background: #f5f7fa;
}

.bgfi-result-icon--agency {
    background: #eef3f8;
}

.bgfi-result-icon--siege {
    background: #eef2e8;
}

.bgfi-result-icon--dab {
    background: #e8f0f6;
}

.bgfi-result-icon--premium {
    background: #fdf2e0;
}

.bgfi-result-icon--business {
    background: #eaeef4;
}

.bgfi-result-icon--cash {
    background: #e8f5ed;
}

/* ── Infos (nom + ville) ────────────────────────────────────────── */

.bgfi-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bgfi-result-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bgfi-result-city {
    font-size: 12px;
    color: #888;
    font-weight: 400;
    line-height: 1.3;
}

/* ── Flèche ─────────────────────────────────────────────────────── */

.bgfi-result-arrow {
    flex-shrink: 0;
    font-size: 18px;
    color: #CCC;
    font-weight: 300;
    transition: color 0.15s;
}

.bgfi-agency-item:hover .bgfi-result-arrow {
    color: #023059;
}

.bgfi-agency-item.active .bgfi-result-arrow {
    color: #023059;
}

.bgfi-agency-item[hidden] {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════
   POPUPS LEAFLET (refonte moderne)
   ═══════════════════════════════════════════════════════════════════ */

.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
    min-width: 240px;
    padding: 0 !important;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
}

.bgfi-popup-content {
    padding: 14px 16px 12px;
}

.bgfi-popup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.bgfi-popup-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.bgfi-popup-title {
    font-size: 15px;
    font-weight: 700;
    color: #023059;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bgfi-popup-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.bgfi-popup-badge--siege {
    background: #99A686;
    color: #fff;
}

.bgfi-popup-badge--dab {
    background: #0367A6;
    color: #fff;
}

.bgfi-popup-badge--premium {
    background: #E8A838;
    color: #fff;
}

.bgfi-popup-badge--business {
    background: #5C6BC0;
    color: #fff;
}

.bgfi-popup-badge--cash {
    background: #43A047;
    color: #fff;
}

.bgfi-popup-address {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    margin-bottom: 2px;
}

.bgfi-popup-city {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

/* Debug : coordonnées GPS (visible seulement en mode debug) */
.bgfi-popup-debug-coords {
    font-size: 11px;
    color: #aaa;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
    user-select: all;
}

.bgfi-popup-in-agency {
    font-size: 12px;
    color: #5a7248;
    margin-bottom: 6px;
    font-weight: 500;
}

.bgfi-popup-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #444;
    margin-bottom: 4px;
}

.bgfi-popup-label {
    flex-shrink: 0;
    font-size: 14px;
}

/* ── Actions popup ─────────────────────────────────────────────── */

.bgfi-popup-actions {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eef1f4;
}

.bgfi-popup-route-btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    color: #023059;
    background: #f0f4f7;
    border: 1px solid #dde3e8;
    border-radius: 9px !important;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.bgfi-popup-route-btn:hover {
    background: #e3ebf2;
    border-color: #023059;
}

/* ── Horaires dans le popup ─────────────────────────────────────── */

.bgfi-popup-hours {
    background: #f7f9f4;
    border-radius: 9px !important;
    padding: 7px 9px;
    font-size: 12px;
    color: #333;
    margin-top: 4px;
    border: 1px solid #e0e6d8;
}

.bgfi-popup-hours--24 {
    background: #eef6e8;
    color: #3a6b20;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    border-color: #c5ddb0;
}

.bgfi-hours-header {
    font-weight: 600;
    color: #023059;
    margin-bottom: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.bgfi-hours-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}

.bgfi-hours-label {
    color: #666;
    flex-shrink: 0;
}

.bgfi-hours-value {
    color: #023059;
    font-weight: 500;
    text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════
   CARTE (curseurs + marqueur utilisateur)
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-map.bgfi-map-focused {
    cursor: grab;
    box-shadow: inset 0 0 0 2px rgba(3, 103, 166, 0.35);
}

/* Marqueur position utilisateur (divIcon Leaflet) */
.leaflet-div-icon.bgfi-user-marker-wrap {
    background: transparent;
    border: none;
}

.bgfi-user-marker-dot {
    display: block;
    width: 16px;
    height: 16px;
    background: #0367A6;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* ── Marqueurs de service (divIcon Leaflet) ─────────────────────── */

.bgfi-marker-wrap {
    background: transparent !important;
    border: none !important;
}

.bgfi-marker-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 3px solid #fff;
    line-height: 1;
}

/* Couleurs par type */
.bgfi-marker--agency .bgfi-marker-emoji {
    background: #0367A6;
}

.bgfi-marker--siege .bgfi-marker-emoji {
    background: #023059;
}

.bgfi-marker--dab .bgfi-marker-emoji {
    background: #00897B;
}

.bgfi-marker--premium .bgfi-marker-emoji {
    background: #E8A838;
}

.bgfi-marker--business .bgfi-marker-emoji {
    background: #5C6BC0;
}

.bgfi-marker--cash .bgfi-marker-emoji {
    background: #43A047;
}

/* ═══════════════════════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(207, 217, 173, 0.95);
    color: #023059;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(2, 48, 89, 0.2);
    z-index: 1000;
    font-weight: 600;
}

.bgfi-loading p {
    margin: 0;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════
   MARQUEUR ACTIF
/* ── Marqueur actif ─────────────────────────────────────────────── */

@keyframes bgfi-pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.bgfi-marker-active .bgfi-marker-emoji {
    animation: bgfi-pulse 1.8s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tablette / petit desktop (≤ 900px) ────────────────────────── */

@media (max-width: 900px) {
    .bgfi-search-bar {
        gap: 8px;
    }

    .bgfi-action-btn {
        padding: 0 10px;
    }

    .bgfi-action-btn-title {
        font-size: 12px;
    }
}

/* ── Mobile large (≤ 768px) ────────────────────────────────────── */

@media (max-width: 768px) {
    .bgfi-agences-container {
        max-width: 100%;
    }

    /* Zone 2 : Search bar → empilement vertical */
    .bgfi-search-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px;
        gap: 8px;
    }

    .bgfi-city-select-wrap {
        max-width: 100%;
        min-width: 0;
    }

    .bgfi-search-input-wrap {
        max-width: 100%;
        min-width: 0;
    }

    /* Boutons d'action en grille 2 colonnes */
    .bgfi-search-bar .bgfi-action-btn {
        flex: 1 1 calc(50% - 4px);
        justify-content: center;
        min-width: 0;
    }

    /* Zone 3+4 : Résultats avant la carte */
    .bgfi-main-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    .bgfi-results-panel {
        border-right: none;
        border-bottom: 1px solid #eef1f4;
        max-height: 40vh;
        order: 2;
    }

    .bgfi-results-header {
        padding: 12px 16px;
    }

    .bgfi-service-filter {
        font-size: 12px;
    }

    .bgfi-map-col {
        order: 1;
        min-height: 350px;
        border-radius: 0;
    }

    .bgfi-map-col .bgfi-map {
        min-height: 350px;
    }

    /* Zone 5 : Légende */
    .bgfi-legend {
        padding: 10px 16px;
        gap: 12px;
    }

    .bgfi-legend-sep {
        margin: 0 8px;
    }

    .bgfi-legend-label {
        font-size: 12px;
    }

    /* Footer */
    .bgfi-info-footer {
        padding: 10px 16px;
        font-size: 10px;
    }
}

/* ── Mobile petit (≤ 480px) ────────────────────────────────────── */

@media (max-width: 480px) {
    /* Boutons d'action : pleine largeur */
    .bgfi-search-bar .bgfi-action-btn {
        flex: 1 1 100%;
    }

    /* Items plus compacts */
    .bgfi-agency-item {
        padding: 10px 12px;
        gap: 8px;
        min-height: 48px;
    }

    .bgfi-result-icon {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }

    .bgfi-result-name {
        font-size: 13px;
    }

    .bgfi-result-city {
        font-size: 11px;
    }

    .bgfi-result-arrow {
        font-size: 16px;
    }

    /* Légende : très compact */
    .bgfi-legend {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 12px;
    }

    .bgfi-legend-sep {
        display: none;
    }

    .bgfi-legend-marker {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .bgfi-legend-label {
        font-size: 11px;
    }

    /* Popup plus compact */
    .leaflet-popup-content-wrapper {
        min-width: 200px;
    }
}

/* ── Mobile phone (≤ 767px) — Refonte complète du bloc de recherche ── */
/* Appliqué APRÈS 480px pour surclasser tous les breakpoints précédents */

@media (max-width: 767px) {

    /* ── Barre de recherche : bloc vertical compact ── */
    .bgfi-search-bar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px;
    }

    /* ── Sélecteur de ville : 100%, hauteur tactile confortable ── */
    .bgfi-city-select-wrap {
        max-width: 100%;
        min-width: 0;
        width: 100%;
        height: 50px;
        border-radius: 8px !important;
        flex: 0 0 auto;
    }

    .bgfi-city-select-icon {
        left: 14px;
        font-size: 16px;
    }

    .bgfi-city-select {
        font-size: 15px;
        padding: 0 32px 0 40px;
    }

    .bgfi-city-select-wrap::after {
        font-size: 12px;
    }

    /* ── Champ recherche : même hauteur que le sélecteur ── */
    .bgfi-search-input-wrap {
        max-width: 100%;
        min-width: 0;
        width: 100%;
        height: 50px;
        flex: 0 0 auto;
    }

    .bgfi-search-input {
        font-size: 15px;
        padding: 0 14px;
        border-radius: 8px !important;
        height: 50px;
    }

    .bgfi-search-input::placeholder {
        font-size: 14px;
    }

    /* Cacher le bouton 🔍 sur mobile (la recherche est automatique) */
    .bgfi-search-submit {
        display: none !important;
    }

    /* ── Bouton PRINCIPAL « Ma position » ── */
    .bgfi-search-bar .bgfi-action-btn:not(.bgfi-action-btn--secondary) {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        height: 54px;
        padding: 0 10px;
        background: #003a74 !important;
        border: none !important;
        border-radius: 10px !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        color: #ffffff !important;
        white-space: nowrap;
        cursor: pointer;
        flex-shrink: 0;
        box-shadow: none !important;
        outline: none !important;
        text-transform: none !important;
        letter-spacing: normal !important;
        line-height: 1.3 !important;
        transition: background 0.2s;
    }

    .bgfi-search-bar .bgfi-action-btn:not(.bgfi-action-btn--secondary):hover {
        background: #002b59 !important;
    }

    .bgfi-search-bar .bgfi-action-btn:not(.bgfi-action-btn--secondary) .bgfi-action-btn-title {
        color: #ffffff;
        font-size: 15px;
    }

    .bgfi-search-bar .bgfi-action-btn:not(.bgfi-action-btn--secondary) .bgfi-action-btn-icon {
        font-size: 20px;
    }

    /* ── Groupe des boutons secondaires (Agence + DAB) ── */
    .bgfi-action-btn-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }

    .bgfi-action-btn-group .bgfi-action-btn--secondary {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 100%;
        height: 52px;
        padding: 0 10px;
        background: #ffffff !important;
        border: 1px solid #d9e0e6 !important;
        border-radius: 10px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        color: #023059 !important;
        white-space: normal;
        word-break: break-word;
        text-align: center;
        cursor: pointer;
        box-shadow: none !important;
        outline: none !important;
        text-transform: none !important;
        letter-spacing: normal !important;
        line-height: 1.2 !important;
        flex-shrink: 0;
        transition: background 0.2s, border-color 0.2s;
    }

    .bgfi-action-btn-group .bgfi-action-btn--secondary:hover {
        background: #f7f9fb !important;
        border-color: #023059 !important;
    }

    .bgfi-action-btn-group .bgfi-action-btn--secondary .bgfi-action-btn-icon {
        font-size: 16px;
    }

    .bgfi-action-btn-group .bgfi-action-btn--secondary .bgfi-action-btn-title {
        font-size: 12px;
        color: #023059;
    }

    /* ── Status message ── */
    .bgfi-search-bar .bgfi-geo-status {
        font-size: 12px;
        margin: 0;
        padding: 2px 0;
    }

    /* ── Espacement entre boutons et carte : 16px max ── */
    .bgfi-main-area {
        margin-top: 4px;
        border-top: 1px solid #eef1f4;
        height: auto;
        min-height: 0;
    }

    /* ── Carte : hauteur adaptée mobile ── */
    .bgfi-map-col {
        min-height: 350px;
        max-height: 450px;
        border-radius: 0;
    }

    .bgfi-map-col .bgfi-map {
        min-height: 350px;
        max-height: 450px;
    }

    /* ── Résultats sous la carte ── */
    .bgfi-results-panel {
        max-height: 35vh;
        border-right: none;
        border-bottom: 1px solid #eef1f4;
    }

    .bgfi-results-header {
        padding: 10px 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   CORRECTIONS WORDPRESS
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-agences-container .wp-block-group,
.bgfi-agences-container .wp-block-column { margin: 0; padding: 0; }

.bgfi-agences-container h1,
.bgfi-agences-container h2,
.bgfi-agences-container h3,
.bgfi-agences-container p { line-height: inherit; margin: 0; }

.bgfi-agences-container a  { text-decoration: none; color: inherit; }

.bgfi-agences-container ul,
.bgfi-agences-container li { list-style: none; margin: 0; padding: 0; }

/* ═══════════════════════════════════════════════════════════════════
   ACCESSIBILITÉ
   ═══════════════════════════════════════════════════════════════════ */

.bgfi-agency-item:focus {
    outline: 2px solid #CFD9AD;
    outline-offset: -2px;
}

.bgfi-agency-item[aria-selected="true"] {
    background: #f0f4f7;
    border-left: 4px solid #023059;
}

/* ═══════════════════════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
    .bgfi-loading {
        background: rgba(2, 48, 89, 0.95);
        color: #CFD9AD;
    }
}

/* ── Badge Premium dans la liste ────────────────────────────────── */
.bgfi-result-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
    margin-left: 4px;
    line-height: 1.6;
}
.bgfi-result-badge--premium {
    background: #fdf2e0;
    color: #b8860b;
    border: 1px solid #f0d78c;
}
