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

/* Reset et styles de base */
.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;
}

.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: #f5f5f5;
}

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

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

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

.bgfi-agency-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

/* Barre de recherche au-dessus de la carte */
.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;
}

/* Carte sans sidebar */
.bgfi-agences-container .bgfi-map-container:only-child {
    border-radius: 8px;
    overflow: hidden;
}

/* Styles des popups Leaflet */
.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}

.bgfi-popup-content {
    text-align: center;
    padding: 5px;
}

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

.bgfi-popup-address {
    font-size: 14px;
    color: #0367A6;
    margin-bottom: 8px;
    line-height: 1.3;
}

.bgfi-popup-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #99A686;
    border-top: 1px solid #CFD9AD;
    padding-top: 8px;
}

/* Indicateur de chargement */
.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;
}

/* Animation de pulsation pour le marqueur actif */
@keyframes bgfi-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

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

/* Responsive Design */
@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;
    }

    .bgfi-agency-item:hover {
        transform: none;
    }
}

@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;
    }

    .bgfi-agency-info {
        font-size: 11px;
    }
}

/* Styles spécifiques pour l'intégration WordPress */
.bgfi-agences-container .wp-block-group,
.bgfi-agences-container .wp-block-column {
    margin: 0;
    padding: 0;
}

/* Correction des conflits avec les thèmes WordPress */
.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;
}

/* Amélioration de l'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 pour les thèmes sombres */
@media (prefers-color-scheme: dark) {
    .bgfi-loading {
        background: rgba(2, 48, 89, 0.95);
        color: #CFD9AD;
    }
}

/* Styles pour l'administration WordPress */
.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;
}