/* ======================================== */
/* MAP */
/* ======================================== */
#map {
    position: fixed;
    left: var(--sidebar-width);
    top: 0;
    right: 0;
    height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    transition: left var(--transition-base);
}

/* Leaflet zoom controls enhancement */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: var(--border-radius) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: white !important;
    color: var(--color-primary) !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    transition: all var(--transition-fast) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--color-primary) !important;
    color: white !important;
    transform: scale(1.05);
}

.leaflet-control-zoom a:first-child {
    border-bottom: 1px solid var(--color-border) !important;
}

/* Leaflet attribution */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-sm) !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Map loading overlay */
#map::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

#map.loading::before {
    opacity: 1;
}

/* Map loading spinner */
#map.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1001;
}

/* ======================================== */
/* TOOLTIP */
/* ======================================== */
.tooltip {
    position: absolute;
    display: none;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    pointer-events: none;
    z-index: var(--z-tooltip);
    white-space: nowrap;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.2s var(--ease-standard);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.95);
}

.tooltip strong {
    font-weight: 600;
    color: var(--color-accent);
}

/* Enhanced tooltip for better readability */
.tooltip-enhanced {
    background: white;
    color: var(--color-text);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--color-border);
    padding: var(--space-md);
    max-width: 250px;
    white-space: normal;
}

.tooltip-enhanced::before {
    border-top-color: white;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.tooltip-enhanced strong {
    color: var(--color-primary);
}

/* ======================================== */
/* MAP INTERACTIONS */
/* ======================================== */

/* Hover effect hint for countries */
.leaflet-interactive {
    transition: all var(--transition-fast) !important;
}

.leaflet-interactive:hover {
    filter: brightness(1.1);
    cursor: pointer;
}

/* ======================================== */
/* RESPONSIVE - MAP */
/* ======================================== */
@media (max-width: 768px) {
    #map {
        left: 0;
        top: 60vh;
        height: 40vh;
        position: relative;
    }
    
    .leaflet-control-zoom {
        margin: var(--space-sm) !important;
    }
    
    .leaflet-control-zoom a {
        width: 32px !important;
        height: 32px !important;
        line-height: 32px !important;
        font-size: 18px !important;
    }
    
    .tooltip {
        font-size: var(--font-size-xs);
        padding: var(--space-xs) var(--space-sm);
    }
}

@media (max-width: 480px) {
    #map {
        top: 50vh;
        height: 50vh;
    }
    
    .leaflet-control-attribution {
        font-size: 9px !important;
        padding: 2px 4px !important;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    #map {
        top: auto;
        left: 40vw;
        right: 0;
        height: 100vh;
        position: fixed;
    }
}

/* Tablet optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    #map {
        left: 280px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .leaflet-control-zoom a,
    .tooltip {
        transform: translateZ(0);
        backface-visibility: hidden;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .leaflet-interactive,
    .tooltip {
        transition: none !important;
        animation: none !important;
    }
}
