/* ============================================================
   JW: Боковое меню в шапке — jw-sidemenu.css
   Все стили изолированы префиксом .jw-sidemenu-
   Применяется на все размеры экранов
   ============================================================ */

/* ---------- Overlay ---------- */
.jw-sidemenu-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none; /* скрыт без display:none — transition на opacity работает */
    transition: opacity 0.3s ease;
}

.jw-sidemenu-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Панель ---------- */
.jw-sidemenu-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    width: 455px;
    max-width: 100vw;
    height: 100dvh;
    height: 100vh; /* fallback */
    background: #ffffff;
    border-radius: 20px 0 0 20px;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.jw-sidemenu-panel.is-open {
    transform: translateX(0);
}

/* ---------- Шапка панели ---------- */
.jw-sidemenu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 30px 20px 20px 20px;
    flex-shrink: 0;
}

.jw-sidemenu-logo {
    display: flex;
    align-items: center;
}

.jw-sidemenu-logo__img {
    max-height: 82px;
    width: auto;
    display: block;
}

.jw-sidemenu-logo__text {
    font-size: 20px;
    font-weight: 700;
    color: var(--jv-text-primary);
    text-decoration: none;
}

/* Кнопка закрыть */
.jw-sidemenu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--jv-primary);
    border-radius: 8px;
    background: none;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.6);
    padding: 0;
    flex-shrink: 0;
    transition: border-color 0.2s, color 0.2s;
}

.jw-sidemenu-close:hover {
    border-color: rgba(0, 0, 0, 0.5);
    color: rgba(0, 0, 0, 0.9);
}

.jw-sidemenu-close svg {
    display: block;
}

/* ---------- Тело панели (прокрутка) ---------- */
.jw-sidemenu-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 20px 10px;
    -webkit-overflow-scrolling: touch;
}

/* Скроллбар — тонкий */
.jw-sidemenu-body::-webkit-scrollbar {
    width: 4px;
}

.jw-sidemenu-body::-webkit-scrollbar-track {
    background: transparent;
}

.jw-sidemenu-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

