/* ============================================
   LOGIN PREMIUM - ESTILO FINTECH
   Padrão Banco do Brasil / Nubank / Inter / XP
   ============================================ */

/* Reset e base */
* {
  box-sizing: border-box;
}

/* Background com imagem full screen - cobrindo toda a tela */
.login-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: url('../img/bg-login.jpg') no-repeat center center;
  background-size: cover;
  background-color: #0B1220;
  overflow: hidden;
  z-index: 0;
  /* Blur muito sutil na imagem de fundo */
  filter: blur(0.5px);
  -webkit-filter: blur(0.5px);
  transform: scale(1.01); /* Evita bordas brancas do blur */
}

/* Em mobile, garantir cobertura total */
@media (max-width: 768px) {
  .login-bg {
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
    filter: blur(0.5px);
    -webkit-filter: blur(0.5px);
    transform: scale(1.01);
    background-color: #0B1220;
  }
  
  .overlay {
    backdrop-filter: blur(0.5px);
    -webkit-backdrop-filter: blur(0.5px);
    opacity: 1;
  }
}

/* Em telas maiores, garantir cobertura total */
@media (min-width: 769px) and (min-height: 600px) {
  .login-bg {
    background-size: cover;
    background-position: center center;
    background-color: #0B1220;
    filter: blur(0.5px);
    -webkit-filter: blur(0.5px);
    transform: scale(1.01);
  }
  
  .overlay {
    backdrop-filter: blur(0.5px);
    -webkit-backdrop-filter: blur(0.5px);
    opacity: 1;
  }
}

/* Overlay escuro profissional estilo app bancário - alto contraste */
.overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(11, 18, 32, 0.75) 0%,
    rgba(15, 23, 42, 0.70) 30%,
    rgba(31, 71, 136, 0.65) 60%,
    rgba(11, 18, 32, 0.80) 100%
  );
  /* Gradiente radial adicional para foco no centro */
  background-image: 
    radial-gradient(
      ellipse at center top,
      rgba(37, 99, 235, 0.12) 0%,
      transparent 50%
    ),
    linear-gradient(
      180deg,
      rgba(11, 18, 32, 0.75) 0%,
      rgba(15, 23, 42, 0.70) 30%,
      rgba(31, 71, 136, 0.65) 60%,
      rgba(11, 18, 32, 0.80) 100%
    );
  backdrop-filter: blur(0.5px);
  -webkit-backdrop-filter: blur(0.5px);
  z-index: 1;
  opacity: 1;
  pointer-events: none;
}

/* Vinheta nas bordas (foco no centro) - estilo profissional bancário */
.overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center 40%,
    transparent 0%,
    rgba(0, 0, 0, 0.2) 40%,
    rgba(0, 0, 0, 0.4) 70%,
    rgba(0, 0, 0, 0.6) 100%
  );
  pointer-events: none;
  opacity: 1;
}

/* Fallback para navegadores sem suporte a backdrop-filter */
@supports not (backdrop-filter: blur(1px)) {
  .overlay {
    backdrop-filter: none;
    background: linear-gradient(
      180deg,
      rgba(11, 18, 32, 0.90) 0%,
      rgba(15, 23, 42, 0.85) 30%,
      rgba(31, 71, 136, 0.80) 60%,
      rgba(11, 18, 32, 0.95) 100%
    );
  }
}

/* Partículas animadas CSS-only - mais discretas */
.particles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: float 60s linear infinite;
  opacity: 0.6;
}

@keyframes float {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 1000px 1000px;
  }
}

/* Container posicionado na parte inferior - estilo app bancário */
.login-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  padding-bottom: 0;
  pointer-events: none;
}

/* Card transparente - apenas campos sobre a imagem */
.login-card {
  background: transparent;
  width: 100%;
  max-width: 100%;
  padding: 32px 24px 40px;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  line-height: 1.2;
  margin-bottom: 0;
  min-height: auto;
  z-index: 11;
  pointer-events: auto;
  border: none;
}

/* Em desktop, limitar largura do card */
@media (min-width: 769px) {
  .login-card {
    width: 100%;
    max-width: 500px;
    border-radius: 0;
    margin-bottom: 40px;
    box-shadow: none;
  }
}

/* Header do card - estilo app bancário */
.login-header {
  text-align: left;
  margin-bottom: 28px;
  padding-top: 8px;
}

