/**
 * Calculator page, version 2 (tz/версия-2/02-kalkulyator-v2.md): two columns ≥ 1024px, one column + bottom bar below.
 */

.calc-page {
    padding-top: 16px;
    padding-bottom: var(--section-gap);
}

/* Page head: H1 with the key → intro → H2 (tz v2 04 §2) */
.calc-page__head {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.calc-page__h1 {
    max-width: 960px;
    font-family: var(--font-head);
    font-size: clamp(28px, 3.4vw, 40px);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -1px;
}

.calc-page__intro {
    max-width: 720px;
    font-size: 17px;
    line-height: 1.55;
    color: var(--c-text-2);
}

.calc-page__title {
    max-width: 900px;
    margin-top: 8px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

/* Below the calculator: local block, FAQ, other cities (tz v2 04 §2.5–2.7) */
.calc-page__more {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.city-local {
    padding: 32px;
    border-radius: var(--r-card);
}

.city-local__title {
    margin-bottom: 12px;
    font-size: clamp(22px, 2.4vw, 28px);
}

.city-local__text {
    max-width: 820px;
    font-size: 16px;
    line-height: 1.65;
    color: var(--c-text-2);
}


@media (max-width: 639px) {
    .city-local {
        padding: var(--pad-block-sm);
    }
}

.calc {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    grid-template-areas:
        'form summary'
        'booking summary';
    align-items: start;
    gap: 16px 24px;
}

.calc__form {
    grid-area: form;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Sticks below the sticky site header (--header-h is measured in site.js); scrolls inside if taller than the screen. */
.summary {
    grid-area: summary;
    position: sticky;
    top: calc(var(--header-h, 80px) + var(--wp-admin--admin-bar--height, 0px) + 16px);
    max-height: calc(100vh - var(--header-h, 80px) - var(--wp-admin--admin-bar--height, 0px) - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.booking {
    grid-area: booking;
}

@media (max-width: 1023px) {
    .calc {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            'form'
            'summary'
            'booking';
    }

    .summary {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .calc-page {
        padding-bottom: calc(var(--section-gap) + 72px);
    }
}

/* ==========================================================
 * Step cards
 * ========================================================== */
.calc-step {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: clamp(20px, 3vw, 28px);
    background: var(--c-surface);
    border-radius: var(--r-card);
}

@media (max-width: 639px) {
    .calc-step {
        padding: var(--pad-block-sm);
    }
}

/* <legend> ignores flex gap, keep spacing explicit */
.calc-step > legend {
    float: left;
    width: 100%;
    margin-bottom: 16px;
}

.calc-step > legend + * {
    clear: both;
}

.calc-step__title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.3;
}

.calc-step__title:focus {
    outline: none;
}

.calc-step__num {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 700;
    color: var(--c-primary);
    background: var(--c-aqua);
    border-radius: var(--r-xs);
}

.calc-step__text {
    font-size: 15px;
    color: var(--c-text-2);
}

.calc-step__hint {
    font-size: 14px;
    color: var(--c-text-2);
}

.calc-step__hint--warn {
    font-weight: 500;
    color: var(--c-ink);
}

/* Radio cards */
.choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.choices--compact {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.choice {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 56px;
    padding: 14px 16px;
    cursor: pointer;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-sm);
}

.choice--compact {
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 12px;
    text-align: center;
}

.choice__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice__title {
    font-weight: 600;
}

.choice__hint {
    font-size: 13px;
    line-height: 1.4;
    color: var(--c-text-3);
}

.choice:hover {
    border-color: var(--c-primary);
}

.choice:has(.choice__input:checked) {
    background: var(--c-aqua-soft);
    border-color: var(--c-primary);
    box-shadow: inset 0 0 0 1px var(--c-primary);
}

.choice:has(.choice__input:focus-visible) {
    outline: var(--focus);
    outline-offset: 2px;
    box-shadow: var(--focus-ring);
}

.choice:has(.choice__input:disabled) {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Switch (pets) */
.switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 12px;
    cursor: pointer;
    border-top: 1px solid var(--c-line-soft);
}

.switch__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch__track {
    position: relative;
    flex: 0 0 auto;
    width: 52px;
    height: 32px;
    background: var(--c-line);
    border-radius: var(--r-pill);
    transition: background-color 0.15s;
}

.switch__track::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    background: var(--c-surface);
    border-radius: 50%;
    transition: transform 0.15s;
}

.switch__input:checked + .switch__track {
    background: var(--c-primary);
}

.switch__input:checked + .switch__track::after {
    transform: translateX(20px);
}

.switch__input:focus-visible + .switch__track {
    outline: var(--focus);
    outline-offset: 2px;
    box-shadow: var(--focus-ring);
}

.switch__text {
    display: flex;
    flex-direction: column;
}

.switch__title {
    font-size: 15px;
    font-weight: 600;
}

.switch__hint {
    font-size: 13px;
    color: var(--c-text-3);
}

/* Grouped controls inside one step card (dirt + pets) */
.calc-step__group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* <legend> ignores flex gap, keep spacing explicit */
.calc-step__group > legend {
    float: left;
    width: 100%;
    margin-bottom: 4px;
}

.calc-step__group > legend + * {
    clear: both;
}

.calc-step__title--big {
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.calc-step__hint--muted {
    font-size: 13px;
    color: var(--c-text-3);
}

/* "Ce este inclus?": opens the "what's included" dialog */
.calc-included-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    margin-top: 4px;
    padding: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    background: none;
    border: 0;
    cursor: pointer;
}

.calc-included-link:hover {
    color: var(--c-ink);
}

/* Extras: checkbox chips with a "price on site" tag */
.chips-check {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip-check {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 8px 8px 12px;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-pill);
}

.chip-check__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip-check__mark {
    flex: 0 0 auto;
    display: flex;
    color: var(--c-primary);
}

.chip-check__tick,
.chip-check:has(.chip-check__input:checked) .chip-check__plus {
    display: none;
}

.chip-check:has(.chip-check__input:checked) .chip-check__tick {
    display: block;
}

.chip-check__note {
    flex: 0 0 auto;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--c-note);
    border-radius: var(--r-pill);
}

.chip-check:hover {
    border-color: var(--c-primary);
}

.chip-check:has(.chip-check__input:checked) {
    background: var(--c-aqua-soft);
    border-color: var(--c-primary);
    box-shadow: inset 0 0 0 1px var(--c-primary);
}

.chip-check:has(.chip-check__input:focus-visible) {
    outline: var(--focus);
    outline-offset: 2px;
    box-shadow: var(--focus-ring);
}

.guarantee {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--c-text-3);
}

.guarantee .icon {
    flex: 0 0 auto;
    color: var(--c-primary);
}

/* ==========================================================
 * Summary (v2 §3)
 * ========================================================== */
.summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background: var(--c-surface);
    border-radius: var(--r-card);
}

@media (max-width: 639px) {
    .summary {
        padding: var(--pad-block-sm);
    }
}

.summary:focus {
    outline: none;
}

.summary__title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
}

.summary__params {
    font-size: 14px;
    line-height: 1.6;
    color: var(--c-text-3);
}

.summary__onsite {
    padding: 10px 14px;
    background: var(--c-note);
    border-radius: var(--r-btn);
}

.summary__onsite > summary {
    min-height: 32px;
    font-weight: 600;
    cursor: pointer;
}

.summary__lines {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    padding-left: 18px;
    font-size: 14px;
}

.summary__total {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 16px;
    border-top: 1px solid var(--c-line-soft);
    container-type: inline-size;
}

.summary__total-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--c-text-3);
}

