/**
 * Widget Mapmonde - Styles
 *
 * @package Widget_Dix_Elementor
 */

/* ===========================
   CONTAINER
   =========================== */
.mapmonde-container {
    width: 100%;
    margin: 0 auto;
    position: relative;
}

/* ===========================
   NAVIGATION CONTROLS
   =========================== */
.mapmonde-navigation-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding: 16px 0;
    position: relative;
    z-index: 50;
}

/* Desktop : remonter sur la carte */
@media (min-width: 769px) {
    .mapmonde-navigation-controls {
        margin-top: -80px;
    }
}

.mapmonde-navigation-controls button {
    width: 50px;
    height: 50px;
    border: none;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.mapmonde-navigation-controls button:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.mapmonde-navigation-controls button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.mapmonde-navigation-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.mapmonde-navigation-controls svg {
    fill: #333;
    width: 24px;
    height: 24px;
}

.mapmonde-nav-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 50px;
    padding: 0 24px;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #333;
    text-transform: uppercase;
}

.mapmonde-wrapper {
    position: relative;
    width: 100%;
    line-height: 0;
}

.mapmonde-image {
    width: 100%;
    height: auto;
    display: block;
}

/* ===========================
   MODE OVERLAY (fond de section)
   Le widget utilise une hauteur minimum pour correspondre à la section
   =========================== */

.mapmonde-container.mode-overlay {
    position: relative;
    width: 100%;
    /* min-height défini via contrôle Elementor */
}

.mapmonde-container.mode-overlay .mapmonde-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    /* min-height défini via contrôle Elementor */
}

/* Placeholder en mode éditeur */
.mapmonde-placeholder {
    background: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

.mapmonde-placeholder p {
    margin: 0;
    font-size: 14px;
}

/* ===========================
   POINTS D'ORIGINE
   =========================== */
.mapmonde-point-wrapper {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* Point actif/hover : passe au-dessus des autres points */
.mapmonde-point-wrapper:hover,
.mapmonde-point-wrapper.is-active {
    z-index: 100;
}

.mapmonde-point {
    border-radius: 50%;
    border-style: solid;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.mapmonde-point:hover {
    transform: scale(1.2);
    z-index: 20;
}

/* Animation pulse */
.mapmonde-point.mapmonde-pulse::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    opacity: 0;
    transform: translate(-50%, -50%);
    animation: mapmonde-pulse-animation 2s infinite;
}

@keyframes mapmonde-pulse-animation {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}


/* ===========================
   TOOLTIP
   =========================== */
.mapmonde-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 100;
    min-width: 180px;
    max-width: 250px;
    text-align: left;
    line-height: 1.4;
    pointer-events: none;
    overflow: visible;
    padding: 0;
}

/* Flèche du tooltip - pointe vers le body blanc */
.mapmonde-tooltip-body::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #ffffff;
    z-index: 1;
}

/* Afficher au hover */
.mapmonde-point-wrapper:hover .mapmonde-tooltip,
.mapmonde-point-wrapper.is-active .mapmonde-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
    pointer-events: auto;
}

/* ===========================
   HEADER TOOLTIP (Bandeau nom produit)
   Pleine largeur, arrondi en haut uniquement
   =========================== */

.mapmonde-tooltip .mapmonde-tooltip-header {
    background-color: #f5f5f5;
    border-radius: 8px 8px 0 0;
    padding: 12px 16px;
    text-align: center;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.mapmonde-tooltip .mapmonde-tooltip-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    display: block;
}

/* ===========================
   BODY TOOLTIP
   Container pour image + contenu texte
   =========================== */

.mapmonde-tooltip-body {
    display: flex;
    flex-direction: row;
    gap: 12px;
    padding: 12px;
    align-items: flex-start;
    background: #ffffff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
}

/* Image produit à gauche */
.mapmonde-tooltip-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mapmonde-tooltip-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Contenu texte à droite */
.mapmonde-tooltip-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

/* Description */
.mapmonde-tooltip-description {
    font-size: 13px;
    color: #666666;
    line-height: 1.5;
    margin: 0;
}

