/**
 * Armazon compartido del acceso (colegio y editorial).
 * La marca vive en pages/colegio/auth/login.css y pages/editorial/auth/login.css.
 */

/* 1. Estructura y Contenedor Principal */

.login-page-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    background-color: var(--color-crema);
    color: var(--color-text-default);
    font-family: var(--font-base, 'Poppins', sans-serif);
    overflow-x: hidden;
}

/* Panel izquierdo: Visual / Banner (Oculto en móviles) */
.login-visual-panel {
    position: relative;
    width: 50%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.5) 100%),
                var(--mkt-publico-login-fondo, var(--color-crema)) no-repeat center center fixed;
    background-size: cover;
    color: var(--color-text-default);
    z-index: 1;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

/* Fallback si no carga la imagen de fondo */
.login-visual-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--color-granate) 0%, var(--color-granate-deep) 100%);
    opacity: 0.15;
    z-index: -1;
}

/* Panel derecho: Formulario e Ilustración */
.login-form-panel {
    position: relative;
    width: 50%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.5rem;
    z-index: 1;
}

/* 2. Elementos Decorativos Geométricos */
.visual-decor-top { position: absolute; top: 0; left: 0; width: 100%; height: 180px; z-index: 2; pointer-events: none; }
.form-decor-bottom { position: absolute; bottom: 0; right: 0; width: 100%; max-width: 450px; height: 140px; z-index: -1; pointer-events: none; }
.form-decor-top-right { position: absolute; top: 0; right: 0; width: 160px; height: 160px; border-top: 4px solid var(--color-granate); border-right: 4px solid var(--color-granate); border-top-right-radius: 12px; margin-top: 2rem; margin-right: 2rem; opacity: 0.8; z-index: 0; pointer-events: none; }

/* 3. Tipografía y Textos del Banner Izquierdo */

.visual-welcome-text {
    margin-top: auto;
    margin-bottom: auto;
    max-width: 100%;
    z-index: 3;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.visual-welcome-text h1 {
    font-size: 5.5rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -2px;
    margin-bottom: 1.5rem;
    text-transform: none;
    /* Efecto de texto relleno con imagen y un tinte rojo/granate */
    background: linear-gradient(rgba(var(--color-granate-rgb), 0.55), rgba(var(--color-granate-rgb), 0.55)), var(--mkt-publico-login-fondo, var(--color-crema)) no-repeat center center fixed;
    background-size: cover;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 2px var(--color-granate); /* Borde rojo */
}

.visual-welcome-text p {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-granate);
    letter-spacing: 0.5px;
    margin: 0;
    padding-top: 1.5rem;
    border-top: 2px solid var(--color-granate);
    width: 80%;
}

.visual-footer-text {
    z-index: 3;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-default);
    letter-spacing: 0.5px;
    text-align: center;
    width: 100%;
}

/* 4. Cabecera con Logo en el Panel de Formulario */

.login-header-brand {
    position: absolute;
    top: 2.5rem;
    right: 3.5rem;
    z-index: 10;
}

.login-logo-img {
    height: 70px;
    width: auto;
    filter: drop-shadow(0 4px 6px rgba(var(--color-granate-rgb), 0.12));
    transition: transform 0.3s ease;
}

.login-logo-img:hover {
    transform: scale(1.05);
}

@media (max-width: 991.98px) {
    .login-header-brand {
        position: relative;
        top: 0;
        right: 0;
        margin-bottom: 2rem;
        width: 100%;
        display: flex;
        justify-content: center;
    }
    .login-logo-img {
        height: 60px;
    }
}

/* 5. Contenedor de Contenido (Card + Mascot) */

.login-content-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    width: 100%;
    max-width: 860px;
    z-index: 2;
}

@media (max-width: 1199.98px) {
    .login-content-container {
        max-width: 520px;
    }
}

/* 6. Tarjeta de Login (White Card) */

