/* ========================================
   WIZARD STEP-BASED UI
   ======================================== */

/* ---- Navigation ---- */
.wizard-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.wizard-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--brand-primary);
    background: transparent;
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, color 0.2s;
}

.wizard-nav-btn:hover {
    background: var(--brand-primary);
    color: #fff;
}

.wizard-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Tooltip wrapper for the disabled next button */
.wizard-next-wrapper {
    position: relative;
    display: inline-flex;
}

.wizard-next-wrapper[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: rgba(20,20,20,0.92);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 9px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
}

.wizard-next-wrapper[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    right: 12px;
    border: 5px solid transparent;
    border-top-color: rgba(20,20,20,0.92);
    pointer-events: none;
    z-index: 9999;
}

.wizard-step-label {
    font-weight: 700;
    font-size: 16px;
    min-width: 40px;
    text-align: center;
    color: var(--text-color);
}

/* ---- Step 1 Guide Tooltip ---- */
.tippy-box[data-theme~='wizard-guide'] {
    background: #102a43;
    color: #ffffff;
    border: 3px solid #0b1f36;
    border-radius: 18px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
    font-weight: 800;
    font-size: 21px;
    line-height: 1.1;
}

.tippy-box[data-theme~='wizard-guide'] .tippy-content {
    padding: 14px 14px;
    min-width: 128px;
    text-align: left;
}

.tippy-box[data-theme~='wizard-guide'] > .tippy-arrow {
    display: none;
}

.tippy-box[data-theme~='wizard-guide'][data-placement^='right']::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 56%;
    transform: translateY(-50%);
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-right: 22px solid #0b1f36;
}

.tippy-box[data-theme~='wizard-guide'][data-placement^='right']::after {
    content: '';
    position: absolute;
    left: -18px;
    top: 56%;
    transform: translateY(-50%);
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-right: 20px solid #102a43;
}

.tippy-box[data-theme~='wizard-guide'][data-placement^='left']::before {
    content: '';
    position: absolute;
    right: -22px;
    top: 56%;
    transform: translateY(-50%);
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-left: 22px solid #0b1f36;
}

.tippy-box[data-theme~='wizard-guide'][data-placement^='left']::after {
    content: '';
    position: absolute;
    right: -18px;
    top: 56%;
    transform: translateY(-50%);
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 20px solid #102a43;
}

@media (max-width: 560px) {
    .tippy-box[data-theme~='wizard-guide'] {
        font-size: 18px;
    }

    .tippy-box[data-theme~='wizard-guide'] .tippy-content {
        padding: 12px;
    }
}

/* ---- Step containers ---- */
.wizard-step {
    display: none;
    flex-direction: column;
    gap: 10px;
    animation: wizardFadeIn 0.25s ease;
}

.wizard-step.active {
    display: flex;
}

@keyframes wizardFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wizard-step-title {
    margin: 0;
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 700;
    text-align: center;
    opacity: 0.8;
}

/* ---- Step 0: Process Cards ---- */
.process-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.process-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.process-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.process-card.selected {
    border-color: var(--brand-primary);
    background: rgba(0, 168, 255, 0.08);
}

.process-card-label {
    font-weight: 700;
    font-size: 16px;
    text-align: center;
}

.process-card-info {
    position: absolute;
    top: 10px;
    right: 12px;
    opacity: 0.5;
    font-size: 16px;
    cursor: help;
    transition: opacity 0.2s;
}

.process-card-info:hover {
    opacity: 1;
}

.process-card-illustration {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 168, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
    margin: 8px 0;
    transition: background 0.2s, transform 0.2s;
}

.process-card.selected .process-card-illustration {
    background: var(--brand-primary);
    color: #fff;
    transform: scale(1.05);
}

.process-card-illustration svg {
    width: 32px;
    height: 32px;
    stroke-width: 2;
}

/* ---- Step 1: Upload Zone ---- */
.wizard-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 12px;
    border: 3px dashed var(--brand-primary);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    min-height: 160px;
}

