/* Мобильная оптимизация для ресторана ЭРА */

/* Улучшенная поддержка touch-устройств */
@media (pointer: coarse) {
    /* Увеличиваем размеры кнопок для удобства нажатия */
    button, 
    .era-more-btn, 
    .banquet-era-btn,
    .dish button {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    /* Компактные кнопки навигации для мобильных устройств */
    .cat-nav a,
    .cat-nav select {
        min-height: auto;
        min-width: auto;
        touch-action: manipulation;
        padding: 4px 10px;
    }
    
    /* Убираем hover-эффекты на touch-устройствах */
    .slider-arrow:hover,
    .menu-card a:hover,
    .era-more-btn:hover,
    .banquet-era-btn:hover,
    .header-menu a:hover,
    .contacts-social a:hover,
    .dish:hover,
    .dish button:hover,
    .cat-nav a:hover,
    .cat-nav select:hover,
    .dot:hover,
    .modal-close:hover {
        transform: none;
        box-shadow: inherit;
        background: inherit;
        color: inherit;
    }
}

/* Оптимизация для устройств с высоким DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .header-logo img,
    .slider-slide img,
    .dish img,
    .menu-era-img,
    .banquet-era-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Улучшенная доступность */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .slider-track,
    .about-carousel-track {
        transition: none !important;
    }
}

/* Поддержка темной темы (если понадобится в будущем) */
@media (prefers-color-scheme: dark) {
    /* Пока оставляем светлую тему */
}

/* Оптимизация для устройств с ограниченной цветовой палитрой */
@media (prefers-contrast: high) {
    .era-more-btn,
    .banquet-era-btn,
    .dish button {
        border-width: 2px;
    }
    
    .slider-arrow {
        border-width: 2px;
    }
}

/* Улучшенная поддержка жестов */
@media (pointer: coarse) {
    /* Улучшенная прокрутка */
    .menu-container,
    .about-carousel-track {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Улучшенные точки навигации */
    .dots {
        gap: 8px;
    }
    
    .dot {
        width: 8px;
        height: 8px;
        min-width: 8px;
        min-height: 8px;
    }
}

/* ОПТИМИЗАЦИЯ КОРЗИНЫ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ */
@media (max-width: 768px) {
    /* Кнопка корзины */
    #era-order-basket {
        position: fixed !important;
        right: 20px !important;
        bottom: 20px !important;
        z-index: 100 !important;
    }
    
    .era-basket-btn_outline {
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        min-height: 60px !important;
        background: #fff !important;
        border: 1px solid #454545 !important;
        border-radius: 50% !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.3s ease !important;
        touch-action: manipulation !important;
    }
    
    .era-basket-btn_outline:hover {
        transform: scale(1.05) !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
    }
    
    .era-basket__icon {
        width: 28px !important;
        height: 28px !important;
        background: url('../images/era_basket.svg') no-repeat center/contain !important;
    }
    
    .era-basket__amount {
        position: absolute !important;
        top: 2px !important;
        right: 2px !important;
        background: #b48a4a !important;
        color: #fff !important;
        border-radius: 50% !important;
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        min-height: 20px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        line-height: 1 !important;
    }
    
    /* Мини-виджет корзины */
    .era-basket__mini {
        position: fixed !important;
        bottom: 90px !important;
        right: 20px !important;
        background: #fff !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
        padding: 12px !important;
        min-width: 200px !important;
        max-width: 280px !important;
        z-index: 99 !important;
        display: none !important;
    }
    
    /* Модальное окно корзины */
    .era-basket__modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 9999999 !important;
        display: none !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }
    
    .era-basket__modal-content {
        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: 20px 16px !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        z-index: 9999999 !important;
    }
    
    .era-basket__close {
        position: absolute !important;
        right: 16px !important;
        top: 16px !important;
        background: rgba(255, 255, 255, 0.9) !important;
        border: 1px solid #ddd !important;
        border-radius: 50% !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 18px !important;
        color: #666 !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.2s ease !important;
        z-index: 10 !important;
        touch-action: manipulation !important;
    }
    
    .era-basket__close:hover {
        background: #f5f5f5 !important;
        color: #333 !important;
        border-color: #999 !important;
    }
}