.login-card-wrapper {
    flex: 1;
    width: 100%;
    max-width: 440px;
}

.login-custom-card {
    background-color: var(--color-blanco);
    border: 1px solid rgba(var(--color-granate-rgb), 0.08);
    border-radius: 28px;
    padding: 2.5rem 2.2rem;
    box-shadow: 0 15px 35px rgba(var(--color-granate-rgb), 0.06), 
                0 5px 15px rgba(0, 0, 0, 0.03);
    /* transition: transform 0.3s ease, box-shadow 0.3s ease; */
}

.login-custom-card:hover {
    /* transform: translateY(-4px); */
    box-shadow: 0 20px 40px rgba(var(--color-granate-rgb), 0.1), 
                0 8px 20px rgba(0, 0, 0, 0.04);
}

/* Encabezado de la Tarjeta */
.card-login-header { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 2rem; }
.card-login-icon { font-size: 1.8rem; color: var(--color-granate); display: flex; align-items: center; }
.card-login-title { font-size: 1.6rem; font-weight: 700; color: var(--color-text-default); margin: 0; letter-spacing: -0.5px; }

/* 7. Formulario y Campos de Entrada (Custom inputs) */

.form-group-custom {
    margin-bottom: 1.5rem;
}

/* Etiquetas superiores estilizadas */
.form-label-custom {
    display: block;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    padding-left: 0.8rem;
}

/* Inputs tipo píldora redondeada */
.form-control-custom {
    display: block;
    width: 100%;
    height: 50px;
    padding: 0.375rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--color-text-default);
    background-color: #FAF7F0; /* Crema suave */
    background-clip: padding-box;
    border: 1px solid rgba(var(--color-granate-rgb), 0.12);
    border-radius: 50px; /* Estilo píldora */
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, background-color 0.2s;
}

.form-control-custom:focus {
    color: var(--color-text-default);
    background-color: var(--color-blanco);
    border-color: var(--color-granate);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(var(--color-granate-rgb), 0.15);
}

.form-control-custom::placeholder {
    color: rgba(var(--color-text-muted-rgb, 92, 74, 61), 0.5);
    font-size: 0.9rem;
}

/* Quitar el relleno azul celeste por defecto de autocompletado en navegadores */
input.form-control-custom:-webkit-autofill,
input.form-control-custom:-webkit-autofill:hover, 
input.form-control-custom:-webkit-autofill:focus, 
input.form-control-custom:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px #FAF7F0 inset !important;
    -webkit-text-fill-color: var(--color-text-default) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Estilos de error para inputs */
.form-control-custom.is-invalid {
    border-color: var(--color-danger);
    background-color: rgba(239, 83, 80, 0.03);
}

.form-control-custom.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(239, 83, 80, 0.15);
}

/* Contraseña con ojito mostrar/ocultar (login / restablecer) */
.form-control-custom-wrap--password {
    position: relative;
    display: block;
}

.form-control-custom-wrap--password > .form-control-custom {
    padding-right: 3.25rem;
}

.form-control-custom__toggle-password {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    z-index: 2;
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-granate);
    cursor: pointer;
    line-height: 0;
}

.form-control-custom__toggle-password:hover {
    color: var(--color-granate-hover);
}