.wizard-upload-zone:hover {
    background: rgba(0, 168, 255, 0.06);
}

.wizard-upload-icon {
    font-size: 48px;
    color: var(--brand-primary);
}

.wizard-upload-label {
    font-weight: 600;
    font-size: 15px;
}

.wizard-arrange {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scale controls in arrange view */
.wizard-scale-controls {
    padding: 8px 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
}

.scale-number-input {
    width: 64px;
    padding: 4px 6px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.07);
    color: inherit;
    font-size: 13px;
    text-align: right;
    -moz-appearance: textfield;
}

.scale-number-input::-webkit-outer-spin-button,
.scale-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.scale-number-input:focus {
    outline: none;
    border-color: var(--brand-primary, #00a8ff);
}

body.light-mode .wizard-scale-controls {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.1);
}

body.light-mode .scale-number-input {
    background: #fff;
    border-color: rgba(0,0,0,0.2);
    color: #333;
}

.wizard-inline-next {
    margin-top: 4px;
    margin-bottom: 2px;
}

/* Arrange card */
.wizard-arrange-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
}

.wizard-arrange-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.wizard-arrange-card i {
    font-size: 28px;
    color: var(--brand-primary);
}

/* Arrange Button Stack */
.wizard-arrange .btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 0;
    overflow: visible;
}

.wizard-arrange .btn-group button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.wizard-arrange .btn-group button i {
    font-size: 18px;
    opacity: 0.8;
}

.wizard-arrange .btn-group button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-color);
}

.wizard-arrange .btn-group button.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

/* ---- Step 2: Material Grid ---- */
.wizard-material-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wizard-material-btn {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-color);
    transition: border-color 0.2s, background 0.2s;
}

.wizard-material-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.wizard-material-btn.selected {
    border-color: var(--brand-primary);
    background: rgba(0, 168, 255, 0.12);
    color: var(--brand-primary);
}

/* ---- Step 3: Color Grid ---- */
.wizard-color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.wizard-color-swatch {
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}

.wizard-color-swatch:hover {
    transform: scale(1.06);
}

.wizard-color-swatch.selected {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.4);
}

/* White swatch needs visible border */
.wizard-color-swatch[data-light="true"] {
    border-color: #ddd;
}

.wizard-color-swatch[data-light="true"].selected {
    border-color: var(--brand-primary);
}

.color-surcharge-badge {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.68);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: none;
}

/* ---- Step 4: Quality List ---- */
.wizard-quality-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wizard-quality-list .quality-card {
    flex: none;
    width: 100%;
    flex-direction: row;
    padding: 8px;
    gap: 10px;
}

/* Media wrapper: holds either the splat canvas or the fallback img */
.wizard-quality-list .quality-card-media {
    position: relative;
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
}

.wizard-quality-list .quality-card-media canvas,
.wizard-quality-list .quality-card-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.35s ease;
}

/* Hide canvas by default; shown by JS when splat is loaded */
.wizard-quality-list .quality-card-media .quality-splat-canvas {
    display: none;
}

.wizard-quality-list .quality-card:hover .quality-card-media canvas,
.wizard-quality-list .quality-card:hover .quality-card-media img,
.wizard-quality-list .quality-card:focus-within .quality-card-media canvas,
.wizard-quality-list .quality-card:focus-within .quality-card-media img {
    transform: scale(1.08);
}

/* When splat is active, hide the fallback image */
.wizard-quality-list .quality-card-media.splat-loaded .quality-splat-canvas {
    display: block;
}

.wizard-quality-list .quality-card-media.splat-loaded .quality-splat-fallback {
    display: none;
}


.wizard-quality-list .quality-card span {
    font-size: 16px;
    font-weight: 700;
}

/* ---- Light Mode Overrides ---- */
body.light-mode .process-card {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .process-card:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light-mode .wizard-upload-zone {
    background: rgba(0, 0, 0, 0.01);
}

body.light-mode .wizard-material-btn {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .wizard-arrange-card {
    background: rgba(0, 0, 0, 0.02);
}