/* =========================================================
   AI IMAGE STUDIO V2 - WIZARD
   File: assets/css/wizard.css
   ========================================================= */

.wizard-page {
    padding-top: 16px;
}

.wizard-hero {
    position: relative;
    display: flex;
    min-height: 168px;
    padding: 22px;
    overflow: hidden;
    border-radius: 26px;
    background:
        linear-gradient(
            135deg,
            #24145d 0%,
            #6840dc 58%,
            #9a6cff 100%
        );
    box-shadow:
        0 18px 42px rgba(74, 48, 174, 0.25);
}

.wizard-hero > div:first-child {
    position: relative;
    z-index: 2;
    max-width: 78%;
}

.wizard-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 999px;
    background: rgba(255,255,255,.14);
}

.wizard-hero h2 {
    margin: 15px 0 8px;
    color: #fff;
    font-size: 22px;
    line-height: 1.25;
}

.wizard-hero p {
    margin: 0;
    color: rgba(255,255,255,.76);
    font-size: 12px;
    line-height: 1.6;
}

.wizard-hero-decoration {
    position: absolute;
    right: -22px;
    bottom: -28px;
    display: grid;
    width: 135px;
    height: 135px;
    place-items: center;
    color: rgba(255,255,255,.15);
    font-size: 70px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 42px;
    transform: rotate(-12deg);
    background: rgba(255,255,255,.06);
}

/* =========================================================
   PROGRESS
   ========================================================= */

.wizard-progress {
    display: grid;
    grid-template-columns:
        auto 1fr auto 1fr auto 1fr auto;
    gap: 6px;
    margin: 18px 0 16px;
    padding: 15px 13px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow);
}

.wizard-progress-item {
    display: flex;
    min-width: 48px;
    padding: 0;
    align-items: center;
    flex-direction: column;
    gap: 5px;
    color: #aaaabb;
    border: 0;
    background: transparent;
}

.wizard-progress-item > span {
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    font-size: 11px;
    font-weight: 900;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fafafa;
    transition: .2s ease;
}

.wizard-progress-item small {
    font-size: 8px;
    font-weight: 800;
}

.wizard-progress-item.active,
.wizard-progress-item.completed {
    color: var(--primary);
}

.wizard-progress-item.active > span {
    color: #fff;
    border-color: var(--primary);
    background:
        linear-gradient(
            135deg,
            var(--primary),
            #9863ff
        );
    box-shadow:
        0 8px 18px rgba(108,76,255,.24);
}

.wizard-progress-item.completed > span {
    color: var(--primary);
    border-color: #d9d1ff;
    background: var(--primary-soft);
}

.wizard-progress-line {
    display: block;
    height: 2px;
    border-radius: 999px;
    background: #ececf3;
}

.wizard-progress-line.completed {
    background:
        linear-gradient(
            90deg,
            var(--primary),
            #9a6cff
        );
}

/* =========================================================
   STEP WRAPPER
   ========================================================= */

.wizard-form {
    display: block;
}

.wizard-step {
    animation: wizardFadeIn .24s ease;
}

.wizard-step[hidden] {
    display: none !important;
}

.wizard-step-heading {
    margin-bottom: 14px;
    padding: 0 2px;
}

.wizard-step-kicker {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--primary);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1.2px;
}

.wizard-step-heading h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.3;
}

.wizard-step-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.wizard-panel {
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow);
}

.wizard-step-actions {
    display: flex;
    margin-top: 16px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wizard-back-button,
.wizard-next-button {
    display: inline-flex;
    min-height: 46px;
    padding: 10px 15px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 800;
    border-radius: 14px;
}

.wizard-back-button {
    color: var(--text);
    border: 1px solid var(--border);
    background: #fff;
}

.wizard-next-button {
    color: #fff;
    border: 0;
    background:
        linear-gradient(
            135deg,
            var(--primary),
            #9160ff
        );
    box-shadow:
        0 12px 24px rgba(108,76,255,.23);
}

/* =========================================================
   SOURCE SWITCH
   ========================================================= */

.main-source-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 9px;
    margin-bottom: 14px;
}

