@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400&display=swap');

/* =========================================
   1. VARIABLES
   ========================================= */
:root {
    /* Colores */
    --color-brand-red: #C8030F;
    --color-brand-teal: #008C95;
    --color-text-main: #333333;
    --color-text-title: #424242;
    --color-text-placeholder: #757575;
    --color-border: #8c8c8c;
    --color-bg-error: #FDE8EA;
    
    /* Dimensiones & Espaciado */
    --form-width: 312px;
    --logo-width: 112px;
    --input-height: 38px;
    --gap-standard: 24px;
    --gap-large: 32px;
    
    --font-main: 'Roboto', sans-serif;
}

/* =========================================
   2. BASE & LAYOUT
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #FFFFFF;
    font-family: var(--font-main);
    color: var(--color-text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 60px; /* Mobile */
    padding-bottom: 20px;
}

@media (min-width: 768px) {
    body { padding-top: 140px; }
}

.login-page, .centrado {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.centrado, #fm1 {
    width: var(--form-width);
    max-width: 95vw;
}

/* Logos (Estilos compartidos) */
.logo-dia {
    display: block;
    width: var(--logo-width);
    height: auto;
    margin-bottom: var(--gap-standard);
}

.login-title {
    color: var(--color-text-title);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--gap-large);
    text-align: center;
    width: 100%;
}

/* =========================================
   3. FORMULARIO: INPUTS
   ========================================= */
.input-wrapper, 
#divUser, 
#divPassword {
    width: 100%;
    margin-bottom: var(--gap-large);
    position: relative;
    display: block;
}

#username, 
#password {
    width: 100%;
    height: var(--input-height);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text-main);
    outline: none;
    background-color: transparent;
}

#password { padding-right: 40px; }

#username:focus, #password:focus { border-color: var(--color-brand-teal); }

/* Placeholders */
#username::placeholder, #password::placeholder {
    font-style: italic;
    color: var(--color-text-placeholder);
    opacity: 1;
}

/* Etiquetas flotantes */
.input-label {
    position: absolute;
    top: -6px;
    left: 12px;
    background-color: #FFFFFF;
    padding: 0 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 5;
    pointer-events: none;
    line-height: 1;
}

/* Icono Ojo Password */
.password-toggle-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    user-select: none;
}

.password-toggle-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-text-placeholder);
    transition: stroke 0.3s;
}

.password-toggle-icon:hover svg { stroke: #333; }

/* Estados de Error en Inputs */
.input-error {
    border-color: var(--color-brand-red) !important;
    color: var(--color-brand-red) !important;
}

/* Placeholder reset para error (Agrupado) */
.input-error::placeholder,
.input-error::-webkit-input-placeholder,
.input-error:-moz-placeholder,
.input-error::-moz-placeholder,
.input-error:-ms-input-placeholder {
    color: var(--color-text-placeholder) !important;
    opacity: 1;
}

/* =========================================
   4. BOTONES Y ENLACES
   ========================================= */
nav.clearfix {
    width: 100%;
    display: flex;
    justify-content: center;
}

nav.clearfix input[type="submit"] {
    padding: 0 32px;
    height: var(--input-height);
    cursor: pointer;
    background-color: var(--color-brand-red);
    color: #FFFFFF;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

nav.clearfix input[type="submit"]:hover { background-color: #a0020c; }
nav.clearfix input[type="submit"]:disabled {
    background-color: #E3E3E3;
    color: #8c8c8c;
    cursor: not-allowed;
}

/* Enlaces (Forgot Password / Activate) */
p.message {
    text-align: center;
    width: 100%;
    line-height: 1.5;
    margin-top: 16px;
}

p.message:first-of-type { margin-top: 32px; }

p.message a {
    color: var(--color-brand-teal);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: underline;
}

p.message a:hover {
    color: #005F66;
    text-decoration: none;
}

/* =========================================
   5. SISTEMA DE ALERTAS Y MENSAJES
   ========================================= */

/* Estilos Estructurales Comunes para TODAS las cajas */
.errors, 
#msg.success, 
.error-box, 
.warning-box {
    width: 100%;
    border-radius: 4px;
    padding: 16px; /* Padding base */
    margin-bottom: 24px;
    text-align: left;
    position: relative;
    font-size: 0.9rem; /* Unificado aprox a 14px */
    line-height: 1.4;
}

/* Pseudo-elemento base para Iconos */
.errors::before, 
#msg.success::before, 
.error-box::before, 
.warning-box::before {
    content: "";
    position: absolute;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* Párrafos dentro de las cajas */
#msg.success p, .error-box p, .warning-box p {
    margin: 0 0 12px 0;
}
#msg.success p:last-child, .error-box p:last-child, .warning-box p:last-child {
    margin-bottom: 0;
}

/* --- TIPO 1: ERRORES DE SPRING (.errors) --- */
.errors {
    background-color: var(--color-bg-error);
    border: 1px solid var(--color-brand-red);
    padding-left: 40px; /* Espacio para icono */
}
.errors::before {
    left: 12px; top: 12px; width: 20px; height: 20px;
    /* SVG Data URI optimizado */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C8030F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='15' y1='9' x2='9' y2='15'%3E%3C/line%3E%3Cline x1='9' y1='9' x2='15' y2='15'%3E%3C/line%3E%3C/svg%3E");
}

/* --- TIPO 2: ÉXITO (#msg.success) --- */
#msg.success {
    background-color: #DAECE5;
    border: 1px solid #054D31;
    padding-left: 24px;
}
#msg.success::before {
    left: 8px; top: 17px; width: 16px; height: 16px;
    background-image: url('../images/check_circle.png');
}
#msg.success .success-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 12px;
}

/* --- TIPO 3: ERROR ESTÁTICO (.error-box) --- */
.error-box {
    background-color: #F7D9DB;
    border: 1px solid #B4030E;
    padding-left: 36px;
}
.error-box::before {
    left: 10px; top: 16px; width: 16px; height: 16px;
    background-image: url('../images/cancel.png');
}
.error-box .error-title {
    margin-bottom: 12px;
    /* Font-weight heredado (400) */
}

/* --- TIPO 4: ADVERTENCIA (.warning-box) --- */
.warning-box {
    background-color: #FDE5B4;
    border: 1px solid #FAAA0D;
    padding-left: 48px; /* Espacio extra solicitado */
}
.warning-box::before {
    left: 16px; top: 16px; width: 18px; height: 18px;
    background-image: url('../images/warning.png');
}
.warning-box .warning-title {
    font-weight: 700;
    margin-bottom: 12px;
    padding-left: 18px; /* Ajuste específico */
}