/* Принудительное переопределение z-index для модального окна */
/* Этот файл должен подключаться последним для переопределения всех конфликтов */

/* Основные модальные элементы */
.modal {
    z-index: 999999 !important;
}

.modal-bg {
    z-index: 999998 !important;
}

.modal-close {
    z-index: 1000000 !important;
}

/* Модальное окно блюда */
#dishModalBg {
    z-index: 999998 !important;
    /* Принудительно скрываем модальное окно по умолчанию */
    display: none !important;
}

#dishModalBg.active {
    display: flex !important;
}

#dishModal {
    z-index: 999999 !important;
}

/* Переопределяем inline стили */
#modal-restaurant-closed {
    z-index: 999998 !important;
}

/* МОДАЛЬНОЕ ОКНО КОРЗИНЫ - должно быть ВПЕРЕДИ ВСЕХ ЭЛЕМЕНТОВ */
#era-cart-order-modal {
    z-index: 2147483647 !important;
}

/* Переопределяем стили из других CSS файлов */
.era-basket__modal {
    z-index: 2147483647 !important;
}

.era-basket__modal-content {
    z-index: 2147483647 !important;
}

/* Переопределяем стили из mobile-optimization.css */
.mobile-menu-toggle {
    z-index: 100 !important;
}

.mobile-menu {
    z-index: 100 !important;
}

/* Переопределяем стили из era-v1.css */
#era-order-basket {
    z-index: 100 !important;
}

/* Переопределяем стили из accessibility.css */
.skip-link {
    z-index: 100 !important;
}

/* Переопределяем стили из era-zoom-2.0.min.css */
.t-zoomer__wrapper {
    z-index: 100 !important;
}

.t-zoomer__container {
    z-index: 100 !important;
}

/* Переопределяем стили из era-popup-1.1.min.css */
.t-popup {
    z-index: 100 !important;
}

/* НАВИГАЦИЯ ПО КАТЕГОРИЯМ - должна быть ниже корзины */
.cat-nav {
    z-index: 50 !important;
}

.cat-nav a,
.cat-nav select {
    z-index: 50 !important;
}

.cat-nav.mobile-nav {
    z-index: 50 !important;
}

/* ПРИНУДИТЕЛЬНОЕ ПЕРЕОПРЕДЕЛЕНИЕ ВСЕХ ВЫСОКИХ Z-INDEX ДЛЯ КАТЕГОРИЙ */
.cat-nav[style*="z-index: 99999"],
.cat-nav[style*="z-index: 999999"],
.cat-nav[style*="z-index: 999998"],
.cat-nav[style*="z-index: 1000"],
.cat-nav[style*="z-index: 10000"] {
    z-index: 50 !important;
}

/* Переопределяем стили из menu.css */
.cat-nav {
    z-index: 50 !important;
}

/* Переопределяем все возможные z-index для категорий */
.cat-nav,
.cat-nav *,
.cat-nav a,
.cat-nav select,
.cat-nav.mobile-nav {
    z-index: 50 !important;
}

/* Боковые точки навигации */
.dots {
    z-index: 50 !important;
}

.dots .dot {
    z-index: 50 !important;
}

/* Индикатор прокрутки */
.scroll-indicator {
    z-index: 50 !important;
}

/* Переопределяем все высокие z-index для навигации */
.cat-nav[style*="z-index"],
.cat-nav * {
    z-index: 50 !important;
}

