/* =========================================================
   KWF FRANCE - CARTE INTERACTIVE DES DOJOS (page-carte-dojos.php)
   Fichier : /wp-content/themes/dt-the7-enfant/css/page-carte-dojos.css
   ========================================================= */

/* Neutralisation du conteneur restrictif de The7 */
.page-template-page-carte-dojos #main {
    padding-top: 24px !important;
    padding-bottom: 0 !important;
}

.page-template-page-carte-dojos #main > .wf-wrap {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
}

.kwf-map-wrapper,
.kwf-map-wrapper * {
    box-sizing: border-box;
}

.kwf-map-wrapper {
    background-color: #f8f9fb;
    color: #1e293b;
    padding-bottom: 70px;
}

.kwf-map-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 8px 24px 0;
}

/* =========================================================
   BARRE SUPÉRIEURE
   ========================================================= */
.kwf-map-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 22px;
}

.kwf-map-heading {
    font-size: clamp(22px, 3vw, 28px) !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin: 0 0 4px !important;
}

.kwf-map-sub {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.kwf-list-switch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #ffffff;
    color: #1e293b !important;
    border: 1px solid #cbd5e1;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: all 0.2s ease;
}

.kwf-list-switch-btn:hover {
    border-color: #b91c1c;
    color: #b91c1c !important;
}

/* =========================================================
   SPLIT LAYOUT : LISTE À GAUCHE + CARTE À DROITE
   ========================================================= */
.kwf-map-layout {
    display: grid;
    grid-template-columns: 390px minmax(0, 1fr);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
    height: 650px;
}

/* Panneau gauche (Liste) */
.kwf-map-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e2e8f0;
    background: #ffffff;
    height: 100%;
    overflow: hidden;
}

.kwf-map-search-box {
    position: relative;
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.kwf-map-search-box svg {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
}

.kwf-map-wrapper input#kwf-map-search {
    width: 100% !important;
    height: 42px !important;
    padding: 0 12px 0 38px !important;
    margin: 0 !important;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 16px !important; /* Évite le zoom automatique iOS */
    color: #0f172a !important;
    box-shadow: none !important;
}

.kwf-map-wrapper input#kwf-map-search:focus {
    outline: none !important;
    border-color: #b91c1c !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12) !important;
}

.kwf-map-count {
    padding: 8px 16px;
    font-size: 12.5px;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.kwf-map-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kwf-map-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.kwf-map-item:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.kwf-map-item.active {
    border-color: #b91c1c;
    background: #fef2f2;
}

.kwf-map-item-logo {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.kwf-map-item-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
}

.kwf-map-item-logo span {
    font-weight: 800;
    font-size: 13px;
    color: #1e293b;
}

.kwf-map-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.kwf-map-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.kwf-map-item-city {
    font-size: 11.5px;
    font-weight: 600;
    color: #b91c1c;
    white-space: normal;
    line-height: 1.3;
}

.kwf-map-item-region {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.kwf-map-item-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
    white-space: normal;
}

.kwf-map-item-sensei {
    font-size: 12px;
    color: #64748b;
    white-space: normal;
    line-height: 1.3;
}

.kwf-map-empty {
    font-size: 13.5px;
    color: #64748b;
    text-align: center;
    padding: 24px 16px;
}

/* =========================================================
   PANNEAU DROIT : CARTE LEAFLET & CONTRÔLES FLOTTANTS
   ========================================================= */
.kwf-map-canvas-wrap {
    position: relative;
    width: 100%;
    height: 100%;
}

#kwf-france-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.kwf-reset-zoom-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    padding: 8px 13px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
    transition: all 0.15s ease;
}

.kwf-reset-zoom-btn:hover {
    border-color: #b91c1c;
    color: #b91c1c;
}

/* Switch Plan / Satellite en bas à droite */
.kwf-layer-switch {
    position: absolute;
    bottom: 24px;
    right: 14px;
    z-index: 500;
    display: inline-flex;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 3px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
}

.kwf-layer-btn {
    background: transparent;
    color: #475569;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.kwf-layer-btn.active {
    background: #1e293b;
    color: #ffffff;
}

