/* Виджет онлайн-бронирования — всё под .sct-booking-widget, не пересекается с классами темы. */

#secondary .sct-booking-widget,
#secondary .sct-booking-widget * {
    box-sizing: border-box;
}

#secondary .sct-booking-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ─── Card shell ─── */
#secondary .sct-bw {
    background: #fff;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    overflow: hidden;
}

/* ─── Price header ─── */
#secondary .sct-bw-price-hdr {
    padding: 13px 16px;
    background: #1a7a3c;
    color: #fff;
}

#secondary .sct-bw-price-hdr.confirmed {
    background: #0f5c2c;
}

#secondary .sct-bw-from {
    font-size: 11px;
    opacity: 0.85;
}

#secondary .sct-bw-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

#secondary .sct-bw-price {
    font-size: 21px;
    font-weight: 500;
    line-height: 1.2;
}

/* Спиннер у цены на время запроса калькулятора — шапку саму не приглушаем (см. setPriceLoading()). */
#secondary .sct-bw-price-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    flex-shrink: 0;
    animation: sct-bw-spin 0.7s linear infinite;
}

#secondary .sct-bw-price-spinner.visible {
    display: inline-block;
}

@keyframes sct-bw-spin {
    to {
        transform: rotate(360deg);
    }
}

#secondary .sct-bw-per {
    font-size: 12px;
    opacity: 0.8;
}

#secondary .sct-bw-disc {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
}

/* ─── Step accordion rows ─── */
#secondary .sct-bw-step {
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

#secondary .sct-bw-step:last-child {
    border-bottom: none;
}

#secondary .sct-bw-step-hdr {
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: default;
}

#secondary .sct-bw-step-hdr.clickable {
    cursor: pointer;
}

#secondary .sct-bw-step-hdr.clickable:hover {
    background: #f9f9f7;
}

#secondary .sct-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    color: #bbb;
    flex-shrink: 0;
}

#secondary .sct-step-num.done {
    background: #1a7a3c;
    border-color: #1a7a3c;
    color: #fff;
}

#secondary .sct-step-num.done i {
    font-size: 11px;
    font-style: normal;
}

#secondary .sct-step-num.active {
    border-color: #1a7a3c;
    color: #1a7a3c;
}

#secondary .sct-step-title-wrap {
    flex: 1;
    min-width: 0;
}

#secondary .sct-step-title {
    font-size: 12px;
    font-weight: 500;
    color: #1a1a1a;
}

#secondary .sct-step-title.muted {
    color: #bbb;
    font-weight: 400;
}

#secondary .sct-step-summary {
    font-size: 11px;
    color: #666;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none;
}

#secondary .sct-step-summary.visible {
    display: block;
}

#secondary .sct-step-edit {
    font-size: 11px;
    color: #1a7a3c;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
    flex-shrink: 0;
    display: none;
}

#secondary .sct-step-edit.visible {
    display: block;
}

#secondary .sct-bw-step-body {
    padding: 0 16px 14px;
    display: none;
}

#secondary .sct-bw-step-body.open {
    display: block;
}

/* ─── Calendar inside widget ─── */
#secondary .sct-wc-month {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

#secondary .sct-wc-month button {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 15px;
    padding: 2px 6px;
    border-radius: 5px;
}

#secondary .sct-wc-month button:hover {
    background: #f0f0f0;
}

#secondary .sct-wc-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

#secondary .sct-wc-hdr {
    text-align: center;
    font-size: 9px;
    color: #aaa;
    font-weight: 500;
    padding: 2px 0;
}

#secondary .sct-wc-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 11px;
    color: #555;
    user-select: none;
}

#secondary .sct-wc-day.has {
    background: #eaf7ef;
    color: #0f6e3a;
    font-weight: 500;
    cursor: pointer;
}

#secondary .sct-wc-day.has:hover {
    background: #d4f0e2;
}

#secondary .sct-wc-day.low {
    background: #fff3e0;
    color: #b35c00;
    font-weight: 500;
    cursor: pointer;
}

#secondary .sct-wc-day.low:hover {
    background: #ffe3c2;
}

#secondary .sct-wc-day.sel {
    background: #1a7a3c;
    color: #fff;
    font-weight: 500;
}

#secondary .sct-wc-day.low.sel {
    background: #f90;
    color: #fff;
}