/* One line for any range, so the summary does not jump while the area changes:
   the size follows the column width so "31 100 – 46 660 lei*" (≈ 11.3em) fits, max 30px. */
.summary__range {
    font-family: var(--font-head);
    font-size: clamp(18px, calc(100cqi / 11.6), 30px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    letter-spacing: -1px;
    white-space: nowrap;
}

.summary__transport {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-primary);
}

.summary__transport .icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.summary__footnote {
    font-size: 13px;
    color: var(--c-text-3);
}

.summary__pay {
    text-align: center;
}

/* Price + button stay visible at the bottom of the panel when it is taller than the screen. */
.summary__foot {
    position: sticky;
    bottom: -24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 -24px -24px;
    padding: 0 24px 24px;
    background: var(--c-surface);
}

@media (max-width: 1023px) {
    .summary__foot {
        position: static;
    }
}

/* ==========================================================
 * Mobile bar
 * ========================================================== */
.minibar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
    background: var(--c-surface);
    border-top: 1px solid var(--c-line-soft);
}

.minibar__sum {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 44px;
    padding: 0;
    text-align: left;
    background: none;
    border: 0;
}

.minibar__label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text-3);
}

.minibar__chevron {
    transform: rotate(180deg);
}

.minibar__price {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.15;
}

@media (min-width: 1024px) {
    .minibar {
        display: none !important;
    }
}
