/* ========================================
   RASTI - Story Form Wizard Styles
   ======================================== */

/* Wizard Container */
.story-form-page {
    min-height: calc(100vh - var(--page-header-offset, var(--navbar-height)));
    padding-top: calc(var(--page-header-offset, var(--navbar-height)) + 2rem);
    padding-bottom: 3rem;
    background: var(--white);
}

.story-form-v2-page--with-promo-ribbon {
    --page-header-offset: calc(var(--navbar-height) + var(--promo-ribbon-height, 42px));
}

.story-form-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* HTMX Transition Animations */
#wizard-content {
    transition: opacity 0.2s ease;
}

#wizard-content.htmx-swapping {
    opacity: 0;
}

#wizard-content.htmx-settling {
    opacity: 1;
}

/* ──────────────────────────────────────
   Progress Indicator
   ────────────────────────────────────── */
.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.25rem, 0.6vw, 0.5rem);
    margin-bottom: 2.5rem;
    width: 100%;
    max-width: 100%;
}

.progress-step {
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
    flex: 0 0 auto;
    box-sizing: border-box;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: var(--gray-200);
    border: 2px solid var(--gray-300);
    transition: all 0.3s ease;
}

.progress-step.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);
}

.progress-step.completed {
    background: var(--primary);
    border-color: var(--primary);
}

.progress-line {
    flex: 1 1 0;
    min-width: 8px;
    max-width: 40px;
    width: 40px;
    height: 2px;
    background: var(--gray-200);
    transition: background 0.3s ease;
}

.progress-line.completed {
    background: var(--primary);
}

/* ──────────────────────────────────────
   Step Content
   ────────────────────────────────────── */
.wizard-step {
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.step-title {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.75rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.step-subtitle {
    font-size: 1rem;
    color: var(--gray-600);
    text-align: center;
    margin-bottom: 2rem;
}

.v2-stage-microcopy {
    max-width: 44rem;
    margin: -1rem auto 1.5rem;
    line-height: 1.55;
}

.v2-loading-message {
    max-width: 38rem;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.95rem;
    line-height: 1.55;
}

/* ──────────────────────────────────────
   Motivo Selection Cards
   ────────────────────────────────────── */
.motivo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
    align-items: stretch;
    justify-items: stretch;
}

.motivo-card {
    position: relative;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
    min-height: 120px;
    box-sizing: border-box;
    width: 100% !important;
    /* Sobrescribe pico.css label:has([type=radio]) */
}

.motivo-card:hover {
    border-color: var(--gray-300);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.motivo-card.selected {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 5%, var(--white));
    box-shadow: 0 4px 16px color-mix(in srgb, var(--primary) 15%, transparent);
}

.motivo-card.selected .motivo-icon {
    color: var(--primary);
}

.motivo-icon {
    font-size: 2rem;
    color: var(--gray-600);
    transition: color 0.25s ease;
}

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

.motivo-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-800);
    line-height: 1.3;
    width: 100%;
}

.motivo-content {
    width: 100%;
}

.motivo-example {
    font-size: 0.8rem;
    color: var(--gray-500);
    line-height: 1.4;
}

/* ──────────────────────────────────────
   Info Button & Tooltip
   ────────────────────────────────────── */

.info-button {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    z-index: 10;
}

.info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-500);
    transition: all 0.2s ease;
}

.info-icon svg {
    width: 14px;
    height: 14px;
}

.info-button:hover .info-icon {
    background: var(--primary);
    color: var(--white);
}

.info-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--white);
    color: black;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    white-space: normal;
    width: 220px;
    text-align: left;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

/* Flecha del tooltip */
.info-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 10px;
    border: 6px solid transparent;
    border-bottom-color: var(--white);
    filter: drop-shadow(0 -1px 0 var(--gray-200));
}

.info-button:hover .info-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.info-button.info-tooltip-open .info-icon {
    background: var(--primary);
    color: var(--white);
}

.info-button.info-tooltip-open .info-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Campo con botón info (estilo postpago) */
.field-with-info {
    position: relative;
}

.info-button-field {
    position: absolute;
    top: 0;
    right: 0;
    width: 24px;
    height: 24px;
    z-index: 10;
}

.info-button-field .info-icon {
    width: 24px;
    height: 24px;
}

.info-button-field .info-icon svg {
    width: 16px;
    height: 16px;
}

/* Tooltip ancho para contenido extenso */
.info-tooltip-wide {
    width: 320px !important;
    padding: 14px 16px !important;
    left: auto;
    right: -8px;
}

