/* ============================================================
   V2 — Wizard chrome (Pattern 03)
   ============================================================
   Майстер: progress-strip із кроковою навігацією. Контейнер +
   тіло + sticky-bar додаються наступним кроком (14b).

   Структура:
     <div class="v2-wizard">
       <header class="v2-wizard-progress">
         <div class="v2-wizard-progress-meta">
           <span>Крок 3 з 4</span>
           <span>75%</span>
         </div>
         <div class="v2-wizard-progress-bar">
           <div class="v2-wizard-progress-fill" style="width: 75%"></div>
         </div>
         <nav class="v2-wizard-steps">
           <button class="v2-wizard-step is-done">…</button>
           <button class="v2-wizard-step is-done">…</button>
           <button class="v2-wizard-step is-active">…</button>
           <button class="v2-wizard-step">…</button>
         </nav>
       </header>
       <div class="v2-wizard-body">…</div>
       <footer class="v2-wizard-stickybar">…</footer>
     </div>
   ============================================================ */

/* box-sizing reset */
.v2-wizard,
.v2-wizard *,
.v2-wizard *::before,
.v2-wizard *::after {
    box-sizing: border-box;
}

/* ============================================================
   CONTAINER
   ============================================================ */
.v2-wizard {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs-v2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ============================================================
   PROGRESS STRIP
   ============================================================ */
.v2-wizard-progress {
    padding: var(--s-6) var(--s-7) var(--s-5);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.v2-wizard-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--s-3);
    font-size: var(--text-xs);
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}
.v2-wizard-progress-meta strong {
    color: var(--text-primary);
    font-weight: var(--weight-semibold);
}

.v2-wizard-progress-bar {
    height: 4px;
    background: var(--bg-muted);
    border-radius: var(--r-pill);
    overflow: hidden;
    margin-bottom: var(--s-5);
}

.v2-wizard-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--r-pill);
    transition: width 0.25s ease;
}

/* ============================================================
   STEP LIST (clickable cards)
   ============================================================ */
.v2-wizard-steps {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: var(--s-2);
}

.v2-wizard-step {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--s-3) var(--s-4);
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
    position: relative;
    min-width: 0;
}
.v2-wizard-step:hover:not(.is-active) {
    background: var(--bg-hover);
}
.v2-wizard-step:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Step number row */
.v2-wizard-step-num {
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.v2-wizard-step-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-muted);
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    flex-shrink: 0;
}

/* Step name (main label) */
.v2-wizard-step-name {
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    line-height: var(--leading-tight);
    overflow-wrap: anywhere;
}

/* Step caption (errors/done count) */
.v2-wizard-step-caption {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    line-height: var(--leading-tight);
}

/* ============================================================
   STEP STATES
   ============================================================ */

/* is-done — completed step (green checkmark) */
.v2-wizard-step.is-done .v2-wizard-step-dot {
    background: var(--success);
    color: var(--text-inverse);
}
.v2-wizard-step.is-done .v2-wizard-step-name {
    color: var(--text-secondary);
}
.v2-wizard-step.is-done .v2-wizard-step-num {
    color: var(--success);
}

/* is-active — current step */
.v2-wizard-step.is-active {
    background: var(--accent-bg);
    border-color: var(--accent);
}
.v2-wizard-step.is-active .v2-wizard-step-dot {
    background: var(--accent);
    color: var(--text-inverse);
}
.v2-wizard-step.is-active .v2-wizard-step-num {
    color: var(--accent-text);
}
.v2-wizard-step.is-active .v2-wizard-step-name {
    color: var(--accent-text);
    font-weight: var(--weight-semibold);
}

/* has-errors — step has validation issues */
.v2-wizard-step.has-errors .v2-wizard-step-dot {
    background: var(--danger);
    color: var(--text-inverse);
}
.v2-wizard-step.has-errors .v2-wizard-step-name {
    color: var(--danger);
}
.v2-wizard-step.has-errors .v2-wizard-step-caption {
    color: var(--danger);
    font-weight: var(--weight-medium);
}
.v2-wizard-step.has-errors .v2-wizard-step-num {
    color: var(--danger);
}

/* is-disabled — недоступний крок (наприклад, зарезервований до виконання попередніх) */
.v2-wizard-step.is-disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

/* ============================================================
   BODY (scrollable step content)
   ============================================================ */
.v2-wizard-body {
    flex: 1;
    min-height: 0;
    padding: var(--s-7) var(--s-8);
    background: var(--bg-card);
    overflow-y: auto;
}

/* ============================================================
   STEP HEAD (eyebrow + h2 + lede) — над section cards у тілі
   ============================================================ */