/* Скрываем категории меню при открытии корзины */
.era-basket__modal[style*="display: flex"] ~ .cat-nav,
.era-basket__modal[style*="display: flex"] ~ .dots,
.era-basket__modal[style*="display: flex"] ~ .scroll-indicator,
.era-basket__modal[style*="display: flex"] ~ .menu-container .cat-nav,
.era-basket__modal[style*="display: flex"] ~ .menu-container .dots,
.era-basket__modal[style*="display: flex"] ~ .menu-container .scroll-indicator {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    transform: translateY(-100%) !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* ПРИНУДИТЕЛЬНОЕ СКРЫТИЕ КАТЕГОРИЙ С ЛЮБЫМ Z-INDEX ПРИ ОТКРЫТОЙ КОРЗИНЕ */
.era-basket__modal[style*="display: flex"] ~ .cat-nav,
.era-basket__modal[style*="display: flex"] ~ .dots,
.era-basket__modal[style*="display: flex"] ~ .scroll-indicator {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    transform: translateY(-100%) !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
    /* Принудительно переопределяем все возможные z-index */
    z-index: -1 !important;
}

/* Скрытие категорий с высоким z-index из menu.css */
.era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 99999"],
.era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 999999"],
.era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 999998"],
.era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 1000"],
.era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 10000"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    transform: translateY(-100%) !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* Скрываем категории меню при открытии корзины (альтернативный способ) */
body:has(.era-basket__modal[style*="display: flex"]) .cat-nav,
body:has(.era-basket__modal[style*="display: flex"]) .dots,
body:has(.era-basket__modal[style*="display: flex"]) .scroll-indicator {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ПРИНУДИТЕЛЬНОЕ СКРЫТИЕ КАТЕГОРИЙ МЕНЮ С ВЫСОКИМ Z-INDEX */
.era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 99999"],
.era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 999999"],
.era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 999998"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    transform: translateY(-100%) !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* ДОПОЛНИТЕЛЬНОЕ СКРЫТИЕ ВСЕХ ЭЛЕМЕНТОВ МЕНЮ ПРИ ОТКРЫТОЙ КОРЗИНЕ */
.era-basket__modal[style*="display: flex"] ~ * .cat-nav,
.era-basket__modal[style*="display: flex"] ~ * .dots,
.era-basket__modal[style*="display: flex"] ~ * .scroll-indicator,
.era-basket__modal[style*="display: flex"] ~ * .menu-nav,
.era-basket__modal[style*="display: flex"] ~ * .category-nav,
.era-basket__modal[style*="display: flex"] ~ * .menu-categories {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    transform: translateY(-100%) !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* Принудительное скрытие всех элементов навигации при открытой корзине */
.era-basket__modal[style*="display: flex"] ~ nav,
.era-basket__modal[style*="display: flex"] ~ .navigation,
.era-basket__modal[style*="display: flex"] ~ .menu-navigation {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    transform: translateY(-100%) !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* Скрытие элементов с высоким z-index при открытой корзине */
.era-basket__modal[style*="display: flex"] ~ [style*="z-index: 99999"],
.era-basket__modal[style*="display: flex"] ~ [style*="z-index: 10000"],
.era-basket__modal[style*="display: flex"] ~ [style*="z-index: 1000"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ЗАКОММЕНТИРОВАНО: Скрытие элементов header.php при открытии корзины */
/* .era-basket__modal[style*="display: flex"] ~ .mobile-menu-overlay,
.era-basket__modal[style*="display: flex"] ~ .mobile-menu-toggle,
.era-basket__modal[style*="display: flex"] ~ .header-mobile,
.era-basket__modal[style*="display: flex"] ~ .desktop-menu,
.era-basket__modal[style*="display: flex"] ~ .desktop-logo,
.era-basket__modal[style*="display: flex"] ~ .desktop-right {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
} */

/* ЗАКОММЕНТИРОВАНО: Принудительное скрытие всех элементов header при открытой корзине */
/* .era-basket__modal[style*="display: flex"] ~ header,
.era-basket__modal[style*="display: flex"] ~ .header,
.era-basket__modal[style*="display: flex"] ~ .site-header {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
} */

/* ИСПРАВЛЕНИЕ: Проблема с header'ом в десктопной версии при открытии корзины */
@media (min-width: 769px) {
    /* Принудительно восстанавливаем правильное позиционирование header'а */
    .header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 100 !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
        transition: all 0.3s ease !important;
    }
    
    /* Восстанавливаем правильное позиционирование элементов header'а */
    .header-grid {
        max-width: 1200px !important;
        margin: 0 auto !important;
        padding: 0 20px !important;
        display: grid !important;
        grid-template-columns: auto 1fr auto !important;
        align-items: center !important;
        min-height: 80px !important;
        gap: 20px !important;
    }
    
    .header-logo {
        justify-self: center !important;
    }
    
    .header-logo img {
        height: 50px !important;
        width: auto !important;
    }
    
    .header-menu ul {
        display: flex !important;
        gap: 30px !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .header-menu a {
        color: #333 !important;
        text-decoration: none !important;
        font-weight: 500 !important;
        font-size: 16px !important;
        transition: color 0.3s ease !important;
        position: relative !important;
    }
    
    .header-right {
        display: flex !important;
        align-items: center !important;
        gap: 20px !important;
    }
    
    .header-phone a {
        color: #333 !important;
        text-decoration: none !important;
        font-weight: 600 !important;
        font-size: 16px !important;
    }
    
    .header-social {
        display: flex !important;
        gap: 10px !important;
    }
    
    .header-social a {
        width: 35px !important;
        height: 35px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        background: #f5f5f5 !important;
        transition: background 0.2s !important;
    }
    
    /* Восстанавливаем правильное позиционирование body */
    body {
        padding-top: 100px !important;
        overflow-x: hidden !important;
        position: static !important;
        height: auto !important;
        width: auto !important;
    }
    
    html {
        overflow: auto !important;
        position: static !important;
        height: auto !important;
        width: auto !important;
    }
}

/* Дополнительные исправления для больших экранов */
@media (min-width: 900px) {
    .header-grid { 
        padding: 0 8px !important; 
        min-height: 70px !important; 
    }
    .header-logo img { 
        height: 44px !important; 
    }
    .header-menu a, .header-phone a { 
        font-size: 14px !important; 
    }
}

/* Дополнительные исправления для средних экранов */
@media (min-width: 600px) and (max-width: 900px) {
    .header-grid { 
        grid-template-columns: 1fr auto 1fr !important; 
        min-height: 60px !important; 
        gap: 8px !important; 
        padding: 0 4px !important; 
    }
    .header-logo img { 
        height: 36px !important; 
    }
    .header-menu ul { 
        gap: 12px !important; 
    }
    .header-right { 
        gap: 8px !important; 
    }
}

/* Другие элементы интерфейса, которые могут мешать */
.menu-container {
    z-index: 10 !important;
}

.category {
    z-index: 10 !important;
}

.dish {
    z-index: 10 !important;
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .modal {
        z-index: 999999 !important;
        position: fixed !important;
    }
    
    .modal-bg {
        z-index: 999998 !important;
    }
    
    .modal-close {
        z-index: 1000000 !important;
    }
    
    /* Модальное окно блюда на мобильных */
    #dishModalBg {
        z-index: 999998 !important;
    }
    
    #dishModal {
        z-index: 999999 !important;
    }
    
    /* Переопределяем inline стили */
    #modal-restaurant-closed {
        z-index: 999998 !important;
    }
    
    /* МОДАЛЬНОЕ ОКНО КОРЗИНЫ - ВПЕРЕДИ ВСЕХ НА МОБИЛЬНЫХ */
    #era-cart-order-modal {
        z-index: 9999999 !important;
    }
    
    .era-basket__modal {
        z-index: 9999999 !important;
        /* Убираем принудительное display: flex !important */
        align-items: center !important;
        justify-content: center !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0,0,0,0.4) !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }
    
    .era-basket__modal-content {
        z-index: 9999999 !important;
        background: #fff !important;
        border-radius: 16px !important;
        max-width: 95vw !important;
        width: 95vw !important;
        max-height: 90vh !important;
        height: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 1.5em 1em !important;
        box-shadow: 0 4px 24px rgba(0,0,0,0.3) !important;
        position: relative !important;
        /* Убираем принудительное display: flex !important */
        flex-direction: column !important;
    }
    
    /* Навигация по категориям на мобильных */
    .cat-nav {
        z-index: 50 !important;
    }
    
    .cat-nav a,
    .cat-nav select {
        z-index: 50 !important;
    }
    
    .cat-nav.mobile-nav {
        z-index: 50 !important;
    }
    
    /* Боковые точки навигации на мобильных */
    .dots {
        z-index: 50 !important;
    }
    
    .dots .dot {
        z-index: 50 !important;
    }
    
    /* Индикатор прокрутки на мобильных */
    .scroll-indicator {
        z-index: 50 !important;
    }
    
    /* Другие элементы на мобильных */
    .menu-container {
        z-index: 10 !important;
    }
    
    .category {
        z-index: 10 !important;
    }
    
    .dish {
        z-index: 10 !important;
    }
}

