/* ============================================================================
 * CARTE PAYS — Styles externalisés
 * Fichier : css/hr-carte-pays.css
 * Thème enfant : Free-DIVI-Child-Theme-by-Pee-Aye-Creative
 *
 * Convention de classes :
 *   .hr-carte-pays           → wrapper principal
 *   .hr-carte-pays .hr-map   → conteneur de la carte Leaflet
 * ============================================================================ */

/* === WRAPPER PRINCIPAL === */
.hr-carte-pays {
    position: relative;
    width: 100%;
    /* max-width: dynamique via style="" */
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

/* === TITRE === */
.hr-carte-pays .map-pays-title-integrated {
    background: #05668d;
    color: #fff;
    padding: 6px 12px;
    font-size: 0.95em;
    font-weight: 600;
    text-align: left;
    position: relative;
    z-index: 1;
}

/* === CARTE === */
.hr-carte-pays .hr-map {
    /* height, width : dynamiques via style="" */
    width: 100%;
    position: relative;
}

/* === INSTRUCTION TACTILE === */
.hr-carte-pays .hr-map .map-touch-instruction {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    z-index: 10000;
    pointer-events: none;
    text-align: center;
    padding: 30px;
}

.hr-carte-pays .hr-map .map-touch-instruction.show {
    display: flex;
}

/* === LISTE DES REPÈRES === */
.hr-carte-pays .markers-pays-list-container {
    background: #f9f9f9;
    border-top: 2px solid #ddd;
}

.hr-carte-pays .markers-pays-list-header {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    align-items: center;
}

.hr-carte-pays .marker-pays-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.hr-carte-pays .marker-pays-sort-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hr-carte-pays .marker-pays-sort-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    margin-left: 20px;
}

.hr-carte-pays .marker-pays-sort-select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.hr-carte-pays .markers-pays-list {
    max-height: none;
    min-height: 420px;
    overflow-y: visible;
    background: white;
}

.hr-carte-pays .marker-pays-list-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 2px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.hr-carte-pays .marker-pays-list-item:hover {
    background: #f0f0f0;
}

.hr-carte-pays .marker-pays-list-item.active {
    background: #e3f2fd;
    border-left: 4px solid #05668d;
}

.hr-carte-pays .marker-pays-item-icon {
    width: 24px;
    height: 28px;
    margin-right: 12px;
    flex-shrink: 0;
    object-fit: contain;
}

.hr-carte-pays .marker-pays-item-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hr-carte-pays .marker-pays-item-name {
    color: #05668d;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
}

.hr-carte-pays .marker-pays-item-name:hover {
    text-decoration: underline;
}

.hr-carte-pays .marker-pays-item-distance {
    color: #666;
    font-size: 13px;
    margin-left: 10px;
    white-space: nowrap;
    font-weight: 500;
}

.hr-carte-pays .markers-pays-list-footer {
    padding: 6px 10px;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 5px;
}

.hr-carte-pays .markers-pays-list-footer .marker-pays-count {
    color: #666;
    font-size: 13px;
}

.hr-carte-pays .pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.hr-carte-pays .pagination-btn {
    padding: 8px 14px;
    border: 1px solid #05668d;
    background: white;
    color: #05668d;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s;
    min-width: 40px;
}

.hr-carte-pays .pagination-btn:hover:not(:disabled) {
    background: #05668d;
    color: white;
}

.hr-carte-pays .pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #ccc;
    color: #999;
}

