


.branches__wrapper {
    position: relative;
    width: 100%;
}


.branches__map {
    position: relative;
    height: auto;
}

.branches__map-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Map Pins */
.branches__pin {
    position: absolute;
    width: 70px;
    height: 52px;
    background: url('../images/dots.svg') no-repeat center center;
    background-size: contain;
    cursor: pointer;
    transform: translate(-50%, -50%);
    z-index: 10;
    border: none;
    transition: transform 0.3s ease;
    padding: 0;
}

.branches__pin:hover,
.branches__pin.active {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Overlay / Slider Modal (Centered Fixed) */
.branches__popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 500px;
    max-height: 90vh; /* Prevent cut-off on small screens */
    overflow-y: auto; /* Allow internal scrolling */
    overscroll-behavior: contain; /* Prevent scrolling parent */
    background: #FFF;
    padding: 32px 24px;
    border-radius: 5px;
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.25);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    pointer-events: none;
    -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
}

.branches__popup::-webkit-scrollbar {
    width: 4px;
}

.branches__popup::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.branches__popup.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

/* Close Button */
.branches__close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    line-height: 1;
    z-index: 201;
}


/* Branch Slider */
.branch-swiper {
    width: 100%;
    height: auto;
    overflow: hidden;
    margin-bottom: 30px;
}

.branch-swiper .swiper-slide {
    height: 250px;
}

.branch-swiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive */
@media (max-width: 1280px) {
    .branches__map {
        min-width: 1200px;
    }
    
    /* On mobile just ensure it fits nicely, distinct from desktop overrides */
    .branches__popup {
        width: 95%;
    }

    /* Scroll Controls styles */
    .branches-wrapper {
        position: relative;
    }
    
    .branches-scroll-controls {
        display: block; /* Show on mobile/tablet */
        pointer-events: none; /* Let clicks pass through container */
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 50; /* Above map */
    }

    .branches-scroll-btn {
        pointer-events: auto; /* Enable clicks on buttons */
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 48px;
        height: 48px;
        background: #FFFFFF;
        border: 1px solid #EBEBEB;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        opacity: 0.9;
        transition: opacity 0.3s, transform 0.2s;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .branches-scroll-btn img {
        display: block;
        width: 24px;
        height: 24px;
    }

    .branches-scroll-btn:active {
        transform: translateY(-50%) scale(0.95);
    }
    
    .branches-scroll-btn.prev {
        left: 10px;
    }
    .branches-scroll-btn.prev img {
        transform: rotate(180deg); /* Flip chevron for left */
    }

    .branches-scroll-btn.next {
        right: 10px;
    }

    /* Hide if disabled (optional logic in JS) */
    .branches-scroll-btn.hidden {
        opacity: 0;
        pointer-events: none;
    }

    /* Custom Scrollbar for visible feedback */
    .branches__wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #C0A062 transparent; /* Brand color thumb */
        padding-bottom: 20px; /* Space for scrollbar */
    }
    
    .branches__wrapper::-webkit-scrollbar {
        display: block; /* Show scrollbar */
        height: 6px;
    }
    
    .branches__wrapper::-webkit-scrollbar-track {
        background: rgba(0,0,0,0.05);
        border-radius: 3px;
        margin: 0 10px;
    }
    
    .branches__wrapper::-webkit-scrollbar-thumb {
        background-color: #C0A062; /* Gold/Brand color from other sections */
        border-radius: 3px;
    }
}

@media (min-width: 1281px) {
    .branches-scroll-controls {
        display: none !important;
    }
}





/* --- СТРУКТУРА КАРТЫ --- */
.branches-section {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Обертка для скролла (срабатывает только на мобилках) */
.map-scroll-wrapper {
    width: 100%;
    /* По умолчанию скролла нет (для десктопа) */
    overflow: visible; 
}

/* Контейнер самой картинки и точек */
.map-container {
    position: relative;
    width: 100%; /* На десктопе резина */
    transform-origin: top left;
}

.map-img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
}



/* --- ГИБРИДНЫЙ РЕЖИМ (СЕКРЕТ УСПЕХА) --- */
@media (max-width: 1280px) {
    /* Removed redundant rules that were conflicting or duplicated above */
    .map-container {
        min-width: 1200px; 
    }
}


/* Backdrop Overlay */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998; /* Below popup (9999) but above everything else */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}
