/**
 * Points de vente - Mapbox Styles
 * @package PointsDeVente
 */

/* Map Container */
.pdv-map-container {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.pdv-mapbox-map {
    position: relative;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.pdv-mapbox-map.pdv-map-loaded {
    opacity: 1;
}

/* FIX CRITIQUE : Optimisation globale pour tous les marqueurs Mapbox */
.mapboxgl-marker {
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

/* Custom Marker - OPTIMISATIONS PERFORMANCES */
.pdv-marker {
    /*background-color: var(--theme-palette-color-1);*/
    background: url("../img/icone_Oceau.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    width: 50px;
    height: 50px;
    /*border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    !* CRITIQUES : Optimisations de performance *!
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    transform: translateZ(0);
    !* Transition UNIQUEMENT sur box-shadow (pas sur transform !) *!
    transition: box-shadow 0.3s ease;
    pointer-events: auto;*/
    position: absolute;
}

.pdv-marker::before {
    content: '';
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
}

.pdv-marker:hover {
    transform: scale(1.15);
}

/* Popup Styles */
.mapboxgl-popup-content {
    padding: 0 !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    min-width: 280px;
}

.pdv-popup {
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

.pdv-popup-title {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 10px;
    color: #093266;
    line-height: 1.3;
}

.pdv-popup-description {
    color: #6c757d;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.pdv-popup-address,
.pdv-popup-phone,
.pdv-popup-email,
.pdv-popup-website,
.pdv-popup-hours {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #495057;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.pdv-popup-address svg,
.pdv-popup-phone svg,
.pdv-popup-email svg,
.pdv-popup-website svg,
.pdv-popup-hours svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #6c757d;
}

.pdv-popup-phone a,
.pdv-popup-email a,
.pdv-popup-website a {
    color: #093266;
    text-decoration: none;
    transition: color 0.2s ease;
}

.pdv-popup-phone a:hover,
.pdv-popup-email a:hover,
.pdv-popup-website a:hover {
    color: var(--theme-palette-color-1);
    text-decoration: underline;
}

.pdv-popup-hours span {
    flex: 1;
}

.pdv-popup-directions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--theme-palette-color-1);
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.pdv-popup-directions:hover {
    transform: translateY(-2px);
}

.pdv-popup-directions svg {
    flex-shrink: 0;
}

/* Mapbox Controls Override */
.mapboxgl-ctrl-top-right {
    top: 20px;
    right: 20px;
}

.mapboxgl-ctrl-group {
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.mapboxgl-ctrl-group button {
    width: 40px;
    height: 40px;
}

.mapboxgl-ctrl-group button:hover {
    background-color: #f8f9fa;
}

/* Popup Tip (Arrow) */
.mapboxgl-popup-tip {
    border-top-color: white !important;
}

.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
    border-top-color: white !important;
}

.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
    border-bottom-color: white !important;
}

/* Close Button */
.mapboxgl-popup-close-button {
    width: 32px;
    height: 32px;
    font-size: 24px;
    color: #6c757d;
    padding: 0;
    line-height: 32px;
    border-radius: 0 10px 0 0;
    transition: all 0.2s ease;
}

.mapboxgl-popup-close-button:hover {
    background-color: #f8f9fa;
    color: var(--theme-palette-color-1);
}

/* Loading State */
.pdv-map-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #093266;
    border-radius: 50%;
    animation: pdv-spin 1s linear infinite;
    z-index: 1;
}

/* Cache le loader quand la carte est chargée */
.pdv-map-container.pdv-map-loaded::before {
    display: none;
}

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

/* No Stores Message */
.pdv-no-stores {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #6c757d;
    font-size: 18px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .mapboxgl-popup-content {
        min-width: 240px;
    }

    .pdv-popup {
        padding: 15px;
    }

    .pdv-popup-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .pdv-popup-address,
    .pdv-popup-phone,
    .pdv-popup-email {
        font-size: 13px;
    }

    .pdv-marker {
        width: 28px;
        height: 28px;
    }

    .pdv-marker::before {
        width: 10px;
        height: 10px;
    }

    .mapboxgl-ctrl-top-right {
        top: 10px;
        right: 10px;
    }
}

/* Print Styles */
@media print {
    .mapboxgl-ctrl-group,
    .mapboxgl-popup-close-button {
        display: none !important;
    }
}
