/* css/auth-gateway.css */
/* Folha de Estilos do Gateway de Autenticação Integrado (App-like Feel) */

.app-auth-gateway {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background-color: var(--bg-primary, #050816);
  color: var(--text-main, #f3f4f6);
  font-family: var(--font-body, 'Inter', sans-serif);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s;
}

.app-auth-gateway.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Elementos de Fundo e Efeitos Neon ── */
.gateway-bg-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 230, 118, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 230, 118, 0.03) 1px, transparent 1px);
  background-size: 35px 35px;
  opacity: 0.85;
}

.gateway-glow-1 {
  position: absolute;
  width: 550px;
  height: 550px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 230, 118, 0.08) 0%, transparent 65%);
  top: -150px;
  left: -150px;
  z-index: 1;
  pointer-events: none;
}

.gateway-glow-2 {
  position: absolute;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.08) 0%, transparent 65%);
  bottom: -100px;
  right: -100px;
  z-index: 1;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .gateway-glow-1 { animation: gatewayDriftA 16s ease-in-out infinite alternate; }
  .gateway-glow-2 { animation: gatewayDriftB 20s ease-in-out infinite alternate; }
}

@keyframes gatewayDriftA {
  to { transform: translate(60px, 40px) scale(1.1); }
}
@keyframes gatewayDriftB {
  to { transform: translate(-50px, -30px) scale(1.05); }
}

/* ── Container da Aplicação Gateway ── */
.gateway-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 410px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Tela de Splash / Inicialização ── */
.gateway-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  animation: gatewayFadeIn 0.4s ease forwards;
}

.gateway-splash.hidden {
  display: none;
}

.splash-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 20px rgba(0, 230, 118, 0.6));
  animation: splashBreathe 2s ease-in-out infinite alternate;
}

@keyframes splashBreathe {
  0% { transform: scale(0.95); filter: drop-shadow(0 0 15px rgba(0, 230, 118, 0.4)); }
  100% { transform: scale(1.08); filter: drop-shadow(0 0 30px rgba(0, 230, 118, 0.8)); }
}

.splash-title {
  font-family: var(--font-title, 'Outfit', sans-serif);
  font-size: 1.85rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 0.25rem;
}

