/* ==========================================================================
   Booking wizard
   --------------------------------------------------------------------------
   Техника → Количество и длительность → Дата → Время → Доп. услуги →
   Контакты → Итог → Подтверждение

   The running total ("Ваша поездка") is pinned beside the steps on desktop and
   drops below them on mobile. It also carries the submit button, so the price
   and the way to confirm it stay together. Every step is a plain fieldset —
   the wizard still works without the scripted transitions.
   ========================================================================== */

.wizard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: var(--space-l);
    align-items: start;
}

/* --- Progress ------------------------------------------------------------ */

.wizard__progress {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: var(--space-m);
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0.35rem;
}

.wizard__progress::-webkit-scrollbar {
    display: none;
}

.wizard__dot {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted-solid);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
}

.wizard__dot-num {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--ink-750);
    font-family: 'Oswald', sans-serif;
    font-size: 0.72rem;
    flex: none;
}

.wizard__dot[data-state='done'] {
    color: var(--text-dim);
    border-color: var(--line-strong);
}

.wizard__dot[data-state='done'] .wizard__dot-num {
    background: var(--season-ambient);
    color: var(--ink-950);
}

.wizard__dot[data-state='current'] {
    color: var(--text);
    border-color: var(--season-accent);
    background: rgba(255, 255, 255, 0.03);
}

.wizard__dot[data-state='current'] .wizard__dot-num {
    background: var(--season-accent);
    color: var(--on-accent);
}

.wizard__dot[disabled] {
    cursor: not-allowed;
    opacity: 0.55;
}

/* --- Steps --------------------------------------------------------------- */

.wizard__steps {
    display: grid;
    gap: var(--space-m);
    min-width: 0;
}

.step-panel {
    display: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    background: var(--season-surface);
    padding: var(--space-m);
    min-width: 0;
}

.step-panel[data-active='true'] {
    display: block;
    animation: step-in 0.4s var(--ease-out);
}

@keyframes step-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.step-panel__head {
    display: grid;
    gap: 0.3rem;
    margin-bottom: var(--space-m);
}

.step-panel__title {
    font-size: var(--step-2);
    letter-spacing: 0;
}

.step-panel__hint {
    font-size: var(--step--1);
    color: var(--text-muted-solid);
}

.wizard__nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-s);
    margin-top: var(--space-m);
    padding-top: var(--space-m);
    border-top: 1px solid var(--line);
}

/* --- Pickable item cards ------------------------------------------------- */

.pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: var(--space-s);
}

.pick {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    background: var(--ink-900);
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    padding: 0;
    color: inherit;
    transition: border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.pick:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
}

.pick[aria-pressed='true'] {
    border-color: var(--season-accent);
    box-shadow: 0 0 0 1px var(--season-accent);
}

.pick__media {
    position: relative;
    aspect-ratio: 16 / 11;
    background: var(--ink-800);
    overflow: hidden;
}

.pick__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pick__check {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: rgba(6, 10, 9, 0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.pick[aria-pressed='true'] .pick__check {
    opacity: 1;
    transform: scale(1);
    background: var(--season-accent);
    border-color: var(--season-accent);
    color: var(--on-accent);
}

.pick__body {
    display: grid;
    gap: 0.3rem;
    align-content: start;
    padding: 0.85rem;
}

.pick__name {
    font-family: 'Oswald', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.15;
}

.pick__price {
    font-size: 0.85rem;
    color: var(--season-glow);
    font-weight: 600;
}

.pick__units {
    font-size: 0.78rem;
    color: var(--text-muted-solid);
}

/* --- Quantity & duration ------------------------------------------------- */

.qty-list,
.qty-list__rows {
    display: grid;
    gap: var(--space-s);
}

.qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-s);
    flex-wrap: wrap;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    background: var(--ink-900);
}

.qty-row__info {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
    flex: 1 1 12rem;
}

.qty-row__name {
    font-weight: 700;
}

.qty-row__meta {
    font-size: 0.82rem;
    color: var(--text-muted-solid);
}

.stepper {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--ink-850);
}

.stepper__btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s var(--ease-out);
}

.stepper__btn:hover:not([disabled]) {
    background: var(--ink-700);
}

.stepper__btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

.stepper__value {
    min-width: 2.5rem;
    text-align: center;
    font-family: 'Oswald', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
}

/* «2 часа» needs more room than «2». */
.stepper__value--wide {
    min-width: 5.5rem;
}

/* The duration belongs to the whole booking, not to one item, so it sits
   apart from the per-item rows. Green is reserved for «свободно» in this
   design, hence a neutral lift rather than a coloured outline. */
.qty-row--duration {
    border-color: var(--line-strong);
    background: var(--ink-850);
}

/* --- Calendar ------------------------------------------------------------ */

.calendar {
    /* Capped, not fluid: stretched across a desktop column the day cells grew
       to the height of a button and the month filled the screen. */
    max-width: 25rem;
    margin-inline: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    background: var(--ink-900);
    padding: var(--space-s);
}

.calendar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-s);
    margin-bottom: var(--space-s);
}

.calendar__month {
    font-family: 'Oswald', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    text-transform: capitalize;
}

.calendar__nav {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s var(--ease-out);
}

.calendar__nav:hover:not([disabled]) {
    background: var(--ink-750);
}

.calendar__nav[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
}

.calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.calendar__weekday {
    padding: 0.35rem 0;
    text-align: center;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted-solid);
}

.calendar__day {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: var(--radius-s);
    background: var(--ink-850);
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s var(--ease-out);
}

.calendar__day:hover:not([disabled]) {
    border-color: var(--season-glow);
    color: var(--text);
}

