/* ============================================================
   Story Upload Modal — sigue el patrón de efm-backdrop / modal-auth
   ============================================================ */

/* Overlay (equivalente a .efm-backdrop / .auth-modal-backdrop) */
.su-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background:
        radial-gradient(circle at 50% 12%, rgba(224, 0, 122, .16), transparent 34%),
        rgba(10, 5, 8, .74);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.su-modal.is-open { display: flex; }

/* Click-to-close (detrás de la card) */
.su-modal__backdrop {
    position: absolute;
    inset: 0;
    cursor: pointer;
}

/* Card (equivalente a .efm-modal / .modal-auth) */
.su-modal__box {
    position: relative;
    z-index: 1;
    background: var(--white);
    border: 1px solid rgba(224, 0, 122, .1);
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(25, 5, 17, .32);
    padding: 58px 32px 30px;   /* top amplio para los botones absolutos */
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    animation: suModalIn .25s cubic-bezier(.4, 0, .2, 1);
}

.su-modal__box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 84px;
    height: 4px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, var(--fuchsia-500), #ff78bf);
    transform: translateX(-50%);
}

@keyframes suModalIn {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Botones cerrar / volver (patrón .modal__close / .efm-modal__close) ── */
.su-modal__close,
.su-modal__back {
    position: absolute;
    top: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, color .2s;
}

.su-modal__close { right: 16px; }
.su-modal__back  { left: 16px; }

.su-modal__close:hover,
.su-modal__back:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.su-modal__close svg,
.su-modal__back svg {
    width: 14px;
    height: 14px;
}

/* ── Cabecera de paso (patrón .efm-modal__header) ── */
.su-modal__title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.42rem;
    font-weight: 700;
    color: var(--gray-900);
    text-align: center;
    margin: 0 0 4px;
}

.su-modal__eyebrow {
    margin: 0 0 6px;
    color: var(--fuchsia-500);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-align: center;
    text-transform: uppercase;
}

.su-modal__sub {
    font-size: .85rem;
    color: var(--gray-400);
    text-align: center;
    margin: 0 0 24px;
    line-height: 1.45;
}

.su-modal__sub--step {
    margin-bottom: 16px;
}

/* Alertas visibles dentro del modal (límites, peso y errores de carga) */
.su-modal__alert {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(220, 38, 38, .2);
    border-radius: var(--radius-sm);
    background: rgba(254, 242, 242, .96);
    color: #b91c1c;
    font-size: .8rem;
    line-height: 1.45;
}

.su-modal__alert[hidden] {
    display: none;
}

.su-modal__alert svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    margin-top: 1px;
}

.su-modal__alert div {
    display: grid;
    gap: 2px;
}

.su-modal__alert strong {
    color: #991b1b;
    font-size: .82rem;
}

/* Story counter */
.su-story-counter {
    font-size: .78rem;
    color: var(--gray-400);
    text-align: center;
    width: fit-content;
    margin: -12px auto 20px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--gray-50);
}

.su-story-counter--warn {
    color: var(--amber-500, #f59e0b);
}

.su-story-counter--zero {
    color: var(--red-500);
    font-weight: 600;
}

/* ── Visibilidad de pasos ── */
.su-step--hidden { display: none !important; }

/* ── Paso 1: selector de tipo ── */
.su-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.su-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 174px;
    padding: 24px 18px;
    background: linear-gradient(160deg, var(--white), var(--gray-50));
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    color: var(--gray-600);
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 8px 24px rgba(39, 39, 42, .04);
    transition: border-color .2s, background .2s, color .2s, transform .15s, box-shadow .2s;
}

.su-type-btn:hover {
    border-color: var(--fuchsia-400);
    background: var(--rose-50);
    color: var(--fuchsia-600);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(224, 0, 122, .1);
}

.su-type-btn svg {
    width: 36px;
    height: 36px;
    color: var(--gray-300);
    transition: color .2s;
}

.su-type-btn:hover svg { color: var(--fuchsia-500); }

.su-type-btn:disabled {
    border-color: var(--gray-200);
    background: var(--gray-50);
    color: var(--gray-400);
    cursor: not-allowed;
    opacity: .58;
    transform: none;
    box-shadow: none;
}

.su-type-btn:disabled svg {
    color: var(--gray-300);
}

.su-type-btn__copy {
    display: grid;
    gap: 4px;
}

.su-type-btn__copy strong {
    font-size: .95rem;
}

