/* ═══════════════════════════════════════════
   InviteAI — Wizard, Forms & Editor
   ═══════════════════════════════════════════ */

/* ═══════ PROGRESS BAR ═══════ */
.progress-bar {
    margin-bottom: 2.5rem;
    padding: 1.25rem 1.5rem 1rem;
    background: var(--surface);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-2);
}

.progress-track {
    height: 3px;
    background: var(--bg-warm);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    border-radius: 3px;
    width: 20%;
    transition: width 0.65s var(--ease);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-body);
    background: var(--bg-warm);
    color: var(--text-muted);
    transition: all var(--dur-md) var(--ease);
}

.progress-step.active .step-number {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(184,92,60,0.25);
    transform: scale(1.08);
}

.progress-step.completed .step-number {
    background: var(--sage);
    color: #fff;
}

.step-label {
    font-size: 0.62rem;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: all var(--dur) var(--ease);
}

.progress-step.active .step-label { color: var(--accent); opacity: 1; }
.progress-step.completed .step-label { color: var(--sage); }

/* ═══════ STEPS ═══════ */
.steps-container { position: relative; }

.step {
    display: none;
    animation: stepIn 0.4s var(--ease) forwards;
}

.step-active { display: block; }

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

/* ── Step Header ── */
.step-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.step-accent-line {
    display: block;
    width: 32px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    margin-bottom: 0.85rem;
}

.step-subtitle {
    margin-top: 0.35rem;
    font-size: 0.92rem;
    max-width: 420px;
    line-height: 1.55;
    color: var(--text-tertiary);
}

/* ═══════ FORMS ═══════ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.015em;
}

.required { color: var(--accent); }

.form-group input,
.form-group textarea,
.form-group select {
    height: 42px;
    padding: 0 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--text-primary);
    background: var(--surface);
    transition: all var(--dur) var(--ease);
    outline: none;
    box-shadow: var(--shadow-1);
}

.form-group textarea {
    height: auto;
    padding: 0.6rem 0.85rem;
    resize: vertical;
    min-height: 72px;
    line-height: 1.5;
}

.form-group input:hover,
.form-group textarea:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-2);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.form-group input.error { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192,57,43,0.08); }
.field-error { font-size: 0.7rem; color: #c0392b; min-height: 0.8rem; }

/* ═══════ STEP ACTIONS ═══════ */
.step-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

/* ═══════ STYLE CARDS ═══════ */
.style-section {
    margin-bottom: 1.75rem;
}

.style-section-title {
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-bottom: 0.7rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.style-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.9rem 0.4rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    font-family: var(--font-body);
    box-shadow: var(--shadow-1);
    position: relative;
}

.style-card::after {
    content: '';
    position: absolute;
    inset: -1.5px;
    border-radius: calc(var(--r-sm) + 1.5px);
    border: 2px solid transparent;
    transition: border-color var(--dur) var(--ease);
    pointer-events: none;
}

.style-card:hover {
    border-color: transparent;
    box-shadow: var(--shadow-3);
    transform: translateY(-2px);
}

.style-card:hover::after {
    border-color: rgba(184,92,60,0.2);
}

.style-card.selected {
    border-color: transparent;
    background: var(--accent-soft);
    box-shadow: var(--shadow-2);
}

.style-card.selected::after {
    border-color: var(--accent);
}

.style-card-icon { font-size: 1.4rem; line-height: 1; }
.style-card-label { font-size: 0.7rem; font-weight: 500; color: var(--text-secondary); text-align: center; }

/* ═══════ PALETTES ═══════ */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.palette-option {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0.55rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    font-family: var(--font-body);
    box-shadow: var(--shadow-1);
    position: relative;
}

.palette-option::after {
    content: '';
    position: absolute;
    inset: -1.5px;
    border-radius: calc(var(--r-sm) + 1.5px);
    border: 2px solid transparent;
    transition: border-color var(--dur) var(--ease);
    pointer-events: none;
}

.palette-option:hover {
    border-color: transparent;
    box-shadow: var(--shadow-3);
    transform: translateY(-2px);
}

.palette-option:hover::after { border-color: rgba(184,92,60,0.2); }

.palette-option.selected {
    border-color: transparent;
    box-shadow: var(--shadow-2);
}

.palette-option.selected::after { border-color: var(--accent); }

.palette-swatch {
    width: calc(50% - 1px);
    aspect-ratio: 1;
    border-radius: 3px;
}

.palette-name {
    width: 100%;
    text-align: center;
    font-size: 0.6rem;
    font-weight: 500;
    margin-top: 0.25rem;
    color: var(--text-tertiary);
}

/* ═══════ CHIPS ═══════ */
.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.element-chip {
    height: 34px;
    padding: 0 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-family: var(--font-body);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    color: var(--text-secondary);
    box-shadow: var(--shadow-1);
    display: inline-flex;
    align-items: center;
}

