/* ==============================================================================
   POPUPS DE AUTENTICAÇÃO - DESIGN PROFISSIONAL VERDE
   ============================================================================== */

/* 🔹 Variáveis CSS Verde Premium */
:root {
  --auth-primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --auth-accent-gradient: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  --auth-success-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --auth-warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --auth-background: rgba(15, 23, 42, 0.95);
  --auth-surface: rgba(255, 255, 255, 0.1);
  --auth-surface-solid: #1e293b;
  --auth-text-primary: #ffffff;
  --auth-text-secondary: #cbd5e1;
  --auth-text-tertiary: #94a3b8;
  --auth-border-light: rgba(255, 255, 255, 0.1);
  --auth-border-medium: rgba(255, 255, 255, 0.2);
  --auth-shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --auth-shadow-2xl: 0 50px 100px -20px rgba(0, 0, 0, 0.7);
  --auth-transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --auth-border-radius: 20px;
  --auth-backdrop-blur: blur(20px);
}

/* 🔹 Container Principal do Popup */
.auth-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--auth-background);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: var(--auth-transition-smooth);
  backdrop-filter: var(--auth-backdrop-blur);
  -webkit-backdrop-filter: var(--auth-backdrop-blur);
}

.auth-popup.visible {
  opacity: 1;
  visibility: visible;
}

.auth-popup.hidden {
  display: none;
}

/* 🔹 Conteúdo do Popup com Efeito Glass */
.auth-popup-content {
  background: var(--auth-surface);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--auth-border-light);
  padding: 3rem;
  border-radius: var(--auth-border-radius);
  box-shadow: var(--auth-shadow-2xl);
  width: 90%;
  max-width: 440px;
  position: relative;
  transform: translateY(30px) scale(0.9);
  transition: var(--auth-transition-smooth);
  overflow: hidden;
}

.auth-popup.visible .auth-popup-content {
  transform: translateY(0) scale(1);
}

/* 🔹 Efeito de Luz Verde Passando */
.auth-popup-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(16, 185, 129, 0.2),
    transparent
  );
  transition: left 0.8s ease;
  z-index: 1;
}

.auth-popup-content:hover::before {
  left: 100%;
}

/* 🔹 Título com Gradiente Verde */
.auth-popup h2 {
  margin-bottom: 2.5rem;
  text-align: center;
  background: var(--auth-primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.5px;
  position: relative;
}

.auth-popup h2::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--auth-primary-gradient);
  border-radius: 2px;
}

/* 🔹 Labels Estilizadas */
.auth-popup label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--auth-text-primary);
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

/* 🔹 Inputs Premium com Foco Verde */
.auth-popup input {
  width: 100%;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--auth-border-light);
  border-radius: 12px;
  font-size: 1rem;
  transition: var(--auth-transition-smooth);
  box-sizing: border-box;
  color: var(--auth-text-primary);
}

.auth-popup input::placeholder {
  color: var(--auth-text-tertiary);
}

.auth-popup input:focus {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  box-shadow: 
    0 0 0 4px rgba(16, 185, 129, 0.1),
    inset 0 0 20px rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

/* 🔹 Botão Principal com Efeito Shine Verde */
.auth-popup .btn-primary {
  width: 100%;
  padding: 1.125rem 1.5rem;
  background: var(--auth-primary-gradient);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  margin-top: 1rem;
  transition: var(--auth-transition-smooth);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.auth-popup .btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.6s ease;
}

.auth-popup .btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 12px 30px rgba(16, 185, 129, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.auth-popup .btn-primary:hover::before {
  left: 100%;
}

.auth-popup .btn-primary:active {
  transform: translateY(-1px);
}

/* 🔹 Botão Secundário */
.auth-popup .btn-secondary {
  width: 100%;
  background: transparent;
  color: var(--auth-text-secondary);
  border: 2px solid var(--auth-border-light);
  padding: 1rem 0;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1.5rem;
  transition: var(--auth-transition-smooth);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.auth-popup .btn-secondary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(16, 185, 129, 0.1),
    transparent
  );
  transition: left 0.6s ease;
}

.auth-popup .btn-secondary:hover {
  color: var(--auth-text-primary);
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.05);
  transform: translateY(-2px);
}