.v2-wizard-step-head {
    margin-bottom: var(--s-7);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.v2-wizard-step-eyebrow {
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    line-height: var(--leading-tight);
}

.v2-wizard-step-h2 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    letter-spacing: -0.01em;
    line-height: var(--leading-tight);
    color: var(--text-primary);
}

.v2-wizard-step-lede {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--text-md);
    line-height: var(--leading-normal);
    max-width: 720px;
}

/* ============================================================
   STICKY BAR (Скасувати / Зберегти чернетку | Назад / Далі)
   ============================================================ */
.v2-wizard-stickybar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-5);
    padding: var(--s-4) var(--s-7);
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -4px 12px rgba(26, 26, 25, 0.04);
    flex-wrap: wrap;
}

.v2-wizard-stickybar-left,
.v2-wizard-stickybar-right {
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
}

.v2-wizard-step-counter {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-right: var(--s-3);
    white-space: nowrap;
}

/* Стани: dirty (показує що draft не збережено), saving (під час post) */
.v2-wizard-stickybar.is-dirty .v2-wizard-step-counter {
    color: var(--warning);
    font-weight: var(--weight-medium);
}

/* ============================================================
   SUMMARY BOX (для останнього кроку — підсумок перед терміналом)
   ============================================================ */
.v2-summary-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--r-md);
    padding: var(--s-5) var(--s-6);
    margin-bottom: var(--s-5);
    box-shadow: var(--shadow-xs-v2);
}

.v2-summary-box-title {
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: var(--s-3);
    padding-bottom: var(--s-2);
    border-bottom: 1px solid var(--border-subtle);
}

.v2-summary-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: var(--s-5);
    padding: var(--s-3) 0;
    font-size: var(--text-md);
    border-bottom: 1px dashed var(--border-subtle);
}
.v2-summary-row:last-child {
    border-bottom: 0;
}
.v2-summary-row .k {
    color: var(--text-tertiary);
    overflow-wrap: anywhere;
}
.v2-summary-row .v {
    color: var(--text-primary);
    font-weight: var(--weight-medium);
    overflow-wrap: anywhere;
}

/* Accent-version для підсумку суми (great total) */
.v2-summary-box-accent {
    background: var(--accent-bg);
    border-color: var(--accent);
}
.v2-summary-box-accent .v2-summary-box-title {
    color: var(--accent-text);
    border-bottom-color: var(--accent-bg-strong);
}
.v2-summary-box-accent .v2-summary-row {
    border-bottom-color: var(--accent-bg-strong);
}
.v2-summary-box-accent .v2-summary-row .k {
    color: var(--accent-text);
}
.v2-summary-box-accent .v2-summary-row .v {
    color: var(--accent-text);
}

/* Велика кінцева цифра (Total to pay) — окремий формат */
.v2-summary-row-total .v {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--accent-text);
}

/* ============================================================
   DENSITY
   ============================================================ */
[data-v2-density="compact"] .v2-wizard-progress {
    padding: var(--s-5) var(--s-6) var(--s-4);
}
[data-v2-density="compact"] .v2-wizard-step {
    padding: var(--s-2) var(--s-3);
}
[data-v2-density="compact"] .v2-wizard-step-name {
    font-size: var(--text-sm);
}
[data-v2-density="compact"] .v2-wizard-step-dot {
    width: 16px;
    height: 16px;
    font-size: 9px;
}

[data-v2-density="spacious"] .v2-wizard-progress {
    padding: var(--s-7) var(--s-8) var(--s-6);
}
[data-v2-density="spacious"] .v2-wizard-step {
    padding: var(--s-4) var(--s-5);
}

[data-v2-density="compact"] .v2-wizard-body {
    padding: var(--s-5) var(--s-6);
}
[data-v2-density="compact"] .v2-wizard-step-head {
    margin-bottom: var(--s-4);
}
[data-v2-density="compact"] .v2-wizard-stickybar {
    padding: var(--s-3) var(--s-5);
}
[data-v2-density="compact"] .v2-wizard-step-h2 {
    font-size: var(--text-lg);
}

[data-v2-density="spacious"] .v2-wizard-body {
    padding: var(--s-9) var(--s-10);
}
[data-v2-density="spacious"] .v2-wizard-stickybar {
    padding: var(--s-5) var(--s-8);
}

/* ============================================================
   RESPONSIVE — на вузьких екранах кроки стають вертикально
   ============================================================ */
@media (max-width: 720px) {
    .v2-wizard-steps {
        grid-auto-flow: row;
        grid-auto-columns: auto;
    }
}
