/*
 * ESTILOS GLOBALES Y DE DISEÑO RESPONSIVE
 */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Jost', sans-serif; 
}

/* --- ESTRUCTURA DE PÁGINA --- */
.login-container {
    display: flex;
    height: 100vh; 
    width: 100%;
}

.half-screen {
    width: 50%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative; 
}

/* CENTRADO VERTICAL */
.half-left {
    display: flex;
    justify-content: center;
    align-items: center; 
}

/* Contenedor principal del formulario (TRANSPARENTE) */
.login-box {
    max-width: 720px; 
    width: 90%; 
    padding: 40px 10px !important; 
    margin: 0 !important; 
    background-color: transparent !important; 
    box-shadow: none !important; 
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center; 
    gap: 0; 
}

.halfway-logo {
    width: 192px; 
    height: 44px; 
    margin: 0 0 20px 0; 
}

/* Contenedores de inputs y botón (mantienen el ancho de 400px) */
.field-loginform-username, 
.field-loginform-password,
.form-group {
    margin: 0 !important; 
    padding: 0 !important;
    width: 400px !important; 
    margin-top: 20px !important;
}
.field-loginform-username {
    margin-top: 0 !important; 
}

/* --- ESTILOS DEL MENSAJE DE ERROR (¡FINAL!) --- */
.invalid-feedback {
    /* 1. Color de Texto y Fondo */
    color: #003E84 !important; /* Azul oscuro (#003E84) para el texto */
    background-color: transparent !important; /* Fondo transparente */
    
    /* 2. Tipografía y alineación (Según especificaciones de Figma) */
    font-family: 'Jost', sans-serif !important;
    font-weight: 500 !important; 
    font-size: 14px !important; 
    text-align: center !important; 
    line-height: 100% !important; 
    
    /* 3. Dimensiones y Posicionamiento */
    display: block !important; /* Ocupa todo el ancho para centrar el texto */
    width: 100% !important; /* Usamos 100% del contenedor de 400px */
    padding: 0 !important;
    
    margin: 10px auto 0 auto !important; 
}


/* --- ESTILOS DE LOS CAMPOS DE LOGIN --- */

/* 1. CONTENEDOR FLEX: Centrado Vertical */
.input-block {
    position: static; 
    width: 400px !important; 
    height: 50px !important; 
    border: 1px solid rgba(69, 158, 215, 0.5) !important; /* Color inicial del borde */
    border-radius: 2px !important;
    box-sizing: border-box; 
    transition: border-color 0.2s ease;
    background-color: white !important;
    
    /* FLEXBOX: El centrado vertical del input */
    display: flex;
    align-items: center; /* Centrado vertical perfecto */
    padding: 0 12px 0 40px !important; 
}

/* ERROR: El borde del input-block y el ícono cambian a azul oscuro (#003E84) */
.has-error .input-block {
    border-color: #003E84 !important; /* Borde azul oscuro de error */
}

/* 2. EL INPUT (TEXTO) */
.custom-input {
    flex-grow: 1 !important;
    width: 100% !important;
    height: 100% !important; 
    box-sizing: border-box !important; 
    
    border: none !important;
    box-shadow: none !important;
    background-color: transparent !important; 
    
    padding: 0 !important; 
    line-height: normal !important; 
    text-indent: 0 !important; 
    
    font-family: 'Jost', sans-serif !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    
    /* Color base: Color del texto escrito NO en foco (Azul claro transparente) */
    color: rgba(69, 158, 215, 0.5) !important; 
    
    text-align: center !important;
}

/* 🔥 REGLA Foco Manual: Cuando el input TIENE FOCO, el color del texto escrito es AZUL OSCURO */
.custom-input:focus {
    color: #003E84 !important;
    border-color: transparent !important; /* Anulación crítica de Bootstrap */
    box-shadow: none !important; /* Anulación crítica de Bootstrap */
    outline: 0 !important; /* Anulación crítica de Bootstrap */
}

