/* ============================================================
   login.css — TELA DE LOGIN / AUTENTICAÇÃO
   Local: /assets/css/login.css

   Depende de: variaveis.css (carregado antes)
   NÃO depende de: layout.css nem componentes.css

   Uso no login.php:
       <link rel="stylesheet" href="../assets/css/variaveis.css">
       <link rel="stylesheet" href="../assets/css/login.css">
   ============================================================ */

/* ----------------------------------------------------------
   RESET MÍNIMO
   ---------------------------------------------------------- */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    min-height: 100%;
    font-family: var(--fonte-sans);
    font-size: var(--text-base);
    color: var(--texto-corpo);
    overflow-x: hidden;
    overflow-y: auto;
}

/* ----------------------------------------------------------
   ESTRUTURA — imagem full-bleed + card central
   ---------------------------------------------------------- */

.login-fundo {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-color: var(--fundo-app);
    background-image:
        /* overlay — desativado; descomentar se precisar de legibilidade sobre a foto
        linear-gradient(
            160deg,
            rgba(26, 23, 23, 0.35) 0%,
            rgba(26, 23, 23, 0.25) 55%,
            rgba(26, 23, 23, 0.4) 100%
        ),
        */
        url('../img/sistema/fundo-login.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--esp-6);
}

.login-form-lado {
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 440px;
}

/* Card central do formulário */
.login-caixa {
    width: 100%;
    max-width: 420px;
    padding: var(--esp-8);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-xl);
    box-shadow: var(--sombra-xl);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: var(--esp-6);
}

.login-logo img {
    height: 44px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.login-alerta-sucesso {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--cor-sucesso-light);
    border: 1px solid rgba(var(--cor-sucesso-rgb), 0.25);
    color: #14532d;
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: var(--esp-4);
}

.login-alerta-aviso {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--cor-alerta-light);
    border: 1px solid rgba(var(--cor-alerta-rgb), 0.25);
    color: #78350f;
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: var(--esp-4);
}

.login-alerta-erro {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--cor-erro-light);
    border: 1px solid rgba(var(--cor-erro-rgb), 0.25);
    color: #7f1d1d;
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: var(--esp-4);
}

/* Legado split — oculto */
.login-visual { display: none; }

/* Cabeçalho do formulário */
.login-header {
    margin-bottom: var(--esp-8);
}

.login-titulo {
    font-size: var(--text-2xl);
    font-weight: var(--peso-bold);
    color: var(--texto-titulo);
    letter-spacing: -.4px;
    line-height: 1.2;
    margin-bottom: var(--esp-2);
}

.login-subtitulo {
    font-size: var(--text-sm);
    color: var(--texto-suave);
    line-height: 1.5;
}

/* ----------------------------------------------------------
   FORMULÁRIO
   ---------------------------------------------------------- */

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--esp-4);
}

.login-grupo {
    display: flex;
    flex-direction: column;
    gap: var(--esp-1);
}

.login-label {
    font-size: var(--text-sm);
    font-weight: var(--peso-semi);
    color: var(--texto-titulo);
}

/* Input */
.login-input {
    width: 100%;
    height: 44px;
    padding: 0 var(--esp-4);
    border: 1.5px solid var(--borda-input);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: inherit;
    color: var(--texto-titulo);
    background: var(--cinza-50);
    outline: none;
    transition: border-color var(--transicao), box-shadow var(--transicao), background var(--transicao);
}

.login-input::placeholder {
    color: var(--texto-suave);
}

.login-input:focus {
    border-color: var(--cor-primaria);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(var(--cor-primaria-rgb), .12);
}

.login-input.erro {
    border-color: var(--cor-erro);
    box-shadow: 0 0 0 3px rgba(var(--cor-erro-rgb), .1);
}

/* Input com ícone */
.login-input-wrap {
    position: relative;
}

.login-input-wrap .login-input {
    padding-left: 42px;
}

.login-input-icone {
    position: absolute;
    left: var(--esp-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--texto-suave);
    font-size: 18px;
    pointer-events: none;
    transition: color var(--transicao);
}

.login-input-wrap:focus-within .login-input-icone {
    color: var(--cor-primaria);
}

