/* ==========================================================================
   0. BIBLIOTECA DE ANIMAÇÕES (Sinta-se à vontade para trocar na classe)
   ========================================================================== */

/* Entrada Suave (Atual padrão no login-page) */
@keyframes fadeInPage {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 1. Slide para cima com Fade (Elegante e moderno) */
@keyframes slideUpFade {
  0% { opacity: 0; transform: translateY(40px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 2. Zoom Suave com Fade (Efeito de aproximação) */
@keyframes zoomInFade {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

/* 3. Cinema: Blur + Slide + Scale (O mais "Premium") */
@keyframes cinemaEntry {
  0% { 
      opacity: 0; 
      filter: blur(10px); 
      transform: translateY(20px) scale(1.02); 
  }
  100% { 
      opacity: 1; 
      filter: blur(0); 
      transform: translateY(0) scale(1); 
  }
}

/* 4. Entrada Lateral (Vindo da Direita) */
@keyframes slideRightFade {
  0% { opacity: 0; transform: translateX(50px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* Animações internas dos inputs e elementos */
@keyframes eyeAppear {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes bounceIn {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ==========================================================================
 1. ESTRUTURA GLOBAL E FUNDO
 ========================================================================== */
html, body {
  height: 100%;
}

body.login-page {
  background: linear-gradient(rgba(0, 31, 43, 0.8), rgba(0, 31, 43, 0.8)), 
              url('../img/auth/bg-login.jpg') !important;
  background-size: cover !important;
  background-position: center !important;
  background-attachment: fixed !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 100vh !important;
  margin: 0 !important;
  
  /* Animação do fundo da página */
  animation: fadeInPage 1.2s ease-in-out forwards;
}

.login-box {
  margin: 0 !important;
  width: auto !important;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-container {
  display: flex;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  min-width: 850px;
  max-width: 1000px;
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);

  /* TROQUE AQUI: Altere 'cinemaEntry' por 'slideUpFade', 'zoomInFade' 
     ou 'slideRightFade' para testar os efeitos. 
  */
  animation: cinemaEntry 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Ajuste para quando a tela de confirmação usa o layout de auth */
body.login-page .lockscreen-name {
  text-align: center;
  color: #001F2B !important;
}

body.login-page .lockscreen-image {
  position: relative; /* Remove o posicionamento absoluto nativo do AdminLTE */
  margin-bottom: -10px;
}

/* ==========================================================================
 2. PAINEL DA MARCA (LADO ESQUERDO)
 ========================================================================== */
.login-brand {
  background: #001F2B;
  color: white;
  width: 40%;
  text-align: center;
  position: relative;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 40px !important;
  min-height: 100%;
}

.login-brand img { 
  max-width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  margin-bottom: 25px;
  filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
}

.brand-text { 
  position: absolute;
  bottom: 40px;
  border-top: 1px solid rgba(255,255,255,0.1);
  width: 70% !important;
  padding-top: 20px;
  font-size: 0.85rem !important;
  opacity: 0.7;
}

/* ==========================================================================
 3. CONTEÚDO E FORMULÁRIO (LADO DIREITO)
 ========================================================================== */
.login-content {
  padding: 60px;
  width: 60%;
  background: #ffffff;
}

.auth-title { font-weight: 800; color: #004a66; margin-bottom: 10px; font-size: 1.5rem; }
.auth-subtitle { color: #6c757d; margin-bottom: 35px; font-size: 0.9rem; }

/* Inputs e Grupos */
.input-group { margin-bottom: 25px !important; }

.toggle-password {
  transition: all 0.2s ease-in-out;
  background-color: transparent !important;
  border-left: none !important;
}

.toggle-password:hover {
  color: #004a66 !important;
}

.toggle-password .fa-eye {
  color: #004a66;
  animation: eyeAppear 0.3s ease;
}

.requirement-item {
  transition: transform 0.2s ease, color 0.2s ease;
  display: block;
}

.requirement-item span.text-success i {
  color: #28a745;
  text-shadow: 0 0 5px rgba(40,167,69,0.2);
}
/* Efeito de transição suave ao validar */
.requirement-item { transition: all 0.3s ease; }

/* Garante que o ícone do spinner gire suavemente */
.fa-spin {
  animation: fa-spin 1s infinite linear;
}

@keyframes fa-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Evita que o botão mude de tamanho bruscamente ao carregar */
.j_btn_submit {
  transition: all 0.3s ease;
  min-width: 160px; /* Opcional: define um tamanho mínimo padrão */
}

.form-control {
  border: 1px solid #e1e5eb !important;
  border-right: none !important;
  height: 50px !important;
  border-radius: 10px 0 0 10px !important;
  padding-left: 20px !important;
}

.form-control:focus {
  border-color: #004a66 !important;
  box-shadow: 0 0 15px rgba(0, 74, 102, 0.2) !important;
  background-color: #fff !important;
  transform: translateX(5px);
  transition: all 0.3s ease !important;
}

.input-group-text {
  background-color: #f8f9fa !important;
  border: 1px solid #e1e5eb !important;
  border-left: none !important;
  border-radius: 0 10px 10px 0 !important;
  color: #004a66 !important;
  width: 45px;
  justify-content: center;
}

.input-group:focus-within .input-group-text {
  border-color: #004a66 !important;
  color: #004a66 !important;
}

.requirement-item.text-success {
  animation: bounceIn 0.4s ease;
  font-weight: 600;
}

input[readonly] {
  background-color: #f8f9fa !important;
  border: 1px solid #e1e5eb !important;
  border-right: none !important;
  color: #6c757d !important;
  cursor: not-allowed;
  opacity: 0.8;
}

/* Botões e Links */
.btn-primary {
  background: linear-gradient(45deg, #004a66, #005f82) !important;
  border: none !important;
  height: 50px;
  border-radius: 10px !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 15px rgba(0, 74, 102, 0.3);
  transition: transform 0.2s, box-shadow 0.2s !important;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  background: #001F2B !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 74, 102, 0.4);
}

.btn-primary:active { transform: scale(0.98); }

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 3s infinite;
}

.login-content a {
  color: #004a66;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s;
}

::placeholder { color: #adb5bd !important; opacity: 1; }

.text-muted.small {
  color: #6c757d !important;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}

.text-muted.small:hover {
  color: #004a66 !important;
  text-decoration: underline !important;
}

.mt-4 { margin-top: 1.5rem !important; }

/* Alertas */
.alert-success {
  background-color: rgba(0, 74, 102, 0.1) !important;
  border: 1px solid rgba(40, 167, 69, 0.3) !important;
  color: #28a745 !important;
  border-radius: 12px !important;
  font-weight: 500;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.alert-success::before {
  content: '\f058';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  margin-right: 10px;
}

/* ==========================================================================
 4. COMPONENTES ESPECÍFICOS (RESET PASSWORD / FORÇA DA SENHA)
 ========================================================================== */
.progress {
  height: 8px !important;
  border-radius: 5px !important;
  background-color: #eee !important;
  margin-bottom: 15px;
}

#password-strength {
  transition: width 0.5s ease, background-color 0.5s ease !important;
}

#result { font-weight: bold; text-transform: uppercase; font-size: 0.75rem; }

.requirement-item { transition: all 0.3s ease; padding: 3px 0; }

.alert-info {
  background-color: #e7f3ff !important;
  border: none !important;
  color: #004a66 !important;
  border-radius: 10px !important;
  font-size: 0.85rem;
}

.list-unstyled li { font-size: 0.85rem; margin-bottom: 5px; color: #666; }

.bg-danger  { background-color: #dc3545 !important; }
.bg-warning { background-color: #ffc107 !important; }
.bg-success { background-color: #28a745 !important; }

/* ==========================================================================
 5. RESPONSIVIDADE
 ========================================================================== */
@media (max-width: 900px) {
  .login-container { 
      flex-direction: column; 
      min-width: 90%; 
      margin: 20px;

      /* --- CONFIGURAÇÃO DE ANIMAÇÃO --- */
      animation: cinemaEntry 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;

      /* OPÇÕES DE ANIMAÇÃO DISPONÍVEIS:
        1. cinemaEntry   -> (Recomendado) Efeito "Apple": Blur suave + Slide + Escala.
        2. slideUpFade   -> Tradicional e limpo: O box sobe suavemente enquanto aparece.
        3. zoomInFade    -> Moderno: O formulário surge do fundo vindo em direção ao usuário.
        4. slideRightFade -> Dinâmico: O box desliza da direita para o centro.
        5. fadeInPage    -> Minimalista: Apenas surge sem movimento.

        DICA DE CURVAS DE VELOCIDADE (Timing Functions):
        - cubic-bezier(0.16, 1, 0.3, 1) -> Início rápido e final "amanteigado" (Premium).
        - ease-out                      -> Desaceleração simples.
        - cubic-bezier(0.68, -0.55, 0.27, 1.55) -> Efeito "Back" (vai um pouco além e volta).
      */
  }
  .login-brand, .login-content { width: 100%; padding: 40px; }
  .login-brand img { max-height: 120px; }
  .login-brand .brand-text { position: relative; bottom: 0; width: 100% !important; margin-top: 20px; }
  body.login-page { height: auto; min-height: 100vh; }
}