/* ============================================================
   SiteBlueprint - Form Wizard Stylesheet
   Multi-step form navigation, panels, and interactions
   ============================================================ */

/* ---------- Wizard Container ---------- */
.sb-wizard {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-xl) var(--container-padding) var(--space-3xl);
}

/* ---------- Step Navigation Bar ---------- */
.sb-step-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-2xl);
    padding: var(--space-md) 0;
    position: relative;
}

/* Horizontal connecting line behind steps */
.sb-step-nav::before {
    content: '';
    position: absolute;
    top: 39%;
    left: 0;
    right: 10%;
    height: 3px;
    background: var(--brand-border);
    border-radius: 2px;
    transform: translateY(-50%);
    z-index: 0;
}

.sb-step-progress-bar {
    position: absolute;
    top: 39%;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-primary-soft));
    border-radius: 2px;
    transform: translateY(-50%);
    z-index: 1;
    transition: width var(--transition-smooth);
}

/* Individual step item */
.sb-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    position: relative;
    z-index: 2;
    cursor: default;
    min-width: 80px;
    flex: 1;
    max-width: 120px;
}

.sb-step-item:not(.sb-step-active):not(.sb-step-completed) {
    cursor: pointer;
}

.sb-step-item:not(.sb-step-active):not(.sb-step-completed):hover .sb-step-number {
    border-color: var(--brand-primary-soft);
    color: var(--brand-primary);
}

/* Step number circle */
.sb-step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-tiny);
    font-weight: var(--font-weight-semibold);
    background: var(--brand-white);
    border: 2px solid var(--brand-border);
    color: var(--brand-text-muted);
    transition: all var(--transition-smooth);
    position: relative;
}

.sb-step-number svg {
    width: 16px;
    height: 16px;
}

/* Active step */
.sb-step-active .sb-step-number {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--brand-white);
    box-shadow: var(--shadow-glow-strong);
    transform: scale(1.1);
}

/* Completed step */
.sb-step-completed .sb-step-number {
    background: var(--brand-success);
    border-color: var(--brand-success);
    color: var(--brand-white);
    animation: sb-step-pop var(--transition-bounce);
}

@keyframes sb-step-pop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Step label */
.sb-step-label {
    font-size: var(--font-size-tiny);
    font-weight: var(--font-weight-medium);
    color: var(--brand-text-muted);
    text-align: center;
    transition: color var(--transition-fast);
    white-space: nowrap;
}

.sb-step-active .sb-step-label {
    color: var(--brand-primary);
    font-weight: var(--font-weight-semibold);
}

.sb-step-completed .sb-step-label {
    color: var(--brand-success);
}

/* ---------- Step Panels ---------- */
.sb-step-panels {
    position: relative;
    overflow: hidden;
}

.sb-step-panel {
    display: none;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sb-step-panel.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.sb-step-panel.leaving {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transform: translateX(-30px);
    pointer-events: none;
}

/* Step header inside panel */
.sb-step-header {
    margin-bottom: var(--space-xl);
    text-align: center;
}

.sb-step-header h2 {
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-h2);
}

.sb-step-header p {
    color: var(--brand-text-muted);
    max-width: 500px;
    margin: 0 auto;
}

/* ---------- Step Content Cards ---------- */
.sb-step-content {
    background: var(--brand-white);
    border: 1px solid var(--brand-border);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-xl);
}

.sb-step-content:focus-within {
    border-color: var(--brand-border-hover);
    box-shadow: 0 4px 20px rgba(73, 104, 248, 0.08);
}

/* Section grouping within a step */
.sb-form-section {
    margin-bottom: var(--space-xl);
}

.sb-form-section:last-child {
    margin-bottom: 0;
}

.sb-form-section-title {
    font-size: var(--font-size-h4);
    font-weight: var(--font-weight-semibold);
    color: var(--brand-dark);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sb-form-section-title .sb-section-count {
    background: var(--brand-primary);
    color: var(--brand-white);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: var(--font-size-tiny);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---------- Checkbox / Radio Groups (Multi-select) ---------- */
.sb-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-sm);
}