/* Botão mostrar/ocultar senha */
.login-olho {
    position: absolute;
    right: var(--esp-3);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--texto-suave);
    font-size: 18px;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transicao);
    display: flex;
    align-items: center;
}
.login-olho:hover { color: var(--texto-titulo); }
.login-input-wrap .login-input.com-olho { padding-right: 42px; }

/* Linha "Esqueceu a senha?" */
.login-linha-extra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--esp-3);
    flex-wrap: wrap;
}

.login-check {
    display: flex;
    align-items: center;
    gap: var(--esp-2);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--texto-corpo);
    user-select: none;
}
.login-check input[type="checkbox"] {
    width: 15px; height: 15px;
    accent-color: var(--cor-primaria);
    cursor: pointer;
}

.login-esqueceu {
    font-size: var(--text-sm);
    color: var(--cor-primaria);
    font-weight: var(--peso-medio);
    text-decoration: none;
    transition: opacity var(--transicao);
}
.login-esqueceu:hover { opacity: .75; text-decoration: none; }

/* Mensagem de erro geral */
.login-erro {
    display: flex;
    align-items: center;
    gap: var(--esp-2);
    padding: var(--esp-3) var(--esp-4);
    border-radius: var(--radius-md);
    background: var(--cor-erro-light);
    border: 1px solid rgba(var(--cor-erro-rgb), .2);
    font-size: var(--text-sm);
    color: var(--cor-erro);
    display: none; /* mostrar via JS quando houver erro */
}
.login-erro.visivel { display: flex; }

/* Botão de entrar */
.login-btn {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--cor-primaria), var(--cor-primaria-hover));
    color: #ffffff;
    font-size: var(--text-md);
    font-weight: var(--peso-semi);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transicao);
    box-shadow: var(--sombra-primaria);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--esp-2);
    margin-top: var(--esp-2);
}

.login-btn:hover {
    background: linear-gradient(135deg, var(--cor-primaria-hover), var(--cor-primaria-hover));
    box-shadow: 0 6px 24px rgba(var(--cor-primaria-rgb), .4);
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
    box-shadow: var(--sombra-primaria);
}

.login-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

/* Estado carregando */
.login-btn.carregando {
    pointer-events: none;
    opacity: .85;
}
.login-btn.carregando::after {
    content: '';
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

/* ----------------------------------------------------------
   RODAPÉ DO FORMULÁRIO
   ---------------------------------------------------------- */

.login-form-footer {
    margin-top: var(--esp-8);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--texto-suave);
}

.login-form-footer a {
    color: var(--cor-primaria);
    font-weight: var(--peso-medio);
    text-decoration: none;
}
.login-form-footer a:hover { text-decoration: underline; }

/* Copyright */
.login-copy {
    margin-top: var(--esp-6);
    text-align: center;
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.85);
    width: 100%;
}

/* ----------------------------------------------------------
   RESPONSIVIDADE
   ---------------------------------------------------------- */

@media (max-width: 480px) {
    .login-wrap { padding: var(--esp-4); }
    .login-caixa {
        padding: var(--esp-6) var(--esp-5);
        max-width: 100%;
    }
    .login-titulo { font-size: var(--text-xl); }
}

/* ----------------------------------------------------------
   ANIMAÇÃO DE ENTRADA
   ---------------------------------------------------------- */

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

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

.login-caixa {
    animation: fadeUp .35s ease;
}
/* ----------------------------------------------------------
   MODAL DE RECUPERAÇÃO DE SENHA
   ---------------------------------------------------------- */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.aberto { display: flex; }

.modal {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,.18);
    animation: modalEntrar .2s ease;
}

@keyframes modalEntrar {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.modal-titulo {
    font-size: var(--text-lg);
    font-weight: var(--peso-bold);
    color: var(--texto-titulo);
    margin: 0;
}

.modal-subtitulo {
    font-size: var(--text-sm);
    color: var(--texto-suave);
    margin: 6px 0 0;
    line-height: 1.5;
}

.modal-fechar {
    background: none;
    border: none;
    color: var(--texto-suave);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transicao), color var(--transicao);
}
.modal-fechar:hover {
    background: var(--cinza-100);
    color: var(--texto-titulo);
}

