/**
 * Optimized Map Styles
 * Enhanced styles for map popups and clustering
 */

/* Enhanced popup styling */
.mapboxgl-popup-content {
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: none;
    max-width: 320px;
}

.marker-popup {
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

.marker-popup h4 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #007cbf;
    padding-bottom: 8px;
}

.marker-popup .profession {
    margin: 8px 0;
    color: #007cbf;
    font-weight: 600;
    font-size: 15px;
}

.marker-popup .specialite {
    margin: 6px 0;
    color: #7f8c8d;
    font-size: 14px;
    font-style: italic;
}

.marker-popup hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
    margin: 15px 0;
}

.marker-popup .address,
.marker-popup .phone {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    padding: 8px 0;
    color: #555;
    font-size: 14px;
}

.marker-popup .address svg,
.marker-popup .phone svg {
    color: #007cbf;
    flex-shrink: 0;
}

.marker-popup .address a,
.marker-popup .phone a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.marker-popup .address a:hover,
.marker-popup .phone a:hover {
    color: #007cbf;
}

.marker-popup .ameli-link {
    text-align: center;
    margin: 15px 0 10px 0;
}

.marker-popup .btn {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #007cbf, #0056b3);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 124, 191, 0.3);
}

.marker-popup .btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 191, 0.4);
    color: white;
}

.marker-popup .content {
    margin: 12px 0 0 0;
    color: #666;
    font-size: 13px;
    line-height: 1.6;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

/* Popup arrow styling */
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
    border-top-color: #fff;
}

.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
    border-bottom-color: #fff;
}

.mapboxgl-popup-anchor-left .mapboxgl-popup-tip {
    border-right-color: #fff;
}

.mapboxgl-popup-anchor-right .mapboxgl-popup-tip {
    border-left-color: #fff;
}

/* Enhanced cluster styling */
.mapboxgl-canvas-container {
    cursor: grab;
}

.mapboxgl-canvas-container:active {
    cursor: grabbing;
}

/* Custom marker styling */
.custom-marker {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.custom-marker:hover {
    transform: scale(1.1);
}

/* Loading indicator for map */
.map-loading {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    display: none;
}

.map-loading.active {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mapboxgl-popup-content {
        max-width: 280px;
    }
    
    .marker-popup {
        padding: 15px;
    }
    
    .marker-popup h4 {
        font-size: 16px;
    }
    
    .marker-popup .profession {
        font-size: 14px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .custom-marker {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Animation for new markers appearing */
@keyframes markerAppear {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.marker-new {
    animation: markerAppear 0.3s ease-out;
}

/* Cluster pulse animation on hover */
.cluster-hover {
    animation: clusterPulse 1s infinite;
}

@keyframes clusterPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Map container enhancements */
#mapbox-map {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Performance optimization: GPU acceleration */
.mapboxgl-canvas {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}