.sb-check-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    border: 1px solid var(--brand-border);
    border-radius: var(--button-radius);
    background: var(--brand-white);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.sb-check-card:hover {
    border-color: var(--brand-primary-soft);
    background: var(--brand-primary-ghost);
}

.sb-check-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sb-check-card .sb-check-box {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--brand-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    margin-top: 1px;
}

.sb-check-card input:checked + .sb-check-box,
.sb-check-card input:checked ~ .sb-check-box {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.sb-check-card input:checked + .sb-check-box::after,
.sb-check-card input:checked ~ .sb-check-box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--brand-white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.sb-check-card input:focus + .sb-check-box,
.sb-check-card input:focus ~ .sb-check-box {
    box-shadow: var(--shadow-glow);
}

.sb-check-card.checked {
    border-color: var(--brand-primary);
    background: var(--brand-primary-ghost);
}

.sb-check-card .sb-check-card-text {
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    color: var(--brand-text);
    line-height: var(--line-height-tight);
}

/* ---------- File Upload Zone ---------- */
.sb-upload-zone {
    border: 2px dashed var(--brand-border);
    border-radius: var(--card-radius);
    background: var(--brand-primary-ghost);
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.sb-upload-zone:hover {
    border-color: var(--brand-primary);
    background: rgba(73, 104, 248, 0.04);
}

.sb-upload-zone.drag-over {
    border-color: var(--brand-primary);
    background: rgba(73, 104, 248, 0.06);
    transform: scale(1.01);
}

.sb-upload-zone.has-files {
    border-style: solid;
    border-color: var(--brand-success);
    background: rgba(97, 206, 112, 0.05);
}

.sb-upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-md);
    color: var(--brand-primary-soft);
    opacity: 0.7;
}

.sb-upload-title {
    font-weight: var(--font-weight-medium);
    color: var(--brand-dark);
    margin-bottom: var(--space-xs);
}

.sb-upload-hint {
    font-size: var(--font-size-small);
    color: var(--brand-text-muted);
}

.sb-upload-hint strong {
    color: var(--brand-primary);
}

.sb-upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Uploaded file list */
.sb-file-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.sb-file-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--brand-white);
    border: 1px solid var(--brand-border);
    border-radius: var(--button-radius);
    transition: box-shadow var(--transition-fast);
}

.sb-file-item:hover {
    box-shadow: var(--shadow-sm);
}

.sb-file-icon {
    width: 40px;
    height: 40px;
    background: var(--brand-primary-ghost);
    border-radius: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
    flex-shrink: 0;
}

.sb-file-info {
    flex: 1;
    min-width: 0;
}