#secondary .sct-wc-day.no {
    color: #ccc;
    background: #f7f7f5;
    cursor: default;
}

#secondary .sct-wc-day.emp {
    background: transparent;
    cursor: default;
}

#secondary .sct-wc-legend {
    display: flex;
    gap: 8px;
    margin-top: 7px;
    font-size: 10px;
    color: #777;
    flex-wrap: wrap;
}

#secondary .sct-wc-legend span {
    display: flex;
    align-items: center;
    gap: 3px;
}

#secondary .sct-leg-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
}

/* ─── Continue buttons ───
       Padding/font-size matched to .sct-btn-book so every primary CTA in the
       widget (step continue buttons + final booking button) is the same height. */
#secondary .sct-btn-continue {
    display: block;
    width: 100%;
    padding: 12px;
    background: #1a7a3c;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    margin-top: 12px;
}

#secondary .sct-btn-continue:hover {
    background: #155f30;
}

/* Ждём пересчёт цены — не то же самое, что sct-btn-continue-dis (мест нет). */
#secondary .sct-btn-continue:disabled {
    background: #8fbf9f;
    cursor: wait;
}

#secondary .sct-btn-continue-dis {
    display: block;
    width: 100%;
    padding: 12px;
    background: #e0e0e0;
    color: #aaa;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: not-allowed;
    text-align: center;
    margin-top: 12px;
}

/* ─── Tourists (pax) block ─── */
#secondary .sct-pax-box {
    border: 0.5px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
    max-height: 300px;
    overflow-y: auto;
}

#secondary .sct-pax-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.07);
}

#secondary .sct-pax-row:last-child {
    border-bottom: none;
}

#secondary .sct-pax-name {
    font-size: 12px;
    color: #1a1a1a;
}

#secondary .sct-pax-price {
    font-size: 11px;
    color: #1a7a3c;
}

#secondary .sct-pax-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Enlarged from 22px — original was too small to reliably tap on mobile. */
#secondary .sct-pax-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    border: 0.5px solid rgba(0, 0, 0, 0.18);
    background: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    line-height: 1;
    flex-shrink: 0;
}

#secondary .sct-pax-btn:hover {
    background: #f0f0f0;
}

#secondary .sct-pax-n {
    font-size: 13px;
    font-weight: 500;
    min-width: 18px;
    text-align: center;
}

#secondary .sct-disc-link {
    display: inline-flex;
    align-items: flex-start;
    gap: 4px;
    font-size: 11px;
    color: #1a7a3c;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
}

#secondary .sct-disc-link-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

/* ─── Hotel category selection ─── */
#secondary .sct-hotel-opts {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

#secondary .sct-h-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s;
}

#secondary .sct-h-opt:hover {
    border-color: #1a7a3c;
}

#secondary .sct-h-opt.sel {
    border-color: #1a7a3c;
    background: #eaf7ef;
}

/* SCANTOUR: NEW — карточка категории/тарифа без доступных мест: серая,
       некликабельная (см. sct_render_hotel_options() в tour-pricing.php —
       для таких карточек onclick вообще не рендерится). */
#secondary .sct-h-opt.disabled {
    cursor: default;
    opacity: 0.55;
    background: #f9f9f7;
}

#secondary .sct-h-opt.disabled:hover {
    border-color: rgba(0, 0, 0, 0.12);
}

#secondary .sct-h-opt-name {
    font-size: 12px;
    font-weight: 500;
}

#secondary .sct-h-opt-price {
    font-size: 11px;
    color: #666;
}

#secondary .sct-h-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
}

#secondary .sct-h-badge-g {
    background: #eaf7ef;
    color: #0f6e3a;
}

#secondary .sct-h-badge-w {
    background: #fff3e0;
    color: #854f0b;
}

/* SCANTOUR: NEW — бейдж "Нет мест" (все размещения/сам тариф avail=1). */
#secondary .sct-h-badge-n {
    background: #f5f5f3;
    color: #999;
}

/* room-type <select> removed from Step 3 per feedback — only hotel category choice remains */

/* ─── Addons mini row — removed per feedback (no addons line in Step 4) ─── */

/* Итог Шага 4 — факты брони + одна сумма, без построчной разбивки. */
#secondary .sct-summary-rows {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 10px;
}

#secondary .sct-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
}

#secondary .sct-summary-label {
    color: #777;
}