.hr-carte-pays .pagination-info {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

/* === MARQUEURS === */
.hr-carte-pays .hr-map .leaflet-marker-icon {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* === CLUSTERS === */
.hr-carte-pays .hr-map .marker-cluster-small,
.hr-carte-pays .hr-map .marker-cluster-medium,
.hr-carte-pays .hr-map .marker-cluster-large {
    background-color: transparent !important;
}

.hr-carte-pays .hr-map .marker-cluster-small div,
.hr-carte-pays .hr-map .marker-cluster-medium div,
.hr-carte-pays .hr-map .marker-cluster-large div {
    background-color: #77d242 !important;
    opacity: 0.75;
    color: #333 !important;
    font-weight: bold !important;
    border-radius: 50% !important;
}

/* === BOUTON HOME === */
.hr-carte-pays .hr-map .leaflet-control-pays-home {
    background: #fff;
    border: 2px solid rgba(0,0,0,0.35);
    border-radius: 4px;
    width: 33px;
    height: 33px;
    cursor: pointer;
}

.hr-carte-pays .hr-map .leaflet-control-pays-home a {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #000;
    font-size: 18px;
    background-image: none !important;
}

.hr-carte-pays .hr-map .leaflet-control-pays-home a:hover {
    background-color: #f4f4f4;
    border-radius: 2px;
}

/* === BOUTON LOCALISATION === */
.hr-carte-pays .hr-map .leaflet-control-pays-locate {
    background: #fff;
    border: 2px solid rgba(0,0,0,0.35);
    border-radius: 4px;
    width: 33px;
    height: 33px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.hr-carte-pays .hr-map .leaflet-control-pays-locate img {
    max-width: 18px !important;
    max-height: 18px !important;
    width: auto !important;
    height: auto !important;
    display: block !important;
    object-fit: contain !important;
}

.hr-carte-pays .hr-map .leaflet-control-pays-locate:hover {
    background-color: #f4f4f4;
}

.hr-carte-pays .hr-map .leaflet-control-pays-locate.active {
    background: #4CAF50 !important;
    border-color: #4CAF50 !important;
}

.hr-carte-pays .hr-map .leaflet-control-pays-locate.loading {
    animation: pulse-pays 1.5s infinite;
}

@keyframes pulse-pays {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === CONTRÔLES LEAFLET === */
.hr-carte-pays .hr-map .leaflet-top.leaflet-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hr-carte-pays .hr-map .leaflet-control-fullscreen a {
    background-image: none !important;
    font-size: 18px;
    line-height: 26px !important;
    text-align: center;
}

.hr-carte-pays .hr-map .leaflet-control-fullscreen a:before {
    content: '⛶';
}

.hr-carte-pays .hr-map .leaflet-fullscreen-on .leaflet-control-fullscreen a:before {
    content: '✕';
}

.hr-carte-pays .hr-map .leaflet-control-zoom a {
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
}

/* === PLEIN ÉCRAN === */
body.hr-fs-active .hr-carte-pays[data-hr-fs],
body.hr-fs-active .hr-carte-pays[data-hr-fs] * {
    visibility: visible !important;
}

body.hr-fs-active .hr-carte-pays[data-hr-fs] {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    margin: 0 !important;
    z-index: 2147483647 !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
    background: #fff !important;
}

body.hr-fs-active .hr-carte-pays[data-hr-fs] .map-pays-title-integrated {
    position: relative !important;
    width: 100% !important;
    flex-shrink: 0 !important;
}

body.hr-fs-active .hr-carte-pays[data-hr-fs] .hr-map {
    flex: 1 !important;
    height: auto !important;
    min-height: 0 !important;
    position: relative !important;
}

body.hr-fs-active .hr-carte-pays[data-hr-fs] .markers-pays-list-container {
    height: auto !important;
    flex-shrink: 0 !important;
    width: 100% !important;
    position: relative !important;
}

/* Plein écran mobile */
@media screen and (max-width: 768px) {
    body.hr-fs-active .hr-carte-pays[data-hr-fs] .map-pays-title-integrated {
        display: none !important;
    }
    body.hr-fs-active .hr-carte-pays[data-hr-fs] .markers-pays-list-container {
        display: none !important;
    }
    body.hr-fs-active .hr-carte-pays[data-hr-fs] .hr-map {
        flex: 1 !important;
        height: 100% !important;
        min-height: 0 !important;
    }
}

/* === POPUPS === */
.hr-carte-pays .hr-map .leaflet-popup-content-wrapper {
    width: 230px !important;
    overflow: hidden !important;
}

.hr-carte-pays .hr-map .leaflet-popup-content {
    margin: 0 !important;
    padding: 10px !important;
    width: 230px !important;
    min-width: 230px !important;
    max-width: 230px !important;
    box-sizing: border-box !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

.hr-carte-pays .hr-map .leaflet-popup-content p {
    margin: 0.2em 0 0;
    line-height: 1.3em;
    font-size: 1.1em;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

.hr-carte-pays .hr-map .leaflet-popup-content .popup-rando-title {
    font-size: 1.4em;
    font-weight: bold;
    color: #05668d !important;
    margin-bottom: 10px;
    padding-bottom: 0;
    line-height: 1.2em;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    white-space: normal !important;
}

.hr-carte-pays .hr-map .leaflet-popup-content .popup-rando-title a {
    color: #05668d !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    display: inline !important;
    white-space: normal !important;
    max-width: 100% !important;
}

.hr-carte-pays .hr-map .leaflet-popup-content .popup-rando-title strong {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    white-space: normal !important;
    display: inline !important;
}

.hr-carte-pays .hr-map .leaflet-popup-content a {
    display: block;
    width: 100%;
    overflow: hidden;
}

.hr-carte-pays .hr-map .leaflet-popup-content img {
    display: block;
    max-width: 210px !important;
    height: auto !important;
    margin: 8px 0px 0 0px;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    transition: opacity 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
    .hr-carte-pays .hr-map .leaflet-popup-content a:hover .popup-rando-img {
        opacity: 0.85;
    }
}

.hr-carte-pays .hr-map .leaflet-popup-content .popup-rando-title a:hover {
    text-decoration: none !important;
}

/* === TOOLTIP === */
.custom-tooltip-pays {
    background-color: white !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
    color: #333 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 5px 9px !important;
    white-space: nowrap !important;
}

.custom-tooltip-pays::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-style: solid;
    z-index: 1;
}

.leaflet-tooltip-right.custom-tooltip-pays::before {
    left: 0; margin-left: -7px;
    border-width: 7px 7px 7px 0;
    border-color: transparent #ccc transparent transparent;
}

.leaflet-tooltip-left.custom-tooltip-pays::before {
    right: 0; margin-right: -7px;
    border-width: 7px 0 7px 7px;
    border-color: transparent transparent transparent #ccc;
}

.custom-tooltip-pays::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-style: solid;
    z-index: 2;
}

.leaflet-tooltip-right.custom-tooltip-pays::after {
    left: 0; margin-left: -6px;
    border-width: 6px 6px 6px 0;
    border-color: transparent white transparent transparent;
}

.leaflet-tooltip-left.custom-tooltip-pays::after {
    right: 0; margin-right: -6px;
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent white;
}

/* === RESPONSIVE === */
@media screen and (max-width: 768px) {
    .hr-carte-pays {
        border-radius: 4px;
        margin: 0;
    }

    .hr-carte-pays .map-pays-title-integrated {
        font-size: 0.9em;
        padding: 5px 10px;
    }

    .hr-carte-pays .markers-pays-list-header {
        flex-direction: column;
        padding: 10px;
        align-items: stretch;
    }

    .hr-carte-pays .marker-pays-sort-wrapper {
        flex-direction: row;
        justify-content: flex-start;
    }

    .hr-carte-pays .marker-pays-sort-label {
        margin-left: 0;
    }

    .hr-carte-pays .markers-pays-list {
        max-height: none;
        overflow-y: visible;
        min-height: auto;
    }

    .hr-carte-pays .hr-map .leaflet-popup-content-wrapper {
        width: 190px !important;
    }

    .hr-carte-pays .hr-map .leaflet-popup-content {
        width: 190px !important;
        min-width: 190px !important;
        max-width: 190px !important;
    }

    .hr-carte-pays .hr-map .leaflet-popup-content img {
        max-width: 170px !important;
    }
}

@media screen and (max-width: 480px) {
    .hr-carte-pays .map-pays-title-integrated {
        font-size: 0.85em;
    }

    .hr-carte-pays .hr-map .leaflet-control-zoom {
        transform: scale(0.9);
    }
}