/* ============================================================
   LOGIN — rediseño de dos paneles (escritorio) / una columna (celular)
   Paleta de base.css. El login se queda en la paleta clara aunque el
   equipo esté en modo oscuro: en oscuro, --brand pasa a #60a5fa y el
   texto blanco del botón quedaría por debajo de 4,5:1.
   ============================================================ */

.login-page {
    --brand:        #004a99;
    --brand-dark:   #002a5c;
    --brand-accent: #63b3ed;
    --text:         #2c3e50;
    --text-muted:   #6c757d;
    --border:       #e0e0e0;
    --white:        #ffffff;
    --surface:      #ffffff;
    --surface-2:    #f8f9fa;
    --danger:       #dc3545;
    --danger-bg:    #f8d7da;
    --danger-text:  #721c24;
    --success:      #28a745;
    --success-bg:   #d4edda;
    --success-text: #155724;
    --login-noche:  #0a1628;   /* panel de marca */
    --login-noche-texto: #cbd5e1;
    color-scheme: light;
}

html, body.login-page {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body.login-page {
    font-family: var(--font-main);
    color: var(--text);
    background: var(--white);
}

/* ── Skip link de accesibilidad ── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--brand);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    z-index: 9999;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus { top: 0; outline: 3px solid var(--brand-accent); outline-offset: 2px; }

/* ── Distribución ── */
.login-layout {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
}

/* ── Panel de marca ── */
.login-brand {
    flex: 1 1 50%;
    min-width: 0;
    background: var(--login-noche);
    color: #ffffff;
    padding: 56px 64px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 48px;
}
.brand-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--brand-accent);
}
.brand-body {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 520px;
}
.brand-title {
    margin: 0;
    font-size: 40px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
}
.brand-modulos {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-size: 15px;
    color: var(--login-noche-texto);
}
.brand-modulos li { display: flex; gap: 12px; align-items: center; }
.brand-modulos i { width: 20px; text-align: center; color: var(--brand-accent); font-size: 16px; }
.brand-nota {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--login-noche-texto);
    max-width: 440px;
}

/* ── Panel del formulario ── */
.login-main {
    flex: 1 1 50%;
    min-width: 0;
    padding: 56px 24px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-form {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.logo-img {
    width: 220px;
    height: auto;
    margin-bottom: 8px;
}
.login-encabezado { display: flex; flex-direction: column; gap: 6px; }
.login-encabezado h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text);
}
.login-encabezado p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
}

/* ── Campos ── */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    padding: 0 4px 0 14px;
    box-sizing: border-box;
    border: 1.5px solid var(--text-muted);   /* antes #e0e0e0: 1,3:1, casi invisible */
    border-radius: var(--radius-sm);
    background: var(--white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-wrapper:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(0, 74, 153, 0.1);
}
.input-wrapper .field-icon {
    color: var(--text-muted);
    font-size: 15px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    pointer-events: none;
}
.input-wrapper:focus-within .field-icon { color: var(--brand); }
.input-wrapper input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    padding: 0 10px 0 0;
    font: inherit;
    font-size: 15px;
    color: var(--text);
    background: transparent;
}
.input-wrapper input:hover,
.input-wrapper input:focus {
    border: 0;
    box-shadow: none;   /* el anillo de foco lo pinta .input-wrapper */
    background: transparent;
}
.input-wrapper input::placeholder { color: var(--text-muted); opacity: 1; }
.input-wrapper.invalido { border-color: var(--danger); }

.btn-ver-clave {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.btn-ver-clave:hover { background: var(--surface-2); transform: none; }
.btn-ver-clave:focus-visible { outline: 3px solid var(--brand); outline-offset: 1px; }

@media (forced-colors: active) {
    .input-wrapper:focus-within { outline: 3px solid ButtonText; }
}

.field-error {
    display: block;
    color: var(--danger-text);
    font-size: 13px;
    font-weight: 600;
    min-height: 0;
}
.field-error:empty { display: none; }

/* ── Botón principal ── */
.btn-login {
    height: 48px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #ffffff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: var(--shadow-brand);
    transition: background var(--transition-fast), transform var(--transition-fast);
}
.btn-login .btn-label { display: inline-flex; align-items: center; gap: 10px; }
.btn-login:hover  { background: var(--brand-dark); transform: none; }
.btn-login:active { transform: scale(0.98); }
.btn-login:focus-visible { outline: 3px solid var(--brand-accent); outline-offset: 2px; }
.btn-login:disabled {
    opacity: 1;
    background: var(--brand-dark);
    cursor: progress;
    box-shadow: none;
    transform: none;
}

/* Spinner dentro del botón */
.btn-login .spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
.btn-login.loading .spinner    { display: inline-block; }
.btn-login.loading .btn-label  { display: none; }

/* ── Mensaje global (error o éxito de soporte) ── */
#error-msg {
    display: none;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid var(--danger);
    border-radius: var(--radius-sm);
    background: var(--danger-bg);
    color: var(--danger-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}
#error-msg.visible { display: flex; }
#error-msg i { font-size: 16px; margin-top: 1px; flex-shrink: 0; }
#error-msg.exito {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success-text);
}

/* ── Pie ── */
.login-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}
.login-footer span { display: inline-flex; align-items: center; gap: 6px; }
.login-footer .punto-activo {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success);
}

/* ── Celular: una columna, franja de marca arriba ── */
@media (max-width: 860px) {
    .login-layout { flex-direction: column; }
    .login-brand {
        flex: 0 0 auto;
        padding: 28px 20px 24px;
        gap: 6px;
    }
    .brand-eyebrow-extra,
    .brand-title-extra,
    .brand-modulos,
    .brand-nota { display: none; }
    .brand-body { gap: 0; }
    .brand-title { font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: 0; }

    .login-main {
        flex: 1 0 auto;
        align-items: flex-start;
        padding: 28px 20px 24px;
    }
    .login-form { gap: 20px; max-width: none; }
    .logo-img { width: 180px; margin-bottom: 0; }
    .login-encabezado { gap: 4px; }
    .login-encabezado h1 { font-size: 22px; }
    .login-encabezado p  { line-height: 1.5; }

    /* 52 px de alto y letra de 16 px: iPhone no hace zoom al tocar el campo */
    .input-wrapper { height: 52px; }
    .input-wrapper input { font-size: 16px; }
    .btn-ver-clave { width: 44px; height: 44px; }
    .btn-login { height: 52px; font-size: 16px; }
    .login-footer { justify-content: center; text-align: center; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