.source-option {
    position: relative;
}

.source-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.source-option > span {
    display: flex;
    min-height: 102px;
    padding: 14px 8px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    transition: .2s ease;
}

.source-option i {
    margin-bottom: 3px;
    color: var(--primary);
    font-size: 24px;
}

.source-option strong {
    font-size: 12px;
}

.source-option small {
    color: var(--muted);
    font-size: 9px;
}

.source-option input:checked + span {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow:
        0 0 0 3px rgba(108,76,255,.08);
}

/* =========================================================
   SUBJECT AI FORM
   ========================================================= */

.main-ai-area {
    margin-top: 1px;
}

.subject-form-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
}

.subject-field {
    display: block;
}

.subject-field > span {
    display: block;
    margin-bottom: 6px;
    color: #5f5f70;
    font-size: 10px;
    font-weight: 800;
}

.subject-field select,
.subject-field textarea {
    width: 100%;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    background: #fafafa;
}

.subject-field select {
    height: 44px;
    padding: 0 11px;
    font-size: 11px;
}

.subject-field textarea {
    padding: 12px;
    resize: vertical;
    font-size: 11px;
    line-height: 1.6;
}

.subject-field select:focus,
.subject-field textarea:focus {
    border-color: var(--primary);
    box-shadow:
        0 0 0 3px rgba(108,76,255,.09);
}

.subject-field-full {
    margin-top: 11px;
}

.quality-chip-group {
    display: flex;
    gap: 7px;
    margin-top: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.quality-chip-group::-webkit-scrollbar {
    display: none;
}

.quality-chip {
    flex: 0 0 auto;
    padding: 8px 11px;
    color: var(--primary);
    font-size: 9px;
    font-weight: 800;
    border: 1px solid #ddd7ff;
    border-radius: 999px;
    background: var(--primary-soft);
}

.quality-chip.active {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.generate-subject-button {
    display: grid;
    grid-template-columns: 41px 1fr auto;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
    padding: 12px 14px;
    align-items: center;
    color: #fff;
    text-align: left;
    border: 0;
    border-radius: 17px;
    background:
        linear-gradient(
            135deg,
            #25165f,
            var(--primary)
        );
    box-shadow:
        0 12px 25px rgba(108,76,255,.22);
}

.generate-subject-button > span {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    font-size: 17px;
    border-radius: 12px;
    background: rgba(255,255,255,.16);
}

.generate-subject-button strong,
.generate-subject-button small {
    display: block;
}

.generate-subject-button strong {
    font-size: 12px;
}

.generate-subject-button small {
    margin-top: 3px;
    color: rgba(255,255,255,.7);
    font-size: 9px;
}

.generate-subject-button:disabled {
    cursor: not-allowed;
    opacity: .64;
}

.subject-generation-loading {
    display: flex;
    margin-top: 13px;
    padding: 13px;
    align-items: center;
    gap: 12px;
    border: 1px solid #ddd7ff;
    border-radius: 15px;
    background: var(--primary-soft);
}

.subject-generation-loading[hidden],
.generated-subject-result[hidden] {
    display: none !important;
}

.subject-generation-loading strong,
.subject-generation-loading small {
    display: block;
}

.subject-generation-loading strong {
    color: var(--primary);
    font-size: 11px;
}

.subject-generation-loading small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
}

.small-ai-loader {
    display: flex;
    width: 48px;
    height: 35px;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.small-ai-loader span {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    animation: aiBounce .75s infinite alternate;
}

.small-ai-loader span:nth-child(2) {
    animation-delay: .15s;
}

.small-ai-loader span:nth-child(3) {
    animation-delay: .3s;
}

.generated-subject-result {
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid #ccebdc;
    border-radius: 18px;
    background: #fff;
}

.generated-subject-status {
    display: flex;
    padding: 11px 12px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.generated-subject-status span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--success);
    font-size: 10px;
    font-weight: 800;
}

.generated-subject-status button {
    padding: 6px 9px;
    color: var(--primary);
    font-size: 9px;
    font-weight: 800;
    border: 0;
    border-radius: 9px;
    background: var(--primary-soft);
}

.generated-subject-image {
    overflow: hidden;
    background: #eeeef5;
}

.generated-subject-image img {
    display: block;
    width: 100%;
    max-height: 460px;
    object-fit: contain;
}

/* =========================================================
   REFERENCES
   ========================================================= */

.reference-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.reference-header-row h3 {
    margin: 0;
    font-size: 14px;
}

.reference-header-row p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 9px;
}