.calendar__day[disabled] {
    background: transparent;
    color: var(--text-muted-solid);
    opacity: 0.35;
    cursor: not-allowed;
}

.calendar__day[data-state='free']::after {
    content: '';
    position: absolute;
    bottom: 5px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--success);
}

.calendar__day[data-state='busy']::after {
    content: '';
    position: absolute;
    bottom: 5px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--danger);
}

.calendar__day[aria-pressed='true'] {
    background: var(--season-accent);
    border-color: var(--season-accent);
    color: var(--on-accent);
}

.calendar__day[aria-pressed='true']::after {
    background: var(--on-accent);
}

.calendar__legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-s);
    margin-top: var(--space-s);
    padding-top: var(--space-s);
    border-top: 1px solid var(--line);
    font-size: 0.78rem;
    color: var(--text-muted-solid);
}

.calendar__legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.calendar__legend i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

/* --- Time slots ---------------------------------------------------------- */

.slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 0.5rem;
}

.slot {
    display: grid;
    gap: 0.1rem;
    place-items: center;
    min-height: 56px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-m);
    background: var(--ink-900);
    font-family: 'Oswald', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.slot:hover:not([disabled]) {
    border-color: var(--season-glow);
    transform: translateY(-2px);
}

.slot__units {
    font-family: 'Manrope', sans-serif;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted-solid);
}

.slot[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    text-decoration: line-through;
}

.slot[aria-pressed='true'] {
    background: var(--season-accent);
    border-color: var(--season-accent);
    color: var(--on-accent);
}

.slot[aria-pressed='true'] .slot__units {
    color: var(--on-accent);
    opacity: 0.75;
}

/* Общие примитивы формы (.field, .form-error) живут в app.css — они нужны
   не только мастеру. */


/* --- Summary ("Ваша поездка") ------------------------------------------- */

.summary {
    position: sticky;
    top: calc(var(--header-h) + 1rem);
    display: grid;
    gap: var(--space-s);
    padding: var(--space-m);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-l);
    background: linear-gradient(165deg, var(--season-surface), var(--ink-900));
    box-shadow: var(--shadow-card);
}

.summary__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-s);
    font-size: var(--step-1);
    letter-spacing: 0;
}

.summary__when {
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-m);
    font-size: 0.9rem;
}

.summary__when-date {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.summary__when-empty {
    color: var(--text-muted-solid);
}

.summary__lines {
    display: grid;
    gap: 0.6rem;
    max-height: 40vh;
    overflow-y: auto;
}

.summary__line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.75rem;
    align-items: baseline;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--line);
}

.summary__line:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.summary__line-name {
    font-weight: 600;
    line-height: 1.3;
}

.summary__line-total {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    white-space: nowrap;
}

.summary__line-calc {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    color: var(--text-muted-solid);
}

.summary__empty {
    padding: var(--space-s) 0;
    color: var(--text-muted-solid);
    font-size: 0.9rem;
}

.summary__total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-s);
    padding-top: var(--space-s);
    border-top: 1px solid var(--line-strong);
}

.summary__total-label {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted-solid);
}

.summary__total-value {
    font-family: 'Oswald', sans-serif;
    font-size: var(--step-2);
    font-weight: 700;
    color: var(--season-accent);
    white-space: nowrap;
    /* Re-triggered by JS when the number changes, so a price update is felt. */
}

.summary__total-value.is-bumped {
    animation: bump 0.42s var(--ease-out);
}

@keyframes bump {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.09); }
    100% { transform: scale(1); }
}

.summary__submit {
    width: 100%;
}

.summary__note {
    font-size: 0.78rem;
    color: var(--text-muted-solid);
    line-height: 1.5;
}

/* --- Confirmation -------------------------------------------------------- */

.done {
    display: grid;
    gap: var(--space-m);
    justify-items: center;
    text-align: center;
    padding: var(--space-xl) var(--space-m);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-l);
    background: linear-gradient(170deg, var(--season-surface), var(--ink-900));
}

.done__mark {
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.4);
    color: var(--success);
}

.done__mark svg {
    width: 40px;
    height: 40px;
}

.done__number {
    font-family: 'Oswald', sans-serif;
    font-size: var(--step-3);
    color: var(--season-accent);
}

.done__text {
    max-width: 40ch;
    color: var(--text-dim);
}

.done__recap {
    display: grid;
    gap: 0.4rem;
    width: min(100%, 28rem);
    padding: var(--space-s);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    text-align: left;
    font-size: 0.9rem;
}

.done__recap-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-s);
}

.done__recap-row dt {
    color: var(--text-muted-solid);
}

.done__recap-row dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
}

/* --- Loading ------------------------------------------------------------- */

.is-loading {
    position: relative;
    pointer-events: none;
}

.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(6, 10, 9, 0.55);
    backdrop-filter: blur(1px);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.slots--loading,
.calendar--loading {
    opacity: 0.45;
    pointer-events: none;
}

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 1040px) {
    .wizard {
        grid-template-columns: 1fr;
    }

    /* Below the steps, not above them: on a phone the wizard should open on
       the equipment, and the total is read after choosing, not before. */
    .summary {
        position: static;
    }

    .summary__lines {
        max-height: none;
    }
}

@media (max-width: 520px) {
    .step-panel {
        padding: var(--space-s);
    }

    .pick-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .wizard__nav {
        flex-direction: column-reverse;
    }

    .wizard__nav .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .step-panel[data-active='true'] {
        animation: none;
    }

    .summary__total-value.is-bumped {
        animation: none;
    }
}