#secondary .sct-summary-val {
    color: #1a1a1a;
    font-weight: 500;
    text-align: right;
}

#secondary .sct-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
    padding-top: 8px;
    margin-top: 2px;
}

#secondary .sct-summary-total span:last-child {
    color: #1a7a3c;
}

/* ─── SCANTOUR: NEW — booking error message ─── */
#secondary .sct-book-error {
    background: #fdecea;
    border: 0.5px solid #f5b5ae;
    color: #b3261e;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 8px;
    display: none;
}

#secondary .sct-book-error.visible {
    display: block;
}

/* ─── CTA buttons ─── */
#secondary .sct-btn-book {
    display: block;
    width: 100%;
    padding: 12px;
    background: #1a7a3c;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    margin-bottom: 6px;
}

#secondary .sct-btn-book:hover {
    background: #155f30;
}

#secondary .sct-btn-ask {
    display: block;
    width: 100%;
    padding: 9px;
    background: #fff;
    color: #1a7a3c;
    border: 0.5px solid #1a7a3c;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
}

#secondary .sct-btn-ask:hover {
    background: #eaf7ef;
}

#secondary .sct-btn-area {
    padding: 12px 16px;
    margin-top: 12px;
    display: none;
}

#secondary .sct-btn-area.visible {
    display: block;
}

#secondary .sct-pay-hint {
    font-size: 11px;
    color: #aaa;
    text-align: center;
    margin-top: 6px;
}

/* "Льготы и скидки" summary card removed per feedback — styles removed with it */

/* =====================================================================
   Price-matrix popup — reuses the site's existing <dialog class="sct-modal">
   shell (see style-index-modals.css) for visual consistency with the
   "Хочу поехать" modal already on the page.
   ===================================================================== */
#secondary .sct-bw-matrix-tabs {
    display: flex;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.12);
    margin-bottom: 14px;
    gap: 4px;
    flex-wrap: wrap;
}

#secondary .sct-bw-matrix-tab {
    padding: 7px 14px;
    font-size: 12px;
    color: #666;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
}

#secondary .sct-bw-matrix-tab.active {
    color: #1a7a3c;
    border-bottom-color: #1a7a3c;
    font-weight: 500;
}

#secondary .sct-bw-matrix-wrap {
    overflow-x: auto;
}

#secondary .sct-bw-pm {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

#secondary .sct-bw-pm th {
    padding: 6px 8px;
    background: #f5f5f3;
    font-weight: 500;
    text-align: left;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    /* Длинные названия льгот переносим в 2 строки, не растягиваем колонку. */
    white-space: normal;
    overflow-wrap: break-word;
    line-height: 1.3;
    max-width: 110px;
    color: #555;
}

#secondary .sct-bw-pm td {
    padding: 6px 8px;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    text-align: center;
    font-size: 12px;
}

#secondary .sct-bw-pm td:first-child {
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
    background: #f9f9f7;
}

#secondary .sct-bw-pm .no {
    color: #bbb;
    font-size: 11px;
}

#secondary .sct-bw-pm .pv {
    color: #1a1a1a;
    font-weight: 500;
}

#secondary .sct-bw-pm .hr td {
    background: #f5fbf7;
}

/* Неактивные вкладки — переключение см. selMatrixTab() в JS. */
#secondary .sct-bw-pm--hidden {
    display: none;
}

/* Отрицательная цена (льгота больше базовой) — показываем как есть, с пометкой аномалии. */
#secondary .sct-bw-pm .sct-pm-anomaly {
    color: #b3261e;
    background: #fdecea;
    cursor: help;
}

#secondary .sct-bw-modal-note {
    font-size: 11px;
    color: #666;
    margin-top: 10px;
    line-height: 1.5;
}

/* Крестик попапов внутри #secondary — компенсируем уменьшенный шрифт кнопок темы. */
#secondary .sct-modal__close {
    font-size: 2rem;
}

@media (max-width: 921px) {
    #secondary .sct-booking-widget {
        gap: 12px;
    }
}

/* Пока ждём ответ калькулятора — цена приглушается. */
#secondary .sct-price-loading {
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

/* Правки шаблона страницы тура (ширина сайдбара, sticky, мобильная шторка) — отдельно от стилей выше. */