/* 🚩 AJUSTE 2: SOLUCIÓN AL AUTOFILL DEL NAVEGADOR (Texto negro) */
.custom-input:-webkit-autofill,
.custom-input:-webkit-autofill:hover, 
.custom-input:-webkit-autofill:focus {
    /* 1. Al salir del foco, el texto autocompletado debe ser el color base (azul claro transparente) */
    -webkit-text-fill-color: rgba(69, 158, 215, 0.5) !important;
    
    /* 2. Forzar el fondo a blanco (el navegador lo pone amarillo/azul) */
    box-shadow: 0 0 0 50px white inset !important;
    
    /* 3. Asegurar que la fuente y alineación se mantengan */
    font-family: 'Jost', sans-serif !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    text-align: center !important;
    
    /* 4. Evitar la transición de color de fondo del navegador */
    transition: background-color 5000s ease-in-out 0s;
}

/* 🔥 REGLA CRÍTICA PARA AUTOFILL Y FOCO: Al tener foco, el texto autocompletado es AZUL OSCURO */
.custom-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #003E84 !important;
}


/* Estilos para el texto Placeholder (Color inicial azul claro) */
.custom-input::placeholder {
    color: rgba(69, 158, 215, 0.5) !important;
    opacity: 1; 
    transition: opacity 0.2s ease, color 0.2s ease; 
}
.custom-input::-webkit-input-placeholder, 
.custom-input::-moz-placeholder, 
.custom-input:-ms-input-placeholder {
    color: rgba(69, 158, 215, 0.5) !important; 
    line-height: normal !important; 
}


/* FOCO: Cambiar borde, placeholder e ícono a azul oscuro */
.input-block:focus-within {
    border-color: #003E84 !important; 
    box-shadow: none !important; 
}

/* Ocultamos el placeholder cuando el input tiene foco */
.input-block:focus-within .custom-input::placeholder {
    opacity: 0 !important; 
}
.input-block:focus-within .custom-input::-webkit-input-placeholder {
    opacity: 0 !important; 
}


/* 3. EL ICONO (SVG) */
.input-block .custom-icon { 
    margin-left: 10px; 
    width: 18px; 
    height: 18px; 
    pointer-events: none; 
    flex-shrink: 0;
    
    /* Color inicial del SVG (azul claro) */
    stroke: rgba(69, 158, 215, 0.5) !important; 
    stroke-width: 2; 
    transition: stroke 0.2s ease;
}

/* FOCO: El SVG cambia de color a azul oscuro */
.input-block:focus-within .custom-icon { 
    stroke: #003E84 !important; 
}

/* ERROR: El SVG cambia de color a azul oscuro para coincidir con el texto de error */
.has-error .input-block .custom-icon {
    stroke: #003E84 !important; 
}


/* --- ESTILOS DEL BOTÓN LOGIN --- */
.custom-login-button {
    width: 400px !important; 
    height: 50px !important;
    background-color: #459ED7 !important; 
    border: none !important;
    border-radius: 2px;
    
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 100%;
    /* Utiliza Flexbox, por eso está centrado */
    display: flex;
    justify-content: center;
    align-items: center;

    color: #FFFFFF !important; 
    transition: background-color 0.2s ease;
}

.custom-login-button:hover {
    background-color: #003E84 !important; 
}


/* --- LOGO MEDITERRANEAN --- */
.mediterranean-logo {
    position: absolute; 
    left: 40px; 
    bottom: 40px; 
    right: auto;
    top: auto;
    
    width: 306px; 
    height: 170px;
    object-fit: contain; 
}

/* --- ESTILOS RESPONSIVE --- */
@media (max-width: 768px) {
    .login-box {
        width: 90% !important; 
        max-width: 400px !important;
        padding: 40px 20px !important; 
    }
    .half-screen {
        width: 100%;
        min-height: 100vh; 
    }
    .half-right {
        display: none; 
    }
    .input-block, .custom-login-button, .form-group, .field-loginform-username, .field-loginform-password {
        width: 100% !important; 
        margin-top: 20px !important; 
    }
    .field-loginform-username {
        margin-top: 0 !important; 
    }
    .halfway-logo {
        margin: 0 auto 20px auto;
    }
    
    /* En móviles, forzamos que el padding sea 40px para la izquierda */
    .input-block {
        padding: 0 12px 0 40px !important; 
    }
    
    .mediterranean-logo {
        display: none;
    }
}