/* ======================================================
   WIZARD CREAR LOTERÍA | SANTA GLORIA VELATORIOS
   Estilo Premium Glassmorphism
   ====================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

:root {
    --purple: #5b2179;
    --purple-card: rgba(55, 18, 77, 0.72);
    --teal: #5fb3b0;
    --teal-glow: rgba(95, 179, 176, 0.45);
    --cream: #f4ead2;
    --gold: #ffbe3b;
    --white: #ffffff;
}

.wizard-page {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1rem, 3vw, 2rem) 3.5rem;
    overflow-x: hidden;
    background: var(--purple) url('../img/fondo.webp') center / cover no-repeat fixed;
}

/* Flores decorativas en esquinas */
.flor {
    position: fixed;
    pointer-events: none;
    user-select: none;
    z-index: 1;
    filter: drop-shadow(0 8px 24px rgba(20, 0, 35, .45));
}

.flor--top-der {
    top: -2vw;
    right: -2vw;
    width: clamp(110px, 15vw, 210px);
    transform: rotate(180deg) scaleX(-1);
    animation: swayTop 7s ease-in-out infinite alternate;
}

.flor--bot-izq {
    bottom: -2vw;
    left: -2vw;
    width: clamp(90px, 11vw, 160px);
    animation: swayBot 7s ease-in-out infinite alternate 1s;
}

/* ======================================================
   HEADER & STEPPER
   ====================================================== */
.wz-header {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 2vw, 1.5rem);
    max-width: 900px;
    margin: 0 auto;
}

.wz-logo {
    width: clamp(150px, 12vw, 210px);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .25));
    transition: transform .25s ease;
}

.wz-logo:hover {
    transform: scale(1.03);
}

/* Stepper moderno con barra conectora */
.steps-wrapper {
    position: relative;
    width: 100%;
    max-width: 580px;
    margin: 0.5rem auto 0;
}

.steps-bar {
    position: absolute;
    top: 1.15rem;
    left: 15%;
    right: 15%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    z-index: 1;
}

.steps-bar__progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--teal), #8ce3e0);
    border-radius: 3px;
    box-shadow: 0 0 10px var(--teal-glow);
    transition: width .4s cubic-bezier(.4, 0, .2, 1);
}

.steps {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    list-style: none;
    font-size: clamp(0.82rem, 0.95vw, 0.92rem);
    font-weight: 600;
}

.steps li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    color: rgba(255, 255, 255, 0.65);
    transition: color .3s ease, transform .3s ease;
    cursor: default;
}