.form-control-custom__toggle-password:focus-visible {
    outline: 2px solid var(--color-dorado, #c9a227);
    outline-offset: 2px;
}

.form-control-custom__toggle-password-icon {
    grid-area: 1 / 1;
    display: block;
    width: 1.35rem;
    height: 1.35rem;
    pointer-events: none;
    stroke-width: 2.25;
}

/* Por defecto (oculta): ojo con raya */
.form-control-custom__toggle-password-icon--abierto {
    display: none;
}

/* Contraseña visible: ojo abierto (sin raya) */
.form-control-custom__toggle-password.is-password-visible .form-control-custom__toggle-password-icon--tachado {
    display: none;
}

.form-control-custom__toggle-password.is-password-visible .form-control-custom__toggle-password-icon--abierto {
    display: block;
}

.invalid-feedback-custom {
    font-size: 0.8rem;
    color: var(--color-danger);
    margin-top: 0.35rem;
    padding-left: 0.8rem;
    font-weight: 500;
}

/* Alertas de error de Laravel */
.alert-custom {
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid rgba(239, 83, 80, 0.2);
    background-color: rgba(239, 83, 80, 0.05);
    color: #c62828;
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
}

.alert-custom--success {
    border-color: rgba(46, 125, 50, 0.25);
    background-color: rgba(46, 125, 50, 0.06);
    color: #2e7d32;
}

.alert-custom--warning {
    border-color: rgba(237, 108, 2, 0.25);
    background-color: rgba(237, 108, 2, 0.06);
    color: #e65100;
}

.alert-custom--info {
    border-color: rgba(2, 136, 209, 0.25);
    background-color: rgba(2, 136, 209, 0.06);
    color: #0277bd;
}

/* 8. Controles de Checkbox y Enlaces */
.form-check-custom {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0.6rem;
    margin: 1.2rem 0 1.8rem;
}
.form-check-input-custom {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 0.1rem;
    border-radius: 4px;
    border: 2px solid var(--color-granate);
    cursor: pointer;
    accent-color: var(--color-granate);
    outline: none;
    transition: transform 0.2s;
}
.form-check-input-custom:hover { transform: scale(1.1); }
.form-check-label-custom {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
    line-height: 1.35;
}
.form-check-label-custom__hint {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.3;
    color: var(--color-text-muted);
    opacity: 0.9;
}

/* 9. Botón de Acción Principal y Enlaces de Retorno */

.btn-login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 50px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-blanco);
    background-color: var(--color-granate);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(var(--color-granate-rgb), 0.2);
    transition: all 0.25s ease;
}

.btn-login-submit:hover {
    color: var(--color-blanco);
    background-color: var(--color-granate-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(var(--color-granate-rgb), 0.3);
}

.btn-login-submit:active {
    color: var(--color-blanco);
    background-color: var(--color-granate-deep);
    transform: translateY(0);
}

/* Botón secundario / volver */
.btn-login-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0.8rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.btn-login-back:hover {
    color: var(--color-granate);
    text-decoration: underline;
}

/* 10. Contenedor de la Mascota 3D */

.login-mascot-wrapper {
    position: relative;
    perspective: 1000px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 420px;
}

.login-mascot-inner {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.login-mascot-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    animation: organicPulse 4s ease-in-out infinite;
}

/* Animación de latido/respiración suave */
@keyframes organicPulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 15px 30px rgba(var(--color-granate-rgb), 0.15));
    }
    50% {
        transform: scale(1.04); /* Crece un poquito, como respirando */
        filter: drop-shadow(0 25px 45px rgba(var(--color-granate-rgb), 0.3)); /* La sombra se intensifica */
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 15px 30px rgba(var(--color-granate-rgb), 0.15));
    }
}

/* Fin de los estilos principales */

/* 11. Pantallas de auth compartidas (forgot, reset, 2FA) */

.auth-card-lead {
    font-size: 0.92rem;
    color: var(--color-text-muted);
    margin: -1rem 0 1.5rem;
    line-height: 1.45;
}

.auth-enlace-centro {
    text-align: center;
    margin: 0.85rem 0 0;
}

.auth-enlace-secundario {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-enlace-secundario:hover {
    color: var(--color-granate);
    text-decoration: underline;
}

.auth-hint-campo {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 0.35rem;
    padding-left: 0.8rem;
    line-height: 1.35;
}

.login-card-wrapper--amplia {
    max-width: 560px;
}

.auth-2fa-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.auth-paso-titulo {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-default);
    margin: 0 0 0.75rem;
}

