:root {

  --wp--style--global--content-size: 1200px !important;
  --wp--style--global--wide-size: 1200px !important;
}

main {
    padding: 0rem !important;
    margin: 0rem !important;
}

/* Layout Principal */
.pimcore-explorer {
    display: flex;
    width: 100%;
    height: 90vh; /* La vue prend 90% de la hauteur de l'écran */
    background: #f8f9fa;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
}

/* 1. Sidebar de gauche (Filtres) */
.explorer-sidebar {
    flex:1;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    padding: 0rem 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.explorer-sidebar h3 { font-size: 18px; margin-bottom: 20px; border-bottom: 2px solid #34495e; padding-bottom: 10px; }

/* 2. Colonne Centrale (Résultats) */
.explorer-results {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f1f3f5;
    position: relative;
    max-width: 30rem;
}

#annuaire-ajax-loader {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px); /* Effet de flou moderne */
    z-index: 100;
    display: none; /* Caché par défaut */
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner-premium {
    width: 50px;
    height: 50px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6; /* Bleu Figma */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}


@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 15px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
}

.results-header { margin-bottom: 15px; font-weight: bold; color: #666; }

/* 3. Colonne de Droite (Carte) */
.explorer-map-container {
    flex: 4;
    position: relative;
     display: block !important;
    height: 100% !important;
    min-height: 500px !important; /* TRÈS IMPORTANT */
    background: #f8fafc !important;
    position: relative !important;
}

/* Design des Cartes (Style Canal du Midi) */
.annuaire-card {
    
    background: #fff;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: 0.3s;
    cursor: pointer;
    position: relative;
}

.card-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.card-image::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 60%;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

.card-title-overlay {
    position: absolute;
    bottom: 15px;
    left: 15px;
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    z-index: 2;
    text-transform: uppercase;
}

.card-content { padding: 15px; display: flex; justify-content: space-between; align-items: center; }
.card-category { font-size: 13px; color: #555; display: flex; align-items: center; gap: 5px; }

/* Boutons de la Sidebar */
.btn-search-block {
    background: #34495e;
    color: white;
    padding: 12px;
    border-radius: 6px;
    border: none;
    width: 100%;
    margin-top: 20px;
    cursor: pointer;
    font-weight: bold;
}

.btn-reset-link {
    text-align: center;
    display: block;
    margin-top: 15px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

.marker-highlight {
    transform-origin: bottom center;
    transform: translateY(-4px) scale(1.12) !important;
    filter: drop-shadow(0 10px 16px rgba(59, 130, 246, 0.34)) saturate(1.08) !important;
    transition: transform 0.18s ease-out, filter 0.18s ease-out;
    animation: marker-hover-pop 0.24s ease-out 1;
    z-index: 99999 !important;
    will-change: transform, filter;
}

@keyframes marker-hover-pop {
    0% { transform: translateY(0) scale(1); }
    65% { transform: translateY(-5px) scale(1.16); }
    100% { transform: translateY(-4px) scale(1.12); }
}

.leaflet-tooltip.pimcore-marker-tooltip {
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border-radius: 10px;
    padding: 6px 9px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.leaflet-tooltip.pimcore-marker-tooltip:before {
    border-top-color: rgba(17, 24, 39, 0.92);
}

.pimcore-marker-label {
    line-height: 1.2;
    text-align: center;
}

.pimcore-marker-label-title {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.pimcore-marker-label-subtitle {
    margin-top: 2px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.84);
    white-space: nowrap;
}

/* Style pour les cartes SANS image */
.annuaire-card.no-image {
    border-left: 5px solid #34495e;
}

.card-text-only {
    padding: 20px 15px 5px 15px;
    background: #fff;
}

.card-title-simple {
    margin: 0;
    font-size: 18px;
    color: #34495e;
    font-weight: 700;
}

/* On ajuste le contenu pour que ce soit équilibré */
.card-content {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.card-action {
    font-size: 12px;
    font-weight: 600;
    color: #2271b1;
    text-transform: uppercase;
}

.annuaire-card:hover .card-action {
    text-decoration: underline;
}

/* Container de la sidebar */
.filters-container {
    padding: 10px 5px;
}

.filters-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
}

/* Groupes de filtres */
.filter-group {
    margin-bottom: 22px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #718096;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

/* Inputs modernes */
.filter-group input[type="text"] {
    width: 95%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: #f8fafc;
    font-size: 14px;
    transition: all 0.2s ease;
    color: #2d3748;
}

.filter-group input[type="text"]:focus {
    outline: none;
    border-color: #3182ce;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

/* --- STYLE MODERNE POUR LES SELECTS --- */

.filter-group select, 
.select-modern {
    appearance: none; /* Supprime la flèche par défaut de Windows/Mac */
    -webkit-appearance: none;
    -moz-appearance: none;
    
    width: 95%;
    padding: 12px 40px 12px 15px !important; /* On laisse de la place à droite pour la flèche */
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.2s ease;

    /* AJOUT D'UNE FLÈCHE PERSONNALISÉE EN SVG */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
}

/* État au survol et au clic */
.filter-group select:hover, 
.select-modern:hover {
    border-color: #cbd5e0;
    background-color: #f1f5f9;
}

.filter-group select:focus, 
.select-modern:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Style des options (limité par les navigateurs, mais on harmonise la police) */
.filter-group select option {
    padding: 10px;
    background: #fff;
    color: #2d3748;
}
.filter-group input[type="text"],
.filter-group input[type="date"],
.filter-group select {
    height: 48px; /* Hauteur fixe pour un alignement parfait */
    box-sizing: border-box;
}

/* Recherche avec icône */
.input-with-icon {
    position: relative;
}

.input-with-icon .dashicons {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 18px;
}
.input-with-icon input {
    padding-left: 31px !important;
    padding-right: 0rem !important;
}

/* Boutons */
.btn-search-main {
    width: 95%;
    background-color: #2d3748;
    color: white;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 10px;
}

.btn-search-main:hover {
    background-color: #1a202c;
}

.link-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
    text-decoration: none;
    color: #a0aec0;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
}

.link-reset:hover {
    color: #e53e3e;
}

.link-reset .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}


.annuaire-pagination {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 0;
    padding: 10px 12px 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(241, 243, 245, 0.88);
    backdrop-filter: blur(8px);
}

.annuaire-pagination-container {
    position: sticky;
    bottom: -24px;
    z-index: 30;
    margin-top: auto;
    padding-top: 10px;
    background: linear-gradient(to bottom, rgba(241, 243, 245, 0), #f1f3f5 26px);
}

.page-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.page-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
    transform: translateY(-1px);
}

.page-info {
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    text-align: center;
}

.pagination-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-numbers {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-number {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
}

.page-number.is-current {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0 12px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
}

.page-btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
}

.page-btn-nav.is-disabled {
    border: 1px solid #e2e8f0;
    color: #94a3b8;
    background: #f8fafc;
    cursor: not-allowed;
}

.page-ellipsis {
    color: #64748b;
    font-weight: 700;
    padding: 0 4px;
}

/* --- CONFIGURATION DESKTOP (Inchangée) --- */
.mobile-tab-bar { display: none; } /* Caché sur PC */


/* Si la carte est activée, on répartit l'espace en 3 colonnes : 1 pour la sidebar, 1 pour les résultats, 4 pour la carte */
.pimcore-explorer.has-map .explorer-sidebar { flex: 1; }
.pimcore-explorer.has-map .explorer-results { flex: 2; }
.pimcore-explorer.has-map .explorer-map-container { flex: 4; }

/* Si la carte est désactivée, on répartit l'espace en 2 colonnes : 1 pour la sidebar, 3 pour les résultats */
.pimcore-explorer.no-map .explorer-sidebar { 
    flex: 1; 
    max-width: 350px; 
}

/* On donne plus d'espace aux résultats et on les affiche en grille pour mieux occuper l'espace */
.pimcore-explorer.no-map .explorer-results { 
    flex: 3; 
    background: #fff; 
}

.annuaire-list-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: normal;
    height: 100%;
    padding: 3rem 0rem;
    
}



/* Affichage en grille pour les résultats quand la carte est désactivée */
.pimcore-explorer.no-map .annuaire-grid {
    padding-top: 2rem;
    
    max-height: 100%;
    overflow-y: auto;

}


/* Badge du logo sur l'image */
.card-logo-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    background: #fff;
    border-radius: 12px; /* Style iOS / Moderne */
    padding: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255,255,255,0.5);
}

.card-logo-badge img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Logo pour les fiches sans image de fond */
.card-logo-small {
    width: 45px;
    height: 45px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 4px;
    border: 1px solid #eee;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-logo-small img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}


/* Couleur des cercles de groupe */
.marker-cluster-small, 
.marker-cluster-medium, 
.marker-cluster-large {
    background-color: rgba(59, 130, 246, 0.4) !important; /* Bleu Figma transparent */
}

.marker-cluster-small div, 
.marker-cluster-medium div, 
.marker-cluster-large div {
    background-color: rgba(59, 130, 246, 0.8) !important; /* Bleu Figma plus opaque */
    color: #fff !important;
    font-weight: bold;
    font-size: 14px;
}

/* Animation fluide quand le cluster s'ouvre */
.leaflet-cluster-anim .leaflet-marker-icon, 
.leaflet-cluster-anim .leaflet-marker-shadow {
    transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}


/* Force la stabilité du conteneur Leaflet */
#pimcore-map-leaflet {
    height: 100% !important;
    width: 100% !important;
    min-height: 400px; /* Sécurité pour ne jamais être à 0px */
    background: #f8fafc; /* Couleur de fond pour que le blanc soit moins choquant */
    position: absolute !important;
    top: 0; bottom: 0; left: 0; right: 0;
}

/* Évite les conflits de bordures qui décalent les tuiles */
.leaflet-container {
    outline: 0;
}
.leaflet-tile-container img {
    box-shadow: none !important;
    max-width: none !important;
    padding: 0 !important;
}

/* Protection contre les règles globales de thème sur img (max-width/height:auto, etc.) */
#pimcore-map-leaflet .leaflet-tile {
    max-width: none !important;
    max-height: none !important;
    width: 256px !important;
    height: 256px !important;
}

/* --- CONFIGURATION MOBILE --- */
@media (max-width: 1024px) {
    .pimcore-explorer {
        flex-direction: column;
        height: 100vh;
        width: 100vw;
        position: fixed;
        top: 0; left: 0;
        z-index: 9999;
    }

    /* Cache toutes les vues par défaut sur mobile */
    .mobile-view {
        display: none !important;
        width: 100% !important;
        height: calc(100vh - 70px); /* Laisse la place pour la barre du bas */
        overflow-y: auto;
    }

    /* Affiche uniquement la vue active */
    .mobile-view.is-active {
        display: flex !important;
        flex-direction: column;
    }

    /* BARRE DE NAVIGATION FIXE EN BAS */
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0; left: 0;
        width: 100%;
        height: 70px;
        background: #fff;
        border-top: 1px solid #ddd;
        justify-content: space-around;
        align-items: center;
        z-index: 10000;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    .tab-btn {
        background: none; border: none; color: #718096;
        display: flex; flex-direction: column; align-items: center;
        gap: 4px; cursor: pointer; flex: 1;
    }

    .tab-btn.is-active { color: #3182ce; }
    .tab-btn .dashicons { font-size: 24px; width: 24px; height: 24px; }
    .tab-btn .tab-label { font-size: 10px; font-weight: 700; text-transform: uppercase; }

    .explorer-sidebar, 
    .explorer-results {
        width: 90% !important; /* Toute la largeur */
        flex: none;
        border-right: none;
        border-bottom: 1px solid #eee;
        margin-top: 3rem;
    }

    .explorer-map-container {
        width: 100%;
        height: 350px; /* On fixe une hauteur pour la carte sur mobile */
        order: -1; /* Optionnel : on peut mettre la carte TOUT EN HAUT */
    }

    .annuaire-pagination-container {
        bottom: 0;
        padding-top: 8px;
        background: linear-gradient(to bottom, rgba(241, 243, 245, 0), rgba(241, 243, 245, 0.96) 22px);
    }

    .annuaire-pagination {
        margin: 0 6px;
        padding: 10px;
        border-radius: 16px;
        border: 1px solid rgba(148, 163, 184, 0.28);
        background: rgba(248, 250, 252, 0.92);
        backdrop-filter: blur(10px);
    }

    .pagination-main {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 8px;
    }

    .page-numbers {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 2px 4px;
        scrollbar-width: none;
    }

    .page-numbers::-webkit-scrollbar {
        display: none;
    }

    .page-btn,
    .page-number,
    .page-number.is-current,
    .page-btn-nav {
        min-height: 40px;
        font-size: 14px;
    }

    .page-btn-nav {
        padding: 0 12px;
    }

    .page-info {
        font-size: 11px;
    }
}

@media (max-width: 768px) {
    .leaflet-top.leaflet-left {
        top: 57px !important;
        left: 10px !important;
        z-index: 1000 !important;
    }

    /* On s'assure que les boutons sont bien visibles et ont une ombre pour ressortir */
    .leaflet-bar {
        border: none !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.2) !important;
    }

    .leaflet-bar a {
        width: 34px !important; /* Un peu plus large pour les gros doigts sur mobile */
        height: 34px !important;
        line-height: 34px !important;
        background-color: #fff !important;
        color: #333 !important;
    }

    .annuaire-pagination-container {
        bottom: 6px;
    }

    .annuaire-pagination {
        margin: 0 2px;
        padding: 8px;
        border-radius: 14px;
    }

    .page-btn-nav span {
        display: none;
    }

    .page-btn-nav {
        width: 40px;
        min-width: 40px;
        justify-content: center;
        padding: 0;
        gap: 0;
    }

    .page-number,
    .page-number.is-current {
        min-width: 34px;
        height: 34px;
        padding: 0 10px;
    }
}

/* Sécurité : on s'assure que le conteneur de la vue map ne coupe rien */
#view-map {
    overflow: visible !important; 
}


@media (max-width: 480px) {
    .annuaire-card {
        margin: 10px;
    }
    .filters-title { font-size: 18px; }

    .annuaire-pagination {
        gap: 8px;
    }

    .page-numbers {
        gap: 4px;
    }

    .page-info {
        font-size: 10px;
    }

    .explorer-sidebar, 
    .explorer-results {
        margin-top: 0rem;
        padding-top: 0rem;
        padding-bottom: 5rem;
    }
 
    .annuaire-grid{
        margin-bottom: 5rem;
    }
}