.sb-file-name {
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    color: var(--brand-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-file-meta {
    font-size: var(--font-size-tiny);
    color: var(--brand-text-muted);
    margin-top: 2px;
}

.sb-file-remove {
    background: none;
    border: none;
    color: var(--brand-text-muted);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--space-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sb-file-remove:hover {
    background: rgba(231, 76, 60, 0.08);
    color: var(--brand-error);
}

/* ---------- Review / Summary Panel ---------- */
.sb-review-section {
    margin-bottom: var(--space-xl);
}

.sb-review-section:last-child {
    margin-bottom: 0;
}

.sb-review-title {
    font-size: var(--font-size-h4);
    font-weight: var(--font-weight-semibold);
    color: var(--brand-dark);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sb-review-title a {
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
}

.sb-review-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md) var(--space-lg);
}

.sb-review-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.sb-review-label {
    font-size: var(--font-size-tiny);
    font-weight: var(--font-weight-medium);
    color: var(--brand-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sb-review-value {
    font-size: var(--font-size-body);
    color: var(--brand-text);
    line-height: var(--line-height-normal);
}

.sb-review-value-empty {
    color: var(--brand-text-muted);
    font-style: italic;
}

.sb-review-value-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.sb-review-value-list .sb-badge {
    font-size: var(--font-size-tiny);
    padding: 3px 8px;
}

/* ---------- Step Actions (Nav Buttons) ---------- */
.sb-step-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--brand-border);
}

.sb-step-actions-right {
    display: flex;
    gap: var(--space-md);
    margin-left: auto;
}

.sb-step-save-hint {
    font-size: var(--font-size-small);
    color: var(--brand-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sb-step-save-hint svg {
    width: 16px;
    height: 16px;
    color: var(--brand-success);
}

/* ---------- Progress Save Indicator ---------- */
.sb-save-indicator {
    position: fixed;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--brand-dark);
    color: var(--brand-white);
    padding: var(--space-sm) var(--space-lg);
    border-radius: 100px;
    font-size: var(--font-size-small);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all var(--transition-smooth);
    z-index: var(--z-toast);
    pointer-events: none;
}

.sb-save-indicator.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.sb-save-indicator svg {
    width: 14px;
    height: 14px;
    animation: sb-spin 1s linear infinite;
}

/* ---------- Conditional Field Groups ---------- */
.sb-conditional {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}

.sb-conditional.is-visible {
    max-height: 800px;
    opacity: 1;
    margin-top: var(--space-md);
}

/* ---------- Budget Range Pills ---------- */
.sb-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.sb-pill {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border: 1px solid var(--brand-border);
    border-radius: 100px;
    background: var(--brand-white);
    color: var(--brand-text);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.sb-pill:hover {
    border-color: var(--brand-primary-soft);
    background: var(--brand-primary-ghost);
}

.sb-pill input {
    position: absolute;
    opacity: 0;
}

.sb-pill:has(input:checked) {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--brand-white);
    box-shadow: 0 2px 8px rgba(73, 104, 248, 0.3);
}

/* ---------- Page Count Selector ---------- */
.sb-page-count {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sb-page-count-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--brand-border);
    background: var(--brand-white);
    color: var(--brand-primary);
    font-size: var(--font-size-h4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.sb-page-count-btn:hover {
    border-color: var(--brand-primary);
    background: var(--brand-primary-ghost);
}

.sb-page-count-value {
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-semibold);
    color: var(--brand-dark);
    min-width: 40px;
    text-align: center;
}

/* ---------- Hero / Intro ---------- */
.sb-hero {
    text-align: center;
    padding: var(--space-2xl) 0 var(--space-xl);
}

.sb-hero h1 {
    margin-bottom: var(--space-md);
}

.sb-hero p {
    color: var(--brand-text-muted);
    font-size: var(--font-size-h4);
    max-width: 600px;
    margin: 0 auto var(--space-lg);
    line-height: var(--line-height-normal);
}

.sb-hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-2xl);
    margin-top: var(--space-xl);
}

.sb-hero-stat {
    text-align: center;
}

.sb-hero-stat-number {
    font-size: var(--font-size-h2);
    font-weight: var(--font-weight-bold);
    color: var(--brand-primary);
    line-height: 1;
}

.sb-hero-stat-label {
    font-size: var(--font-size-small);
    color: var(--brand-text-muted);
    margin-top: var(--space-xs);
}

/* ---------- Success Page ---------- */
.sb-success {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
}

.sb-success-icon {
    width: 80px;
    height: 80px;
    background: var(--brand-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-xl);
    color: var(--brand-white);
    animation: sb-step-pop var(--transition-bounce);
}

.sb-success-icon svg {
    width: 40px;
    height: 40px;
}

.sb-success h2 {
    margin-bottom: var(--space-md);
}

.sb-success p {
    color: var(--brand-text-muted);
    max-width: 500px;
    margin: 0 auto var(--space-xl);
}

.sb-success-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
}