/* Logo FatorFinanceiro.app */
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.login-logo-image {
  height: 60px;
  width: auto;
  max-width: 350px;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 24px rgba(0, 0, 0, 0.3));
  -webkit-filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 24px rgba(0, 0, 0, 0.3));
}

.login-logo-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.login-logo-badge {
  background: var(--rfb-blue, #1f4788);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  text-shadow: none;
}

.login-logo-text {
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6), 0 0 24px rgba(0, 0, 0, 0.4);
  letter-spacing: -0.5px;
}

.login-icon {
  display: none;
}

.login-header h2 {
  display: none;
}

.login-subtitle {
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.3;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Grupos de formulário - estilo app bancário */
.form-group {
  margin-bottom: 20px;
}

/* Container para input com botão */
.input-with-button {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-button input {
  flex: 1;
}

/* Botão de avançar */
.btn-next {
  background: #f5c400;
  color: #1f2937;
  border: none;
  padding: 16px 20px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(245, 196, 0, 0.3);
  font-family: 'Inter', system-ui, -apple-system, Arial, sans-serif;
}

.btn-next:hover {
  background: #e6b300;
  box-shadow: 0 6px 16px rgba(245, 196, 0, 0.4);
  transform: translateY(-1px);
}

.btn-next:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(245, 196, 0, 0.3);
}

.btn-next:focus {
  outline: 3px solid rgba(245, 196, 0, 0.5);
  outline-offset: 2px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 0.95rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Inputs - estilo fintech premium com fundo sólido translúcido */
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"] {
  width: 100%;
  padding: 16px 18px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  font-size: 16px;
  font-family: 'Inter', system-ui, -apple-system, Arial, sans-serif;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  box-sizing: border-box;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.form-group input[type="email"]::placeholder,
.form-group input[type="password"]::placeholder,
.form-group input[type="number"]::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="number"]:focus {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.22);
  outline: none;
  box-shadow: 
    0 0 0 4px rgba(255, 255, 255, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.form-group input[type="email"]::placeholder,
.form-group input[type="password"]::placeholder,
.form-group input[type="number"]::placeholder {
  color: #9ca3af;
}

.form-hint {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 8px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Ícone de check no hint do CAPTCHA */
.captcha-group .form-hint::before {
  content: "✓";
  color: rgba(245, 196, 0, 0.9);
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* CAPTCHA Box - estilo fintech premium */
.captcha-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.1);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.captcha-box:focus-within {
  border-color: rgba(245, 196, 0, 0.5);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 0 0 3px rgba(245, 196, 0, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

/* Telas de login - transição suave */
.email-screen,
.password-screen {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.email-screen {
  display: block;
}

.password-screen {
  display: none;
}

.password-screen.show {
  display: block;
  animation: slideIn 0.3s ease;
}

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

/* Campo CAPTCHA - visível quando dentro da tela 2 */
.captcha-group {
  opacity: 1;
  max-height: 200px;
  margin-bottom: 14px;
  margin-top: 8px;
  transition: opacity 0.3s ease, max-height 0.4s ease, margin-bottom 0.3s ease;
  pointer-events: auto;
}

/* Se estiver escondido (para compatibilidade) */
.captcha-group.hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin-bottom: 0;
  pointer-events: none;
}

/* Label do CAPTCHA com estilo fintech */
.captcha-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #ffffff;
  font-size: 0.95rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Ícone de escudo antes do label */
.captcha-group label::before {
  content: "🛡️";
  font-size: 1.1rem;
  display: inline-block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.captcha-question {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.3;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.3px;
}

.captcha-input {
  flex: 1;
  max-width: 90px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.1);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.captcha-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

.captcha-input:focus {
  border-color: rgba(245, 196, 0, 0.7);
  background: rgba(255, 255, 255, 0.22);
  outline: none;
  box-shadow: 
    0 0 0 3px rgba(245, 196, 0, 0.2),
    0 4px 10px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Botão principal amarelo (estilo app bancário) */
.btn-primary {
  background: #f5c400;
  color: #1f2937;
  border: none;
  padding: 18px 24px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-top: 24px;
  box-shadow: 0 4px 12px rgba(245, 196, 0, 0.3);
  font-family: 'Inter', system-ui, -apple-system, Arial, sans-serif;
  line-height: 1.4;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.3px;
}

.btn-primary:hover {
  background: #e6b300;
  box-shadow: 0 6px 16px rgba(245, 196, 0, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(245, 196, 0, 0.3);
}

.btn-primary:focus {
  outline: 3px solid rgba(245, 196, 0, 0.5);
  outline-offset: 2px;
}

.btn-block {
  width: 100%;
}

/* Footer do login - estilo app bancário */
.login-footer {
  margin-top: 24px;
  text-align: center;
}

.login-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
  margin: 10px 0;
}

.link {
  color: #f5c400;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.link:hover {
  color: #e6b300;
  text-decoration: underline;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.link:focus {
  outline: 2px solid rgba(31, 71, 136, 0.5);
  outline-offset: 2px;
  border-radius: 2px;
}

.link-strong {
  color: #f5c400;
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.link-strong:hover {
  color: #e6b300;
  text-decoration: underline;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.link-strong:focus {
  outline: 2px solid rgba(31, 71, 136, 0.5);
  outline-offset: 2px;
  border-radius: 2px;
}

.login-footer p {
  color: #ffffff;
  margin: 0;
  font-size: 0.95rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Mensagens de erro/flash */
.flash-message {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.2;
}

.flash-message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.flash-message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

/* Responsividade Mobile First */
@media (max-width: 768px) {
  .login-container {
    justify-content: center;
    align-items: flex-end;
    padding: 0;
    padding-bottom: 0;
  }
  
  .login-card {
    width: 100%;
    max-width: 100%;
    padding: 28px 20px 32px;
    border-radius: 0;
    margin-bottom: 0;
  }
  
  .login-subtitle {
    font-size: 1.4rem;
  }
  
  /* Garantir que o formulário seja acessível no mobile */
  .form-group input[type="email"],
  .form-group input[type="password"],
  .form-group input[type="number"] {
    font-size: 16px !important; /* Evita zoom automático no iOS */
    padding: 16px 18px !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }
  
  .btn-primary {
    min-height: 56px; /* Tamanho mínimo para touch */
    padding: 18px 24px !important;
    touch-action: manipulation;
    font-size: 16px;
  }

  .login-header h2 {
    font-size: 1.3rem;
  }

  .login-icon {
    font-size: 1.8rem;
    margin-bottom: 10px;
  }

  .form-group input[type="email"],
  .form-group input[type="password"],
  .form-group input[type="number"] {
    padding: 12px;
    font-size: 16px; /* Evita zoom no iOS */
    width: 100%;
  }

  .btn-primary {
    padding: 12px 20px;
    font-size: 14px;
  }

  .captcha-box {
    padding: 10px;
  }

  .captcha-question {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .login-card {
    width: 92vw;
    padding: 18px;
    border-radius: 12px;
  }

  .login-header h2 {
    font-size: 1.2rem;
  }

  .login-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }
}

/* Acessibilidade - Alto contraste */
@media (prefers-contrast: high) {
  .login-card {
    border: 2px solid #1f4788;
  }

  .btn-primary {
    border: 2px solid #1f2937;
  }

  .form-group input:focus {
    border-width: 2px;
  }
}

/* Redução de movimento para usuários sensíveis */
@media (prefers-reduced-motion: reduce) {
  .particles {
    animation: none;
  }

  .btn-primary,
  .form-group input,
  .link {
    transition: none;
  }
}

/* Garantir que o body não tenha scroll quando login-bg está ativo */
body.login-page {
  overflow: hidden;
  height: 100vh;
  margin: 0;
  padding: 0;
  background: transparent !important;
  background-color: transparent !important;
}

body.login-page .wrap {
  height: 100vh;
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: transparent !important;
  background-color: transparent !important;
}

/* Remover background branco de elementos específicos */
body.login-page .card,
body.login-page .container,
body.login-page .content,
body.login-page main,
body.login-page section {
  background: transparent !important;
  background-color: transparent !important;
}

/* Card de login transparente */
body.login-page .login-card {
  background: transparent !important;
}

/* Inputs transparentes */
body.login-page .form-group input {
  background: transparent !important;
  color: #ffffff !important;
}

body.login-page .form-group input:focus {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

body.login-page .form-group input::placeholder {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Esconder header, footer e banner de instalação na página de login */
body.login-page header,
body.login-page .footer,
body.login-page .app-header,
body.login-page .main-nav,
body.login-page #installBanner,
body.login-page .install-banner {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.login-page .login-bg {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  background-color: rgba(31, 71, 136, 0.4) !important;
}