/* Nom du pays (en bas, sans fond) */
.mapmonde-tooltip-country {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.mapmonde-location-icon {
    width: 12px;
    height: 12px;
    fill: #666666;
    flex-shrink: 0;
}

/* ===========================
   AJUSTEMENTS TAILLE TOOLTIP
   =========================== */

/* Tooltip avec image - plus large et sans padding */
.mapmonde-tooltip.has-image {
    min-width: 280px;
    max-width: 380px;
    padding: 0 !important;
}

/* Tooltip sans image - garde body mais sans image */
.mapmonde-tooltip:not(.has-image) .mapmonde-tooltip-body {
    padding: 12px 16px;
}

/* ===========================
   POSITIONNEMENT INTELLIGENT TOOLTIP
   =========================== */

/* Tooltip à gauche si point trop à droite */
.mapmonde-point-wrapper[data-position="left"] .mapmonde-tooltip {
    left: auto;
    right: calc(100% + 15px);
    bottom: 50%;
    transform: translateY(50%);
}

.mapmonde-point-wrapper[data-position="left"] .mapmonde-tooltip::after {
    top: 50%;
    left: 100%;
    right: auto;
    bottom: auto;
    transform: translateY(-50%);
    border-top-color: transparent;
    border-left-color: #ffffff;
}

.mapmonde-point-wrapper[data-position="left"]:hover .mapmonde-tooltip,
.mapmonde-point-wrapper[data-position="left"].is-active .mapmonde-tooltip {
    transform: translateY(50%) translateX(-5px);
}

/* Tooltip à droite si point trop à gauche */
.mapmonde-point-wrapper[data-position="right"] .mapmonde-tooltip {
    left: calc(100% + 15px);
    right: auto;
    bottom: 50%;
    transform: translateY(50%);
}

.mapmonde-point-wrapper[data-position="right"] .mapmonde-tooltip::after {
    top: 50%;
    right: 100%;
    left: auto;
    bottom: auto;
    transform: translateY(-50%);
    border-top-color: transparent;
    border-right-color: #ffffff;
}

.mapmonde-point-wrapper[data-position="right"]:hover .mapmonde-tooltip,
.mapmonde-point-wrapper[data-position="right"].is-active .mapmonde-tooltip {
    transform: translateY(50%) translateX(5px);
}

/* Tooltip en bas si point trop en haut */
.mapmonde-point-wrapper[data-position="bottom"] .mapmonde-tooltip {
    bottom: auto;
    top: calc(100% + 15px);
}

.mapmonde-point-wrapper[data-position="bottom"] .mapmonde-tooltip::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #ffffff;
}

.mapmonde-point-wrapper[data-position="bottom"]:hover .mapmonde-tooltip,
.mapmonde-point-wrapper[data-position="bottom"].is-active .mapmonde-tooltip {
    transform: translateX(-50%) translateY(5px);
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
    .mapmonde-tooltip {
        min-width: 240px;
        max-width: 320px;
    }

    .mapmonde-tooltip.has-image {
        min-width: 260px;
        max-width: 340px;
    }

    /* Header tablette */
    .mapmonde-tooltip-header {
        padding: 9px 14px;
    }

    /* Body tablette */
    .mapmonde-tooltip-body {
        padding: 11px;
        gap: 11px;
    }

    .mapmonde-tooltip:not(.has-image) .mapmonde-tooltip-body {
        padding: 11px 14px;
    }

    /* Image tablette */
    .mapmonde-tooltip-image {
        width: 70px;
        height: 70px;
    }

    /* Textes tablette */
    .mapmonde-tooltip-product-name {
        font-size: 13px;
    }

    .mapmonde-tooltip-description {
        font-size: 12px;
    }

    .mapmonde-tooltip-country {
        font-size: 11px;
    }

    .mapmonde-location-icon {
        width: 11px;
        height: 11px;
    }

    /* Points légèrement plus petits sur tablette */
    .mapmonde-point {
        transform: scale(0.85);
    }

    .mapmonde-point:hover {
        transform: scale(1);
    }
}

@media (max-width: 480px) {
    .mapmonde-tooltip {
        min-width: 200px;
        max-width: 280px;
    }

    /* Tooltip avec image - plus compact sur mobile */
    .mapmonde-tooltip.has-image {
        min-width: 220px;
        max-width: 300px;
    }

    /* Header plus compact */
    .mapmonde-tooltip-header {
        padding: 8px 12px;
    }

    /* Body plus compact */
    .mapmonde-tooltip-body {
        padding: 10px;
        gap: 10px;
    }

    .mapmonde-tooltip:not(.has-image) .mapmonde-tooltip-body {
        padding: 10px 12px;
    }

    /* Image plus petite */
    .mapmonde-tooltip-image {
        width: 60px;
        height: 60px;
    }

    /* Textes plus petits */
    .mapmonde-tooltip-product-name {
        font-size: 12px;
    }

    .mapmonde-tooltip-description {
        font-size: 11px;
    }

    .mapmonde-tooltip-country {
        font-size: 11px;
        gap: 4px;
    }

    .mapmonde-location-icon {
        width: 10px;
        height: 10px;
    }

    /* Animation pulse réduite sur mobile */
    .mapmonde-point.mapmonde-pulse::before {
        animation: none;
    }
}
