/**
 * Kidzup - Google Maps Styles
 * 
 * Styles pour l'intégration Google Maps
 * 
 * @package Kidzup
 * @since 1.0.0
 */

/* ==========================================================================
   MAP WRAPPER
   ========================================================================== */

.kidzup-map-wrapper {
    position: relative;
    width: 100%;
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.kidzup-map {
    width: 100%;
    min-height: 400px;
}

/* Map pour single (grande) */
.single-kidzup_adresse .kidzup-map {
    min-height: 500px;
}

/* Map pour archive (liste) */
.archive .kidzup-map {
    min-height: 600px;
}

/* Map pour widget/sidebar (petite) */
.widget .kidzup-map {
    min-height: 300px;
}

/* ==========================================================================
   MAP CONTROLS
   ========================================================================== */

.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    gap: 8px;
}

.map-control-btn {
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.map-control-btn:hover {
    background: var(--primary-color, #007bff);
    color: white;
    border-color: var(--primary-color, #007bff);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.map-control-btn i {
    margin-right: 6px;
}

.map-control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   INFO WINDOW (popup au clic sur marqueur)
   ========================================================================== */

.gm-style .map-info-window {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 280px;
}

.gm-style .map-info-window h6 {
    color: #2d3748;
    font-weight: 600;
    margin: 0 0 12px;
    font-size: 16px;
    line-height: 1.4;
}

.gm-style .map-info-window img {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    margin: -16px -16px 12px;
}

.gm-style .map-info-window .btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary-color, #007bff);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.gm-style .map-info-window .btn:hover {
    background: var(--primary-hover, #0056b3);
}

/* Override Google Maps default InfoWindow styles */
.gm-style .gm-style-iw {
    padding: 16px !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

.gm-style .gm-style-iw-c {
    padding: 0 !important;
    border-radius: 12px !important;
}

.gm-style .gm-style-iw-d {
    overflow: auto !important;
    max-height: 400px !important;
}

/* Close button */
.gm-style .gm-ui-hover-effect {
    top: 8px !important;
    right: 8px !important;
    width: 32px !important;
    height: 32px !important;
    opacity: 0.8;
}

.gm-style .gm-ui-hover-effect:hover {
    opacity: 1;
}

/* ==========================================================================
   NEARBY ADDRESSES (adresses à proximité)
   ========================================================================== */

.nearby-addresses {
    margin-top: 3rem;
}

.nearby-addresses-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.nearby-addresses-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.nearby-addresses-header i {
    margin-right: 12px;
    color: var(--primary-color, #007bff);
    font-size: 1.8rem;
}

.nearby-addresses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.nearby-address-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.nearby-address-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.nearby-address-distance {
    display: inline-block;
    padding: 6px 12px;
    background: var(--primary-color, #007bff);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    margin-top: 8px;
}

/* ==========================================================================
   LOADING STATE
   ========================================================================== */

.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: #f8f9fa;
    border-radius: 12px;
}

.map-loading-spinner {
    text-align: center;
}

.map-loading-spinner i {
    font-size: 3rem;
    color: var(--primary-color, #007bff);
    animation: spin 1s linear infinite;
}

.map-loading-text {
    margin-top: 1rem;
    color: #6c757d;
    font-size: 14px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   MAP ERROR STATE
   ========================================================================== */

.map-error {
    padding: 2rem;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 12px;
    text-align: center;
}

.map-error i {
    font-size: 3rem;
    color: #ffc107;
    margin-bottom: 1rem;
}

.map-error h4 {
    margin: 0 0 0.5rem;
    color: #856404;
}

.map-error p {
    margin: 0;
    color: #856404;
    font-size: 14px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .kidzup-map {
        min-height: 300px;
    }

    .single-kidzup_adresse .kidzup-map {
        min-height: 400px;
    }

    .archive .kidzup-map {
        min-height: 450px;
    }

    .map-controls {
        top: 8px;
        right: 8px;
        flex-direction: column;
    }

    .map-control-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .nearby-addresses-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .kidzup-map {
        min-height: 250px;
        border-radius: 8px;
    }

    .kidzup-map-wrapper {
        margin: 1.5rem 0;
    }

    .gm-style .map-info-window {
        max-width: 240px;
    }

    .map-control-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ==========================================================================
   ARCHIVE MODE: LISTE AVEC CARTE À CÔTÉ
   ========================================================================== */

.archive-with-map {
    display: grid;
    grid-template-columns: 1fr 450px;
    gap: 32px;
    align-items: start;
}

.archive-with-map .addresses-list {
    /* Contenu à gauche */
}

.archive-with-map .map-sidebar {
    /* Carte sticky à droite */
    position: sticky;
    top: 100px;
    height: calc(100vh - 120px);
}

.archive-with-map .map-sidebar .kidzup-map {
    height: 100%;
    min-height: 500px;
}

@media (max-width: 1200px) {
    .archive-with-map {
        grid-template-columns: 1fr;
    }

    .archive-with-map .map-sidebar {
        position: static;
        height: auto;
    }

    .archive-with-map .map-sidebar .kidzup-map {
        height: 450px;
    }
}

/* ==========================================================================
   SEARCH WITH MAP (page recherche)
   ========================================================================== */

.search-with-map-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 0;
    min-height: calc(100vh - 80px);
}

.search-filters-panel {
    background: #f8f9fa;
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.search-map-panel {
    position: relative;
}

.search-map-panel .kidzup-map {
    height: 100%;
    min-height: calc(100vh - 80px);
}

@media (max-width: 992px) {
    .search-with-map-layout {
        grid-template-columns: 1fr;
    }

    .search-filters-panel {
        max-height: none;
    }

    .search-map-panel .kidzup-map {
        height: 500px;
        min-height: 500px;
    }
}

/* ==========================================================================
   MARKER CLUSTERS (groupes de marqueurs)
   ========================================================================== */

.cluster-icon {
    background: var(--primary-color, #007bff);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   GEOLOCATION BUTTON (dans formulaire recherche)
   ========================================================================== */

.geolocation-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.geolocation-btn:hover {
    background: var(--primary-color, #007bff);
    color: white;
}

.geolocation-btn i {
    margin-right: 8px;
}

.geolocation-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
/* ==========================================================================
   FIX GOOGLE MAP Z-INDEX / OVERLAY BUG
   ========================================================================== */

/* Contexte propre pour la carte */
.kidzup-map-wrapper,
.kidzup-map {
    position: relative !important;
    z-index: 0 !important;
    overflow: hidden;
}

/* Google injecte des div avec z-index 1000 — on le neutralise */
.kidzup-map .gm-style,
.kidzup-map-wrapper .gm-style {
    position: relative !important;
    z-index: 0 !important;
}

/* Les sections suivantes doivent être au-dessus */
.adresse-section,
.adresse-content-wrapper,
.site-footer {
    position: relative;
    z-index: 2;
}

/* Option : désactive les interactions tant que l’utilisateur n’a pas cliqué */
.kidzup-map {
    pointer-events: none;
}
.kidzup-map.active {
    pointer-events: auto;
}