/* ОПТИМИЗАЦИЯ КОРЗИНЫ ДЛЯ МАЛЕНЬКИХ ЭКРАНОВ */
@media (max-width: 480px) {
    #era-order-basket {
        right: 15px !important;
        bottom: 15px !important;
    }
    
    .era-basket-btn_outline {
        width: 55px !important;
        height: 55px !important;
        min-width: 55px !important;
        min-height: 55px !important;
    }
    
    .era-basket__icon {
        width: 26px !important;
        height: 26px !important;
    }
    
    .era-basket__amount {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        min-height: 18px !important;
        font-size: 10px !important;
        top: 1px !important;
        right: 1px !important;
    }
    
    .era-basket__modal-content {
        padding: 16px 12px !important;
        max-height: 85vh !important;
    }
    
    .era-basket__close {
        right: 12px !important;
        top: 12px !important;
        width: 28px !important;
        height: 28px !important;
        font-size: 16px !important;
    }
}

/* ОПТИМИЗАЦИЯ КОРЗИНЫ ДЛЯ ОЧЕНЬ МАЛЕНЬКИХ ЭКРАНОВ */
@media (max-width: 360px) {
    #era-order-basket {
        right: 10px !important;
        bottom: 10px !important;
    }
    
    .era-basket-btn_outline {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
    }
    
    .era-basket__icon {
        width: 24px !important;
        height: 24px !important;
    }
    
    .era-basket__amount {
        width: 16px !important;
        height: 16px !important;
        min-width: 16px !important;
        min-height: 16px !important;
        font-size: 9px !important;
        top: 0px !important;
        right: 0px !important;
    }
    
    .era-basket__modal-content {
        padding: 12px 8px !important;
        max-height: 80vh !important;
        width: 98vw !important;
        max-width: 98vw !important;
    }
    
    .era-basket__close {
        right: 8px !important;
        top: 8px !important;
        width: 24px !important;
        height: 24px !important;
        font-size: 14px !important;
    }
}

/* ОПТИМИЗАЦИЯ КОРЗИНЫ ДЛЯ iOS */
@supports (-webkit-touch-callout: none) {
    .era-basket-btn_outline {
        -webkit-tap-highlight-color: transparent !important;
    }
    
    .era-basket__modal-content {
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }
    
    .era-basket__close {
        -webkit-tap-highlight-color: transparent !important;
    }
}