/* Marqueur rouge KWF */
.kwf-custom-pin {
    background: transparent;
    border: none;
}

.kwf-pin-dot {
    width: 30px;
    height: 30px;
    background: rgba(185, 28, 28, 0.22);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.kwf-pin-dot span {
    width: 14px;
    height: 14px;
    background: #b91c1c;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.kwf-custom-pin:hover .kwf-pin-dot {
    transform: scale(1.25);
}

/* =========================================================
   INFOBULLE (POPUP) CENTRÉE
   ========================================================= */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16) !important;
    border: 1px solid #e2e8f0;
}

.leaflet-popup-content {
    margin: 14px 16px !important;
}

.kwf-map-popup {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.kwf-pop-logo-center {
    width: 58px;
    height: 58px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 8px;
}

.kwf-pop-logo-center img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.kwf-pop-logo-center span {
    font-weight: 800;
    font-size: 15px;
    color: #1e293b;
}

.kwf-pop-city {
    font-size: 11.5px;
    font-weight: 600;
    color: #b91c1c;
    margin-bottom: 2px;
}

.kwf-pop-title {
    font-size: 15px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin: 0 0 6px !important;
    line-height: 1.25 !important;
}

.kwf-pop-sensei {
    font-size: 12.5px;
    color: #475569;
    margin-bottom: 8px;
}

.kwf-pop-grade {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 3px;
}

.kwf-pop-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-bottom: 10px;
}

.kwf-pop-tags span {
    font-size: 11px;
    font-weight: 500;
    color: #475569;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 4px;
}

.kwf-pop-cta {
    display: block;
    width: 100%;
    text-align: center;
    background: #1e293b;
    color: #ffffff !important;
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 7px;
    text-decoration: none !important;
    transition: background 0.15s ease;
}

.kwf-pop-cta:hover {
    background: #b91c1c;
}

/* =========================================================
   RESPONSIVE TABLETTE & MOBILE (< 900px)
   ========================================================= */
@media (max-width: 900px) {
    .page-template-page-carte-dojos #main {
        padding-top: 14px !important;
    }

    .kwf-map-wrapper {
        padding-bottom: 48px;
    }

    .kwf-map-container {
        padding: 4px 14px 0;
    }

    .kwf-map-topbar {
        gap: 10px;
        margin-bottom: 14px;
    }

    .kwf-map-sub {
        font-size: 13px;
    }

    .kwf-list-switch-btn {
        width: 100%;
        padding: 9px 14px;
        font-size: 13px;
    }

    .kwf-map-layout {
        grid-template-columns: 1fr;
        height: auto;
        border-radius: 12px;
    }

    /* Carte en haut, dimensionnée pour laisser voir la recherche en dessous */
    .kwf-map-canvas-wrap {
        order: 1;
        height: 330px;
    }

    /* Liste en dessous, fluide au défilement */
    .kwf-map-sidebar {
        order: 2;
        border-right: none;
        border-top: 1px solid #e2e8f0;
        height: auto;
        max-height: 440px;
    }

    .kwf-map-search-box {
        padding: 12px;
    }

    .kwf-map-search-box svg {
        left: 24px;
    }

    .kwf-map-list {
        padding: 8px 12px 12px;
    }

    .kwf-map-item {
        padding: 10px;
        gap: 10px;
    }

    .kwf-map-item-logo {
        width: 44px;
        height: 44px;
    }

    /* Contrôles flottants compacts sur carte mobile */
    .kwf-reset-zoom-btn {
        top: 10px;
        right: 10px;
        padding: 6px 10px;
        font-size: 11.5px;
    }

    .kwf-layer-switch {
        bottom: 20px;
        right: 10px;
        padding: 2px;
    }

    .kwf-layer-btn {
        padding: 4px 9px;
        font-size: 11px;
    }

    /* Popup plus compacte sur petit écran */
    .leaflet-popup-content {
        margin: 10px 12px !important;
        max-width: 215px !important;
    }

    .kwf-pop-logo-center {
        width: 44px;
        height: 44px;
        margin-bottom: 6px;
    }

    .kwf-pop-title {
        font-size: 13.5px !important;
    }

    .kwf-pop-sensei {
        font-size: 11.5px;
    }
}