/* ===================================================
   LABMETAL - LOGIN (login.css)
   Official Logo Box + Single Direction Top-to-Bottom Gradient
   White Login Container (Mobile & Desktop) + Staggered Entrance
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary-blue: #002b5c;
    --primary-dark: #001738;
    --logo-blue: #1687eb;
    --brand-blue: #0284c7;
    --brand-cyan: #0ea5e9;

    --text-white: #ffffff;
    --text-dark: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-dim: #94a3b8;

    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-border: #fca5a5;
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    caret-color: transparent;
}

input, textarea {
    caret-color: auto;
}

button, a, input, select {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    /* Degradado en una sola dirección de arriba a abajo, sin destellos */
    background: linear-gradient(180deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    background-attachment: fixed;
}

/* ==========================================
   ANIMACIONES DE APARICIÓN ESCALONADA
   (Tanto para PC como para Móvil)
   ========================================== */
@keyframes logoEnter {
    0% {
        opacity: 0;
        transform: translateY(22px) scale(0.94);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes nameEnter {
    0% {
        opacity: 0;
        transform: translateY(18px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardEnter {
    0% {
        opacity: 0;
        transform: translateY(28px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   LAYOUT MÓVIL (Por Defecto)
   ========================================== */
.login-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 24px;
}

/* Logo Oficial (Rectángulo azul con letras LM) */
.logo-section {
    text-align: center;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border-radius: 0;
    transition: var(--transition);
    animation: logoEnter 0.75s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.logo-img {
    width: 96px;
    height: 96px;
    display: block;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-radius: 0;
}

.logo-text {
    font-size: 3.2rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: 1px;
    line-height: 1;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.company-name {
    color: var(--text-white);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-align: center;
    animation: nameEnter 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

/* Contenedor del Formulario (Más estrecho en móvil para evitar que quede pegado) */
.login-form-side {
    width: 100%;
    max-width: 360px;
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

/* Tarjeta de Login (Fondo Blanco tanto en móvil como en PC) */
.login-card {
    width: 100%;
    background: #ffffff;
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: 0 20px 50px -10px rgba(0, 10, 30, 0.4), 0 0 1px 1px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
    z-index: 5;
    animation: cardEnter 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.login-header {
    text-align: center;
    margin-bottom: 22px;
}

.login-header h2 {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--primary-blue);
    letter-spacing: -0.3px;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
    line-height: 1.4;
}

/* Formulario */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-dark);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 15px;
    color: var(--text-dim);
    font-size: 0.92rem;
    pointer-events: none;
    transition: color 0.2s;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-dark);
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    outline: none;
    transition: var(--transition);
}

.input-wrapper input::placeholder {
    color: var(--text-dim);
}

.input-wrapper input:hover {
    background: #ffffff;
    border-color: rgba(2, 132, 199, 0.45);
}

.input-wrapper input:focus {
    background: #ffffff;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.16);
}

.input-wrapper:focus-within .input-icon {
    color: var(--brand-blue);
}

/* Checkbox Recordarme */
.remember-me {
    display: flex;
    align-items: center;
    margin-top: 2px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    gap: 9px;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox {
    height: 19px;
    width: 19px;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.checkbox-container:hover input ~ .custom-checkbox {
    background: #ffffff;
    border-color: var(--brand-blue);
}

.checkbox-container input:checked ~ .custom-checkbox {
    background: var(--logo-blue);
    border-color: var(--logo-blue);
}

.custom-checkbox::after {
    content: "";
    display: none;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.checkbox-container input:checked ~ .custom-checkbox::after {
    display: block;
}

.checkbox-label {
    font-size: 0.85rem;
    color: var(--text-body);
}

/* Error Message */
.error-message {
    font-size: 0.84rem;
    color: #b91c1c;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    padding: 10px 14px;
    border-radius: 12px;
    display: none;
    animation: shakeError 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.error-message.show {
    display: block;
}

@keyframes shakeError {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(3px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* Botón Iniciar Sesión */
.btn-login {
    width: 100%;
    padding: 13px 18px;
    font-size: 0.98rem;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 0.3px;
    color: var(--text-white);
    background: linear-gradient(135deg, #1687eb 0%, #0284c7 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(22, 135, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    margin-top: 4px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(22, 135, 235, 0.55);
    background: linear-gradient(135deg, #2563eb 0%, #0284c7 100%);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(22, 135, 235, 0.3);
}

.btn-login .btn-icon {
    font-size: 0.88rem;
    transition: transform 0.3s ease;
}

.btn-login:hover .btn-icon {
    transform: translateX(3px);
}

.btn-login:disabled,
.btn-login.loading {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===================================================
   DESKTOP LAYOUT (min-width: 1024px)
   Pantalla dividida en 2 partes:
   - Izquierda: Degradado azul de arriba a abajo con Marca
   - Derecha: Fondo blanco detrás del contenedor de login
   =================================================== */
@media (min-width: 1024px) {
    body {
        background-color: #ffffff;
    }

    .login-wrapper {
        flex-direction: row;
        padding: 0;
        min-height: 100vh;
        width: 100vw;
    }

    /* 1. Lado Izquierdo: Azul corporativo con degradado de arriba a abajo */
    .logo-section {
        width: 50%;
        min-height: 100vh;
        background: linear-gradient(180deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 60px 40px;
        margin-bottom: 0;
        max-width: none;
    }

    .logo-container {
        padding: 0;
        margin-bottom: 24px;
        box-shadow: none;
    }

    .logo-img {
        width: 130px;
        height: 130px;
        border-radius: 0;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    }

    .logo-text {
        font-size: 4.5rem;
        letter-spacing: 2px;
    }

    .company-name {
        font-size: 1.75rem;
        letter-spacing: 6px;
    }

    /* 2. Lado Derecho: Fondo blanco detrás del contenedor de inicio de sesión */
    .login-form-side {
        width: 50%;
        min-height: 100vh;
        background-color: #f8fafc;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 60px 48px;
        max-width: none;
    }

    .login-card {
        max-width: 440px;
        padding: 46px 40px;
        border-radius: 28px;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        box-shadow: 0 20px 45px -10px rgba(0, 32, 77, 0.08), 0 4px 16px rgba(0, 0, 0, 0.03);
    }

    .login-header h2 {
        font-size: 1.6rem;
    }

    .login-subtitle {
        font-size: 0.88rem;
    }
}
