/* Стили для списка филиалов в шапке */
.location-branches-container {
    position: relative;
}

.location-branches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.location-branch-item {
    position: relative;
    display: grid;
    grid-template-columns: 18px 1fr;
    grid-template-rows: auto auto;
    grid-auto-flow: row;
    column-gap: 8px;
    row-gap: 2px;
    align-items: start;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.06);
    background: rgba(255,255,255,0.6);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.location-branch-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
    border-color: rgba(0,0,0,0.12);
}

.location-branch-icon {
    color: var(--location-primary-color, #3b82f6);
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: inline-block;
    position: relative;
}

.location-branch-icon::before {
    content: "📍";
    font-size: 16px;
}

.location-branch-name {
    grid-column: 2 / 3;
    grid-row: 1;
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.35;
    display: block; /* перенос на свою строку */
    white-space: normal;
}

.location-branch-phone {
    grid-column: 2 / 3;
    grid-row: 2;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.35;
    display: block; /* всегда с новой строки */
    text-decoration: none;
    transition: color 0.2s ease;
}

.location-branch-phone:hover {
    color: var(--location-primary-color, #3b82f6);
}

/* Pop-up при наведении */
.location-branch-popup {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 20px;
    min-width: 350px;
    max-width: 450px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.location-branch-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Стрелка указывающая на элемент */
.location-branch-popup::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #ffffff;
}

/* Добавляем небольшой зазор между элементом и pop-up для плавного перехода */
.location-branch-item {
    position: relative;
}

.location-branch-popup-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
}

.location-branch-popup-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-branch-popup-star {
    color: var(--location-primary-color, #3b82f6);
    font-size: 16px;
    display: inline-block;
    margin-left: 5px;
}

.location-branch-popup-address {
    color: #6b7280;
    font-size: 14px;
    margin: 0 0 8px 0;
}

.location-branch-popup-schedule {
    color: #6b7280;
    font-size: 14px;
    margin: 0 0 8px 0;
}

.location-branch-popup-phone {
    color: var(--location-primary-color, #3b82f6);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    display: block;
    margin: 10px 0;
    transition: color 0.2s ease;
}

.location-branch-popup-phone:hover {
    color: var(--location-hover-color, #2563eb);
}

.location-branch-popup-more {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 15px;
    color: #6b7280;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.location-branch-popup-more:hover {
    color: var(--location-primary-color, #3b82f6);
}

.location-branch-popup-arrow {
    margin-left: 5px;
    font-size: 16px;
}

/* Кнопка "Показать все" */
.location-branches-show-all {
    margin-top: 10px;
}

.location-branches-show-all:hover { }

/* Модальное окно с подробной информацией */
.location-branch-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.location-branch-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.location-branch-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.4s ease;
}

.location-branch-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    z-index: 10;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-branch-modal-close .dashicons {
    font-size: 20px;
}

.location-branch-modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1f2937;
}

.location-branch-modal-header {
    padding: 30px 30px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.location-branch-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-branch-modal-address {
    color: #6b7280;
    font-size: 16px;
    margin: 0 0 10px 0;
}

.location-branch-modal-schedule {
    color: #6b7280;
    font-size: 14px;
    margin: 0 0 10px 0;
}

.location-branch-modal-status {
    color: #10b981;
    font-size: 14px;
    font-weight: 500;
}

.location-branch-modal-body {
    padding: 30px;
}

.location-branch-modal-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.location-branch-modal-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.location-branch-modal-image:hover {
    transform: scale(1.05);
}

.location-branch-modal-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.location-branch-modal-phone-button {
    text-decoration: none;
    color: inherit;
    font-size: 16px;
    display: inline-block;
}


.location-branch-modal-map-container {
    margin-bottom: 25px;
}

.location-branch-routes {
    margin-top: 12px;
}

.location-branch-routes-title {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 6px;
}

.location-branch-routes-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.location-route-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    background: #10b981 !important;
    color: #ffffff !important;
    border: none !important;
}

.location-route-btn:hover,
.location-route-btn:focus,
.location-route-btn:active {
    background: #10b981 !important;
    color: #ffffff !important;
    border: none !important;
    text-decoration: none !important;
}

.location-branch-modal-directions h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 15px 0;
}

.location-branch-modal-directions-content {
    color: #4b5563;
    line-height: 1.8;
    font-size: 15px;
    white-space: pre-line;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Мобильная версия - кнопка с иконкой локации (скрыта по умолчанию) */
.location-branches-mobile-toggle {
    display: none !important;
}

.location-branches-mobile-dropdown {
    display: none !important;
}

.location-branches-mobile-overlay {
    display: none !important;
}

/* Адаптивность для мобильных (< 1024px) */
@media (max-width: 1023px) {
    /* Скрываем десктопную версию */
    .location-branches-list,
    .location-branches-show-all {
        display: none !important;
    }
    
    /* Показываем мобильную кнопку */
    .location-branches-mobile-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.9);
        cursor: pointer;
        transition: all 0.2s ease;
        position: relative;
    }
    
    .location-branches-mobile-toggle:hover {
        background: rgba(255, 255, 255, 1);
        border-color: rgba(0, 0, 0, 0.15);
    }
    
    .location-branches-mobile-toggle.active {
        background: var(--location-primary-color, #3b82f6);
        border-color: var(--location-primary-color, #3b82f6);
    }
    
    .location-branches-mobile-icon {
        font-size: 20px;
        line-height: 1;
    }
    
    .location-branches-mobile-toggle.active .location-branches-mobile-icon {
        filter: brightness(0) invert(1);
    }
    
    /* Выпадающий список */
    .location-branches-mobile-dropdown {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        display: flex !important;
        align-items: center;
        justify-content: center;
        z-index: 10000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        pointer-events: none;
        padding: 20px;
        box-sizing: border-box;
    }
    
    .location-branches-mobile-dropdown.show {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    
    /* Показываем overlay на мобильных */
    .location-branches-mobile-overlay {
        display: block !important;
    }
    
    /* Внутренний контейнер для содержимого */
    .location-branches-mobile-dropdown::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: -1;
    }
    
    .location-branches-mobile-list {
        position: relative;
        width: 100%;
        max-width: 500px;
        min-width: 280px;
        background: #ffffff;
        border-radius: 16px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        max-height: 80vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }
    
    /* Кнопка закрытия */
    .location-branches-mobile-close {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        padding: 0;
        border: none;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
        transition: background-color 0.2s ease;
    }
    
    .location-branches-mobile-close:hover,
    .location-branches-mobile-close:active {
        background: rgba(0, 0, 0, 0.1);
    }
    
    .location-branches-mobile-close-icon {
        font-size: 24px;
        line-height: 1;
        color: #1f2937;
        font-weight: 300;
    }
    
    .location-branches-mobile-list-content {
        padding: 20px 16px 16px;
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
        max-height: calc(80vh - 40px);
    }
    
    .location-branch-mobile-item {
        padding: 16px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        transition: background-color 0.2s ease;
    }
    
    .location-branch-mobile-item:last-child {
        border-bottom: none;
    }
    
    .location-branch-mobile-item:active {
        background-color: rgba(0, 0, 0, 0.04);
    }
    
    .location-branch-mobile-name {
        font-weight: 600;
        color: #1f2937;
        font-size: 16px;
        margin-bottom: 8px;
        line-height: 1.4;
    }
    
    .location-branch-mobile-address {
        color: #6b7280;
        font-size: 14px;
        margin-bottom: 8px;
        line-height: 1.5;
    }
    
    .location-branch-mobile-address-link {
        color: var(--location-primary-color, #3b82f6);
        text-decoration: none;
        cursor: pointer;
        transition: color 0.2s ease, opacity 0.2s ease;
        display: inline-block;
    }
    
    .location-branch-mobile-address-link:active {
        opacity: 0.8;
    }
    
    .location-branch-mobile-phone {
        color: var(--location-primary-color, #3b82f6);
        font-size: 15px;
        font-weight: 500;
        text-decoration: none;
        display: inline-block;
        line-height: 1.5;
    }
    
    .location-branch-mobile-phone:active {
        opacity: 0.8;
    }
    
    .location-branch-popup {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 400px;
    }
    
    .location-branch-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .location-branch-modal-images {
        grid-template-columns: 1fr;
    }
    
    .location-branch-modal-actions {
        flex-direction: column;
    }
    
    .location-branch-modal-phone-button {
        width: 100%;
    }
}

/* Адаптивность для очень маленьких экранов */
@media (max-width: 768px) {
    .location-branches-mobile-dropdown {
        width: 90vw;
        max-width: none;
    }
}

/* Дополнительные стили для корректной работы в DevTools */
@media (max-width: 1023px) {
    /* Убеждаемся, что контейнер правильно позиционируется */
    .location-branches-container {
        position: relative;
        z-index: 1;
    }
    
    /* Исправление для корректного отображения в DevTools */
    html, body {
        overflow-x: hidden;
    }
}

/* Затемнение фона при открытом меню */
.location-branches-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    /* Исправление для DevTools */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.location-branches-mobile-overlay.show {
    opacity: 1;
    visibility: visible;
}

