/* ═══════════════════════════════════════════════════════════════
   Login — Sistema de Inventario (Design System v3)
   Respeta los colores de marca configurables (--primary-color, etc.)
   ═══════════════════════════════════════════════════════════════ */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
}

.login-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    overflow: hidden;
    background:
        radial-gradient(ellipse 65% 55% at 12% 0%, color-mix(in srgb, var(--primary-color, #4e73df) 30%, transparent), transparent 62%),
        radial-gradient(ellipse 55% 50% at 95% 100%, color-mix(in srgb, var(--accent-color, #1cc88a) 22%, transparent), transparent 60%),
        linear-gradient(160deg, var(--sidebar-color, #2c3e50) 0%, color-mix(in srgb, var(--sidebar-color, #2c3e50) 70%, #000) 100%);
}

/* Retícula sutil de fondo: identidad "almacén ordenado" */
.login-decor {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 75% 70% at 50% 40%, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 40%, #000 30%, transparent 75%);
    pointer-events: none;
}

.login-box {
    position: relative;
    background: #ffffff;
    padding: 2.5rem 2.5rem 2rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .5);
    box-shadow: 0 24px 70px -18px rgba(0, 0, 0, 0.45);
    width: 100%;
    max-width: 410px;
    animation: slideUp 0.45s cubic-bezier(.22, 1, .36, 1);
}

@keyframes slideUp {
    from { transform: translateY(22px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.login-header {
    text-align: center;
    margin-bottom: 1.8rem;
}

.login-logo-badge {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.1rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--primary-color, #4e73df) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--primary-color, #4e73df) 26%, transparent);
    box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--primary-color, #4e73df) 55%, transparent);
}

.logo-icon {
    color: var(--primary-color, #4e73df);
    font-size: 26px;
}

.login-header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #1e293b;
    margin-bottom: .3rem;
}

.login-header p {
    font-size: .88rem;
    color: #64748b;
}

/* ── Estado SSO ── */
.sso-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 1.2rem;
    border-radius: 10px;
    background: color-mix(in srgb, var(--primary-color, #4e73df) 8%, #fff);
    border: 1px solid color-mix(in srgb, var(--primary-color, #4e73df) 25%, transparent);
    font-size: .85rem;
    font-weight: 600;
    color: var(--primary-color, #4e73df);
}

.sso-spinner {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    border: 2px solid color-mix(in srgb, var(--primary-color, #4e73df) 30%, transparent);
    border-top-color: var(--primary-color, #4e73df);
    border-radius: 50%;
    animation: ssoSpin .7s linear infinite;
}

@keyframes ssoSpin { to { transform: rotate(360deg); } }

/* ── Formulario ── */
.field-label {
    display: block;
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #5b6b7f;
    margin-bottom: .4rem;
}

.input-group {
    margin-bottom: 1.15rem;
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: .85rem;
    transition: color .18s ease;
}

.input-group:focus-within .input-icon {
    color: var(--primary-color, #4e73df);
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1.5px solid #e4e9f2;
    border-radius: 10px;
    font-size: .95rem;
    font-family: inherit;
    color: #1e293b;
    background: #fbfcfe;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input::placeholder { color: #a5b1c2; }

input:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary-color, #4e73df);
    box-shadow: 0 0 0 3px var(--primary-shadow-color, rgba(78, 115, 223, 0.14));
}

.login-btn {
    width: 100%;
    margin-top: .3rem;
    padding: 13px;
    background: var(--primary-color, #4e73df);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--primary-color, #4e73df) 80%, transparent);
    transition: filter .18s ease, transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.login-btn:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow: 0 12px 26px -10px color-mix(in srgb, var(--primary-color, #4e73df) 90%, transparent);
}

.login-btn:active { transform: translateY(0); }

.login-btn:disabled {
    opacity: .65;
    cursor: wait;
    transform: none;
}

/* ── Mensaje de error ── */
.error-message {
    margin-top: 1rem;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(220, 38, 38, .07);
    border: 1px solid rgba(220, 38, 38, .25);
    color: #b91c1c;
    font-size: .85rem;
    font-weight: 500;
    line-height: 1.45;
}

/* Sacudida al fallar (la clase la añade login.js) */
.shake {
    animation: loginShake .4s ease;
}

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

/* ── Pie ── */
.login-footer {
    margin-top: 1.8rem;
    padding-top: 1.1rem;
    border-top: 1px solid #eef1f7;
    text-align: center;
    font-size: .84rem;
}

.login-footer a {
    color: var(--primary-color, #4e73df);
    font-weight: 600;
    text-decoration: none;
}

.login-footer a:hover { text-decoration: underline; }

.version {
    display: block;
    margin-top: .55rem;
    color: #a5b1c2;
    font-size: .76rem;
}

@media (max-width: 480px) {
    .login-box { padding: 1.9rem 1.4rem 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .login-box, .shake, .sso-spinner { animation: none !important; }
}