/* Оптимизация для устройств с маленьким экраном */
@media (max-width: 320px) {
    .header-menu a {
        font-size: 12px;
        padding: 4px 6px;
    }
    
    .header-logo img {
        height: 20px;
        min-width: 50px;
    }
    
    .header-phone a {
        font-size: 12px;
    }
    
    .header-social a {
        width: 22px;
        height: 22px;
    }
    
    .header-social a img,
    .header-social a svg {
        width: 22px !important;
        height: 22px !important;
    }
    
    .slider-main,
    .slider-slide {
        height: 120px;
    }
    
    .slider-arrow {
        width: 28px;
        height: 28px;
        font-size: 0.8em;
    }
    
    .menu-era-artboard {
        margin: 8px 4px 16px 4px;
    }
    
    .menu-era-img {
        min-height: 100px;
    }
    
    .menu-era-content {
        padding: 8px 4px;
    }
    
    .menu-era-title {
        font-size: 16px;
        margin-bottom: 4px;
    }
    
    .menu-era-desc {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .era-more-btn {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .about-section-era,
    .banquet-era-row,
    .contacts-block-era {
        margin: 16px 4px;
    }
    
    .about-era-title,
    .banquet-era-title,
    .contacts-era-title {
        font-size: 16px;
        margin-bottom: 6px;
    }
    
    .about-era-desc,
    .banquet-era-desc,
    .contacts-era-address,
    .contacts-era-time,
    .contacts-era-phone {
        font-size: 11px;
    }
    
    .era-more-btn,
    .banquet-era-btn {
        font-size: 11px;
        padding: 6px 8px;
    }
    
    .contacts-era-social a img,
    .contacts-era-social a svg {
        width: 18px !important;
        height: 18px !important;
    }
}

/* Оптимизация для устройств с большим экраном */
@media (min-width: 1600px) {
    .header-grid {
        max-width: 1400px;
    }
    
    .slider-wrap {
        max-width: 1400px;
    }
    
    .menu-era-artboard {
        max-width: 1400px;
    }
    
    .banquet-era-row {
        max-width: 1400px;
    }
    
    .contacts-era-row {
        max-width: 1400px;
    }
    
    .container {
        max-width: 1400px;
    }
}

/* Улучшенная поддержка ландшафтной ориентации на планшетах */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .header {
        min-height: 70px;
    }
    
    .header-grid {
        min-height: 70px;
    }
    
    .slider-main,
    .slider-slide {
        height: 300px;
    }
    
    .menu-era-img {
        min-height: 200px;
    }
    
    .banquet-era-img {
        min-height: 200px;
    }
    
    .menu-container {
        height: calc(100vh - 150px); /* Увеличиваем высоту для планшетов */
        min-height: 400px;
    }
}

/* Оптимизация для устройств с поддержкой hover */
@media (hover: hover) and (pointer: fine) {
    .slider-arrow:hover {
        background: #f0f0f0;
        transform: translateY(-50%) scale(1.05);
    }
    
    .menu-card a:hover {
        background: #b48a4a;
        color: #fff;
        transform: translateY(-2px);
    }
    
    .era-more-btn:hover,
    .banquet-era-btn:hover {
        background: #454545;
        color: #fff;
        transform: translateY(-1px);
    }
    
    .header-menu a:hover {
        color: #b48a4a;
        transform: translateY(-1px);
    }
    
    .contacts-social a:hover {
        background: #b48a4a;
        color: #fff;
        transform: scale(1.1);
    }
    
    .dish:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    }
    
    .dish button:hover {
        background: #454545;
        transform: translateY(-1px);
    }
    
    .cat-nav a:hover,
    .cat-nav select:hover {
        background: #f0f0f0;
        transform: translateY(-1px);
    }
    
    .dot:hover {
        background: #454545;
        transform: scale(1.2);
    }
    
    .modal-close:hover {
        background: #f0f0f0;
        transform: scale(1.1);
    }
}

/* Улучшенная поддержка фокуса для доступности */
*:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Для accessibility - добавляем альтернативную индикацию фокуса */
*:focus-visible {
    outline: 2px solid #454545 !important;
    outline-offset: 2px !important;
}

/* Оптимизация для устройств с ограниченной полосой пропускания */
@media (prefers-reduced-data: reduce) {
    .slider-slide img,
    .dish img,
    .menu-era-img,
    .banquet-era-img {
        loading: lazy;
    }
}

/* Улучшенная поддержка печати */
@media print {
    .header,
    .slider-wrap,
    .menu-era-artboard,
    #era-order-basket,
    #delivery-type-bar,
    .dots,
    .cat-nav {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }
    
    .about-section-era,
    .banquet-era-row,
    .contacts-block-era {
        margin: 20pt 0;
        page-break-inside: avoid;
    }
    
    .about-era-title,
    .banquet-era-title,
    .contacts-era-title {
        font-size: 18pt;
        margin-bottom: 10pt;
    }
    
    .about-era-desc,
    .banquet-era-desc,
    .contacts-era-address,
    .contacts-era-time,
    .contacts-era-phone {
        font-size: 12pt;
    }
} 

