/* 
 * 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;
    /* Deja espacio mínimo para no chocar con el logo absoluto */
    padding-top: 30px;
    overflow-y: auto;
}

/* Compactar espaciado del formulario en auth pages para que todo quepa en viewport estándar */
.auth-layout-override .auth-container h2 {
    margin-bottom: 1.2rem !important;
}

.auth-layout-override .mui-textfield {
    margin-bottom: 1rem;
}

.auth-layout-override .auth-divider {
    margin: 0.75rem 0 0.6rem;
}

.auth-layout-override .auth-links {
    margin-top: 0.9rem;
}

/* Registro: reducir título y alertas para ganar espacio */
body:has(#registerForm) .auth-layout-override .auth-container h2 {
    font-size: 1.7rem !important;
    margin-bottom: 0.8rem !important;
}
body:has(#registerForm) .auth-alert-box {
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.8rem;
    font-size: 0.82rem;
}
body:has(#registerForm) .auth-layout-override .auth-divider {
    margin: 0.5rem 0 0.4rem;
}
body:has(#registerForm) .auth-layout-override .auth-links {
    margin-top: 0.5rem;
}
body:has(#registerForm) .auth-layout-override .panel-left {
    padding: 20px 40px;
}





/* ── Separador "o" entre el formulario y el login social ───────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.5rem 0 1rem;
    color: rgba(0, 0, 0, 0.45);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(0, 0, 0, 0.12);
}

/* ── Boton "Continuar con Google" ───────────────────────────────────────
   Sigue las directrices de marca de Google: fondo blanco, borde gris,
   logo SVG oficial a la izquierda y tipografia legible. */
.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    border-radius: 10px;
    border: 1px solid #dadce0;
    background: #ffffff;
    color: #3c4043;
    font-family: 'Inter', 'Roboto', system-ui, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.btn-google:hover {
    background: #f7f8fa;
    border-color: #c8ccd1;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.16), 0 2px 6px rgba(60, 64, 67, 0.08);
}
.btn-google:active {
    background: #f1f3f4;
    transform: translateY(1px);
}
.btn-google:focus-visible {
    outline: 2px solid #4285f4;
    outline-offset: 2px;
}
.btn-google__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.btn-google__label {
    white-space: nowrap;
}

.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;
}

/* ── Registro: compactar campos para que quepan en viewport estándar ── */
#registerForm .mui-textfield {
    margin-bottom: 0.65rem;
}
#registerForm .mui-textfield:has(input.input-error) {
    margin-bottom: 2rem;
}
#registerForm .mui-textfield input {
    padding: 11px 12px;
    font-size: 0.9rem;
}
#registerForm .mui-textfield input:focus {
    padding: 10px 11px;
}
#registerForm .mui-textfield label {
    font-size: 0.9rem;
}
#registerForm button[type="submit"] {
    padding: 10px 16px;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.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;
    }
}