.modal-sucesso {
    display: none;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--cor-sucesso-light);
    border: 1px solid rgba(var(--cor-sucesso-rgb), .25);
    color: #14532d;
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: 16px;
}
.modal-sucesso.visivel { display: block; }

.visivel { display: block !important; }

/* ----------------------------------------------------------
   FORÇA DA SENHA — redefinir_senha.php
   ---------------------------------------------------------- */

.forca-wrap {
    margin-top: 6px;
}

.forca-barra {
    height: 4px;
    border-radius: 999px;
    background: var(--cinza-200, #e2e8f0);
    overflow: hidden;
    margin-bottom: 4px;
}

.forca-fill {
    height: 100%;
    border-radius: 999px;
    width: 0%;
    transition: width .3s, background .3s;
}

.forca-label {
    font-size: 11px;
    color: var(--texto-suave);
}
/* ----------------------------------------------------------
   QUADRADINHOS DO CÓDIGO 2FA
   ---------------------------------------------------------- */

.cod-input {
    width: 48px;
    height: 56px;
    border: 2px solid var(--borda-input);
    border-radius: var(--radius-md);
    font-size: var(--text-2xl);
    font-weight: var(--peso-bold);
    text-align: center;
    color: var(--texto-titulo);
    background: var(--cinza-50);
    outline: none;
    transition: border-color var(--transicao), box-shadow var(--transicao), background var(--transicao);
    caret-color: transparent;
}

.cod-input:focus {
    border-color: var(--cor-primaria);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(var(--cor-primaria-rgb), .12);
}

.cod-input:not(:placeholder-shown) {
    border-color: var(--cor-primaria);
    background: #ffffff;
}

@media (max-width: 480px) {
    .cod-input {
        width: 40px;
        height: 48px;
        font-size: var(--text-xl);
    }
}

.icon-lg {
    width: 16px;
    height: 16px;
}
.oculto {
    display: none !important;
}

.login-hint {
    font-size: 12px;
    color: var(--texto-suave);
    margin-top: 6px;
}

.login-2fa-erro { margin-bottom: 12px; }
.login-2fa-grupo { margin-bottom: 16px; }

.login-link-row {
    text-align: center;
    margin-top: 16px;
    font-size: var(--text-sm);
    color: var(--texto-suave);
}

.login-link-row-sm {
    text-align: center;
    margin-top: 12px;
}

.login-btn-link {
    background: none;
    border: none;
    color: var(--cor-primaria);
    font-weight: var(--peso-semi);
    cursor: pointer;
    font-size: inherit;
}

.login-btn-link-muted {
    background: none;
    border: none;
    color: var(--texto-suave);
    font-size: var(--text-sm);
    cursor: pointer;
}

.login-sucesso-icone {
    width: 15px;
    height: 15px;
    vertical-align: middle;
}

.login-sucesso-dica { opacity: .75; }

.login-sucesso-box {
    display: none;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--cor-sucesso-light);
    border: 1px solid rgba(var(--cor-sucesso-rgb), .25);
    color: #14532d;
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: 16px;
}
.login-sucesso-box.visivel { display: block; }

.cod-grid {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.forca-fill.forca-nivel-0 { width: 0%;   background: #ef4444; }
.forca-fill.forca-nivel-1 { width: 16%;  background: #ef4444; }
.forca-fill.forca-nivel-2 { width: 33%;  background: #f97316; }
.forca-fill.forca-nivel-3 { width: 50%;  background: #f59e0b; }
.forca-fill.forca-nivel-4 { width: 66%;  background: #84cc16; }
.forca-fill.forca-nivel-5 { width: 100%; background: #16a34a; }

.forca-label.forca-nivel-0 { color: #ef4444; }
.forca-label.forca-nivel-1 { color: #ef4444; }
.forca-label.forca-nivel-2 { color: #f97316; }
.forca-label.forca-nivel-3 { color: #f59e0b; }
.forca-label.forca-nivel-4 { color: #84cc16; }
.forca-label.forca-nivel-5 { color: #16a34a; }