.steps li span {
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    background: rgba(45, 12, 60, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: var(--white);
    font-weight: 700;
    font-size: 0.95rem;
    backdrop-filter: blur(8px);
    transition: all .35s cubic-bezier(.2, .8, .2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.steps li.is-active {
    color: var(--white);
    transform: translateY(-2px);
}

.steps li.is-active span {
    background: var(--teal);
    border-color: var(--white);
    box-shadow: 0 0 0 5px var(--teal-glow), 0 6px 18px rgba(0, 0, 0, 0.35);
    transform: scale(1.08);
}

.steps li.is-done {
    color: var(--white);
}

.steps li.is-done span {
    background: var(--white);
    border-color: var(--white);
    color: var(--purple);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* ======================================================
   LAYOUT PRINCIPAL
   ====================================================== */
.wz {
    position: relative;
    z-index: 3;
    max-width: 1140px;
    margin: clamp(1.5rem, 3vw, 2.5rem) auto 0;
}

.wz-grid {
    display: grid;
    grid-template-columns: 1.25fr 0.95fr;
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: start;
}

/* Tarjeta contenedora de cada paso */
.wz-step {
    display: none;
    grid-column: 1;
    background: var(--purple-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 24px;
    padding: clamp(1.5rem, 3.5vw, 2.75rem);
    box-shadow: 0 24px 60px rgba(15, 0, 25, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.wz-step.is-active {
    display: block;
    animation: stepIn .45s cubic-bezier(.2, .8, .2, 1) both;
}

/* Columna previa (cartas de muestra) */
.wz-preview {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 2rem;
}

.wz-preview img {
    width: 100%;
    max-width: 440px;
    filter: drop-shadow(0 24px 50px rgba(20, 0, 35, 0.6));
    animation: float 5.5s ease-in-out infinite;
    user-select: none;
    pointer-events: none;
}

/* ======================================================
   TIPOGRAFÍA Y ENCABEZADOS DE PASOS
   ====================================================== */
.wz-title {
    font-size: clamp(1.4rem, 2vw, 1.85rem);
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.wz-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 1.35em;
    background: linear-gradient(180deg, var(--gold), var(--teal));
    border-radius: 3px;
}

.wz-intro {
    font-size: clamp(0.92rem, 1.05vw, 1.05rem);
    font-weight: 400;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 1.6rem;
    text-shadow: 0 2px 8px rgba(20, 0, 35, .3);
}

/* ======================================================
   INPUTS Y CAMPOS MODERNOS
   ====================================================== */
.field {
    display: block;
    margin-bottom: 1.25rem;
}

.field > span {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 0.45rem;
}

.field input {
    width: 100%;
    padding: 0.85rem 1.15rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: #2a0b3c;
    background: rgba(255, 255, 255, 0.96);
    border: 2px solid transparent;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: all .25s ease;
}

.field input::placeholder {
    color: #8c769b;
    font-weight: 400;
}

.field input:hover {
    background: #ffffff;
}

.field input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--teal);
    box-shadow: 0 0 0 4px var(--teal-glow), 0 6px 18px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.field input:user-invalid {
    border-color: #ff7878;
    box-shadow: 0 0 0 4px rgba(255, 120, 120, 0.25);
}

/* ======================================================
   PASO 1: CHIPS DE FACETAS
   ====================================================== */
.facetas {
    border: 0;
    margin-top: 1.25rem;
}

.facetas legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 0.86rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 0.85rem;
}

.badge-count {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: rgba(95, 179, 176, 0.25);
    border: 1px solid var(--teal);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: 0 0 10px rgba(95, 179, 176, 0.2);
    transition: all .25s ease;
}

.badge-count.has-facetas {
    background: var(--teal);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(95, 179, 176, 0.5);
}

.facetas-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
}

.chip {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.chip span {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.95rem;
    font-size: 0.92rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(6px);
    transition: all .2s cubic-bezier(.2, .8, .2, 1);
}

.chip-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    background: transparent;
    transition: all .2s ease;
}

.chip-icon svg {
    width: 0.85rem;
    height: 0.85rem;
    opacity: 0;
    transform: scale(0.5);
    transition: all .2s cubic-bezier(.2, 1.4, .4, 1);
}

.chip:hover span {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.chip input:checked + span {
    background: linear-gradient(135deg, rgba(95, 179, 176, 0.42), rgba(95, 179, 176, 0.18));
    border-color: var(--teal);
    box-shadow: 0 4px 18px rgba(95, 179, 176, 0.35);
    color: #ffffff;
    font-weight: 600;
    transform: translateY(-2px);
}

.chip input:checked + span .chip-icon {
    background: var(--teal);
    border-color: var(--teal);
    box-shadow: 0 0 8px rgba(95, 179, 176, 0.6);
}

.chip input:checked + span .chip-icon svg {
    opacity: 1;
    transform: scale(1);
}

.chip input:focus-visible + span {
    outline: 2px solid var(--white);
    outline-offset: 2px;
}

/* ======================================================
   PASO 2: CHECKBOXES Y AVISOS
   ====================================================== */
.check {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.92);
    margin: 0.85rem 0;
    cursor: pointer;
    line-height: 1.4;
    user-select: none;
}

.check input {
    accent-color: var(--teal);
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.15rem;
    border-radius: 4px;
    cursor: pointer;
}

.wz-link {
    display: inline-block;
    color: #9fe2df;
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-top: 0.35rem;
    transition: color .2s ease;
}

.wz-link:hover {
    color: var(--white);
}

/* Mismo color que .wz-link, pero para un link suelto DENTRO de una oración (ej. el
   checkbox de términos y condiciones) — sin los márgenes/tamaño de .wz-link, que son
   para cuando el link es su propia línea. */
.wz-link-inline {
    color: #9fe2df;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color .2s ease;
}

.wz-link-inline:hover {
    color: var(--white);
}

.wz-note {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.72);
    margin-top: 0.85rem;
    font-style: italic;
}

/* ======================================================
   PASO 3: DROPZONE ELEGANTE
   ====================================================== */
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 2.25rem 1.5rem;
    text-align: center;
    border: 2.5px dashed rgba(255, 255, 255, 0.45);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    overflow: hidden;
    transition: all .3s cubic-bezier(.2, .8, .2, 1);
}

.dropzone:hover,
.dropzone.is-over {
    background: rgba(95, 179, 176, 0.18);
    border-color: var(--teal);
    box-shadow: 0 0 25px rgba(95, 179, 176, 0.35);
    transform: scale(1.01);
}

.dropzone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
}

.dropzone__icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: var(--white);
    transition: transform .3s ease;
}