.info-tooltip-wide .tooltip-section-title {
    font-size: 12px;
    margin-bottom: 8px;
}

.info-tooltip-wide .tooltip-examples {
    background: #f9fafb;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

@media (max-width: 640px) {
    .info-tooltip-wide {
        width: 280px !important;
        right: -40px;
    }

    .info-tooltip-wide::before {
        right: 48px;
    }
}

/* Hidden radio for selection */
.motivo-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* ──────────────────────────────────────
   Text Input Fields
   ────────────────────────────────────── */
.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
    color: var(--gray-900);
    transition: all 0.25s ease;
}

.form-input::placeholder {
    color: var(--gray-400, #9ca3af);
    opacity: 0.7;
}

.form-input:hover {
    border-color: var(--gray-300);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.form-input.is-invalid {
    border-color: #ef4444;
    background: color-mix(in srgb, #ef4444 8%, var(--gray-50));
    box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 12%, transparent);
}

.dark-mode .form-input.is-invalid {
    border-color: #f87171;
    background: color-mix(in srgb, #ef4444 12%, var(--bg-secondary));
    box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 18%, transparent);
}

/* ──────────────────────────────────────
   Chip Selector
   ────────────────────────────────────── */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto !important;
    /* Sobrescribe pico.css */
}

.chip:hover {
    border-color: var(--gray-300);
    background: var(--gray-100);
}

.chip.selected {
    background: color-mix(in srgb, var(--primary) 10%, var(--white));
    border-color: var(--primary);
    color: var(--primary);
}

/* ──────────────────────────────────────
   Step 3: Emociones Layout
   ────────────────────────────────────── */
.step-emociones .chip-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.step-emociones .chip {
    width: 100% !important;
    justify-content: center;
    text-align: center;
    padding: 0.6rem 0.75rem;
}

.chip input[type="radio"],
.chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* ──────────────────────────────────────────────────────────────
   Step 3 (Emociones) - Layout en 2 filas (4 arriba, 3 abajo)
   ────────────────────────────────────────────────────────────── */
.step-emociones .multi-chip-selector .chip-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.625rem;
}

.step-emociones .chip-selector .chip-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.625rem;
}

.step-emociones .chip-group .chip {
    width: 100% !important;
    justify-content: center;
    text-align: center;
}

/* Variante client7 */
.story-form-page-client7 #step1 .step-header {
    margin-bottom: 1.5rem;
}

.story-form-page-client7 #step1 .step-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    text-align: center;
    margin: 0 auto;
    max-width: 32rem;
    line-height: 1.4;
}

#step4 .step-subtitle {
    font-weight: 700;
}