.auth-popup .btn-secondary:hover::before {
  left: 100%;
}

/* 🔹 Botão de Fechar com Hover Verde */
.auth-popup-content .close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid var(--auth-border-light);
  border-radius: 50%;
  color: var(--auth-text-primary);
  transition: var(--auth-transition-smooth);
  font-size: 1.25rem;
  font-weight: 300;
  z-index: 2;
}

.auth-popup-content .close-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

/* 🔹 Mensagens com Cores Harmonizadas */
.message-area {
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.message-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: currentColor;
  opacity: 0.1;
  z-index: -1;
}

.error-message {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.success-message {
  color: #86efac;
  border-color: rgba(16, 185, 129, 0.4);
}

.info-message {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.3);
}

/* 🔹 Loading States */
.auth-popup button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.auth-popup button.loading {
  position: relative;
  color: transparent;
}

.auth-popup button.loading::after {
  content: '';
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  top: 50%;
  left: 50%;
  margin: -0.625rem 0 0 -0.625rem;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 🔹 Switch de Formulário */
.form-switch {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--auth-text-secondary);
}

.form-switch a {
  color: #10b981;
  text-decoration: none;
  font-weight: 700;
  margin-left: 0.5rem;
  position: relative;
  transition: var(--auth-transition-smooth);
}

.form-switch a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--auth-primary-gradient);
  transition: width 0.3s ease;
}

.form-switch a:hover {
  color: #34d399;
}

.form-switch a:hover::after {
  width: 100%;
}

/* 🔹 Animações */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 🔹 Responsividade */
@media (max-width: 480px) {
  .auth-popup-content {
    padding: 2rem 1.5rem;
    margin: 1rem;
    width: calc(100% - 2rem);
    border-radius: 16px;
  }
  
  .auth-popup h2 {
    font-size: 1.75rem;
    margin-bottom: 2rem;
  }
  
  .auth-popup input {
    padding: 0.875rem 1rem;
  }
  
  .auth-popup .btn-primary,
  .auth-popup .btn-secondary {
    padding: 1rem 1.25rem;
  }
}

/* 🔹 Acessibilidade */
@media (prefers-reduced-motion: reduce) {
  .auth-popup,
  .auth-popup-content,
  .close-btn,
  .btn-primary,
  .btn-secondary {
    transition: none;
    animation: none;
  }
}

.auth-popup *:focus-visible {
  outline: 2px solid rgba(16, 185, 129, 0.8);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 🔹 Efeitos de Partículas Verdes */
.auth-popup-content::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at center,
    rgba(16, 185, 129, 0.1) 0%,
    transparent 50%
  );
  animation: float 6s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(180deg); }
}

/* 🔹 Botões de Loading */
.btn-primary.loading,
.app-btn-logout.loading {
  opacity: 0.8;
  cursor: not-allowed;
  position: relative;
  color: transparent;
}

.btn-primary.loading::after,
.app-btn-logout.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
}

/* 🔹 Estilos para Botões Externos - VERDE */
.app-btn {
  padding: 0.375rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--auth-transition-smooth);
  border: none;
  position: relative;
  overflow: hidden;
}

.app-btn-login {
  background: var(--auth-primary-gradient);
  color: white;
}

.app-btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.app-btn-register {
  background: var(--auth-accent-gradient);
  color: white;
}

.app-btn-register:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(52, 211, 153, 0.4);
}

.app-btn-logout {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.app-btn-logout:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* 🔹 Flash Messages Verdes */
.flash-messages {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  max-width: 400px;
}

.flash-message {
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  font-weight: 600;
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  border: 1px solid;
  position: relative;
  overflow: hidden;
}

.flash-message::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: currentColor;
  opacity: 0.1;
  z-index: -1;
}

.flash-success {
  color: #86efac;
  border-color: rgba(16, 185, 129, 0.4);
}

.flash-error {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.flash-info {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.4);
}

.flash-warning {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 🔹 Efeito de Brilho nos Botões Externos */
.app-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.6s ease;
}

.app-btn:hover::before {
  left: 100%;
}