/* ---------- Shake Animation (Validation Error) ---------- */
@keyframes sb-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ---------- Mobile Step Navigation (Dots) ---------- */
@media (max-width: 768px) {
    .sb-step-nav {
        gap: var(--space-sm);
        padding: var(--space-sm) 0;
    }

    .sb-step-nav::before {
        left: 5%;
        right: 5%;
    }

    .sb-step-item {
        min-width: auto;
        max-width: none;
    }

    .sb-step-label {
        display: none;
    }

    .sb-step-number {
        width: 32px;
        height: 32px;
        font-size: 11px;
    }

    .sb-step-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--brand-white);
        border-top: 1px solid var(--brand-border);
        padding: var(--space-md) var(--container-padding);
        margin-top: 0;
        z-index: var(--z-sticky);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }

    .sb-wizard {
        padding-bottom: calc(var(--space-3xl) + 60px);
    }

    .sb-check-grid {
        grid-template-columns: 1fr;
    }

    .sb-review-grid {
        grid-template-columns: 1fr;
    }

    .sb-hero-stats {
        gap: var(--space-lg);
    }

    .sb-hero-stat-number {
        font-size: var(--font-size-h3);
    }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   Cost Estimator
   ============================================================ */

.sb-estimate {
    background: linear-gradient(135deg, var(--brand-darker) 0%, #1e3a8a 100%);
    border-radius: var(--card-radius);
    padding: var(--space-xl) var(--card-padding);
    color: var(--brand-white);
    box-shadow: 0 8px 32px rgba(73, 104, 248, 0.25);
}

.sb-estimate-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.sb-estimate-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.12);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sb-estimate-title {
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
}

.sb-estimate-note {
    font-size: var(--font-size-small);
    color: rgba(255,255,255,0.65);
    margin-top: 2px;
}

/* Range display */
.sb-estimate-range {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: var(--space-md);
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: var(--space-xl);
    text-align: center;
}

.sb-estimate-range-label {
    font-size: var(--font-size-tiny);
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}

.sb-estimate-range-value {
    font-size: 1.4rem;
    font-weight: var(--font-weight-semibold);
    color: rgba(255,255,255,0.75);
}

.sb-estimate-mid {
    border-left: 1px solid rgba(255,255,255,0.15);
    border-right: 1px solid rgba(255,255,255,0.15);
    padding: 0 var(--space-md);
}

.sb-estimate-mid-label {
    font-size: var(--font-size-tiny);
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}

.sb-estimate-mid-value {
    font-size: 2.2rem;
    font-weight: var(--font-weight-bold);
    color: var(--brand-white);
    line-height: 1;
}

/* Breakdown table */
.sb-estimate-breakdown {
    margin-bottom: var(--space-lg);
}

.sb-estimate-breakdown summary {
    font-size: var(--font-size-small);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: var(--space-sm) 0;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.sb-estimate-breakdown summary::-webkit-details-marker { display: none; }

.sb-estimate-breakdown summary::before {
    content: '▶';
    font-size: 10px;
    transition: transform 0.2s;
    display: inline-block;
}

.sb-estimate-breakdown[open] summary::before {
    transform: rotate(90deg);
}

.sb-estimate-breakdown summary:hover {
    color: var(--brand-white);
}

.sb-estimate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-small);
    margin-top: var(--space-md);
}

.sb-estimate-table th {
    text-align: left;
    padding: var(--space-xs) var(--space-sm);
    color: rgba(255,255,255,0.5);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-tiny);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sb-estimate-table th:not(:first-child),
.sb-estimate-table td:not(:first-child) {
    text-align: right;
    white-space: nowrap;
}

.sb-estimate-table td {
    padding: var(--space-xs) var(--space-sm);
    color: rgba(255,255,255,0.85);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    vertical-align: top;
}

.sb-estimate-table tbody tr:hover td {
    background: rgba(255,255,255,0.04);
}

.sb-estimate-item-label {
    display: block;
}

.sb-estimate-item-note {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-top: 1px;
}

.sb-estimate-table tfoot td {
    border-top: 1px solid rgba(255,255,255,0.2);
    border-bottom: none;
    color: var(--brand-white);
    padding-top: var(--space-sm);
}

.sb-estimate-disclaimer {
    font-size: var(--font-size-tiny);
    color: rgba(255,255,255,0.45);
    margin: 0;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .sb-estimate-range {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    .sb-estimate-mid {
        border: none;
        border-top: 1px solid rgba(255,255,255,0.15);
        border-bottom: 1px solid rgba(255,255,255,0.15);
        padding: var(--space-sm) 0;
    }
    .sb-estimate-mid-value {
        font-size: 1.8rem;
    }
}
