
.map-section {
    --map-primary: #0a71b9;
    --map-secondary: #088395;
    --map-accent: #9CCD42;
    --map-blue: #00B5E2;
    --map-dark: #05445e;
    --map-white: #ffffff;
    --map-gray: #f4f4f4;
    --map-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --map-radius: 20px;
    --map-radius-sm: 12px;
    
    background: linear-gradient(180deg, var(--map-dark) 0%, var(--map-secondary) 100%);
    padding: clamp(30px, 5vw, 60px) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.map-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.05)"/></svg>');
    background-size: 30px 30px;
    pointer-events: none;
}

.map-section .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    padding: 0 clamp(15px, 3vw, 30px);
    position: relative;
    z-index: 1;
}

/* ============================================
   MAP TITLE
   ============================================ */
.map-section .page-title,
.map-title {
    color: var(--map-white);
    margin-bottom: clamp(20px, 4vw, 35px);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    line-height: 1.3;
}

/* ============================================
   MAP CONTAINER
   ============================================ */
.map-section .map-container {
    width: 100%;
    max-width: min(1200px, 95vw);
    aspect-ratio: 16 / 7;
    background: var(--map-white);
    border-radius: var(--map-radius);
    box-shadow: var(--map-shadow);
    overflow: hidden;
    position: relative;
    padding: clamp(20px, 4vw, 40px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.map-section .map-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

/* ============================================
   MAP ELEMENT
   ============================================ */
.map-section #map {
    width: 100%;
    height: 100%;
    background: var(--map-gray);
    border-radius: calc(var(--map-radius) - 5px);
    position: relative;
    z-index: 1;
}

/* ============================================
   MAIN PIN (SANAA)
   ============================================ */
.main-pin-icon {
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.35));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.main-pin-icon:hover {
    transform: scale(1.15) translateY(-8px);
    z-index: 1000 !important;
}

/* ============================================
   PULSE RING ANIMATION
   ============================================ */
.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid #9CCD42;
    border-radius: 50%;
    animation: mapPulseRing 2s ease-out infinite;
    opacity: 0;
    z-index: -1;
    pointer-events: none;
}

@keyframes mapPulseRing {
    0% {
        width: 20px;
        height: 20px;
        opacity: 0.9;
        border-width: 4px;
    }
    100% {
        width: 80px;
        height: 80px;
        opacity: 0;
        border-width: 1px;
    }
}

/* ============================================
   BRANCH PINS
   ============================================ */
.pin-drop-animation {
    animation: mapDropBounce 0.8s cubic-bezier(0.2, 0.8, 0.2, 1.2) forwards;
    transform-origin: bottom center;
}