.su-type-btn__copy small {
    color: var(--gray-400);
    font-size: .7rem;
    font-weight: 500;
    line-height: 1.45;
}

.su-expiry-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 18px 0 0;
    color: var(--gray-400);
    font-size: .72rem;
}

.su-expiry-note svg {
    width: 15px;
    height: 15px;
}

/* ── Paso 2: preview vertical (formato story 9:16) ── */
.su-preview {
    position: relative;
    /* Llena el ancho disponible con máx de 260px; la altura queda ~463px */
    width: 100%;
    max-width: 260px;
    aspect-ratio: 9 / 16;
    margin: 0 auto 16px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--gray-300);
    transition: border-color .2s;
}

.su-preview:hover { border-color: var(--fuchsia-400); }

.su-preview__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--gray-500);
    font-size: .8rem;
    text-align: center;
    padding: 0 16px;
}

.su-preview__placeholder svg {
    width: 40px;
    height: 40px;
    color: var(--gray-400);
}

.su-preview__img,
.su-preview__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.su-preview__media--hidden { display: none; }

/* Contain mode */
.su-preview--contain { background: #000; }
.su-preview--contain .su-preview__img { object-fit: contain; }

/* Draggable states */
.su-preview--draggable { cursor: grab; }
.su-preview--dragging  { cursor: grabbing; }

/* Drag hint */
.su-preview__drag-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    font-size: .78rem;
    font-weight: 600;
    pointer-events: none;
    z-index: 2;
    animation: suDragHintFade 2s ease forwards;
}

.su-preview__drag-hint--hidden { display: none; }

@keyframes suDragHintFade {
    0%, 50% { opacity: 1; }
    100%    { opacity: 0; }
}

.su-preview__text-layer {
    position: absolute;
    bottom: 32px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .85);
    padding: 0 12px;
    pointer-events: none;
    word-break: break-word;
}

/* ── Zoom controls ── */
.su-zoom-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto 14px;
    width: fit-content;
    max-width: 260px;
}

.su-zoom-controls--hidden { display: none; }

.su-zoom-controls__btn {
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--gray-200);
    border-radius: 50%;
    background: var(--white);
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color .2s, color .2s, background .2s;
}

.su-zoom-controls__btn:hover {
    border-color: var(--fuchsia-400);
    color: var(--fuchsia-500);
    background: var(--rose-50);
}

.su-zoom-controls__btn svg {
    width: 14px;
    height: 14px;
}

.su-zoom-controls__track {
    flex: 1;
    height: 4px;
    background: var(--gray-200);
    border-radius: 999px;
    overflow: hidden;
    min-width: 80px;
}

.su-zoom-controls__fill {
    height: 100%;
    width: 0%;
    background: var(--fuchsia-500);
    border-radius: 999px;
    transition: width .1s ease;
}

/* ── File input oculto ── */
.su-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ── Input de texto overlay (patrón .form-input de modal-auth) ── */
.su-text-field { margin-bottom: 14px; }

.su-text-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .9rem;
    color: var(--gray-800);
    background: var(--white);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

.su-text-input::placeholder { color: var(--gray-400); }

.su-text-input:focus {
    border-color: var(--fuchsia-400);
    box-shadow: 0 0 0 3px rgba(224, 0, 122, .1);
}

/* ── Botón publicar (patrón .efm-btn-primary / .btn-primary) ── */
.su-submit {
    width: 100%;
    padding: 13px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, var(--fuchsia-600), var(--fuchsia-500));
    color: var(--white);
    box-shadow: 0 4px 14px rgba(224, 0, 122, .3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform .2s, box-shadow .2s, opacity .15s;
}

.su-submit:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.su-submit:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(224, 0, 122, .35);
}

/* ── Spinner ── */
.su-submit__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: su-spin .7s linear infinite;
}

.su-submit__spinner--hidden { display: none; }

@keyframes su-spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive ── */
@media (max-width: 512px) {
    .su-modal {
        padding: 0;
        align-items: stretch;
        z-index: 500;
    }

    .su-modal__box {
        border-radius: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 60px 20px 32px;
    }

    .su-type-grid {
        grid-template-columns: 1fr;
    }

    .su-type-btn {
        min-height: 116px;
        flex-direction: row;
        justify-content: flex-start;
        padding: 20px 22px;
        text-align: left;
    }

    .su-preview {
        max-width: 220px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .su-modal__box {
        animation: none;
    }
}
