/* ══════════════════════════════════════════════════════
   STM Auth Modal v1.2.0
   FIX MOBILE: arquitectura mobile-first.
   La animación desktop (translate -50%,-50%) ya NO
   afecta al móvil porque cada breakpoint tiene su propia
   @keyframe. El modal en mobile sube desde abajo (sheet).
══════════════════════════════════════════════════════ */

/* ── Backdrop ─────────────────────────────────────── */
.stm-auth-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.75);
    z-index: 99998;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.stm-auth-backdrop.active { display: block; animation: stm-fade-in .2s ease; }
@keyframes stm-fade-in { from{opacity:0} to{opacity:1} }

/* ══ MODAL — Mobile first (bottom sheet) ═══════════ */
.stm-auth-modal {
    display: none;
    position: fixed;
    /* Mobile: sube desde la parte inferior */
    bottom: 0; left: 0; right: 0;
    top: auto;
    width: 100%; max-width: 100%;
    max-height: 92dvh;
    overflow-y: auto;
    background: #0d1b2e;
    border: .5px solid rgba(201,168,76,.25);
    border-radius: 22px 22px 0 0;
    padding: 26px 20px 36px;
    z-index: 99999;
    font-family: 'Space Grotesk', 'DM Sans', system-ui, sans-serif;
    color: #fafaf8;
    box-shadow: 0 -8px 60px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.04);
    scrollbar-width: thin;
    scrollbar-color: rgba(201,168,76,.2) transparent;
    box-sizing: border-box;
}
.stm-auth-modal.active {
    display: block;
    /* Animación MOBILE: sube desde abajo, sin translate X */
    animation: stm-sheet-up .3s cubic-bezier(.34,1.08,.64,1) forwards;
}
@keyframes stm-sheet-up {
    from { opacity: 0; transform: translateY(48px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══ MODAL — Desktop (ventana centrada) ════════════ */
@media (min-width: 481px) {
    .stm-auth-modal {
        /* Sobrescribir mobile: centrar en pantalla */
        bottom: auto;
        top: 50%; left: 50%;
        right: auto;
        width: min(440px, calc(100vw - 24px));
        max-width: 440px;
        max-height: calc(100dvh - 48px);
        border-radius: 18px;
        padding: 28px 28px 28px;
        box-shadow: 0 32px 80px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.04);
    }
    .stm-auth-modal.active {
        /* Animación DESKTOP: escala + translate, NO afecta mobile */
        animation: stm-modal-in .25s cubic-bezier(.34,1.12,.64,1) forwards;
    }
    @keyframes stm-modal-in {
        from { opacity:0; transform: translate(-50%,-48%) scale(.94); }
        to   { opacity:1; transform: translate(-50%,-50%) scale(1); }
    }
}

/* ── Botón cerrar ─────────────────────────────────── */
.stm-auth-close {
    position: absolute; top: 14px; right: 14px;
    background: rgba(255,255,255,.06);
    border: .5px solid rgba(255,255,255,.1);
    color: rgba(250,250,248,.5);
    width: 32px; height: 32px;
    border-radius: 50%; cursor: pointer; font-size: 15px;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s; padding: 0; font-family: inherit;
}
.stm-auth-close:hover { background: rgba(255,255,255,.14); color: #fafaf8; }

/* ── Logo ──────────────────────────────────────────── */
.stm-auth-logo-wrap {
    text-align: center; margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: .5px solid rgba(255,255,255,.06);
}
.stm-auth-logo-img {
    width: 64px; height: 64px;
    border-radius: 50%; object-fit: cover;
    border: 2px solid rgba(201,168,76,.3);
    background: rgba(201,168,76,.06);
    display: block; margin: 0 auto 8px;
}
.stm-auth-logo-fallback {
    width: 64px; height: 64px; border-radius: 50%;
    background: rgba(201,168,76,.1);
    border: 2px solid rgba(201,168,76,.25);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px; color: #c9a84c; margin-bottom: 8px;
}
.stm-auth-site-name {
    font-size: 11px; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase; color: rgba(250,250,248,.35);
}

/* ── Pantallas ─────────────────────────────────────── */
.stm-auth-screen { display: none; }
.stm-auth-screen.active { display: block; animation: stm-fade-in .18s ease; }

/* ── Títulos ───────────────────────────────────────── */
.stm-auth-title {
    font-size: 21px; font-weight: 700;
    color: #fafaf8; text-align: center;
    margin: 0 0 6px; letter-spacing: .02em;
    font-variant: small-caps;
}
.stm-auth-sub {
    font-size: 13px; color: rgba(250,250,248,.42);
    text-align: center; margin: 0 0 22px; line-height: 1.55;
}

/* ── Formulario ────────────────────────────────────── */
.stm-auth-form { display: flex; flex-direction: column; gap: 14px; }

.stm-auth-field { display: flex; flex-direction: column; gap: 5px; }
.stm-auth-field label {
    font-size: 10px; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: rgba(250,250,248,.36);
}
.stm-auth-optional { font-weight: 400; opacity: .65; }

.stm-auth-field input {
    width: 100%; padding: 13px 14px;
    background: rgba(250,250,248,.05);
    border: .5px solid rgba(201,168,76,.2);
    border-radius: 8px; color: #fafaf8;
    font-size: 15px; font-family: inherit;
    box-sizing: border-box;
    transition: border-color .15s, background .15s; outline: none;
    /* iOS: evita zoom al enfocar */
    -webkit-text-size-adjust: none;
}
.stm-auth-field input:focus {
    border-color: rgba(201,168,76,.65);
    background: rgba(201,168,76,.04);
}
.stm-auth-field input::placeholder { color: rgba(250,250,248,.22); }

.stm-auth-pwd-wrap { position: relative; }
.stm-auth-pwd-wrap input { padding-right: 48px; }
.stm-auth-eye {
    position: absolute; right: 14px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: rgba(250,250,248,.3); padding: 0;
    line-height: 1; transition: color .15s; font-family: inherit;
    /* Área táctil grande en móvil */
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: flex-end;
}
.stm-auth-eye:hover { color: rgba(250,250,248,.7); }

/* ── Botón principal ───────────────────────────────── */
.stm-auth-btn-primary {
    width: 100%; padding: 15px 20px;
    background: linear-gradient(135deg, #b8942a, #e8c76a);
    color: #09090b; border: none; border-radius: 8px;
    font-size: 15px; font-weight: 700; font-family: inherit;
    cursor: pointer; letter-spacing: .04em;
    transition: opacity .15s; margin-top: 4px;
    box-shadow: 0 4px 16px rgba(201,168,76,.25);
    /* Área táctil mínima móvil */
    min-height: 52px;
}
.stm-auth-btn-primary:hover { opacity: .9; }
.stm-auth-btn-primary:active { opacity: .8; }
.stm-auth-btn-primary:disabled { opacity: .45; cursor: not-allowed; }

/* ── Links ─────────────────────────────────────────── */
.stm-auth-link {
    background: none; border: none; color: rgba(250,250,248,.38);
    font-size: 13px; font-family: inherit; cursor: pointer;
    text-align: center; padding: 8px 4px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    text-decoration: underline; text-decoration-color: transparent;
    transition: color .15s, text-decoration-color .15s;
}
.stm-auth-link:hover { color: rgba(250,250,248,.75); text-decoration-color: currentColor; }

.stm-auth-link-gold {
    background: none; border: none; color: #c9a84c;
    font-size: 14px; font-weight: 700; font-family: inherit;
    cursor: pointer; padding: 4px 0;
    text-decoration: underline; text-decoration-color: transparent;
    transition: all .15s; min-height: 44px;
}
.stm-auth-link-gold:hover { text-decoration-color: #c9a84c; opacity: .85; }

/* ── Mensajes ──────────────────────────────────────── */
.stm-auth-msg {
    padding: 11px 14px; border-radius: 8px;
    font-size: 13px; line-height: 1.4;
}
.stm-auth-msg.ok {
    background: rgba(13,46,26,.9);
    border: .5px solid rgba(74,222,128,.3); color: #86efac;
}
.stm-auth-msg.err {
    background: rgba(127,29,29,.4);
    border: .5px solid rgba(239,68,68,.3); color: #fca5a5;
}

.stm-auth-switch {
    font-size: 14px; color: rgba(250,250,248,.38);
    text-align: center; margin: 14px 0 0;
}

/* ── Spinner ───────────────────────────────────────── */
.stm-auth-spinner-wrap { display: flex; justify-content: center; padding: 20px 0; }
.stm-auth-spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(201,168,76,.15);
    border-top-color: #c9a84c;
    border-radius: 50%;
    animation: stm-spin .7s linear infinite;
}
@keyframes stm-spin { to { transform: rotate(360deg); } }

/* ── Shortcode buttons ─────────────────────────────── */
.stm-auth-sc-wrap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stm-auth-sc-btn {
    padding: 10px 18px; border-radius: 6px;
    font-size: 14px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all .15s;
    border: .5px solid rgba(250,250,248,.15);
    background: rgba(250,250,248,.06); color: rgba(250,250,248,.8);
    min-height: 44px;
}
.stm-auth-sc-btn:hover { background: rgba(250,250,248,.12); }
.stm-auth-sc-gold {
    background: linear-gradient(135deg,#b8942a,#e8c76a);
    color: #09090b; border-color: transparent;
}
.stm-auth-sc-gold:hover { opacity: .9; }
.stm-auth-sc-account {
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none; padding: 10px 16px; border-radius: 6px;
    font-size: 14px; font-weight: 600;
    background: rgba(201,168,76,.1);
    border: .5px solid rgba(201,168,76,.3); color: #c9a84c;
}