@media (max-width: 820px) {
    .story-form-page-client7 #step1 .step-title {
        font-size: 1rem;
    }

    .v2-stage-microcopy {
        margin: -0.75rem auto 1.25rem;
        padding: 0 0.75rem;
    }

    .v2-loading-message {
        padding: 0 0.75rem;
        font-size: 0.9rem;
    }

    .step-emociones .multi-chip-selector .chip-group {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .step-emociones .chip-selector .chip-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .step-emociones .multi-chip-selector .chip-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .step-emociones .chip-selector .chip-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .step-emociones .chip-group .chip {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

.form-section-inline {
    margin-top: 1.5rem;
}

/* ──────────────────────────────────────
   Scroll Hint (guía visual entre tarjetas y textarea)
   ────────────────────────────────────── */
.motivo-scroll-hint {
    text-align: center;
    padding: 0.75rem 0 0.25rem;
    animation: hintFadeIn 0.6s ease forwards;
}

.motivo-scroll-hint-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 500;
}

.motivo-scroll-hint-inner svg {
    animation: hintBounce 1.5s ease-in-out infinite;
    color: var(--primary);
    width: 22px;
    height: 22px;
}

@keyframes hintBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

@keyframes hintFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ──────────────────────────────────────
   Description Textarea
   ────────────────────────────────────── */
.form-section {
    margin-top: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.description-section {
    animation: slideDownFade 0.4s ease forwards;
    scroll-margin-top: calc(var(--page-header-offset, var(--navbar-height, 60px)) + 1rem);
}

.description-section.hidden {
    display: none;
    border-top: none !important;
}

.contacto-section {
    animation: slideDownFade 0.4s ease forwards;
}

.contacto-section.hidden {
    display: none;
    border-top: none !important;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.form-label {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.form-hint-warning {
    color: #b45309;
}

.form-hint-list {
    margin: -0.25rem 0 0.75rem 1.25rem;
    padding: 0;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.form-hint-list li {
    margin: 0 0 0.25rem;
}

.form-textarea {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
    color: var(--gray-900);
    resize: vertical;
    transition: all 0.25s ease;
}

.form-textarea::placeholder {
    color: var(--gray-500);
    opacity: 0.62;
}

.form-textarea:hover {
    border-color: var(--gray-300);
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

/* Step 4 (Gusto) textarea: hide scrollbars by default but keep scroll */
#step4 #gusto_simbolo.form-textarea {
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#step4 #gusto_simbolo.form-textarea::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* ──────────────────────────────────────
   Children Fields (Multi-child)
   ────────────────────────────────────── */
.children-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 0.5rem;
}

.children-count-row {
    max-width: none;
}

.children-count-input {
    text-align: center;
    font-weight: 600;
    max-width: 120px;
}

.child-block {
    padding: 0.5rem 0 0;
}

.child-animate {
    animation: slideDownFade 0.4s ease forwards;
}

.child-block + .child-block {
    margin-top: 1.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--gray-200);
}

.child-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: var(--gray-800);
}

.child-fields {
    display: grid;
    gap: 1rem;
}

.child-field .form-label {
    margin-bottom: 0.4rem;
}

@media (min-width: 720px) {
    .child-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ──────────────────────────────────────
   Child Tabs (multi-child steps)
   ────────────────────────────────────── */
.child-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.child-tabs:empty {
    display: none;
    margin-bottom: 0;
}

.child-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1.1rem;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.child-tab:hover {
    border-color: var(--gray-300);
    background: var(--gray-100);
}

.child-tab.active {
    background: color-mix(in srgb, var(--primary) 10%, var(--white));
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.child-tab-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gray-300);
    flex-shrink: 0;
}

.child-tab.completed .child-tab-status {
    background: #22c55e;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.step-mundo-cotidiano .client7-step-section {
    margin-bottom: 1.5rem;
}

.step-mundo-cotidiano .client7-step-section:last-child {
    margin-bottom: 0;
}

.step-mundo-cotidiano .form-hint {
    margin-bottom: 0.5rem;
}

.step-detalles-unicos .client7-step-section {
    margin-bottom: 1.5rem;
}

.step-detalles-unicos .client7-step-section:last-child {
    margin-bottom: 0;
}

.step-detalles-unicos .form-hint {
    margin-bottom: 0.5rem;
}

.step-intencion-final .client7-step-section {
    margin-bottom: 1.5rem;
}

.step-intencion-final .client7-step-section:last-child {
    margin-bottom: 0;
}

.step-intencion-final .form-hint {
    margin-bottom: 0.5rem;
}

.step-mundo-cotidiano .client7-step-section-gusto .form-textarea,
.step-mundo-cotidiano .client7-step-section-familia .form-textarea {
    height: 5.875rem !important;
    min-height: 5.875rem !important;
}

.step-mundo-cotidiano .client7-step-section-familia .textarea-with-examples {
    height: 5.875rem !important;
    min-height: 5.875rem !important;
}

@media (max-width: 480px) {
    .child-tabs {
        gap: 0.375rem;
    }

    .child-tab {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .step-mundo-cotidiano .client7-step-section {
        margin-bottom: 1.25rem;
    }

    .step-mundo-cotidiano .form-hint {
        margin-bottom: 0.375rem;
    }

    .step-detalles-unicos .client7-step-section {
        margin-bottom: 1.25rem;
    }

    .step-detalles-unicos .form-hint {
        margin-bottom: 0.375rem;
    }

    .step-intencion-final .client7-step-section {
        margin-bottom: 1.25rem;
    }

    .step-intencion-final .form-hint {
        margin-bottom: 0.375rem;
    }

    .step-mundo-cotidiano .client7-step-section-gusto .form-textarea,
    .step-mundo-cotidiano .client7-step-section-familia .form-textarea {
        height: 5rem !important;
        min-height: 5rem !important;
    }

    .step-mundo-cotidiano .client7-step-section-familia .textarea-with-examples {
        height: 5rem !important;
        min-height: 5rem !important;
    }
}

/* ──────────────────────────────────────
   Navigation Buttons
   ────────────────────────────────────── */
.btn-next,
.btn-prev {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-next {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 6px;
}

.btn-next:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent);
}

.btn-prev {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.875rem 1.5rem;
    border-radius: 6px;
}

.btn-prev:hover {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
}

.wizard-nav-spacer {
    flex: 1;
}

.wizard-nav .btn-next {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.wizard-nav .btn-next:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent);
}

.wizard-nav .btn-next:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wizard-nav .btn-prev {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.875rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.wizard-nav .btn-prev:hover {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

/* ──────────────────────────────────────
   Responsive
   ────────────────────────────────────── */
@media (max-width: 640px) {
    .story-form-page {
        padding-top: calc(var(--page-header-offset, var(--navbar-height)) + 1.5rem);
    }

    .story-form-container {
        padding: 0 1rem;
    }

    .wizard-progress {
        gap: 0.25rem;
        margin-bottom: 2rem;
    }

    .progress-step {
        width: 10px;
        height: 10px;
        min-width: 10px;
        min-height: 10px;
    }

    .progress-line {
        min-width: 6px;
        max-width: 24px;
        width: 24px;
    }

    .step-title {
        font-size: 1.5rem;
    }

    .motivo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
    }

    .motivo-card {
        flex-direction: column;
        text-align: center;
        padding: 0.7rem;
        min-height: 90px;
        gap: 0.4rem;
    }

    .motivo-icon {
        font-size: 1.25rem;
    }

    .motivo-icon svg {
        width: 24px;
        height: 24px;
    }

    .motivo-scroll-hint-inner {
        font-size: 0.8rem;
    }

    .motivo-scroll-hint-inner svg {
        width: 20px;
        height: 20px;
    }

    .motivo-content {
        width: 100%;
    }

    .motivo-label {
        font-size: 0.85rem;
    }

    .wizard-nav {
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .wizard-nav .btn-next {
        width: 100%;
        justify-content: center;
    }

    .wizard-nav .btn-prev {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 820px) {
    .story-form-container {
        max-width: 100%;
        padding: 0 1rem;
    }

    .motivo-grid {
        max-width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* ──────────────────────────────────────
   Dark Mode
   ────────────────────────────────────── */
.dark-mode .story-form-page {
    background: var(--bg-primary);
}

.dark-mode .step-title {
    color: var(--text-primary);
}

.dark-mode .step-subtitle {
    color: var(--text-secondary);
}

.dark-mode .v2-loading-message {
    color: var(--text-secondary);
}

.dark-mode .motivo-card {
    background: var(--bg-secondary);
    border-color: var(--gray-200);
}

.dark-mode .motivo-card:hover {
    border-color: var(--gray-300);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dark-mode .motivo-card.selected {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, var(--bg-secondary));
}

.dark-mode .motivo-label {
    color: var(--text-primary);
}

.dark-mode .motivo-example {
    color: var(--text-muted);
}

.dark-mode .motivo-icon {
    color: var(--text-secondary);
}

.dark-mode .motivo-scroll-hint-inner {
    color: var(--primary);
}

.dark-mode .info-icon {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.dark-mode .info-button:hover .info-icon {
    background: var(--primary);
    color: var(--white);
}

.dark-mode .info-tooltip {
    background: var(--gray-100);
    color: var(--gray-900);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.dark-mode .info-tooltip::before {
    border-bottom-color: var(--gray-100);
}

.dark-mode .form-section {
    border-top-color: var(--gray-200);
}

.dark-mode .form-label {
    color: var(--text-primary);
}

.dark-mode .form-hint {
    color: var(--text-muted);
}

.dark-mode .form-textarea {
    background: var(--bg-secondary);
    border-color: var(--gray-200);
    color: var(--text-primary);
}

.dark-mode .form-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.68;
}

.dark-mode .form-textarea:focus {
    background: var(--bg-tertiary);
    border-color: var(--primary);
}

.dark-mode .wizard-nav {
    border-top-color: var(--gray-200);
}

.dark-mode .wizard-nav .btn-prev {
    color: var(--text-secondary);
}

.dark-mode .wizard-nav .btn-prev:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.dark-mode .form-input {
    background: var(--bg-secondary);
    border-color: var(--gray-200);
    color: var(--text-primary);
}

.dark-mode .form-input::placeholder {
    color: var(--text-muted);
}

.dark-mode .form-input:focus {
    background: var(--bg-tertiary);
    border-color: var(--primary);
}

.form-input.is-invalid {
    border-color: #ef4444;
    background: color-mix(in srgb, #ef4444 8%, var(--gray-50));
    box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 12%, transparent);
}

.dark-mode .form-input.is-invalid {
    border-color: #f87171;
    background: color-mix(in srgb, #ef4444 12%, var(--bg-secondary));
    box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 18%, transparent);
}

.dark-mode .child-tab {
    background: var(--bg-secondary);
    border-color: var(--gray-200);
    color: var(--text-secondary);
}

.dark-mode .child-tab:hover {
    background: var(--bg-tertiary);
    border-color: var(--gray-300);
}

.dark-mode .child-tab.active {
    background: color-mix(in srgb, var(--primary) 15%, var(--bg-secondary));
    border-color: var(--primary);
    color: var(--primary);
}

.dark-mode .chip {
    background: var(--bg-secondary);
    border-color: var(--gray-200);
    color: var(--text-secondary);
}

.dark-mode .chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--gray-300);
}

.dark-mode .chip.selected {
    background: color-mix(in srgb, var(--primary) 15%, var(--bg-secondary));
    border-color: var(--primary);
    color: var(--primary);
}

/* ──────────────────────────────────────
   Cierre Step
   ────────────────────────────────────── */
.step-cierre .step-content {
    text-align: center;
    padding: 3rem 1rem;
}

.cierre-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.cierre-icon {
    width: 64px;
    height: 64px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    padding: 0.75rem;
    border-radius: 12px;
    box-sizing: content-box;
}

.cierre-message {
    font-size: 1.25rem;
    color: var(--gray-700);
    line-height: 1.6;
    max-width: 400px;
}

.cierre-message-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.cierre-message-subtitle {
    font-size: 1.1rem;
    color: var(--gray-600);
    font-weight: 400;
}

/* Botón largo "Seguir Personalizando..." */
.btn-next-long {
    font-size: 0.95rem;
    padding: 0.875rem 1.25rem;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .btn-next-long {
        font-size: 0.8rem;
        padding: 0.75rem 1rem;
    }

    .cierre-message-title {
        font-size: 1.2rem;
    }

    .cierre-message-subtitle {
        font-size: 1rem;
    }
}

/* Botón Crear mi cuento */
.btn-create {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    font-size: 1.1rem;
    padding: 1rem 2rem !important;
    gap: 0.75rem;
}

.btn-create:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 40%, transparent);
}

/* ──────────────────────────────────────
   Contacto Step (Pre-pago Paso 5)
   ────────────────────────────────────── */
.step-contacto {
    padding: 0.5rem 0 2rem;
}

.contacto-icon-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 1.75rem;
}

.contacto-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    padding: 0.875rem;
    border-radius: 14px;
    box-sizing: content-box;
}

.contacto-fields {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 480px;
    margin: 0 auto;
}

#step2 .step-contacto {
    padding: 0;
}

#step2 .contacto-fields {
    max-width: 100%;
    margin: 0;
}