/* Мобильная версия header */
@media (max-width: 768px) {
    .header {
        background: #fff !important;
        color: #454545 !important;
        padding: 0 !important;
    }
    
    .header-grid {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 1rem !important;
        position: relative !important;
    }
    
    .header-mobile {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding: 0 !important;
    }
    
    .header-logo-mobile {
        flex: 0 0 auto !important;
        display: flex !important;
        justify-content: flex-start !important;
    }
    
    .header-logo-mobile img {
        height: 40px !important;
        width: auto !important;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        width: 6px !important;
        height: 4px !important;
        background: none !important;
        border: none !important;
        cursor: pointer !important;
        padding: 0 !important;
        z-index: 1001 !important;
        margin-left: auto !important;
        margin-right: 0 !important;
        flex-shrink: 0 !important;
    }
    
    .mobile-menu-toggle span {
        display: block !important;
        width: 100% !important;
        height: 1px !important;
        background: #454545 !important;
        border-radius: 0.5px !important;
        transition: all 0.3s ease !important;
    }
    
    /* Скрываем десктопные элементы */
    .desktop-menu,
    .desktop-logo,
    .desktop-right {
        display: none !important;
    }
} 

/* Мобильная версия header */
@media (max-width: 768px) {
    /* Скрываем десктопную версию */
    .desktop-menu,
    .desktop-logo,
    .desktop-right {
        display: none !important;
    }
    
    /* Показываем мобильную версию */
    .header-mobile {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding: 0 !important;
    }
    
    .header-logo-mobile {
        flex: 1 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    .header-logo-mobile img {
        height: 40px !important;
        width: auto !important;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        width: 6px !important;
        height: 4px !important;
        background: none !important;
        border: none !important;
        cursor: pointer !important;
        padding: 0 !important;
        z-index: 1001 !important;
        margin-left: auto !important;
        margin-right: 0 !important;
        flex-shrink: 0 !important;
    }
    
    .mobile-menu-toggle span {
        display: block !important;
        width: 100% !important;
        height: 1px !important;
        background: #454545 !important;
        border-radius: 0.5px !important;
        transition: all 0.3s ease !important;
    }
    
    /* Мобильное меню */
    .mobile-menu {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        width: 100% !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.9) !important;
        z-index: 1000 !important;
        transition: left 0.3s ease !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    .mobile-menu.active {
        left: 0 !important;
    }
    
    .mobile-menu-close {
        position: absolute !important;
        top: 20px !important;
        right: 20px !important;
        background: none !important;
        border: none !important;
        color: white !important;
        font-size: 24px !important;
        cursor: pointer !important;
    }
    
    .mobile-menu ul {
        list-style: none !important;
        padding: 0 !important;
        margin: 0 !important;
        text-align: center !important;
    }
    
    .mobile-menu li {
        margin: 20px 0 !important;
    }
    
    .mobile-menu a {
        color: white !important;
        text-decoration: none !important;
        font-size: 24px !important;
        font-weight: 500 !important;
    }
    
    .mobile-menu-social {
        margin-top: 40px !important;
        display: flex !important;
        gap: 20px !important;
    }
    
    .mobile-menu-social a {
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border-radius: 50% !important;
    }
    
    .mobile-menu-social img {
        width: 24px !important;
        height: 24px !important;
        filter: brightness(0) invert(1) !important;
    }
}

/* Десктопная версия */
@media (min-width: 769px) {
    .header-mobile {
        display: none !important;
    }
    
    .desktop-menu,
    .desktop-logo,
    .desktop-right {
        display: block !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;
    }
    
    /* Дополнительное скрытие всех элементов навигации при открытой корзине */
    .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;
    }
    
    /* Принудительное скрытие всех элементов навигации при открытой корзине */
    .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 при открытой корзине */
    .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"],
    .era-basket__modal[style*="display: flex"] ~ #scrollToTopBtn {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !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;
    }
    
    /* Дополнительное скрытие всех элементов навигации при открытой корзине */
    .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;
    }
    
    /* Принудительное скрытие всех элементов навигации при открытой корзине */
    .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 при открытой корзине */
    .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"],
    .era-basket__modal[style*="display: flex"] ~ #scrollToTopBtn {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}