/* v03-ai-wizard — sidebar wizard on v01/v02 light shell */

:root {
    --coral: #FF5744;
    --coral-light: #FF7744;
    --coral-soft: rgba(255, 87, 68, 0.14);
    --coral-glow: rgba(255, 87, 68, 0.2);
    --card-white: #ffffff;
    --border-light: #e5e7eb;
    --radius-lg: 1.5rem;
    --radius-md: 0.875rem;
    --shadow-card: 0 24px 80px rgba(17, 24, 39, 0.08);
    --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font);
}

.wizard-shell {
    position: relative;
    min-height: 100vh;
}

.wizard-layout {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 4.5rem);
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    padding: 2rem 1rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 960px) {
    .wizard-layout {
        grid-template-columns: 220px minmax(0, 1fr);
        column-gap: 2rem;
        padding: 3rem 2rem 4rem;
    }
}

/* Sidebar */
.sidebar {
    display: none;
}

@media (min-width: 960px) {
    .sidebar {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding-top: 4rem;
    }
}

.sidebar-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: #d1d5db;
    flex-shrink: 0;
    transition: transform 0.2s, background 0.2s;
}

.sidebar-label {
    font-size: 0.95rem;
    color: #9ca3af;
    font-weight: 500;
    transition: color 0.2s;
}

.sidebar-step.is-active .sidebar-dot {
    width: 1.125rem;
    height: 1.125rem;
    background: var(--coral);
    box-shadow: 0 0 20px var(--coral-glow);
}

.sidebar-step.is-active .sidebar-label {
    color: #111827;
    font-weight: 700;
}

.sidebar-step.is-done .sidebar-dot {
    background: #9ca3af;
}

.sidebar-step.is-done .sidebar-label {
    color: #6b7280;
}

.sidebar-line {
    width: 2px;
    height: 2.5rem;
    background: #e5e7eb;
    margin: 0.35rem 0 0.35rem 0.3rem;
}

/* Main */
.wizard-main {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}

.wizard-step {
    width: 100%;
    max-width: 560px;
    animation: fadeSlideIn 0.4s ease-out;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Step card */
.step-card {
    background: var(--card-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    color: #111827;
}

.step-card--compact {
    padding: 2rem;
}

/* Card hero */
.card-hero {
    position: relative;
    padding: 3.5rem 1.5rem 2.5rem;
    text-align: center;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    overflow: hidden;
}

.card-hero-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image:
        linear-gradient(30deg, rgba(255, 87, 68, 0.08) 12%, transparent 12.5%, transparent 87%, rgba(255, 87, 68, 0.08) 87.5%),
        linear-gradient(150deg, rgba(255, 87, 68, 0.08) 12%, transparent 12.5%, transparent 87%, rgba(255, 87, 68, 0.08) 87.5%),
        linear-gradient(30deg, rgba(255, 87, 68, 0.08) 12%, transparent 12.5%, transparent 87%, rgba(255, 87, 68, 0.08) 87.5%),
        linear-gradient(150deg, rgba(255, 87, 68, 0.08) 12%, transparent 12.5%, transparent 87%, rgba(255, 87, 68, 0.08) 87.5%);
    background-size: 40px 70px;
    background-position: 0 0, 0 0, 20px 35px, 20px 35px;
}

.card-hero-wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2rem;
    background: var(--card-white);
    clip-path: ellipse(55% 100% at 50% 100%);
}

.card-icon {
    position: relative;
    z-index: 1;
    width: 3rem;
    height: 3rem;
    margin: -4.25rem auto 1rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--coral) 0%, var(--coral-light) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px var(--coral-glow);
}

.card-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.card-title {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #111827;
}

.card-title--plain {
    margin-bottom: 0.5rem;
}

.step-card-body {
    padding: 1.5rem 1.5rem 0.5rem;
}

.step-card-body--center {
    text-align: center;
}

.step-card-footer {
    padding: 0 1.5rem 1.25rem;
}

.step-disclaimer {
    margin: 0;
    padding: 0.75rem 1.5rem 1.25rem;
    font-size: 0.7rem;
    line-height: 1.45;
    color: #9ca3af;
    text-align: center;
    border-top: 1px solid #f3f4f6;
}

/* Fields */
.field-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.field-wrap {
    position: relative;
    margin-bottom: 1.25rem;
}

.field-input,
.field-select,
.field-textarea {
    width: 100%;
    padding: 0.95rem 1.1rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font: inherit;
    font-size: 1rem;
    color: #111827;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field-input--accent {
    border-color: rgba(255, 87, 68, 0.55);
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
    outline: none;
    border-color: var(--coral);
    box-shadow: 0 0 0 3px var(--coral-soft);
}

.field-clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
}

.field-clear:hover {
    color: #374151;
}