.auth-qr-img {
    display: block;
    width: 100%;
    max-width: 220px;
    border-radius: 16px;
    border: 1px solid rgba(var(--color-granate-rgb), 0.12);
    padding: 0.5rem;
    background: var(--color-blanco);
}

.auth-nota-pie {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin: 0.5rem 0 0;
    line-height: 1.35;
}

.auth-codigos-panel {
    margin-top: 1.75rem;
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid rgba(2, 136, 209, 0.25);
    background-color: rgba(2, 136, 209, 0.06);
}

.auth-codigos-panel h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0277bd;
    margin: 0 0 0.35rem;
}

.auth-codigos-lista {
    background: var(--color-blanco);
    border-radius: 12px;
    border: 1px solid rgba(var(--color-granate-rgb), 0.08);
    padding: 0.75rem 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

@media (max-width: 575.98px) {
    .auth-2fa-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablet ancha: panel visual a la izquierda; mascota compacta bajo la tarjeta */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .login-content-container {
        flex-direction: column;
        gap: 1rem;
    }

    .login-mascot-wrapper {
        display: flex;
        max-width: 180px;
        margin: 0 auto;
        flex: 0 0 auto;
    }

    .login-mascot-img {
        max-height: 170px;
        width: auto;
    }
}

/* Movil / tablet estrecha: hero arriba (Bienvenido + fondo) y formulario debajo.
   Logo flotante sobre la imagen (esquina superior derecha). Sin muñeco.
   Va al final para ganar al tipado base del panel visual. */
@media (max-width: 991.98px) {
    .login-page-wrapper {
        position: relative;
        flex-direction: column;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .login-visual-panel {
        display: flex;
        width: 100%;
        min-height: 0;
        height: clamp(168px, 30vh, 240px);
        padding: 1.1rem 1.25rem 1rem;
        box-shadow: none;
        /* fixed rompe en iOS/Android; scroll mantiene la foto visible */
        background-attachment: scroll;
        justify-content: center;
    }

    .login-visual-panel .visual-decor-top {
        height: 72px;
    }

    .login-visual-panel .visual-welcome-text {
        margin: 0;
        z-index: 3;
    }

    .login-visual-panel .visual-welcome-text h1 {
        font-size: clamp(2.1rem, 9vw, 3.1rem);
        letter-spacing: -1px;
        margin-bottom: 0.65rem;
        -webkit-text-stroke: 1.5px var(--color-granate);
        background-attachment: scroll;
    }

    .login-visual-panel .visual-welcome-text p {
        font-size: clamp(0.95rem, 3.6vw, 1.15rem);
        padding-top: 0.65rem;
        width: min(92%, 22rem);
    }

    .login-visual-panel .visual-footer-text {
        display: none;
    }

    .login-form-panel {
        width: 100%;
        min-height: 0;
        flex: 1 1 auto;
        justify-content: flex-start;
        padding: 1.25rem 1.15rem 1.75rem;
    }

    .form-decor-top-right {
        display: none;
    }

    /* Logo sobre la foto del hero (el brand vive en el panel del form;
       se sube con el mismo alto del hero; offset evita el adorno SVG superior). */
    .login-header-brand {
        position: absolute;
        top: calc(-1 * clamp(168px, 30vh, 240px) + 2.85rem);
        right: 0.75rem;
        z-index: 20;
        width: auto;
        margin: 0;
        display: flex;
        justify-content: flex-end;
    }

    .login-logo-img {
        height: 58px;
        filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.45));
    }

    .login-content-container {
        flex-direction: column;
        max-width: 440px;
        gap: 0;
    }

    .login-mascot-wrapper {
        display: none !important;
    }

    .login-custom-card {
        padding: 1.75rem 1.35rem;
        border-radius: 22px;
    }
}

/* Honeypot anti-bot: fuera de vista, no debe rellenarse */
.auth-campo-trampa {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
