/* ===== media-header.css (исправленная версия для мобильного меню) ===== */

/* Планшеты (до 1024px) */
@media (max-width: 1024px) {
    #ast-desktop-header {
        display: none;
    }

    #ast-mobile-header {
        display: block;
        background: white;
        box-shadow: var(--shadow-sm);
        position: sticky;
        top: 0;
        z-index: 1000;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.98);
    }

    .ast-primary-header-bar {
        padding: 0.5rem 1rem;
    }

    /* Адаптивные стили логотипа */
    .site-branding {
        padding: 0.25rem 0;
    }

    .custom-logo {
        height: 50px !important;
        max-width: 88px !important;
        transition: all 0.2s ease;
    }

    /* Кнопка бургер-меню */
    .ast-button-wrap .menu-toggle {
        background: transparent !important;
        border: none !important;
        color: var(--header-text) !important;
        border-radius: 12px;
        padding: 0.75rem !important;
        transition: background 0.2s ease;
    }

    .ast-button-wrap .menu-toggle:hover {
        background: rgba(67, 97, 238, 0.08) !important;
    }

    .ast-mobile-menu-trigger-minimal {
        font-size: 1.5rem;
    }

    /* Выпадающее меню (мобильное) */
    .ast-mobile-header-content {
        background: white;
        border-top: 1px solid var(--border-color);
        box-shadow: var(--shadow-hover);
        padding: 1rem 0;
        max-height: 80vh;
        overflow-y: auto;
        display: none; /* По умолчанию скрыто */
    }

    /* Показываем меню когда чекбокс отмечен (если есть) */
    /* Альтернатива: через :target или JS, но это уже зависит от структуры */
    
    #ast-hf-mobile-menu {
        flex-direction: column;
        width: 100%;
        padding: 0 1rem;
        list-style: none;
        margin: 0;
    }

    #ast-hf-mobile-menu .menu-item {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
        position: relative;
    }

    #ast-hf-mobile-menu .menu-item:last-child {
        border-bottom: none;
    }

    #ast-hf-mobile-menu .menu-link {
        padding: 1rem 0.5rem !important;
        color: var(--header-text);
        font-weight: 500;
        font-size: 1.1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: color 0.2s ease;
        text-decoration: none;
    }

    #ast-hf-mobile-menu .menu-link:hover {
        color: var(--accent-color);
    }
/* ===== ПОЛНОСТЬЮ ИСПРАВЛЕННЫЙ БЛОК ДЛЯ МОБИЛЬНОГО МЕНЮ ===== */

#ast-hf-mobile-menu .menu-item-has-children {
    position: relative;
}

/* Кнопка меню - без фона */
#ast-hf-mobile-menu .ast-menu-toggle {
    position: absolute;
    right: 0.5rem;
    top: 0.5rem;
    background: transparent;
    border: none;
    color: var(--header-text);
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    outline: none !important;
}

/* Убираем фон при наведении */
#ast-hf-mobile-menu .ast-menu-toggle:hover {
    background: transparent;
}

#ast-hf-mobile-menu .ast-menu-toggle:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Иконка стрелки - базовое состояние */
#ast-hf-mobile-menu .ast-menu-toggle .ast-icon.icon-arrow svg {
    transform: rotate(0deg);
    transition: transform 0.2s ease;
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Подменю скрыто по умолчанию */
#ast-hf-mobile-menu .menu-item-has-children .sub-menu {
    display: none;
}

/* При фокусе на родителе - показываем подменю */
#ast-hf-mobile-menu .menu-item-has-children:focus-within > .sub-menu {
    display: block;
}

/* При фокусе на родителе - поворачиваем стрелку */
#ast-hf-mobile-menu .menu-item-has-children:focus-within > .ast-menu-toggle .ast-icon.icon-arrow svg {
    transform: rotate(180deg);
}

/* Для поддержки активного класса, если он есть */
#ast-hf-mobile-menu .menu-item-has-children.active > .ast-menu-toggle .ast-icon.icon-arrow svg {
    transform: rotate(180deg);
}

    /* Контакты в мобильном меню */
    .ast-mobile-header-content .ast-header-html-2 {
        display: block;
        padding: 1rem;
        border-top: 1px solid var(--border-color);
        margin-top: 0.5rem;
    }

    .ast-mobile-header-content .ast-header-html-2 p {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        text-align: left;
    }

    .ast-mobile-header-content .ast-header-html-2 a {
        white-space: normal;
        word-break: break-all;
        text-decoration: none;
        color: var(--header-text);
    }

    .ast-mobile-header-content .ast-header-html-2 a[href^="tel"] {
        display: inline-block;
        width: fit-content;
        white-space: nowrap;
        background: rgba(67, 97, 238, 0.08);
        padding: 0.5rem 1.2rem;
        border-radius: 50px;
        color: var(--accent-color);
        font-weight: 600;
    }
}

/* Смартфоны (до 768px) */
@media (max-width: 768px) {
    .ast-primary-header-bar {
        padding: 0.25rem 0.75rem;
    }

    .custom-logo {
        height: 42px !important;
        max-width: 74px !important;
    }

    .ast-header-html-1 .ast-builder-html-element p {
        display: none;
    }

    #ast-hf-mobile-menu .menu-link {
        font-size: 1rem;
        padding: 0.9rem 0.5rem !important;
    }

    #ast-hf-mobile-menu .sub-menu .menu-link {
        font-size: 0.95rem;
        padding: 0.7rem 1rem !important;
    }
}

/* Очень маленькие смартфоны (до 480px) */
@media (max-width: 480px) {
    .custom-logo {
        height: 35px !important;
        max-width: 62px !important;
    }

    .ast-button-wrap .menu-toggle {
        padding: 0.5rem !important;
    }
}