.element-chip:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-2);
}

.element-chip.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-hover);
    font-weight: 500;
    box-shadow: 0 0 0 2px var(--accent-soft);
}

/* ═══════ LOADING ═══════ */
.generate-loading {
    text-align: center;
    padding: 5rem 2rem;
}

.loading-envelope {
    margin-bottom: 1.75rem;
    animation: float 2.5s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.loading-letter { animation: float 2.5s ease-in-out infinite; }

.loading-text {
    font-family: var(--font-display);
    font-size: 1.35rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.loading-dots span { animation: dot 1.4s ease-in-out infinite; opacity: 0; }
.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

.loading-subtext { font-size: 0.8rem; color: var(--text-muted); }

/* ═══════ REFINE LAYOUT ═══════ */
.refine-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2rem;
    align-items: start;
}

.refine-preview-wrap { position: sticky; top: 72px; }

.refine-hint {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.6rem;
    font-style: italic;
    transition: opacity var(--dur) var(--ease);
}

.refine-controls { position: sticky; top: 72px; }

.refine-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.15rem 0;
}

/* ── Editable selection ── */
.refine-preview [data-editable] {
    cursor: pointer;
    outline: 2px solid transparent;
    outline-offset: 3px;
    border-radius: 3px;
    position: relative;
    transition: outline-color 0.12s ease;
}

.refine-preview [data-editable]:hover {
    outline-color: rgba(184,92,60,0.25);
}

.refine-preview [data-editable].el-selected {
    outline-color: var(--accent);
    box-shadow: 0 0 0 5px var(--accent-soft);
}

.refine-preview [data-editable]::after {
    content: attr(data-label);
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%) scale(0.92);
    background: var(--text-primary);
    color: var(--bg);
    font-family: var(--font-body);
    font-size: 0.5rem;
    font-style: normal;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.12s ease;
    z-index: 10;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.refine-preview [data-editable]:hover::after,
.refine-preview [data-editable].el-selected::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ═══════ ELEMENT EDITOR ═══════ */
.element-editor {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem;
    box-shadow: var(--shadow-3);
    animation: edIn 0.2s var(--ease);
}

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

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

.editor-element-name {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
}

.editor-deselect {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: none;
    font-size: 0.95rem;
    color: var(--text-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    line-height: 1;
    transition: all var(--dur) var(--ease);
}

.editor-deselect:hover { border-color: var(--accent); color: var(--accent); }

.editor-section { margin-bottom: 0.65rem; }

.editor-label {
    display: block;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}

.editor-value {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.55;
}

.editor-textarea {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--bg);
    resize: vertical;
    min-height: 34px;
    outline: none;
}

.editor-textarea:focus { border-color: var(--accent); }

.editor-select {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--bg);
    outline: none;
    cursor: pointer;
}

.editor-select:focus { border-color: var(--accent); }

.editor-range {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-warm);
    border-radius: 4px;
    outline: none;
    margin-top: 0.15rem;
}

.editor-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(184,92,60,0.25);
}

.editor-range::-moz-range-thumb {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.editor-toggle-row { display: flex; gap: 3px; }

.editor-toggle {
    flex: 1;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    background: none;
    font-family: var(--font-body);
    font-size: 0.68rem;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}

.editor-toggle:hover { border-color: var(--border-hover); }

.editor-toggle.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-hover);
    font-weight: 600;
}

.editor-toggle.small { flex: 0; padding: 0 0.5rem; font-size: 0.62rem; }

.editor-color-row { display: flex; align-items: center; gap: 0.4rem; }

.editor-color-input {
    width: 28px; height: 28px;
    border: 2px solid var(--border);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    background: none;
}

.editor-color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.editor-color-input::-webkit-color-swatch { border: none; border-radius: 3px; }

.editor-color-hex {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.editor-empty {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--surface);
    border: 1.5px dashed var(--border);
    border-radius: var(--r-md);
}

.editor-empty-icon { font-size: 1.5rem; margin-bottom: 0.5rem; opacity: 0.5; }
.editor-empty p { font-size: 0.82rem; color: var(--text-tertiary); margin-bottom: 0.15rem; }
.editor-empty-hint { font-size: 0.7rem !important; opacity: 0.5 !important; }

/* ═══════ ORIENTATION SELECTOR ═══════ */
.orientation-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.orientation-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 0.4rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    font-family: var(--font-body);
    box-shadow: var(--shadow-1);
    position: relative;
    color: var(--text-muted);
}

.orientation-card::after {
    content: '';
    position: absolute;
    inset: -1.5px;
    border-radius: calc(var(--r-sm) + 1.5px);
    border: 2px solid transparent;
    transition: border-color var(--dur) var(--ease);
    pointer-events: none;
}

