/* ============================================================
   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

   CONVENÇÃO CSS
   ─────────────
   • Estilos das telas de auth (fora do shell SPA).
   • endpoint: login/login.php, login/redefinir_senha.php

   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;
}

.oculto { display: none !important; }

/* ----------------------------------------------------------
   ESTRUTURA PRINCIPAL — imagem esquerda, formulário direita
   ---------------------------------------------------------- */

/*
   Layout (tema Lantin):
   fundo-login.webp em tela cheia + card central transparente
*/

.login-fundo {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-color: var(--fundo-app);
    background-image: 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);
    overflow-y: auto;
}

body {
    text-shadow: var(--text-shadow-ui);
}

/* Card central */
.login-caixa {
    width: 100%;
    max-width: 420px;
    padding: var(--esp-8) var(--esp-8);
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow);
    animation: fadeUp .35s ease;
}

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

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

/* Lado visual legado — oculto (fundo agora é tela cheia) */
.login-visual { display: none; }

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

.login-copy {
    margin-top: var(--esp-6);
    text-align: center;
    font-size: var(--text-xs);
    color: var(--texto-suave);
    width: 100%;
}

/* 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: 1px solid var(--borda-forte);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: inherit;
    color: var(--texto-titulo);
    background: rgba(255, 255, 255, 0.06);
    outline: none;
    text-shadow: none;
    transition: border-color var(--transicao), box-shadow var(--transicao), background var(--transicao);
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

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

.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(--texto-suave);
    font-weight: var(--peso-medio);
    text-decoration: none;
    transition: color var(--transicao);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.login-esqueceu:hover { color: var(--texto-titulo); text-decoration: none; }

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

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

.login-btn:hover {
    background: var(--cor-primaria-hover);
    transform: none;
    box-shadow: none;
}

.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-hint {
    font-size: 12px;
    color: var(--texto-suave);
    margin-top: 6px;
    line-height: 1.45;
}

.login-linha-extra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--esp-3);
    flex-wrap: wrap;
}

.login-alerta-sucesso {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(var(--cor-sucesso-rgb), 0.15);
    border: 1px solid rgba(var(--cor-sucesso-rgb), 0.35);
    color: #bbf7d0;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    text-shadow: none;
}

.login-alerta-aviso {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--borda-forte);
    color: var(--texto-titulo);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    text-shadow: none;
}

.login-header-2fa {
    margin-bottom: 16px;
}

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

.login-link-btn:hover { color: var(--texto-titulo); }

.login-link-btn-primario {
    color: var(--texto-titulo);
}

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

.login-voltar {
    text-align: center;
    margin-top: 12px;
}

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

.login-voltar-btn:hover { color: var(--texto-titulo); }

.login-alerta-erro {
    background: rgba(var(--cor-erro-rgb), 0.15);
    border: 1px solid rgba(var(--cor-erro-rgb), 0.35);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 13px;
    color: #fecaca;
    margin-bottom: 20px;
    line-height: 1.5;
    text-shadow: none;
}

.login-titulo-erro { color: #fecaca; }

.login-icone-inline {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

.login-sucesso-box {
    display: none;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(var(--cor-sucesso-rgb), 0.15);
    border: 1px solid rgba(var(--cor-sucesso-rgb), 0.35);
    color: #bbf7d0;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    text-shadow: none;
}

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

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

.login-btn-link {
    text-decoration: none;
    display: flex;
    justify-content: center;
}

/* 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); }
}

@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: rgba(255, 255, 255, 0.08);
    color: var(--texto-titulo);
}

.modal-sucesso {
    display: none;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(var(--cor-sucesso-rgb), 0.15);
    border: 1px solid rgba(var(--cor-sucesso-rgb), 0.35);
    color: #bbf7d0;
    text-shadow: none;
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: 16px;
}

/* Modal — reutiliza tokens do portal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.aberto { display: flex; }

.modal {
    background: var(--fundo-card-solid);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--glass-shadow);
    color: var(--texto-corpo);
    text-shadow: none;
    animation: modalEntrar .2s ease;
}

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

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

.forca-barra {
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    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: 1px solid var(--borda-forte);
    border-radius: var(--radius-md);
    font-size: var(--text-2xl);
    font-weight: var(--peso-bold);
    text-align: center;
    color: var(--texto-titulo);
    background: rgba(255, 255, 255, 0.06);
    outline: none;
    text-shadow: none;
    transition: border-color var(--transicao), box-shadow var(--transicao);
    caret-color: transparent;
}

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

.cod-input:not(:placeholder-shown) {
    border-color: var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}

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