/* ============================================================
   Sequential step gating — seeHoldREnt
   Shared by index.html, step2.html, step3.html
   Pairs with steps.js. Uses each page's existing :root tokens,
   with fallbacks so it also works standalone.
   ============================================================ */

.substeps-list {
    --step-done: #059669;
    --step-done-soft: rgba(5, 150, 105, 0.10);
    --step-lock: #9ca3af;
    --step-lock-soft: #f3f4f6;
}

/* ---------- Progress summary (injected above the list) ---------- */

.step-progress {
    margin: 0 0 1.25rem;
}

.step-progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.step-progress-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--dark, #1f2937);
    letter-spacing: 0.01em;
}

.step-progress.is-complete .step-progress-count {
    color: #059669;
}

.step-reset {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 0.78rem;
    color: var(--gray, #6b7280);
    text-decoration: underline;
    cursor: pointer;
}

.step-reset:hover {
    color: var(--dark, #1f2937);
}

.step-progress-track {
    height: 6px;
    border-radius: 999px;
    background: var(--border, #e5e7eb);
    overflow: hidden;
}

.step-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: var(--primary, #2563eb);
    transition: width 0.35s ease;
}

.step-progress.is-complete .step-progress-fill {
    background: #059669;
}

/* ---------- Number badge ---------- */

.substeps-list .substep-num {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    background: var(--step-lock-soft);
    color: var(--step-lock);
    transition: background-color 0.2s ease, color 0.2s ease;
}

li.is-active > .substep-main > .substep-num {
    background: var(--primary, #2563eb);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

li.is-done > .substep-main > .substep-num {
    background: var(--step-done);
    color: #fff;
}

/* <i> wrapper is a hook for the check swap below, not emphasis */
.substeps-list .substep-num-txt {
    font-style: normal;
}

/* Swap the digit for a checkmark once done */
li.is-done > .substep-main > .substep-num .substep-num-txt {
    display: none;
}

li.is-done > .substep-main > .substep-num::before {
    content: "\2713";
    font-size: 0.95rem;
}

/* The green-highlighted cards (step2) keep their own accent for the active dot */
.step-card.highlight li.is-active > .substep-main > .substep-num {
    background: var(--secondary, #0596a5);
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.16);
}

/* ---------- Row states ---------- */

.substeps-list > li {
    position: relative;
    padding-left: 0.85rem;
    border-left: 3px solid transparent;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.substeps-list > li.is-active {
    border-left-color: var(--primary, #2563eb);
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.045), transparent 65%);
}

.step-card.highlight .substeps-list > li.is-active {
    border-left-color: var(--secondary, #0596a5);
    background: linear-gradient(90deg, rgba(5, 150, 105, 0.05), transparent 65%);
}

.substeps-list > li.is-locked {
    opacity: 0.55;
}

.substeps-list > li.is-done {
    opacity: 0.9;
}

/* Locked buttons: visibly inert, but still focusable so a click can explain why */
.substeps-list [aria-disabled="true"] {
    background-color: var(--step-lock-soft) !important;
    color: var(--step-lock) !important;
    border-color: transparent !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

.substeps-list [aria-disabled="true"]:hover {
    transform: none !important;
    background-color: var(--step-lock-soft) !important;
    color: var(--step-lock) !important;
}

/* Completed link buttons stay usable (in case they need to re-open a form) */
.substeps-list li.is-done .substep-btn:not(.next-step-btn) {
    background-color: var(--step-done-soft) !important;
    color: var(--step-done) !important;
    border-color: rgba(5, 150, 105, 0.25) !important;
}

/* ---------- Status pill ---------- */

.substep-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 2.15rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--step-lock);
}

li.is-active > .substep-status {
    color: var(--primary, #2563eb);
}

.step-card.highlight li.is-active > .substep-status {
    color: var(--secondary, #0596a5);
}

li.is-done > .substep-status {
    color: var(--step-done);
}

/* ---------- "Mark as done" + confirmation prompt ---------- */

.substep-action {
    margin: 0.55rem 0 0 2.15rem;
}

.substep-confirm {
    margin: 0.6rem 0 0.1rem 2.15rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.04);
}

.step-card.highlight .substep-confirm {
    border-color: rgba(5, 150, 105, 0.25);
    background: rgba(5, 150, 105, 0.04);
}

.substep-confirm p {
    margin: 0 0 0.6rem !important;
    font-size: 0.85rem;
    color: var(--dark, #1f2937);
}

.substep-confirm-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.step-btn {
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.step-btn-yes {
    background: var(--step-done);
    color: #fff;
}

.step-btn-yes:hover {
    background: #047857;
}

.step-btn-no {
    background: #fff;
    color: var(--gray, #6b7280);
    border-color: var(--border, #e5e7eb);
}

.step-btn-no:hover {
    color: var(--dark, #1f2937);
    border-color: var(--step-lock);
}

.step-btn-manual {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary, #2563eb);
    border-color: rgba(37, 99, 235, 0.2);
}

.step-btn-manual:hover {
    background: var(--primary, #2563eb);
    color: #fff;
}

.step-card.highlight .step-btn-manual {
    background: rgba(5, 150, 105, 0.08);
    color: var(--secondary, #0596a5);
    border-color: rgba(5, 150, 105, 0.2);
}

.step-card.highlight .step-btn-manual:hover {
    background: var(--secondary, #0596a5);
    color: #fff;
}

.step-btn-undo {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 0.75rem;
    color: var(--gray, #6b7280);
    text-decoration: underline;
    cursor: pointer;
}

.step-btn-undo:hover {
    color: var(--dark, #1f2937);
}

/* ---------- Inline "why is this locked" hint ---------- */

.substep-hint {
    margin: 0.5rem 0 0 2.15rem;
    font-size: 0.8rem;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
}

.substep-hint.is-flash {
    animation: step-flash 0.35s ease;
}

@keyframes step-flash {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-4px); }
    75%  { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

/* ---------- Cross-page gate (landing on step2/step3 too early) ---------- */

.step-gate {
    margin: 0 0 1.5rem;
    padding: 1.1rem 1.25rem;
    border-radius: 10px;
    border: 1px solid #fde68a;
    background: #fffbeb;
}

.step-gate h4 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    color: #92400e;
}

.step-gate p {
    margin: 0 0 0.85rem !important;
    font-size: 0.88rem;
    color: #b45309 !important;
}

.step-gate .step-gate-btn {
    display: inline-flex;
    align-items: center;
    background: #b45309;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
}

.step-gate .step-gate-btn:hover {
    background: #92400e;
}

.substeps-list.is-gated {
    pointer-events: none;
    opacity: 0.5;
    filter: grayscale(0.35);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .step-progress-fill,
    .substeps-list .substep-num,
    .substeps-list > li,
    .step-btn {
        transition: none;
    }
    .substep-hint.is-flash {
        animation: none;
    }
}

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
    .substep-status,
    .substep-action,
    .substep-confirm,
    .substep-hint {
        margin-left: 0;
    }
}

/* Note: with JS disabled none of the above elements are injected at all,
   so the pages simply fall back to their original ungated behaviour. */
