/**
 * Ultragaz 24 Horas — Animações da tela de autenticação
 */

/* ══ Fundo animado (substitui imagens de couro) ══ */
.login-bg-waves {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background:
        linear-gradient(135deg, #060d18 0%, #0a1422 35%, #0d1a30 70%, #060d18 100%);
    background-size: 400% 400%;
    animation: login-bg-shift 18s ease infinite;
}

html[data-mode="light"] .login-bg-waves {
    background:
        linear-gradient(135deg, #dce4ef 0%, #e8ecf2 40%, #f0f4fa 70%, #dce4ef 100%);
    background-size: 400% 400%;
}

@keyframes login-bg-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.login-bg-waves::before,
.login-bg-waves::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
    animation: login-orb-drift 14s ease-in-out infinite;
}

.login-bg-waves::before {
    width: 55vw;
    height: 55vw;
    top: -15%;
    left: -10%;
    background: radial-gradient(circle, rgba(0, 15, 255, 0.35) 0%, transparent 70%);
}

.login-bg-waves::after {
    width: 45vw;
    height: 45vw;
    bottom: -20%;
    right: -8%;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.2) 0%, rgba(0, 255, 0, 0.08) 40%, transparent 70%);
    animation-delay: -7s;
}

@keyframes login-orb-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(3%, 2%) scale(1.05); }
    66% { transform: translate(-2%, -3%) scale(0.96); }
}

body.login-corporativo .particles-container {
    display: block !important;
    z-index: 1;
}

body.login-corporativo #ambientLights {
    display: none !important;
}

/* ══ Entrada do card ══ */
.login-frame {
    transform: translateY(24px);
    transition: opacity 0.2s var(--couro-ease, ease), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-frame.ready {
    animation: login-fade-up 0.65s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes login-fade-up {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-frame.ready .emblema-couro-plaque {
    animation: login-fade-up 0.55s 0.12s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.login-frame.ready .login-glass-card__inner {
    animation: login-fade-up 0.55s 0.22s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Logo no header */
.hdr-logo--animated {
    animation: login-logo-in 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.hdr-logo--animated img {
    animation: login-logo-glow 3s ease-in-out infinite;
}

@keyframes login-logo-in {
    from {
        opacity: 0;
        transform: scale(0.85) rotate(-8deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

@keyframes login-logo-glow {
    0%, 100% { filter: drop-shadow(0 0 0 transparent); }
    50% { filter: drop-shadow(0 0 6px rgba(0, 255, 255, 0.35)); }
}

/* ══ Campos com foco ══ */
.login-corporativo .form-group {
    transition: transform 0.2s ease;
}

.login-corporativo .form-group:focus-within {
    transform: translateY(-1px);
}

.login-corporativo .form-group:focus-within label {
    color: var(--ug-ciano) !important;
    transition: color 0.25s ease;
}

.login-corporativo .form-group .input-wrapper i {
    transition: color 0.25s ease, transform 0.25s ease;
}

.login-corporativo .form-group:focus-within .input-wrapper i {
    transform: translateY(-50%) scale(1.1);
}

.login-corporativo .form-group input {
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        background 0.25s ease !important;
}

/* Erro — shake */
.login-corporativo .input-error,
.login-corporativo input.invalid.input-error {
    animation: login-shake 0.35s ease;
    border-color: #e53935 !important;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.15) !important;
}

@keyframes login-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
}

/* ══ Botão login ══ */
.login-corporativo .btn-login {
    position: relative;
    overflow: hidden;
}

.login-corporativo .btn-login::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(0, 255, 255, 0.12) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.5s ease;
}

.login-corporativo .btn-login:hover::after {
    transform: translateX(120%);
}

.login-corporativo .btn-login.is-loading {
    pointer-events: none;
}

.login-corporativo .btn-login.is-success {
    background: linear-gradient(180deg, #00aa44 0%, #007733 100%) !important;
}

.login-corporativo .btn-login.is-pressed {
    transform: scale(0.98) !important;
}

/* Spinner chama/energia */
.ug-flame-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 255, 0.2);
    border-top-color: var(--ug-ciano, #00ffff);
    border-right-color: var(--ug-verde, #00ff00);
    animation: ug-flame-spin 0.7s linear infinite;
    vertical-align: middle;
}

@keyframes ug-flame-spin {
    to { transform: rotate(360deg); }
}

/* ══ Alertas animados ══ */
.login-corporativo .alert {
    animation: login-alert-in 0.35s ease both;
}

@keyframes login-alert-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ══ Cadeado de segurança ══ */
.login-security-badge {
    transition: border-color 0.4s ease, background 0.4s ease;
}

.login-security-badge .sec-icon {
    display: inline-block;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s ease;
}

.login-security-badge.is-unlocked .sec-icon {
    transform: rotate(-12deg) scale(1.15);
    color: var(--ug-verde, #00ff00) !important;
}

.login-security-badge.is-unlocked {
    border-color: rgba(0, 255, 0, 0.25);
    background: rgba(0, 255, 0, 0.06);
}

/* ══ Toggle senha ══ */
.login-corporativo .toggle-password i {
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.login-corporativo .toggle-password.is-visible i {
    transform: scale(1.15);
    color: var(--ug-ciano);
}

/* ══ Força da senha ══ */
.password-strength {
    margin-top: 8px;
    height: 4px;
    border-radius: 2px;
    background: var(--line);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.password-strength.is-visible {
    opacity: 1;
}

.password-strength__bar {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.35s ease, background 0.35s ease;
}

.password-strength--weak .password-strength__bar {
    width: 33%;
    background: #e53935;
}

.password-strength--medium .password-strength__bar {
    width: 66%;
    background: #ffb300;
}

.password-strength--strong .password-strength__bar {
    width: 100%;
    background: #00c853;
}

/* ══ Saída após login ══ */
body.login-exit-active .login-frame {
    animation: login-exit 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

body.login-exit-active #login-hdr {
    animation: login-exit 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes login-exit {
    to {
        opacity: 0;
        transform: translateY(-16px) scale(0.98);
    }
}

/* ══ Chips de links ══ */
.login-corporativo .form-link-chip {
    animation: login-fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.login-corporativo .form-links .form-link-chip:nth-child(1) { animation-delay: 0.35s; }
.login-corporativo .form-links .form-link-chip:nth-child(2) { animation-delay: 0.42s; }

/* ══ Acessibilidade ══ */
@media (prefers-reduced-motion: reduce) {
    .login-bg-waves,
    .login-bg-waves::before,
    .login-bg-waves::after,
    .hdr-logo--animated,
    .hdr-logo--animated img,
    .login-frame.ready,
    .login-frame.ready .emblema-couro-plaque,
    .login-frame.ready .login-glass-card__inner,
    .form-link-chip {
        animation: none !important;
    }

    .login-frame.ready {
        opacity: 1;
        transform: none;
    }

    .login-corporativo .input-error {
        animation: none;
    }

    .login-corporativo .btn-login::after {
        display: none;
    }
}