/*
 * Pantalla de acceso (identidad visual premium).
 * Reutiliza la paleta índigo/violeta de layout.css (--bm-grad-*) sobre un fondo
 * oscuro tecnológico. Aislado en su propio archivo: no afecta el resto del shell
 * autenticado (layout.css), que sigue intacto.
 */

.bm-auth {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(ellipse 60% 50% at 18% 20%, rgba(99, 102, 241, 0.28), transparent 60%),
        radial-gradient(ellipse 55% 45% at 85% 78%, rgba(139, 92, 246, 0.22), transparent 60%),
        radial-gradient(ellipse 40% 40% at 50% 100%, rgba(79, 70, 229, 0.16), transparent 65%),
        linear-gradient(160deg, #05060f 0%, #090b1a 45%, #0c0f24 100%);
    color: #e7e9f5;
    isolation: isolate;
}

/* Líneas y orbes: puramente decorativos, no interactivos, no leídos por lectores de pantalla. */
.bm-auth__field {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.035) 0px, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 120px),
        repeating-linear-gradient(25deg, rgba(255, 255, 255, 0.025) 0px, rgba(255, 255, 255, 0.025) 1px, transparent 1px, transparent 160px);
    mask-image: radial-gradient(ellipse 90% 90% at 50% 45%, #000 45%, transparent 90%);
}

.bm-auth__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.8;
}

.bm-auth__orb--1 {
    width: 34rem;
    height: 34rem;
    top: -10rem;
    left: -8rem;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.45), transparent 70%);
}

.bm-auth__orb--2 {
    width: 38rem;
    height: 38rem;
    bottom: -12rem;
    right: -10rem;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.4), transparent 70%);
}

.bm-auth__orb--3 {
    width: 26rem;
    height: 26rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(79, 70, 229, 0.22), transparent 72%);
}

@media (prefers-reduced-motion: no-preference) {
    .bm-auth__orb--1 {
        animation: bm-drift-1 20s ease-in-out infinite alternate;
    }

    .bm-auth__orb--2 {
        animation: bm-drift-2 24s ease-in-out infinite alternate;
    }
}

@keyframes bm-drift-1 {
    from { transform: translate(0, 0); }
    to { transform: translate(24px, 18px); }
}

@keyframes bm-drift-2 {
    from { transform: translate(0, 0); }
    to { transform: translate(-20px, -16px); }
}

/* ---------- Contenedor principal ---------- */

.bm-auth__stack {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 30rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* ---------- Panel de identidad ---------- */

.bm-auth__identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    animation: bm-rise 0.6s ease both;
}

.bm-auth__medallion {
    /* Logo horizontal (2:1): la tarjeta es rectangular para que se lea bien. */
    width: 17rem;
    height: 8.5rem;
    border-radius: 28px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.5) inset,
        0 20px 45px -15px rgba(79, 70, 229, 0.65),
        0 0 60px rgba(99, 102, 241, 0.35);
}

.bm-auth__medallion img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bm-auth__wordmark {
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    margin: 0;
    background: linear-gradient(120deg, #ffffff 0%, #c7d2fe 60%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.bm-auth__tagline {
    font-size: 1.05rem;
    color: #aab0d6;
    margin: 0;
    max-width: 26rem;
}

.bm-auth__divider {
    width: 3.5rem;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--bm-grad-start, #4f46e5), var(--bm-grad-end, #8b5cf6));
    opacity: 0.7;
}

.bm-auth__subtext {
    font-size: 0.88rem;
    color: #7c82b0;
    margin: 0;
}

.bm-auth__features {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.bm-auth__feature {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: #c2c6ea;
}

.bm-auth__feature i {
    color: #a5b4fc;
    font-size: 1rem;
}

/* ---------- Tarjeta de acceso (glass) ---------- */

.bm-auth__card {
    position: relative;
    background: rgba(17, 20, 40, 0.6);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 28px;
    padding: 2.75rem;
    box-shadow: 0 30px 80px -25px rgba(2, 4, 20, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    width: 100%;
    animation: bm-rise 0.7s ease 0.08s both;
}

@media (max-width: 380px) {
    .bm-auth__card {
        padding: 1.5rem;
        border-radius: 22px;
    }
}

@media (max-width: 575.98px) {
    .bm-auth__medallion {
        width: 14rem;
        height: 7rem;
        border-radius: 24px;
        padding: 0.5rem 0.8rem;
    }
}

.bm-auth__card-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #a5b4fc;
    margin-bottom: 0.5rem;
}

.bm-auth__card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 1.5rem;
}

/* ---------- Campos ---------- */

.bm-auth__field-group {
    margin-bottom: 1.15rem;
}

.bm-auth__label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #9298c2;
    margin-bottom: 0.4rem;
}

