/* ============================================================
 * БАЗА
 * ============================================================ */
.mobile-menu-toggle,
.mobile-menu-close,
.mobile-menu-overlay { display: none; }

/* ============================================================
 * DESKTOP ≥ 990px
 * ============================================================ */
@media (min-width: 990px) {

    /* Прячем штатный Enfold-хедер, сдвигаем контент */
    #header { display: none !important; }
    #main   { padding-top: 0 !important; }

    html body {
        padding-left: 300px !important;
        overflow-x: hidden;
    }
    html body #wrap_all {
        max-width: calc(100vw - 300px) !important;
        width:     calc(100vw - 300px) !important;
    }
    html body #wrap_all .container_wrap,
    html body #wrap_all .avia-section,
    html body #wrap_all .av-layout-grid-container {
        max-width: 100% !important;
    }

    /* ====== Сайдбар ====== */
    .custom-side-menu {
        position: fixed;
        top: 0; left: 0;
        width: 300px;
        height: 100vh;
        background: #1a1a2e;
        color: #fff;
        z-index: 9999;
        overflow-y: auto;
        overflow-x: hidden; /* подменю fixed, за пределы не уходит */
    }
    .side-menu-inner {
        display: flex;
        flex-direction: column;
        min-height: 100%;
        padding: 40px 22px;
    }

    /* Логотип */
    .side-menu-logo { text-align: center; margin-bottom: 34px; }
    .side-menu-logo img {
        max-width: 200px;
        height: auto;
        display: inline-block;
        /* логотип тёмный на тёмном — осветляем до белого */
        filter: brightness(0) invert(1);
        opacity: 0.95;
    }
    .side-menu-subtitle {
        margin: 14px 0 0;
        font-size: 11px;
        letter-spacing: 2px;
        text-transform: uppercase;
        color: #9aa0a6;
    }

    /* ====== Меню ====== */
    .side-menu-nav { flex: 1 1 auto; }
    .side-menu-list,
    .side-menu-list .sub-menu {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .side-menu-list > li { margin-bottom: 4px; position: relative; }

    .side-menu-list > li > a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 14px;
        text-decoration: none;
        border-radius: 8px;
        transition: background .2s, color .2s;
        position: relative;
    }
    /* Иконка */
    .side-menu-list > li > a .menu-icon {
        display: inline-flex;
        width: 20px; height: 20px;
        flex-shrink: 0;
        color: #e94560;
        opacity: 0.95;
    }
    .side-menu-list > li > a .menu-icon svg { width: 100%; height: 100%; display: block; }
    .side-menu-list > li > a .menu-text { flex: 1 1 auto; }

    /* Индикатор «есть подменю» */
    .side-menu-list .menu-item-has-children > a::after {
        content: '';
        width: 6px; height: 6px;
        border-right: 2px solid currentColor;
        border-top: 2px solid currentColor;
        transform: rotate(45deg);
        opacity: 0.5;
        margin-left: 8px;
        flex-shrink: 0;
        transition: opacity .2s;
    }
    .side-menu-list .menu-item-has-children:hover > a::after { opacity: 1; }

    /* ПЕРВЫЕ 4 пункта — стиль A */
    .side-menu-list > li:nth-child(-n+4) > a {
        font-size: 15px;
        font-weight: 600;
        color: #fff;
        background: rgba(255,255,255,0.06);
    }
    .side-menu-list > li:nth-child(-n+4) > a:hover {
        background: rgba(255,255,255,0.15);
    }
    /* ОСТАЛЬНЫЕ — стиль B */
    .side-menu-list > li:nth-child(n+5) > a {
        font-size: 14px;
        color: #9aa0a6;
    }
    .side-menu-list > li:nth-child(n+5) > a:hover {
        color: #fff;
        background: rgba(255,255,255,0.06);
    }

    /* Активный пункт */
    .side-menu-list > li.current-menu-item > a,
    .side-menu-list > li.current-menu-ancestor > a {
        color: #e94560 !important;
    }

    /* ====== ФЛАЙАУТ-ПОДМЕНЮ ====== */
    .side-menu-list .sub-menu {
        display: none;
        position: fixed;                /* вылетает за пределы сайдбара */
        min-width: 250px;
        max-width: 340px;
        max-height: calc(100vh - 20px);
        overflow-y: auto;
        background: #232340;
        color: #fff;
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 10px;
        box-shadow: 0 12px 40px rgba(0,0,0,0.4);
        padding: 8px;
        z-index: 10000;
        animation: flyoutFade .15s ease;
    }
    .side-menu-list .sub-menu.is-visible { display: block; }
    @keyframes flyoutFade {
        from { opacity: 0; transform: translateX(-6px); }
        to   { opacity: 1; transform: translateX(0); }
    }

    .side-menu-list .sub-menu li { margin: 0; }
    .side-menu-list .sub-menu li a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 9px 14px;
        font-size: 13px;
        color: #b0b5ba;
        text-decoration: none;
        border-radius: 6px;
        white-space: normal;
        transition: background .15s, color .15s;
    }
    .side-menu-list .sub-menu li a:hover {
        color: #fff;
        background: rgba(255,255,255,0.08);
    }
    /* Вложенный уровень — тоже индикатор */
    .side-menu-list .sub-menu .menu-item-has-children > a::after {
        content: '';
        width: 5px; height: 5px;
        border-right: 2px solid currentColor;
        border-top: 2px solid currentColor;
        transform: rotate(45deg);
        opacity: 0.5;
        flex-shrink: 0;
    }
    .side-menu-list .sub-menu .menu-item-has-children:hover > a::after { opacity: 1; }

    /* ====== Контакты внизу ====== */
    .side-menu-contacts {
        margin-top: 28px;
        padding-top: 22px;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    .side-menu-phone {
        display: block;
        margin-bottom: 16px;
        color: #fff;
        font-size: 17px;
        font-weight: 600;
        text-decoration: none;
    }
    .side-menu-social { display: flex; gap: 8px; margin-bottom: 18px; }
    .side-menu-social a {
        display: flex; align-items: center; justify-content: center;
        width: 38px; height: 38px;
        border-radius: 50%;
        background: rgba(255,255,255,0.08);
        color: #fff;
        transition: background .2s;
    }
    .side-menu-social a:hover { background: rgba(255,255,255,0.2); }

    .side-menu-contact-btn {
        width: 100%;
        padding: 13px;
        background: #e94560;
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        transition: background .2s;
    }
    .side-menu-contact-btn:hover { background: #d63751; }
}

/* ============================================================
 * MOBILE ≤ 989px
 * ============================================================ */
@media (max-width: 989px) {

    /* Гамбургер */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        position: fixed;
        top: 14px; left: 14px;
        width: 44px; height: 44px;
        background: #1a1a2e;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        z-index: 10001;
        box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    }
    .mobile-menu-toggle span {
        display: block;
        width: 22px; height: 2px;
        background: #fff;
        border-radius: 2px;
    }

    /* Оверлей */
    .mobile-menu-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s;
        z-index: 10000;
    }
    body.mobile-menu-open .mobile-menu-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    /* Drawer */
    .custom-side-menu {
        position: fixed;
        top: 0; left: 0;
        width: 300px;
        max-width: 88vw;
        height: 100vh;
        background: #1a1a2e;
        color: #fff;
        z-index: 10002;
        transform: translateX(-100%);
        transition: transform .3s ease;
        overflow-y: auto;
    }
    body.mobile-menu-open .custom-side-menu {
        transform: translateX(0);
    }

    .mobile-menu-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 12px; right: 12px;
        width: 36px; height: 36px;
        background: rgba(255,255,255,0.1);
        border: none;
        border-radius: 50%;
        color: #fff;
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
        z-index: 10003;
    }

    .side-menu-inner { padding: 56px 18px 30px; }
    .side-menu-logo { text-align: center; margin-bottom: 26px; }
    .side-menu-logo img {
        max-width: 180px; height: auto;
        filter: brightness(0) invert(1);
        opacity: 0.95;
    }
    .side-menu-subtitle {
        margin: 10px 0 0;
        font-size: 10px;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        color: #9aa0a6;
    }

    .side-menu-list,
    .side-menu-list .sub-menu {
        list-style: none; margin: 0; padding: 0;
    }
    .side-menu-list > li { margin-bottom: 2px; }
    .side-menu-list > li > a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        text-decoration: none;
        border-radius: 8px;
        color: #fff;
        font-size: 15px;
    }
    .side-menu-list > li > a .menu-icon {
        display: inline-flex;
        width: 20px; height: 20px;
        color: #e94560;
        flex-shrink: 0;
    }
    .side-menu-list > li > a .menu-icon svg { width: 100%; height: 100%; display: block; }
    .side-menu-list > li > a .menu-text { flex: 1 1 auto; }

    .side-menu-list > li:nth-child(-n+4) > a {
        font-weight: 600;
        background: rgba(255,255,255,0.06);
    }

    /* Индикатор-стрелка */
    .side-menu-list .menu-item-has-children > a::after {
        content: '';
        width: 7px; height: 7px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg) translateY(-2px);
        opacity: 0.5;
        flex-shrink: 0;
        transition: transform .2s;
    }
    .side-menu-list .menu-item-has-children.is-open > a::after {
        transform: rotate(-135deg) translateY(-2px);
        opacity: 1;
    }

    /* Аккордеон на мобильных */
    .side-menu-list .sub-menu {
        display: none;
        margin: 4px 0 8px;
        padding-left: 16px;
        border-left: 2px solid rgba(255,255,255,0.1);
    }
    .side-menu-list .menu-item-has-children.is-open > .sub-menu {
        display: block;
    }
    .side-menu-list .sub-menu a {
        display: block;
        padding: 10px 14px;
        font-size: 14px;
        color: #b0b5ba;
        text-decoration: none;
        border-radius: 6px;
    }
    .side-menu-list .sub-menu .sub-menu {
        margin-left: 8px;
        padding-left: 12px;
    }

    /* Контакты */
    .side-menu-contacts {
        margin-top: 24px;
        padding-top: 20px;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    .side-menu-phone {
        display: block;
        margin-bottom: 14px;
        color: #fff;
        font-size: 17px;
        font-weight: 600;
        text-decoration: none;
    }
    .side-menu-social { display: flex; gap: 8px; margin-bottom: 16px; }
    .side-menu-social a {
        display: flex; align-items: center; justify-content: center;
        width: 38px; height: 38px;
        border-radius: 50%;
        background: rgba(255,255,255,0.08);
        color: #fff;
    }
    .side-menu-contact-btn {
        width: 100%;
        padding: 13px;
        background: #e94560;
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
    }

    /* Плавающая «Связаться» — смещаем вниз, чтобы не мешала гамбургеру */
    .mobile-contact-btn {
        position: fixed;
        bottom: 20px; right: 20px;
        padding: 13px 22px;
        background: #e94560;
        color: #fff;
        border: none;
        border-radius: 50px;
        font-size: 15px;
        font-weight: 600;
        box-shadow: 0 6px 24px rgba(233,69,96,0.4);
        cursor: pointer;
        z-index: 9999;
    }
}

/* ============================================================
 * POPUP (общий)
 * ============================================================ */
.contact-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
}
.contact-popup.is-open { display: flex; }

.contact-popup-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
}
.contact-popup-box {
    position: relative;
    background: #fff;
    padding: 40px;
    border-radius: 14px;
    max-width: 480px;
    width: calc(100% - 40px);
    z-index: 1;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.contact-popup-box h3 { margin: 0 0 8px; font-size: 22px; }
.contact-popup-box p  { margin: 0 0 22px; color: #666; font-size: 14px; }

.contact-popup-close {
    position: absolute;
    top: 10px; right: 14px;
    background: none; border: none;
    font-size: 28px; line-height: 1;
    color: #999; cursor: pointer;
}
.contact-popup-close:hover { color: #000; }

.contact-popup-form input,
.contact-popup-form textarea {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
}
.contact-popup-form textarea { min-height: 90px; resize: vertical; }
.contact-popup-form button {
    width: 100%;
    padding: 14px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.contact-popup-form button:hover { background: #d63751; }