.reference-suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 9px;
    margin-top: 13px;
}

.reference-suggestion {
    display: flex;
    min-width: 0;
    padding: 13px;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}

.reference-suggestion > i {
    display: grid;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    place-items: center;
    color: var(--primary);
    font-size: 17px;
    border-radius: 12px;
    background: var(--primary-soft);
}

.reference-suggestion strong,
.reference-suggestion small {
    display: block;
}

.reference-suggestion strong {
    font-size: 10px;
}

.reference-suggestion small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 8px;
}

/* =========================================================
   PROMPT
   ========================================================= */

.prompt-field {
    display: block;
}

.prompt-field > span,
.prompt-chip-section > span {
    display: block;
    margin-bottom: 7px;
    color: #5f5f70;
    font-size: 10px;
    font-weight: 800;
}

.prompt-chip-section {
    margin-top: 12px;
}

.negative-prompt-field {
    margin-top: 14px;
}

.negative-prompt-field textarea {
    width: 100%;
    padding: 12px;
    resize: vertical;
    color: var(--text);
    font-size: 11px;
    line-height: 1.6;
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;
    background: #fafafa;
}

.negative-prompt-field textarea:focus {
    border-color: var(--primary);
    box-shadow:
        0 0 0 3px rgba(108,76,255,.09);
}

/* =========================================================
   FINAL STEP
   ========================================================= */

.final-setting-heading {
    margin-bottom: 14px;
}

.final-setting-heading h3 {
    margin: 0;
    font-size: 14px;
}

.final-setting-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 9px;
}

.final-summary-card {
    display: flex;
    margin-top: 13px;
    padding: 15px;
    align-items: center;
    gap: 12px;
    border: 1px solid #ddd7ff;
    border-radius: 17px;
    background: var(--primary-soft);
}

.final-summary-icon {
    display: grid;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    place-items: center;
    color: var(--primary);
    font-size: 19px;
    border-radius: 14px;
    background: #fff;
}

.final-summary-card strong {
    display: block;
    color: var(--primary);
    font-size: 11px;
}

.final-summary-card p {
    margin: 4px 0 0;
    color: #6f6f80;
    font-size: 9px;
    line-height: 1.5;
}

.final-actions {
    align-items: stretch;
}

.final-actions .generate-button {
    width: auto;
    flex: 1;
}

/* =========================================================
   ANIMATIONS
   ========================================================= */

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

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

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 390px) {
    .wizard-progress {
        gap: 3px;
        padding: 13px 8px;
    }

    .wizard-progress-item {
        min-width: 42px;
    }

    .wizard-progress-item small {
        font-size: 7px;
    }

    .subject-form-grid {
        grid-template-columns: 1fr;
    }

    .reference-suggestion-grid {
        grid-template-columns: 1fr;
    }

    .wizard-step-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .wizard-back-button,
    .wizard-next-button {
        width: 100%;
    }

    .wizard-step-actions > span:empty {
        display: none;
    }

    .final-actions {
        flex-direction: column;
    }

    .final-actions .generate-button {
        width: 100%;
    }
}

.reference-type-content {
    flex: 1;
    min-width: 0;
}

.reference-weight-field {
    display: block;
    margin-top: 10px;
}

.reference-weight-field > span {
    display: flex;
    margin-bottom: 6px;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-size: 9px;
}

.reference-weight-field strong {
    color: var(--primary);
}

.reference-weight-input {
    width: 100%;
    accent-color: var(--primary);
}

.reference-preview-card.dragging {
    opacity: .45;
}

.reference-preview-card.drag-over {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.main-upload-box.drag-active {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow:
        0 0 0 4px rgba(108, 76, 255, 0.08);
}

.main-upload-box.has-image {
    border-style: solid;
}