.bm-auth__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.bm-auth__input-icon {
    position: absolute;
    left: 1rem;
    color: #7c82b0;
    font-size: 1.05rem;
    pointer-events: none;
}

.bm-auth__input {
    width: 100%;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    color: #f2f3fb;
    padding: 0.85rem 1rem 0.85rem 2.75rem;
    font-size: 0.98rem;
    min-height: 3.1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.bm-auth__input::placeholder {
    color: rgba(226, 228, 245, 0.35);
}

.bm-auth__input:focus {
    outline: none;
    border-color: #8b8ff5;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
}

.bm-auth__input.is-invalid {
    border-color: #f87171;
}

.bm-auth__toggle-password {
    position: absolute;
    right: 0.4rem;
    background: transparent;
    border: 0;
    color: #9298c2;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.bm-auth__toggle-password:hover {
    color: #e7e9f5;
    background: rgba(255, 255, 255, 0.08);
}

.bm-auth__toggle-password:focus-visible,
.bm-auth__input:focus-visible,
.bm-auth__submit:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

/* ---------- Botón ---------- */

.bm-auth__submit {
    width: 100%;
    border: 0;
    border-radius: 14px;
    padding: 0.95rem 1.25rem;
    min-height: 3.1rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #fff;
    background: linear-gradient(135deg, var(--bm-grad-start, #4f46e5), var(--bm-grad-mid, #6366f1) 50%, var(--bm-grad-end, #8b5cf6));
    box-shadow: 0 14px 30px -10px rgba(79, 70, 229, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
    margin-top: 0.35rem;
}

.bm-auth__submit:hover {
    filter: brightness(1.08);
    box-shadow: 0 18px 36px -10px rgba(99, 102, 241, 0.75);
}

.bm-auth__submit:active {
    transform: scale(0.985);
}

.bm-auth__submit:disabled {
    opacity: 0.85;
    cursor: progress;
    filter: none;
}

.bm-auth__submit .bi-arrow-repeat {
    display: inline-block;
}

@media (prefers-reduced-motion: no-preference) {
    .bm-auth__submit.is-loading .bi-arrow-repeat {
        animation: bm-spin 0.9s linear infinite;
    }
}

@keyframes bm-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Errores ---------- */

.bm-auth__alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-left: 3px solid #f87171;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.15rem;
    font-size: 0.88rem;
    color: #fecaca;
    animation: bm-rise 0.3s ease both;
}

.bm-auth__alert i {
    font-size: 1.1rem;
    color: #f87171;
    margin-top: 0.1rem;
}

.bm-auth__alert ul {
    margin: 0;
    padding-left: 1rem;
}

.bm-auth__alert--ok {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.35);
    border-left-color: #4ade80;
    color: #bbf7d0;
}

.bm-auth__alert--ok i {
    color: #4ade80;
}

/* ---------- Recuperar contraseña ---------- */

.bm-auth__forgot {
    display: flex;
    justify-content: flex-end;
    margin: -0.4rem 0 1.15rem;
}

.bm-auth__forgot a,
.bm-auth__back {
    font-size: 0.84rem;
    font-weight: 600;
    color: #a5b4fc;
    text-decoration: none;
}

.bm-auth__forgot a:hover,
.bm-auth__back:hover {
    color: #e7e9f5;
    text-decoration: underline;
}

.bm-auth__back {
    display: block;
    text-align: center;
    margin-top: 1rem;
}

.bm-auth__intro {
    font-size: 0.9rem;
    color: #b8bde0;
    margin: -0.75rem 0 1.25rem;
}

a.bm-auth__submit {
    text-decoration: none;
}

.bm-auth__strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 0.45rem;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.bm-auth__strength span {
    display: block;
    height: 100%;
    width: 0;
    transition: width 0.3s, background 0.3s;
}

.bm-auth__strength-text {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: #838abc;
}

/* ---------- Seguridad + footer ---------- */

.bm-auth__security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 1.35rem;
    font-size: 0.78rem;
    color: #838abc;
}

.bm-auth__security i {
    color: #a5b4fc;
}

.bm-auth__footer {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: 0.75rem;
    color: #5c628f;
    margin-top: 2rem;
    width: 100%;
}

/* ---------- Microinteracciones de entrada ---------- */

@media (prefers-reduced-motion: no-preference) {
    @keyframes bm-rise {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

@media (prefers-reduced-motion: reduce) {
    .bm-auth__identity,
    .bm-auth__card,
    .bm-auth__alert {
        animation: none;
    }

    .bm-auth__orb--1,
    .bm-auth__orb--2 {
        animation: none;
    }
}
