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

/* ── Conteneur principal ────────────────────────────────────────── */

.bgfi-agences-container {
    display: flex;
    max-width: 100%;
    margin: 0 auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
}

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

/* ── Barre latérale ─────────────────────────────────────────────── */

.bgfi-sidebar {
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.bgfi-sidebar-header {
    padding: 20px 16px;
    background: #023059;
    text-align: center;
    flex-shrink: 0;
}

.bgfi-sidebar-header .bgfi-sidebar-title,
.bgfi-sidebar-header h1,
.bgfi-sidebar-header h2 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    color: #FFFFFF !important;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.bgfi-sidebar-header p {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
    color: #FFFFFF;
}

.bgfi-agencies-list {
    padding: 0;
    margin: 0;
    background: #ffffff;
    flex: 1;
}

/* ── Items de la liste ──────────────────────────────────────────── */

.bgfi-agency-item {
    padding: 14px 20px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
    background: #ffffff;
    color: #333;
}

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

.bgfi-agency-item.active {
    background: #f5f5f5;
    border-left: 4px solid #0367A6;
}

.bgfi-agency-item.siege {
    background: #fafaf8;
    border-left: 4px solid #99A686;
}

.bgfi-agency-item.siege:hover,
.bgfi-agency-item.siege.active {
    background: #f0f2ec;
}

.bgfi-agency-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    color: #222;
}

.bgfi-agency-address {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* ── Badges liste latérale ──────────────────────────────────────── */

.bgfi-siege-badge {
    background: #99A686;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    flex-shrink: 0;
}

.bgfi-dab-badge {
    background: #0367A6;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    flex-shrink: 0;
}

/* ── Barre de recherche ─────────────────────────────────────────── */

.bgfi-map-search {
    flex-shrink: 0;
    padding: 12px 16px;
    background: #faf8f5;
    border-bottom: 1px solid #e8e6e2;
}

.bgfi-map-search .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.bgfi-map-search-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 12px center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    color: #333;
}

.bgfi-map-search-input::placeholder { color: #999; }

.bgfi-map-search-input:focus {
    outline: none;
    border-color: #0367A6;
    box-shadow: 0 0 0 2px rgba(3, 103, 166, 0.15);
}

/* ── Conteneur de la carte ──────────────────────────────────────── */

.bgfi-map-container {
    flex: 1;
    position: relative;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    background: #f5f0e6;
}

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

/* Curseur quand zoom molette actif */
.bgfi-map.bgfi-map-focused {
    cursor: grab;
    box-shadow: inset 0 0 0 2px rgba(3, 103, 166, 0.35);
}

/* ── Popups Leaflet ─────────────────────────────────────────────── */

.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
    min-width: 220px;
}

.bgfi-popup-content {
    padding: 4px 2px;
}

.bgfi-popup-badges {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.bgfi-popup-badge {
    font-size: 10px;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 10px;
    display: inline-block;
}

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

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

.bgfi-popup-title {
    font-size: 15px;
    font-weight: bold;
    color: #023059;
    margin-bottom: 5px;
}

.bgfi-popup-address {
    font-size: 13px;
    color: #444;
    margin-bottom: 6px;
    line-height: 1.35;
}

.bgfi-popup-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #0367A6;
    border-top: 1px solid #e0e4d8;
    padding-top: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 4px;
}

.bgfi-popup-phone {
    color: #023059;
}

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

.bgfi-popup-hours {
    background: #f7f9f4;
    border-radius: 5px;
    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;
}

/* ── 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 ─────────────────────────────────────────────── */

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

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

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .bgfi-agences-container {
        flex-direction: column;
        height: auto !important;
    }

    .bgfi-sidebar {
        width: 100% !important;
        max-height: 40vh;
        order: 2;
    }

    .bgfi-map-container {
        height: 60vh;
        order: 1;
    }
}

@media (max-width: 480px) {
    .bgfi-sidebar-header h1,
    .bgfi-sidebar-header h2,
    .bgfi-sidebar-header .bgfi-sidebar-title { font-size: 16px; }
    .bgfi-sidebar-header p                   { font-size: 12px; }
    .bgfi-agency-item                        { padding: 12px 15px; }
    .bgfi-agency-name                        { font-size: 14px; }
    .bgfi-agency-address                     { font-size: 12px; }
}

/* ── 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: #f5f5f5;
    border-left: 4px solid #0367A6;
}

/* ── Support dark mode ──────────────────────────────────────────── */

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

/* ── Administration ─────────────────────────────────────────────── */

.bgfi-admin-preview {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-top: 20px;
    background: #f9f9f9;
}

.bgfi-admin-shortcode {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-family: monospace;
    margin: 10px 0;
    display: inline-block;
}