.field-icon {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.field-icon svg {
    width: 1.15rem;
    height: 1.15rem;
    display: block;
}

.field-wrap .field-input {
    padding-right: 2.5rem;
}

.link-suggestions {
    display: inline-block;
    margin: -0.5rem 0 1rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--coral);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.suggestion-panel {
    margin-bottom: 0.5rem;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-chip {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: #f9fafb;
    color: #374151;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.suggestion-chip:hover {
    border-color: var(--coral);
    background: var(--coral-soft);
    color: #111827;
}

.select-wrap {
    position: relative;
    margin-bottom: 1.25rem;
}

.field-select {
    appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
}

.select-chevron {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
}

.select-chevron svg {
    width: 1.1rem;
    height: 1.1rem;
    display: block;
}

.textarea-wrap {
    position: relative;
}

.field-textarea {
    resize: vertical;
    min-height: 9rem;
    padding-bottom: 2.5rem;
}

.textarea-wand {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--coral-soft);
    color: var(--coral);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
}

.textarea-wand:hover {
    background: rgba(255, 87, 68, 0.22);
    transform: scale(1.05);
}

.textarea-wand svg {
    width: 1rem;
    height: 1rem;
}

/* Layout cards */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.layout-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 0.75rem 1rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.layout-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.layout-card.is-selected,
.layout-card:has(input:checked) {
    border-color: var(--coral);
    box-shadow: 0 0 0 3px var(--coral-soft);
}

.layout-illustration {
    width: 100%;
    height: 7rem;
    border-radius: 0.5rem;
    background: #f3f4f6;
    position: relative;
}

.layout-illustration--one::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0.75rem;
    transform: translateX(-50%);
    width: 70%;
    height: 0.5rem;
    background: #d1d5db;
    border-radius: 2px;
    box-shadow:
        0 1rem 0 #e5e7eb,
        0 2rem 0 #e5e7eb,
        0 3rem 0 #e5e7eb,
        0 4rem 0 #e5e7eb,
        0 5rem 0 #e5e7eb;
}

.layout-illustration--multi::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0.75rem;
    transform: translateX(-50%);
    width: 35%;
    height: 0.5rem;
    background: #d1d5db;
    border-radius: 2px;
}

.layout-illustration--multi::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 2rem;
    transform: translateX(-50%);
    width: 2px;
    height: 1.5rem;
    background: #d1d5db;
    box-shadow:
        -2.5rem 1.5rem 0 0 #e5e7eb,
        0 1.5rem 0 0 #e5e7eb,
        2.5rem 1.5rem 0 0 #e5e7eb;
}

.layout-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
}

/* Buttons */
.card-nav {
    display: flex;
    gap: 0.75rem;
}

.card-nav--split .btn-back {
    flex: 1;
}

.card-nav--split .btn-primary {
    flex: 1.4;
}

.btn-primary,
.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.95rem 1.25rem;
    border-radius: var(--radius-md);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s, opacity 0.2s, transform 0.15s;
}

.btn-primary {
    background: var(--coral);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: rgba(255, 87, 68, 0.9);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary svg {
    width: 1.1rem;
    height: 1.1rem;
}

.btn-sparkles {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    opacity: 0.9;
}

.btn-back {
    background: #f3f4f6;
    color: #4b5563;
}

.btn-back:hover {
    background: #e5e7eb;
}

.btn-back svg {
    width: 1.1rem;
    height: 1.1rem;
}

.btn-primary--full {
    margin-top: 0.5rem;
}

.btn-primary--inline {
    display: inline-flex;
    width: auto;
    margin-top: 1rem;
    text-decoration: none;
}

.muted-text {
    color: #6b7280;
}

/* Generating screen */
.generating-screen {
    max-width: 520px;
}

.generating-card {
    background: var(--card-white);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.75rem 1.75rem;
    text-align: center;
    color: #111827;
    box-shadow: var(--shadow-card);
}

.generating-spinner {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--coral) 0%, var(--coral-light) 100%);
    position: relative;
}

.generating-spinner::after {
    content: '';
    position: absolute;
    inset: 0.65rem;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.generating-title {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.generating-lead {
    margin: 0 0 0.25rem;
    color: #4b5563;
}

.generating-sub {
    margin: 0 0 1.5rem;
    color: #9ca3af;
    font-size: 0.95rem;
}

.generating-steps {
    text-align: left;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.generation-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
}

.step-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: #fff;
}

.step-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: #9ca3af;
    display: block;
}

.step-label {
    margin: 0;
    font-weight: 500;
    color: #9ca3af;
    font-size: 0.95rem;
}

.generation-step.is-active .step-icon {
    background: var(--coral);
}

.generation-step.is-active .step-label {
    color: #111827;
}

.generation-step.is-done .step-icon {
    background: #22c55e;
}

.generation-step.is-done .step-label {
    color: #111827;
}

.generating-notice {
    background: rgba(255, 87, 68, 0.08);
    border: 1px solid rgba(255, 87, 68, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: left;
}

.generating-notice-title {
    margin: 0 0 0.25rem;
    font-weight: 600;
    color: #374151;
}

.generating-notice-text {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.generating-complete {
    margin: 0 0 1rem;
    font-weight: 600;
    color: #111827;
}

.generating-complete.hidden {
    display: none;
}

.generating-reset {
    margin-top: 1rem;
}

.generating-reset button {
    border: none;
    background: none;
    color: #9ca3af;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
}

.generating-reset button:hover {
    color: #6b7280;
}

/* RTL */
[dir='rtl'] .field-clear,
[dir='rtl'] .field-icon,
[dir='rtl'] .select-chevron {
    right: auto;
    left: 0.85rem;
}

[dir='rtl'] .field-wrap .field-input,
[dir='rtl'] .field-select {
    padding-right: 1.1rem;
    padding-left: 2.5rem;
}

[dir='rtl'] .sidebar-line {
    margin-left: 0;
    margin-right: 0.3rem;
}

[dir='rtl'] .card-nav--split .btn-back svg {
    transform: scaleX(-1);
}

[dir='rtl'] .btn-primary svg {
    transform: scaleX(-1);
}

@media (max-width: 520px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }

    .card-hero {
        padding-top: 3rem;
    }
}