.contacto-fields .form-field {
    display: flex;
    flex-direction: column;
}

@media (max-width: 480px) {
    .step-contacto {
        padding: 0 0 0.5rem;
    }

    .contacto-icon-wrapper {
        margin-bottom: 0.75rem;
    }

    .contacto-icon {
        width: 32px;
        height: 32px;
        padding: 0.5rem;
        border-radius: 10px;
    }

    .contacto-fields {
        gap: 0.75rem;
    }
}

/* ──────────────────────────────────────
   Confirmación Step (Post-pago)
   ────────────────────────────────────── */
.step-confirmacion .step-content {
    text-align: center;
    padding: 3rem 1rem;
}

.confirmacion-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.confirmacion-icon {
    width: 80px;
    height: 80px;
    color: #22c55e;
}

.confirmacion-message {
    font-size: 1.25rem;
    color: var(--gray-700);
    line-height: 1.6;
    max-width: 400px;
}

.confirmacion-submessage {
    font-size: 1rem;
    color: var(--gray-500);
    max-width: 350px;
}

/* ──────────────────────────────────────
   Bienvenida Step (Post-pago)
   ────────────────────────────────────── */
.step-bienvenida .step-content {
    text-align: center;
    padding: 3rem 1rem;
}

.bienvenida-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.bienvenida-icon {
    width: 80px;
    height: 80px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    padding: 1rem;
    border-radius: 12px;
    box-sizing: content-box;
}

.bienvenida-message {
    font-size: 1.25rem;
    color: var(--gray-600);
    line-height: 1.6;
    max-width: 400px;
}

/* Rutina + Bienvenida combinado */
.step-rutina-bienvenida {
    text-align: center;
}

.bienvenida-icon-wrapper {
    margin-bottom: 1.5rem;
}

.form-section-divider {
    height: 1px;
    max-width: 200px;
    margin: 0 auto 1.5rem;
    background: var(--gray-200);
}

.form-section-inline {
    text-align: left;
}