/* iOS специфичные переопределения */
@supports (-webkit-touch-callout: none) {
    .modal {
        z-index: 999999 !important;
        position: fixed !important;
    }
    
    .modal-bg {
        z-index: 999998 !important;
    }
    
    .modal-close {
        z-index: 1000000 !important;
    }
    
    /* Модальное окно блюда на iOS */
    #dishModalBg {
        z-index: 999998 !important;
    }
    
    #dishModal {
        z-index: 999999 !important;
    }
    
    /* МОДАЛЬНОЕ ОКНО КОРЗИНЫ - ВПЕРЕДИ ВСЕХ НА iOS */
    #era-cart-order-modal {
        z-index: 9999999 !important;
    }
    
    .era-basket__modal {
        z-index: 9999999 !important;
        /* Убираем принудительное display: flex !important */
        align-items: center !important;
        justify-content: center !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0,0,0,0.4) !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }
    
    .era-basket__modal-content {
        z-index: 9999999 !important;
        background: #fff !important;
        border-radius: 16px !important;
        max-width: 95vw !important;
        width: 95vw !important;
        max-height: 85vh !important;
        height: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 1.5em 1em !important;
        box-shadow: 0 4px 24px rgba(0,0,0,0.3) !important;
        position: relative !important;
        /* Убираем принудительное display: flex !important */
        flex-direction: column !important;
    }
    
    /* Навигация по категориям на iOS */
    .cat-nav {
        z-index: 50 !important;
    }
    
    .cat-nav a,
    .cat-nav select {
        z-index: 50 !important;
    }
    
    .cat-nav.mobile-nav {
        z-index: 50 !important;
    }
    
    /* Боковые точки навигации на iOS */
    .dots {
        z-index: 50 !important;
    }
    
    .dots .dot {
        z-index: 50 !important;
    }
    
    /* Индикатор прокрутки на iOS */
    .scroll-indicator {
        z-index: 50 !important;
    }
} 