.orientation-card:hover {
    border-color: transparent;
    box-shadow: var(--shadow-3);
    transform: translateY(-2px);
    color: var(--text-secondary);
}

.orientation-card:hover::after { border-color: rgba(184,92,60,0.2); }

.orientation-card.selected {
    border-color: transparent;
    background: var(--accent-soft);
    color: var(--accent);
}

.orientation-card.selected::after { border-color: var(--accent); }

.orientation-label {
    font-size: 0.68rem;
    font-weight: 500;
}

.orientation-selector.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ═══════ SIZE CATEGORY TABS ═══════ */
.size-category-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    background: var(--bg-warm);
    border-radius: var(--r-sm);
    padding: 3px;
}

.size-tab {
    flex: 1;
    height: 32px;
    border: none;
    background: none;
    border-radius: calc(var(--r-sm) - 2px);
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    white-space: nowrap;
}

.size-tab:hover { color: var(--text-secondary); }

.size-tab.active {
    background: var(--surface);
    color: var(--accent);
    font-weight: 600;
    box-shadow: var(--shadow-2);
}

/* ═══════ SIZE SELECTION ═══════ */
.size-selection { margin-bottom: 1.75rem; }

.size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.size-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem 0.4rem 0.7rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    font-family: var(--font-body);
    box-shadow: var(--shadow-1);
    position: relative;
}

.size-card::after {
    content: '';
    position: absolute;
    inset: -1.5px;
    border-radius: calc(var(--r-sm) + 1.5px);
    border: 2px solid transparent;
    transition: border-color var(--dur) var(--ease);
    pointer-events: none;
}

.size-card:hover {
    border-color: transparent;
    box-shadow: var(--shadow-3);
    transform: translateY(-2px);
}

.size-card:hover::after { border-color: rgba(184,92,60,0.2); }

.size-card.selected {
    border-color: transparent;
    background: var(--accent-soft);
}

.size-card.selected::after { border-color: var(--accent); }

.size-preview {
    border: 1.5px solid var(--text-muted);
    border-radius: 1px;
    opacity: 0.18;
    transition: all var(--dur) var(--ease);
}

.size-card.selected .size-preview { border-color: var(--accent); opacity: 0.45; }

.size-label { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.size-desc  { font-size: 0.62rem; color: var(--text-muted); }

.size-price-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

/* ═══════ DOWNLOAD ═══════ */
.download-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.download-preview { position: sticky; top: 72px; }

.download-options {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.format-card {
    padding: 1.15rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    position: relative;
    box-shadow: var(--shadow-2);
}

.format-card.premium {
    border-color: rgba(196,162,78,0.3);
    background: linear-gradient(160deg, #FFFEF9, #FFF8E5);
    box-shadow: var(--shadow-3), 0 0 0 1px rgba(196,162,78,0.08);
}

.format-badge {
    position: absolute;
    top: -8px; right: 12px;
    height: 18px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg-warm);
    color: var(--text-tertiary);
    display: grid;
    place-items: center;
}

.format-badge.premium-badge {
    background: linear-gradient(135deg, var(--gold), #DDC36E);
    color: #4A3A10;
}

.format-card h3 { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 0.1rem; }
.format-card p { font-size: 0.78rem; margin-bottom: 0.75rem; }

.price {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.format-features {
    list-style: none;
    margin-bottom: 0.85rem;
}

.format-features li {
    font-size: 0.78rem;
    padding: 0.12rem 0;
    color: var(--text-tertiary);
}

.format-card .btn { width: 100%; }

/* ═══════ PAYMENT SUCCESS ═══════ */
.payment-success {
    text-align: center;
    padding: 2.25rem 1.75rem;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-4);
    max-width: 420px;
    margin: 2rem auto;
}

.success-icon {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--sage);
    color: white;
    font-size: 1.6rem;
    display: grid;
    place-items: center;
    margin: 0 auto 0.75rem;
}

.payment-success h3 { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 0.3rem; }
.payment-success p { margin-bottom: 1.15rem; }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 768px) {
    .progress-bar { padding: 1rem; }
    .card-grid, .palette-grid { grid-template-columns: repeat(2, 1fr); }
    .size-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full-width { grid-column: 1; }
    .refine-layout, .download-layout { grid-template-columns: 1fr; }
    .refine-preview-wrap, .refine-controls, .download-preview { position: static; }
    .step-label { font-size: 0.55rem; }

    .orientation-selector { flex-wrap: wrap; }
    .orientation-card { min-width: calc(50% - 0.25rem); }

    .size-category-tabs {
        flex-wrap: wrap;
    }
    .size-tab { font-size: 0.62rem; min-width: calc(50% - 2px); }
}