.dropzone:hover .dropzone__icon {
    transform: scale(1.1) translateY(-2px);
    background: rgba(95, 179, 176, 0.3);
    border-color: var(--teal);
}

.dropzone__msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    max-width: 380px;
}

.dropzone__msg strong {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--white);
}

.dropzone__msg span {
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.85);
}

.dropzone__tags {
    display: inline-flex;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.dropzone__tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
}

.dropzone__tip {
    font-size: 0.78rem;
    color: var(--gold);
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Vista previa de la foto subida: ocupa todo el recuadro punteado, con el botón de
   cambiar pegado abajo. */
.dropzone-preview-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(25, 5, 35, 0.92);
    z-index: 2;
    padding: 1rem;
    gap: 0.85rem;
}

/* .dropzone-preview-wrap declara su propio `display`, que pisa el que pone el
   atributo `hidden` (mismo problema que .btn-start/.btn-ghost, ver .wz-nav [hidden]
   arriba) — sin esto, la vista previa se ve siempre, incluso sin foto elegida. */
.dropzone-preview-wrap[hidden] {
    display: none;
}

.dropzone-preview-wrap img {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    border: 3px solid var(--white);
}

.dropzone-change-btn {
    margin-top: 0.85rem;
    padding: 0.4rem 1rem;
    background: var(--teal);
    color: var(--white);
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ======================================================
   BOTONERA DE NAVEGACIÓN
   ====================================================== */
.wz-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* .btn-start/.btn-ghost declaran su propio `display`, que pisa el que pone el atributo
   `hidden` (misma especificidad, pero el de [hidden] es del user-agent). Sin esto,
   "Crear mi lotería" y "Atrás" se ven en pasos donde deberían estar ocultos. */
.wz-nav [hidden] {
    display: none;
}

.btn-start {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 175px;
    padding: 0.6rem 1.85rem;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--white);
    background: var(--teal);
    border: 3.5px solid var(--white);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(20, 0, 35, .35);
    cursor: pointer;
    transition: all .25s cubic-bezier(.2, .8, .2, 1);
    user-select: none;
}

.btn-start:hover:not(:disabled) {
    background: #6ec8c5;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 25px rgba(20, 0, 35, .45);
}

.btn-start:active:not(:disabled) {
    transform: translateY(0);
}

.btn-start:disabled {
    opacity: 0.7;
    cursor: wait;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 6px;
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition: all .2s ease;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--white);
    transform: translateY(-1px);
}

/* ======================================================
   ALERTA DE ERROR
   ====================================================== */
.wz-error,
.wz-errors {
    text-align: center;
    margin: 1.25rem auto 0;
    padding: 0.75rem 1.25rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #ffffff;
    background: rgba(230, 60, 60, 0.35);
    border: 1.5px solid rgba(255, 110, 110, 0.6);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    max-width: 500px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    animation: shake .4s ease;
}

/* Animaciones */
@keyframes stepIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

@keyframes swayTop {
    0% { transform: rotate(178deg) scaleX(-1); }
    100% { transform: rotate(182deg) scaleX(-1); }
}

@keyframes swayBot {
    0% { transform: rotate(-3deg); }
    100% { transform: rotate(1deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ======================================================
   RESPONSIVE MÓVIL
   ====================================================== */
@media (max-width: 920px) {
    .wz-grid {
        grid-template-columns: 1fr;
    }

    .wz-preview {
        display: none;
    }

    .wz-step {
        padding: 1.5rem 1.25rem;
    }

    .steps-wrapper {
        max-width: 100%;
    }

    .steps li {
        font-size: 0.78rem;
    }

    .steps li span {
        width: 2rem;
        height: 2rem;
        font-size: 0.85rem;
    }

    .steps-bar {
        top: 1rem;
    }
}

@media (max-width: 540px) {
    .wizard-page {
        padding: 1.25rem 0.85rem 2.5rem;
    }

    .facetas-grid {
        grid-template-columns: 1fr;
    }

    .chip span {
        padding: 0.65rem 0.85rem;
        font-size: 0.88rem;
    }

    .wz-nav {
        flex-direction: column-reverse;
        gap: 0.65rem;
    }

    .wz-nav .btn-start,
    .wz-nav .btn-ghost {
        width: 100%;
        min-width: 0;
    }
}