/* ---------- Список категорий ---------- */
.jw-sidemenu-categories {
    list-style: none;
    margin: 0 10px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ---------- Элемент категории ---------- */
.jw-sidemenu-category {
    margin: 0;
    padding: 0;
}

/* Строка категории */
.jw-sidemenu-category-row {
    display: flex;
    align-items: center;
}

/* Кнопка-тогл для категорий с детьми (само название становится кнопкой) */
.jw-sidemenu-category-toggle {
    flex: 1;
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    font-weight: 500;
    font-style: normal;
    font-size: 18px;
    line-height: 100%;
    letter-spacing: 0;
    color: rgba(0, 0, 0, 0.6);
    transition: color 0.2s;
}

/* Ссылка для категорий без детей */
.jw-sidemenu-category-link {
    flex: 1;
    display: block;
    font-weight: 500;
    font-style: normal;
    font-size: 18px;
    line-height: 100%;
    letter-spacing: 0;
    color: rgba(0, 0, 0, 0.6);
    text-decoration: none;
    transition: color 0.2s;
}

.jw-sidemenu-category-link:hover {
    color: rgba(0, 0, 0, 0.9);
    text-decoration: none;
}

/* Открытая (развёрнутая) категория — название темнее */
.jw-sidemenu-category.is-open > .jw-sidemenu-category-row .jw-sidemenu-category-toggle {
    color: rgba(0, 0, 0, 1);
}

.jw-sidemenu-category-toggle:hover {
    color: rgba(0, 0, 0, 0.9);
}

/* ---------- Подкатегории ---------- */
.jw-sidemenu-subcategories {
    list-style: disc;
    margin: 10px 0 0 18px;
    padding: 0;
    display: none; /* скрыты по умолчанию */
}

.jw-sidemenu-category.is-open > .jw-sidemenu-subcategories {
    display: block;
}

.jw-sidemenu-subcategory {
    margin: 0;
    padding: 0;
}

/* Точки перечисления — через нативный list-style, цвет через color */
.jw-sidemenu-subcategories {
    color: rgba(0, 0, 0, 0.6);
}

.jw-sidemenu-subcategory a {
    display: inline;
    font-weight: 500;
    font-style: normal;
    font-size: 17px;
    line-height: 160%;
    letter-spacing: 0;
    color: rgba(0, 0, 0, 0.6);
    text-decoration: none;
    transition: color 0.2s;
}

.jw-sidemenu-subcategory a:hover {
    color: rgba(0, 0, 0, 0.9);
    text-decoration: none;
}

/* ---------- Подвал панели ---------- */
.jw-sidemenu-footer {
    flex-shrink: 0;
    padding: 16px 20px 20px;
    /* border-top: 1px solid rgba(0, 0, 0, 0.06); */
}

/* Кнопка «Задать вопрос» */
/* .jw-sidemenu-ask-btn переведена на единый компонент .jw-btn--secondary --block (jw-buttons.css). */

/* Адрес */
.jw-sidemenu-address {
    margin-top: 19px;
    font-size: 13px;
    line-height: 1.4;
    color: rgba(0, 0, 0, 0.45);
    text-align: center;
}

/* ---------- Блокировка прокрутки body при открытом меню ---------- */
body.jw-sidemenu-open {
    overflow: hidden;
}

/* ---------- Адаптив: мобильные устройства ---------- */
@media (max-width: 480px) {
    .jw-sidemenu-panel {
        width: min(100vw, 375px);
        /* #677 (19.08): скругление вернули по просьбе заказчика — на мобилке его
           снимали заодно с шириной, и панель выглядела вырезанным прямоугольником. */
        border-radius: 20px 0 0 20px;
    }


}

/* ===== Модалка «Задать вопрос» (общая, из сайдменю) ===== */
.jw-ask-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 100000;
    align-items: center;
    justify-content: center;
}
.jw-ask-overlay.active { display: flex; }
.jw-ask-modal {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    max-width: 440px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    margin: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.jw-ask-modal__close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    opacity: .6;
    transition: opacity .2s;
}
.jw-ask-modal__close:hover { opacity: 1; }
.jw-ask-modal__title {
    font-size: 44px;
    font-weight: 700;
    text-align: center;
    color: var(--jv-text-primary, #172033);
    margin: 0;
}
.jw-ask-modal__subtitle {
    font-size: 14px;
    color: rgba(153,153,153,1);
    margin: 0;
    text-align: center;
}
.jw-ask-modal input,
.jw-ask-modal textarea {
    width: 100%;
    border: 3px solid rgba(242,243,246,1);
    border-radius: 10px;
    padding: 6px 15px;
    font-size: 14px;
    outline: none;
    font-weight: 450;
    box-sizing: border-box;
    font-family: inherit;
    color: rgba(153,153,153,1);
    transition: border-color .2s;
}
.jw-ask-modal input:focus,
.jw-ask-modal textarea:focus { border-color: var(--jv-primary, #E94E1B); }
#jw-ask-phone { letter-spacing: 2px; }
.jw-ask-modal textarea { resize: vertical; min-height: 63px; }
/* .jw-ask-modal__btn переведена на .jw-btn--primary --block (jw-buttons.css); остаётся только отступ. */
.jw-ask-modal__btn { margin-top: 5px; }
.jw-ask-modal__msg { font-size: 14px; text-align: center; min-height: 20px; margin: 0; }
/* согласие — теперь чекбокс (label), а не абзац: строка выравнивается по левому краю */
.jw-ask-modal__consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 11px;
    font-weight: 450;
    color: rgba(153,153,153,1);
    text-align: left;
    margin: 0 0 14px;
    cursor: pointer;
}
.jw-ask-modal__consent input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 1px 0 0;
    accent-color: var(--jv-primary, #E94E1B);
}
.jw-ask-modal__consent a { color: rgba(153,153,153,1); text-decoration: underline; }
@media (max-width: 600px) {
    .jw-ask-modal { padding: 24px 20px; }
    .jw-ask-modal__title { font-size: 32px; }
}
