/* ═══════════════════════════════════════════════════════
   Прайс + Калькулятор услуг  v2
   ═══════════════════════════════════════════════════════ */

/* ── Inline цена [price] ─────────────────────────────── */
.price-value { font-weight: 700; color: var(--color-brand-red, #e31f26); white-space: nowrap; }
.price-error { color: #999; font-style: italic; }
.price-na    { color: #888; font-style: italic; }

/* ── Таблица [price_table] ───────────────────────────── */
.academ-price-table-wrap { width: 100%; overflow-x: auto; margin: 1.5em 0; }
.academ-price-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.academ-price-table thead { background: var(--color-text-dark, #1a1a2e); color: #fff; }
.academ-price-table th { padding: 12px 16px; text-align: left; font-weight: 600; }
.academ-price-table td { padding: 10px 16px; border-bottom: 1px solid #eee; }
.academ-price-table tbody tr:hover { background: #f9f9f9; }
.academ-price-table .price-cell { font-weight: 700; color: var(--color-brand-red, #e31f26); white-space: nowrap; text-align: right; }
@media (max-width: 600px) {
    .academ-price-table { font-size: 13px; }
    .academ-price-table th, .academ-price-table td { padding: 8px 10px; }
}

/* ═══════════════════════════════════════════════════════
   Калькулятор [service_calculator]
   ═══════════════════════════════════════════════════════ */

/* ── Обёртка ─────────────────────────────────────────── */
.sc {
    background: #f7f8fa;
    border-radius: 16px;
    padding: 36px 24px;
    margin: 2em 0;
    font-family: inherit;
}
.sc__title {
    text-align: left;
    font-size: 26px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px;
}
.sc__sub {
    text-align: left;
    color: #777;
    font-size: 14px;
    margin: 0 0 24px;
}

/* ── Двухколоночный layout ───────────────────────────── */
.sc__body {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

/* ── Левая: аккордеоны ───────────────────────────────── */
.sc__left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sc__group {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e8e8ee;
    overflow: hidden;
    transition: box-shadow .15s;
}
.sc__group:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

/* Кнопка-заголовок группы */
.sc__group-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 18px;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    text-align: left;
    text-transform: none;
    transition: background .12s;
}
.sc__group-btn:hover { background: #fafbfe; }

.sc__group-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Бейдж кол-ва выбранных */
.sc__group-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    background: #eee;
    color: #888;
    transition: background .2s, color .2s;
}
.sc__group-badge.has-selected {
    background: var(--color-brand-red, #e31f26);
    color: #fff;
}

/* Шеврон */
.sc__chevron {
    transition: transform .2s;
    color: #aaa;
    flex-shrink: 0;
}
.sc__group-btn[aria-expanded="true"] .sc__chevron {
    transform: rotate(180deg);
}

/* Список услуг внутри группы */
.sc__group-list {
    border-top: 1px solid #eee;
    padding: 6px 0;
}
.sc__group-list[hidden] {
    display: none;
}

/* Строка-услуга (чекбокс) */
.sc__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    cursor: pointer;
    transition: background .1s;
    user-select: none;
}
.sc__row:hover { background: #f5f7ff; }

.sc__row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-brand-red, #e31f26);
    flex-shrink: 0;
    cursor: pointer;
}
.sc__row-name {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.3;
}
.sc__row-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-brand-red, #e31f26);
    white-space: nowrap;
}
.sc__row.is-checked {
    background: #fef2f2;
}

/* ── Правая: сводка (sticky) ─────────────────────────── */
.sc__right {
    position: sticky;
    top: 100px;
}
.sc__summary {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8e8ee;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,.05);
}
.sc__summary-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}
.sc__summary-icon { font-size: 20px; }

/* Заглушка пока ничего не выбрано */
.sc__summary-empty {
    text-align: center;
    color: #bbb;
    font-size: 13px;
    padding: 20px 0;
}
.sc__summary.has-items .sc__summary-empty { display: none; }

/* Список выбранных */
.sc__summary-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}
.sc__summary.has-items .sc__summary-list { display: block; }
/* На мобиле пересилить — скрыть в свёрнутом состоянии */
@media (max-width: 820px) {
    .sc__summary.has-items .sc__summary-list { display: none; }
    .sc__summary.has-items.is-expanded .sc__summary-list { display: block; }
}

.sc__summary-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px dashed #f0f0f0;
    color: #444;
}
.sc__summary-list li:last-child { border-bottom: none; }
.sc__summary-list .li-price {
    font-weight: 600;
    color: var(--color-brand-red, #e31f26);
    white-space: nowrap;
    margin-left: 8px;
}

/* Итого */
.sc__summary-bottom {
    border-top: 2px solid #eee;
    margin-top: 12px;
    padding-top: 12px;
}
.sc__summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #555;
    margin-bottom: 4px;
}
.sc__summary-total {
    font-size: 18px;
    margin-top: 4px;
}
.sc__summary-total strong {
    color: var(--color-brand-red, #e31f26);
    font-size: 22px;
}

/* Форма */
.sc__form {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eee;
}
.sc__input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color .15s;
    box-sizing: border-box;
}
.sc__input:focus { border-color: var(--color-brand-red, #e31f26); }

.sc__consent {
    font-size: 12px;
    color: #888;
    margin: 6px 0 12px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    cursor: pointer;
    line-height: 1.4;
}
.sc__consent input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 2px;
}
.sc__consent span {
    flex: 1;
}
.sc__consent a { color: var(--color-brand-blue, #2196f3); }

.sc__submit {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--color-brand-red, #e31f26);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}
.sc__submit:hover { background: #c7191f; }
.sc__submit:disabled { opacity: .45; cursor: not-allowed; }

.sc__msg {
    text-align: center;
    margin-top: 8px;
    font-size: 13px;
    min-height: 18px;
}
.sc__msg.success { color: #2e7d32; }
.sc__msg.error   { color: #c62828; }

/* ── Защита от белого текста при тапе (iOS / Astra / WebKit) ── */
/* Специфичность через body.wp-theme-astra вместо !important */
body.wp-theme-astra .sc__group-btn,
body.wp-theme-astra .sc__group-btn:active,
body.wp-theme-astra .sc__group-btn:focus,
body.wp-theme-astra .sc__group-btn:hover {
    color: #1a1a2e;
    -webkit-text-fill-color: #1a1a2e;
    outline: none;
}
body.wp-theme-astra .sc__group-name {
    color: #1a1a2e;
    -webkit-text-fill-color: #1a1a2e;
}
body.wp-theme-astra .sc__row:active .sc__row-name,
body.wp-theme-astra .sc__row:focus .sc__row-name {
    color: #333;
    -webkit-text-fill-color: #333;
}
body.wp-theme-astra .sc__row:active .sc__row-price,
body.wp-theme-astra .sc__row:focus .sc__row-price {
    color: var(--color-brand-red, #e31f26);
    -webkit-text-fill-color: var(--color-brand-red, #e31f26);
}
.sc__group-btn,
.sc__row,
.sc__expand-btn,
.sc__summary-bottom {
    -webkit-tap-highlight-color: transparent;
}

/* ── Мобильная вёрстка ───────────────────────────────── */
@media (max-width: 820px) {
    .sc { padding: 20px 12px; border-radius: 0; margin: 1em 0; }
    .sc__title { font-size: 20px; }
    .sc__body {
        grid-template-columns: 1fr;
    }
    /* Отступ снизу чтобы контент не прятался за фиксированную панель */
    .sc__left {
        padding-bottom: 80px;
    }
    .sc__right {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        z-index: 999;
        padding: 0;
        pointer-events: none;
    }
    .sc__summary {
        pointer-events: auto;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,.12);
        padding: 0;
        background: #fff;
    }
    /* На мобиле скрываем всё кроме компактного бара */
    .sc__summary-head,
    .sc__summary-empty,
    .sc__summary-list,
    .sc__form { display: none; }

    .sc__summary-bottom {
        border-top: none;
        margin: 0;
        padding: 10px 16px;
    }
    .sc__summary-row {
        font-size: 13px;
    }
    .sc__summary-total {
        font-size: 16px;
    }
    .sc__summary-total strong {
        font-size: 18px;
    }

    /* ── Кнопка-ручка: невидима в свёрнутом состоянии ── */
    .sc__expand-btn {
        display: none;
        width: 40px;
        height: 5px;
        border-radius: 3px;
        background: #ccc;
        margin: 8px auto;
        border: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    /* ── Раскрытая сводка (по тапу на итого) ──────── */
    .sc__summary.is-expanded {
        max-height: 55vh;
        max-height: 55dvh;     /* dynamic viewport — учитывает клавиатуру iOS / Android */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 16px 16px;
    }
    .sc__summary.is-expanded .sc__expand-btn {
        display: block;
    }
    .sc__summary.is-expanded .sc__summary-head,
    .sc__summary.is-expanded .sc__summary-list,
    .sc__summary.is-expanded .sc__form { display: block; }
    .sc__summary.is-expanded .sc__summary-empty { display: none; }
    .sc__summary.has-items.is-expanded .sc__summary-list { display: block; }

    .sc__summary.is-expanded .sc__summary-bottom {
        border-top: 2px solid #eee;
        margin-top: 12px;
        padding: 12px 0 0;
    }

    /* ── Стрелка-подсказка на итого-баре ──────── */
    .sc__summary-bottom::after {
        content: "▲ подробнее";
        display: block;
        text-align: center;
        font-size: 12px;
        color: #aaa;
        margin-top: 4px;
    }
    .sc__summary.is-expanded .sc__summary-bottom::after {
        content: "";
        display: none;
    }

    .sc__group-btn { padding: 12px 14px; font-size: 14px; }
    .sc__group-btn:active { background: #f5f7ff; color: #1a1a2e; }

    .sc__row { padding: 8px 14px; }
    .sc__row-name { font-size: 13px; color: #333; }
    .sc__row-price { font-size: 13px; color: var(--color-brand-red, #e31f26); }
    .sc__row:active { background: #f5f7ff; }
    .sc__row:active .sc__row-name { color: #333; }
    .sc__row:active .sc__row-price { color: var(--color-brand-red, #e31f26); }

    /* Инпуты: 16px чтобы iOS не зумил, manipulation — без double-tap zoom */
    .sc__input {
        font-size: 16px;
        touch-action: manipulation;
    }
}
@media (min-width: 821px) {
    .sc__expand-btn { display: none; }
}