.splash-title span {
  color: var(--primary, #00E676);
}

.splash-tagline {
  font-size: 0.875rem;
  color: var(--text-muted, #9ca3af);
  margin-bottom: 2rem;
}

.splash-loader-track {
  width: 160px;
  height: 4px;
  background: var(--bg-tertiary, #1b242e);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.splash-loader-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary, #00E676), var(--accent, #00C8FF));
  border-radius: 99px;
  animation: splashLoad 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes splashLoad {
  0% { left: -40%; width: 40%; }
  50% { left: 40%; width: 50%; }
  100% { left: 100%; width: 0%; }
}

/* ── Card de Autenticação ── */
.gateway-card {
  background: rgba(18, 24, 31, 0.85);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 24px;
  padding: 2rem;
  -webkit-backdrop-filter: blur(25px);
  backdrop-filter: blur(25px);
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(0, 230, 118, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
  animation: gatewaySlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gateway-card.hidden {
  display: none;
}

.gateway-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary, #00E676), var(--accent, #00C8FF), transparent);
  opacity: 0.8;
}

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

@keyframes gatewayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Tabs de Navegação (Entrar / Registrar) ── */
.gateway-tabs {
  display: flex;
  gap: 0.35rem;
  background: var(--bg-primary, #050816);
  border-radius: 12px;
  padding: 0.3rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.gateway-tab-btn {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted, #9ca3af);
  font-family: var(--font-body, sans-serif);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.gateway-tab-btn.active {
  background: var(--bg-tertiary, #1b242e);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.gateway-tab-btn:hover:not(.active) {
  color: #fff;
}

/* ── Seções / Painéis do Card ── */
.gateway-panel {
  display: none;
  animation: gatewayFadeIn 0.3s ease;
}

.gateway-panel.active {
  display: block;
}

.gateway-header {
  margin-bottom: 1.25rem;
}

.gateway-title {
  font-family: var(--font-title, 'Outfit', sans-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}

.gateway-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted, #9ca3af);
  line-height: 1.4;
}

/* ── Voltar para Recuperação ── */
.gateway-back-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.gateway-back-btn {
  background: var(--bg-primary, #050816);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  color: var(--text-main, #f3f4f6);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.gateway-back-btn:hover {
  background: var(--bg-tertiary, #1b242e);
  color: var(--primary, #00E676);
}

/* ── Formulário e Inputs ── */
.gateway-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gateway-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.gateway-field label {
  font-size: 0.785rem;
  font-weight: 600;
  color: var(--text-muted, #9ca3af);
  letter-spacing: 0.5px;
}

.gateway-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.gateway-input-wrapper input {
  width: 100%;
  padding: 0.75rem 1rem;
  padding-right: 2.75rem; /* Espaço para o olho da senha */
  background: var(--bg-primary, #050816);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-body, sans-serif);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gateway-input-wrapper input:focus {
  border-color: var(--primary, #00E676);
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.15);
}

.gateway-input-wrapper input:focus.accent-focus {
  border-color: var(--accent, #00C8FF);
  box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.15);
}

.gateway-input-wrapper input::placeholder {
  color: #4b5563;
}

.gateway-toggle-pass {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted, #9ca3af);
  cursor: pointer;
  font-size: 1.05rem;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  z-index: 5;
}

.gateway-toggle-pass:hover {
  color: #fff;
}

/* Link esqueceu senha */
.gateway-forgot {
  align-self: flex-end;
  font-size: 0.8125rem;
  color: var(--text-muted, #9ca3af);
  text-decoration: none;
  transition: color 0.2s;
  margin-top: -0.25rem;
  font-weight: 500;
}

.gateway-forgot:hover {
  color: var(--primary, #00E676);
}

/* Botões */
.gateway-btn-submit {
  width: 100%;
  padding: 0.8125rem 1.5rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary, #00E676), #00a152);
  color: #fff;
  font-family: var(--font-title, sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(0, 230, 118, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.gateway-btn-submit:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 230, 118, 0.4);
}

.gateway-btn-submit:active:not(:disabled) {
  transform: translateY(0);
}

.gateway-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.gateway-btn-submit.loading::after {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gatewaySpin 0.7s linear infinite;
}

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

/* Mensagens de Feedback */
.gateway-msg {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.45;
  display: none;
  margin-top: 0.5rem;
  animation: gatewayFadeIn 0.3s ease;
}

.gateway-msg.show {
  display: block;
}

.gateway-msg.error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: #f87171;
}

.gateway-msg.success {
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.2);
  color: var(--primary-light, #69f0ae);
}

/* ── Rodapé Offline / Ignorar Login ── */
.gateway-offline-footer {
  text-align: center;
  font-size: 0.8125rem;
  margin-top: 1rem;
  animation: gatewayFadeIn 0.4s ease;
}

.gateway-offline-link {
  color: var(--text-muted, #9ca3af);
  text-decoration: none;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.gateway-offline-link:hover {
  color: #fff;
}

/* Toasts de Autenticação */
.gateway-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-tertiary, #1b242e);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  color: #fff;
  padding: 0.8rem 1.4rem;
  border-radius: 14px;
  font-size: 0.875rem;
  z-index: 100000;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}

.gateway-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Mobile First responsive scaling ── */
@media (max-width: 480px) {
  .app-auth-gateway {
    padding: 1rem;
  }
  .gateway-card {
    padding: 1.5rem;
    border-radius: 20px;
  }
}

.gateway-field label span {
  font-weight: normal;
  font-size: 0.75rem;
}

.gateway-subtitle-margin {
  margin-bottom: 1.25rem;
}
