/* Reset e Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  min-height: 100vh;
  overflow: hidden;
}

/* Container Principal - Split Layout */
.login-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Lado Esquerdo - Imagem de Fundo */
.login-image {
  flex: 1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

.login-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to right,
    transparent 90%,
    rgba(255, 255, 255, 0.1) 100%
  );
}

/* Lado Direito - Formulário */
.login-panel {
  width: 420px;
  min-width: 420px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 50px;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
}

.login-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 20px;
}

/* Logo */
.logo-container {
  text-align: center;
  margin-bottom: 40px;
}

.logo-container img {
  max-width: 200px;
  height: auto;
}

/* Formulário */
.login-form {
  width: 100%;
}

.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-group input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  background-color: #ffffff;
  transition: all 0.2s ease;
}

.form-group input::placeholder {
  color: #9ca3af;
}

.form-group input:focus {
  outline: none;
  border-color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Ícones nos inputs */
.form-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 16px;
  pointer-events: none;
}

.form-group .input-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Toggle de visibilidade da senha */
.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: #6b7280;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

/* Link Esqueci Senha */
.forgot-password {
  text-align: center;
  margin-bottom: 20px;
}

.forgot-password a {
  color: #1e3a8a;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.forgot-password a:hover {
  color: #1e40af;
  text-decoration: underline;
}

/* Cap.js CAPTCHA Widget */
.captcha-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

cap-widget {
  --cap-background: #fafafa;
  --cap-border-color: #d1d5db;
  --cap-border-radius: 6px;
  --cap-widget-height: 28px;
  --cap-widget-width: 100%;
  --cap-widget-padding: 12px;
  --cap-gap: 12px;
  --cap-color: #374151;
  --cap-checkbox-size: 22px;
  --cap-checkbox-border: 1px solid #9ca3af;
  --cap-checkbox-border-radius: 4px;
  --cap-checkbox-background: #ffffff;
  --cap-checkbox-margin: 2px;
  --cap-font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --cap-spinner-color: #1e3a8a;
  --cap-spinner-background-color: #e5e7eb;
  --cap-spinner-thickness: 3px;
  width: 100%;
}

/* Botão Acessar (Azul) */
.btn-acessar {
  width: 100%;
  padding: 14px 20px;
  background-color: #1e3a8a;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 20px;
}

.btn-acessar:hover {
  background-color: #1e40af;
}

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

.btn-acessar:disabled {
  background-color: #93c5fd;
  cursor: not-allowed;
}

/* Seção de Acesso Público */
.public-access {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

/* Link Solicitar Acesso */
.register-link {
  text-align: center;
  margin-bottom: 16px;
}

.register-link a {
  color: #1e3a8a;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}

.register-link a:hover {
  color: #1e40af;
  text-decoration: underline;
}

.public-access-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  color: #6b7280;
  font-size: 14px;
}

.public-access-info svg {
  width: 20px;
  height: 20px;
  color: #3b82f6;
}

/* Botão Acesso Público (Verde) */
.btn-publico {
  width: 100%;
  padding: 14px 20px;
  background-color: #16a34a;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: block;
  text-align: center;
}

.btn-publico:hover {
  background-color: #15803d;
}

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

.btn-publico.loading {
  opacity: 0.7;
  cursor: wait;
}

/* Versão no Rodapé */
.version-info {
  text-align: center;
  padding-top: 30px;
  color: #9ca3af;
  font-size: 12px;
}

/* Mensagens de erro */
.error-message {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  display: none;
}

.error-message.show {
  display: block;
}

/* Loading state */
.btn-acessar.loading {
  position: relative;
  color: transparent;
}

.btn-acessar.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Botão Entrar com Gov.br ────────────────────────────────────── */
.govbr-separator {
  display: flex;
  align-items: center;
  margin: 16px 0;
  gap: 12px;
}

.govbr-separator::before,
.govbr-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #ddd;
}

.govbr-separator span {
  font-size: 13px;
  color: #888;
  text-transform: lowercase;
}

.btn-govbr {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: #1351b4;
  color: #ffffff;
  border: none;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.1s ease;
  letter-spacing: 0.02em;
}

.btn-govbr:hover {
  background: #0c326f;
  transform: translateY(-1px);
}

.btn-govbr:active {
  transform: translateY(0);
}

.btn-govbr .govbr-logo {
  height: 20px;
  width: auto;
}

.btn-govbr strong {
  font-weight: 700;
}

/* Responsividade */
@media (max-width: 1024px) {
  .login-image {
    display: none;
  }

  .login-panel {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .login-panel {
    padding: 30px 24px;
  }

  .logo-container img {
    max-width: 160px;
  }
}