@keyframes mapDropBounce {
    0% {
        opacity: 0;
        transform: translateY(-60px) scale(1.5);
    }
    60% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    80% {
        transform: translateY(-12px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.branch-pin-svg {
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.branch-pin-svg:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.35));
}

/* ============================================
   LINE ANIMATIONS
   ============================================ */
.animate-path {
    stroke-dasharray: 2500;
    stroke-dashoffset: 2500;
    animation: mapDrawLine 2s ease-in-out forwards;
}

@keyframes mapDrawLine {
    to {
        stroke-dashoffset: 0;
    }
}

.line-flowing {
    stroke-dasharray: 10, 10 !important;
    animation: mapFlowDash 3s linear infinite !important;
    stroke-dashoffset: 0;
}

@keyframes mapFlowDash {
    to {
        stroke-dashoffset: -200;
    }
}

/* ============================================
   LEGEND
   ============================================ */
.map-section .legend {
    position: absolute;
    bottom: clamp(20px, 4vw, 35px);
    right: clamp(20px, 4vw, 35px);
    background: rgba(255, 255, 255, 0.97);
    padding: clamp(12px, 2vw, 18px) clamp(15px, 2.5vw, 22px);
    border-radius: var(--map-radius-sm);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-size: clamp(0.75rem, 1.8vw, 0.95rem);
    border-right: 4px solid #9CCD42;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-width: min(280px, 55vw);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.map-section .legend:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

[dir="rtl"] .map-section .legend {
    right: auto;
    left: clamp(20px, 4vw, 35px);
    border-right: none;
    border-left: 4px solid #9CCD42;
}

.map-section .legend-item {
    display: flex;
    align-items: center;
    margin-bottom: clamp(8px, 1.5vw, 12px);
    color: #333;
    font-weight: 600;
    white-space: normal;
}

.map-section .legend-item:last-child {
    margin-bottom: 0;
}

.map-section .legend-icon {
    width: clamp(18px, 3vw, 24px);
    height: clamp(18px, 3vw, 24px);
    margin-left: clamp(8px, 1.5vw, 12px);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

[dir="rtl"] .map-section .legend-icon {
    margin-left: 0;
    margin-right: clamp(8px, 1.5vw, 12px);
}

/* ============================================
   LEAFLET CUSTOMIZATION
   ============================================ */
.map-section .leaflet-popup-content-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    padding: 0;
    overflow: hidden;
}

.map-section .leaflet-popup-content {
    margin: 15px 18px;
    font-family: 'Poppins', 'Tajawal', sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #333;
}

.map-section .leaflet-popup-content b {
    display: block;
    margin-bottom: 5px;
    font-size: 1rem;
}

.map-section .leaflet-popup-tip {
    background: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.map-section .leaflet-popup-close-button {
    color: #999 !important;
    font-size: 20px !important;
    width: 28px !important;
    height: 28px !important;
    padding: 5px !important;
    transition: color 0.2s ease;
}

.map-section .leaflet-popup-close-button:hover {
    color: #333 !important;
}

.map-section .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
    border-radius: 10px !important;
    overflow: hidden;
}

.map-section .leaflet-control-zoom a {
    background: #fff !important;
    color: #333 !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
    border: none !important;
    transition: background 0.2s ease, color 0.2s ease;
}

.map-section .leaflet-control-zoom a:hover {
    background: #f0f0f0 !important;
    color: #0a71b9 !important;
}

.map-section .leaflet-control-zoom a:first-child {
    border-radius: 10px 10px 0 0 !important;
}

.map-section .leaflet-control-zoom a:last-child {
    border-radius: 0 0 10px 10px !important;
}

/* ============================================
   RESPONSIVE - DISTRIBUTION MAP
   ============================================ */

/* Large Desktop */
@media (min-width: 1400px) {
    .map-section .map-container {
        max-width: 1300px;
    }
}

/* Desktop */
@media (max-width: 1200px) {
    .map-section .map-container {
        aspect-ratio: 16 / 8;
    }
}

/* Tablet Landscape */
@media (max-width: 1024px) {
    .map-section .map-container {
        aspect-ratio: 4 / 3;
    }
}

/* Tablet Portrait */
@media (max-width: 768px) {
    .map-section {
        padding: clamp(25px, 5vw, 50px) 0;
    }

    .map-section .map-container {
        aspect-ratio: 4 / 3;
        border-radius: 16px;
        padding: clamp(15px, 3vw, 25px);
    }

    .map-section .legend {
        bottom: clamp(15px, 3vw, 25px);
        right: clamp(15px, 3vw, 25px);
        max-width: min(220px, 60vw);
    }

    [dir="rtl"] .map-section .legend {
        left: clamp(15px, 3vw, 25px);
    }
}

/* Mobile Landscape */
@media (max-width: 640px) {
    .map-section .map-container {
        aspect-ratio: 1 / 1;
        max-width: 100%;
    }
    
    .map-section #map {
        min-height: 300px;
    }
}

/* Mobile Portrait */
@media (max-width: 576px) {
    .map-section .container {
        padding: 0 clamp(10px, 3vw, 20px);
    }
    
    .map-section .map-container {
        aspect-ratio: unset;
        height: auto;
        min-height: 320px;
        border-radius: 12px;
    }
    
    .map-section #map {
        min-height: 280px;
        border-radius: 10px;
    }
    
    .map-section .legend {
        position: relative;
        bottom: auto;
        right: auto;
        left: auto;
        margin-top: 15px;
        max-width: 100%;
        width: 100%;
        border-radius: 10px;
    }
    
    [dir="rtl"] .map-section .legend {
        left: auto;
        right: auto;
    }
}

/* Small Mobile */
@media (max-width: 380px) {
    .map-section {
        padding: clamp(20px, 4vw, 30px) 0;
    }

    .map-section .map-container {
        min-height: 280px;
        padding: clamp(10px, 2vw, 15px);
        border-radius: 10px;
    }

    .map-section #map {
        min-height: 260px;
        border-radius: 8px;
    }

    .map-section .page-title,
    .map-title {
        font-size: clamp(1.2rem, 5vw, 1.5rem);
    }

    .map-section .legend-item {
        font-size: clamp(0.7rem, 2.5vw, 0.85rem);
    }
}

/* ============================================
   TOUCH DEVICES
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    .main-pin-icon:hover,
    .branch-pin-svg:hover {
        transform: none;
    }
    
    .map-section .map-container:hover,
    .map-section .legend:hover {
        transform: none;
    }
}

/* ============================================
   HIGH DPI DISPLAYS
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .main-pin-icon svg,
    .branch-pin-svg {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .pulse-ring,
    .pin-drop-animation,
    .animate-path,
    .line-flowing {
        animation: none !important;
    }
    
    .animate-path {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .map-section {
        background: #fff !important;
        padding: 20px 0;
    }
    
    .map-section .map-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .pulse-ring,
    .line-flowing {
        display: none;
    }
}