@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  --accent-color: #6366f1;
  --bg-light: #f8fafc;
  --surface: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-dim: #64748b;
  --success: #10b981;
  --danger: #ef4444;
}

body, html {
  height: 100%;
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-light);
  background-image: radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.05) 0%, transparent 30%),
  radial-gradient(circle at 100% 100%, rgba(99, 102, 241, 0.05) 0%, transparent 30%);
  color: var(--text-main);
  overflow: hidden;
}

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  padding: 2rem 2.5rem;
  border-radius: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1), 0 8px 15px -6px rgba(0, 0, 0, 0.05);
  text-align: center;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.logo-container {
  margin-bottom: 0.75rem;
}

.logo-container img {
  width: 350px; /* Valor original */
  max-width: 100%; /* Garante que não exceda o contêiner */
  height: auto;
}

.login-title { /* Novo estilo para o h2 */
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  margin-top: 0;
}

.input-group {
  position: relative;
  margin-bottom: 1.25rem;
}

.input-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 1.2rem;
  pointer-events: none;
}

#loginBtn {
  width: 100%;
  padding: 1.1rem;
  border-radius: 0.75rem;
  border: none;
  background: var(--primary-gradient);
  color: white;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
  letter-spacing: 0.025em;
}

#loginBtn:hover {
  transform: translateY(-3px);
  filter: brightness(1.1);
  box-shadow: 0 15px 25px -8px rgba(99, 102, 241, 0.5);
}

#loginBtn:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
  transform: translateY(0);
  filter: brightness(1);
}

.biometry-loading-status {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

#feedback {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 1rem;
  min-height: 20px;
}

.custom-select-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.selection-carousel {
  display: flex;
  width: 200%;
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.selection-carousel.show-user-list {
  transform: translateX(-50%);
}

.selection-screen {
  width: 50%;
  flex-shrink: 0;
}

.alphabet-filter {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 0.5rem;
  background-color: var(--surface);
  border-radius: 1rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.08);
}

.letter-button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.letter-button:hover {
  color: var(--accent-color);
  background-color: #eef2ff;
  transform: translateY(-2px);
}

.letter-button.active {
  background-color: var(--accent-color);
  color: white;
  box-shadow: 0 3px 8px (99, 102, 241, 0.3);
  transform: translateY(-1px);
}

.user-list-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.back-button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.back-button:hover {
  color: var(--accent-color);
  background-color: #eef2ff;
  transform: translateX(-3px);
}

.selected-letter-display {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-color);
  text-transform: uppercase;
}

.custom-user-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.08);
  padding: 0.5rem 0;
}

.custom-user-list.hidden {
  display: none;
}

.custom-select-item {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  border: 2px solid transparent;
  border-radius: 0.8rem;
  margin: 0.3rem 0.6rem;
}

.custom-select-item:hover {
  background-color: #f1f5f9;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px -8px rgba(99, 102, 241, 0.25);
}

.custom-select-item.selected {
  border-color: var(--accent-color);
  background-color: #eef2ff;
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 10px 22px -8px rgba(99, 102, 241, 0.4);
}

.custom-select-item .user-name {
  font-size: 1rem;
  font-weight: 500;
}

.no-users-message {
  text-align: center;
  color: var(--text-dim);
  padding: 1rem;
  font-size: 0.9rem;
}

.footer-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.biometric-popup-rounded {
  border-radius: 3rem !important;
  background: var(--surface) !important;
  padding: 2.5rem !important;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.3), 0 20px 40px -12px rgba(0, 0, 0, 0.2) !important;
}
.camera-viewfinder {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto 2rem;
  border-radius: 50%;
  overflow: hidden;
  background: var(--text-main);
  border: 6px solid var(--border-color);
  box-shadow:
          inset 0 0 25px rgba(0, 0, 0, 0.6),
          inset 0 0 10px rgba(0, 0, 0, 0.3),
          0 8px 20px rgba(0, 0, 0, 0.15);
}
.camera-viewfinder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.active-ring {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 8px solid var(--accent-color);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin-biometry 2s cubic-bezier(0.65, 0.05, 0.36, 1) infinite;
  z-index: 11;
}
@keyframes spin-biometry { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.step-card {
  margin-top: 1.5rem;
  background: var(--surface);
  padding: 1.75rem;
  border-radius: 1.75rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px -8px rgba(0, 0, 0, 0.15), 0 4px 10px -2px rgba(0, 0, 0, 0.05);
}
.dot-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 1.25rem;
}
.dot-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-color);
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}
.dot-active {
  background: var(--accent-color);
  transform: scale(1.4);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.8);
}
.dot-done {
  background: var(--success);
  transform: scale(1.4);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
}

.swal-biometry-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 1.8rem;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
}

.swal-biometry-step-text {
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.6;
}

.swal-biometry-step-hint {
  font-size: 0.8rem;
}

/* --- Media Queries para Responsividade --- */
@media screen and (max-width: 768px) {
  .login-container {
    padding: 1.5rem 1.5rem; /* Reduzir padding em telas menores */
    margin: 20px; /* Adicionar margem para não colar nas bordas */
  }

  .logo-container img {
    width: 250px; /* Ajustar largura para telas menores */
  }

  .biometric-popup-rounded {
    padding: 1.5rem !important; /* Reduzir padding do modal */
    border-radius: 2rem !important;
  }

  .camera-viewfinder {
    width: 80%; /* Tornar a largura responsiva */
    max-width: 250px; /* Limitar o tamanho máximo */
    height: auto; /* Remover altura fixa */
    aspect-ratio: 1 / 1; /* Manter proporção 1:1 */
    margin-bottom: 1.5rem; /* Ajustar margem */
  }

  .swal-biometry-title {
    font-size: 1.5rem; /* Reduzir tamanho do título */
  }

  .step-card {
    padding: 1.25rem; /* Reduzir padding do card de passos */
  }
}

@media screen and (max-width: 480px) {
  .login-container {
    padding: 1rem 1rem;
  }

  .logo-container img {
    width: 200px; /* Ainda menor para celulares muito pequenos */
  }

  .biometric-popup-rounded {
    padding: 1rem !important;
    border-radius: 1.5rem !important;
  }

  .camera-viewfinder {
    width: 90%;
    max-width: 200px;
    margin-bottom: 1rem;
  }

  .swal-biometry-title {
    font-size: 1.2rem;
  }

  .swal-biometry-step-text {
    font-size: 0.9rem;
  }

  .swal-biometry-step-hint {
    font-size: 0.75rem;
  }

  #loginBtn {
    padding: 0.9rem;
    font-size: 0.95rem;
  }
}