/* ПРИНУДИТЕЛЬНОЕ СКРЫТИЕ КАТЕГОРИЙ МЕНЮ НА МОБИЛЬНЫХ УСТРОЙСТВАХ */
@media (max-width: 768px) {
    .era-basket__modal[style*="display: flex"] ~ .cat-nav,
    .era-basket__modal[style*="display: flex"] ~ .dots,
    .era-basket__modal[style*="display: flex"] ~ .scroll-indicator,
    .era-basket__modal[style*="display: flex"] ~ .menu-container .cat-nav,
    .era-basket__modal[style*="display: flex"] ~ .menu-container .dots,
    .era-basket__modal[style*="display: flex"] ~ .menu-container .scroll-indicator {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        z-index: -1 !important;
        transform: translateY(-100%) !important;
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }
    
    /* ПРИНУДИТЕЛЬНОЕ СКРЫТИЕ КАТЕГОРИЙ МЕНЮ С ВЫСОКИМ Z-INDEX НА МОБИЛЬНЫХ */
    .era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 99999"],
    .era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 999999"],
    .era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 999998"] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        z-index: -1 !important;
        transform: translateY(-100%) !important;
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }
}

/* ПРИНУДИТЕЛЬНОЕ СКРЫТИЕ КАТЕГОРИЙ МЕНЮ НА iOS УСТРОЙСТВАХ */
@supports (-webkit-touch-callout: none) {
    .era-basket__modal[style*="display: flex"] ~ .cat-nav,
    .era-basket__modal[style*="display: flex"] ~ .dots,
    .era-basket__modal[style*="display: flex"] ~ .scroll-indicator,
    .era-basket__modal[style*="display: flex"] ~ .menu-container .cat-nav,
    .era-basket__modal[style*="display: flex"] ~ .menu-container .dots,
    .era-basket__modal[style*="display: flex"] ~ .menu-container .scroll-indicator {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        z-index: -1 !important;
        transform: translateY(-100%) !important;
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }
    
    /* ПРИНУДИТЕЛЬНОЕ СКРЫТИЕ КАТЕГОРИЙ МЕНЮ С ВЫСОКИМ Z-INDEX НА iOS */
    .era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 99999"],
    .era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 999999"],
    .era-basket__modal[style*="display: flex"] ~ .cat-nav[style*="z-index: 999998"] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        z-index: -1 !important;
        transform: translateY(-100%) !important;
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }
} 