/* 
 * auth.css 
 * Estilos modulares para las vistas de Login y Registro.
 * Hereda de la paleta de variables y estructura de welcome.css
 */

.auth-container {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    position: relative;
    z-index: 50;
    /* Utilizado para centrado vertical sobre el flex de la barra izquierda */
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
}

/* Modificadores que garantizan soporte Flex para situar la caja al centro del 50% de la pantalla */
.auth-layout-override .panel-left {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 40px;
}





.auth-links { 
    margin-top: 1.5rem; 
    text-align: center; 
}
.auth-links a { 
    color: var(--color-main-text); 
    text-decoration: none; 
    font-size: 0.9rem; 
    font-weight: 500;
}
.auth-links a:hover { 
    color: var(--color-primary-accent); 
    text-decoration: underline; 
}

.auth-link-forgot {
    font-size: 0.85rem;
    color: var(--color-primary-accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}
.auth-link-forgot:hover {
    opacity: 0.75;
    text-decoration: underline;
}

/* Desktop first: solo se muestra la X de escritorio */
.auth-close-btn {
    display: block;
}

.auth-close-btn-mobile {
    display: none !important;
}

/* Módulos de Error y Éxito de Server / JS */
.auth-alert-box { 
    background: #fee2e2; 
    color: #b91c1c; 
    padding: 1rem; 
    border-radius: 12px; 
    margin-bottom: 1.5rem; 
    font-size: 0.9rem; 
    border: 1px solid #fca5a5; 
}
.auth-alert-success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

/* ── Validaciones inline (onblur) ── */
.mui-textfield input.input-error {
    border-color: #d32f2f !important;
    box-shadow: 0 0 0 1px #d32f2f !important;
}

.mui-textfield input.input-error:focus {
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.25) !important;
}

/* Dar espacio al mensaje de error sin desplazar el label flotante */
.mui-textfield:has(input.input-error) {
    margin-bottom: 2rem;
}

.field-error-msg {
    position: absolute;
    top: 100%;
    left: 2px;
    margin-top: 4px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #d32f2f;
}

/* Responsive específico: Se parte la pantalla en modo Movil nativo */
@media (max-width: 900px) {
    .main-card.auth-main-card {
        flex-direction: column !important;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        overflow: hidden;
    }

    /* Rescatar el logo superior para que no flote encima del formulario */
    header.top-header {
        position: relative !important;
        padding: 5px !important;
        display: flex;
        justify-content: center;
    }

    header.top-header img {
        height: 130px !important;
    }

    .auth-close-btn {
        display: none !important;
    }

    .auth-close-btn-mobile {
        display: block !important;
        position: absolute;
        top: 3px;
        right: 3px;
        z-index: 999;
        color: var(--color-main-text);
        opacity: 0.45;
        font-size: 1.6rem;
        line-height: 1;
        text-decoration: none;
        transition: opacity 0.2s;
    }

    /* Ocultar la foto por completo en versión móvil */
    .auth-layout-override .panel-right {
        display: none !important;
    }

    .auth-layout-override .panel-left {
        padding: 12px 24px;
        min-height: auto;
        align-items: center;
        justify-content: center;
    }

    .wrapper.auth-wrapper { 
        height: auto; 
        max-height: none; 
        padding: 0;
    }

    .auth-container {
        min-height: auto !important;
        justify-content: center !important;
        gap: 0;
    }

    .auth-container h2 {
        font-size: 1.6rem !important;
        margin-bottom: 1.4rem !important;
        text-align: center;
    }

    .auth-container form {
        display: flex;
        flex-direction: column;
        gap: 0.9rem;
        width: 100%;
    }

    .auth-container form > div[style] {
        margin-top: 0 !important;
    }

    .auth-container form button[type="submit"] {
        margin-top: 0.5rem !important;
    }

    .auth-links {
        margin-top: 1rem !important;
    }



    .auth-alert-box {
        padding: 0.8rem;
        margin-bottom: 1rem;
    }
}