/* Ширина сайдбара — компенсируем padding темы, чтобы вернуть ~310px из макета. */
@media (min-width: 993px) {
    body.single-tour #content .ast-container {
        --st-sidebar-width: 325px;
    }
}

/* Sticky-сайдбар — 94px совпадает с отступом темы под липкую шапку.
       Не добавлять align-self/height к #secondary — сломает position:sticky. */
@media (min-width: 922px) {
    body.single-tour #secondary .sidebar-main {
        position: sticky;
        top: 94px;
    }
}

/* Скрыто на десктопе — должно идти ДО медиа-запроса ниже (порядок каскада). */
body.single-tour #secondary .sct-mobile-bar,
body.single-tour #secondary .sct-mobile-backdrop,
body.single-tour #secondary .sct-bw-mobile-close {
    display: none;
}

/* Мобильная bottom sheet — < 921px (зеркалит breakpoint sticky-правила выше).
       Состояние — класс .sct-mobile-expanded на .tour-sidebar (общий предок
       бара/backdrop/виджета, см. toggleMobileSheet() в JS). Бар и backdrop —
       намеренно вне .sct-booking-widget: transform на виджете иначе утащил бы
       их за собой (новый containing block для position:fixed потомков). */
@media (max-width: 921px) {
    body.single-tour #secondary .sct-mobile-bar,
    body.single-tour #secondary .sct-mobile-backdrop {
        position: fixed;
        left: 0;
        right: 0;
    }

    /* Липкая полоска — цену/подзаголовок уже обновляет setStickyBar() в JS. */
    body.single-tour #secondary .sct-mobile-bar {
        display: flex;
        align-items: center;
        gap: 12px;
        bottom: 0;
        z-index: 9990;
        background: #fff;
        border-top: 1px solid rgba(0, 0, 0, 0.14);
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    body.single-tour #secondary .sct-mobile-bar-info {
        flex: 1;
        min-width: 0;
    }

    body.single-tour #secondary .sct-mobile-bar-price {
        font-size: 17px;
        font-weight: 700;
        line-height: 1.2;
        color: #1a1a1a;
    }

    body.single-tour #secondary .sct-mobile-bar-sub {
        font-size: 11.5px;
        color: #777;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.single-tour #secondary .sct-mobile-bar-btn {
        /* Размер под кнопку "Хочу поехать" в шапке — оценка по скриншотам, не сверено. */
        padding: 15px 28px;
        background: #1a7a3c;
        color: #fff;
        border: none;
        border-radius: 10px;
        font-size: 15px;
        font-weight: 700;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* display:block обязателен — иначе базовое display:none никогда не перебивается.
           touch-action:none — не даёт браузеру трактовать жест над backdrop как
           скролл страницы под ним (доп. страховка поверх body position:fixed в JS). */
    body.single-tour #secondary .sct-mobile-backdrop {
        display: block;
        top: 0;
        bottom: 0;
        z-index: 9998;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        pointer-events: none;
        touch-action: none;
        transition: opacity 0.25s;
    }

    body.single-tour #secondary .tour-sidebar.sct-mobile-expanded .sct-mobile-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* Свёрнута за экраном по умолчанию, выезжает по .sct-mobile-expanded. */
    body.single-tour #secondary .sct-booking-widget {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        z-index: 9999;
        max-height: 86vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
        transform: translateY(calc(100% + 10px));
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    }

    body.single-tour #secondary .tour-sidebar.sct-mobile-expanded .sct-booking-widget {
        transform: translateY(0);
    }

    /* position:relative нужен, чтобы крестик ниже позиционировался от шапки, не от viewport. */
    body.single-tour #secondary .sct-bw-price-hdr {
        position: relative;
    }

    /* Крестик — сворачивает шторку обратно в полоску. */
    body.single-tour #secondary .sct-bw-mobile-close {
        display: flex;
        position: absolute;
        top: 10px;
        right: 12px;
        width: 26px;
        height: 26px;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.25);
        color: #fff;
        font-size: 16px;
        line-height: 1;
        z-index: 1;
    }

    /* Блокируем скролл фона, пока шторка открыта.
           position:fixed (см. toggleMobileSheet() в JS) убирает body из потока —
           width:100% обязателен, иначе body сжимается по контенту и страница
           визуально "прыгает" по горизонтали в момент открытия. */
    body.sct-mobile-sheet-open {
        overflow: hidden;
        width: 100%;
    }
}
