/**
 * Estilos para integração de formulários com a API
 * Modais, formulários de cadastro/login e dashboard
 */

/* ============================================
   MODAIS
   ============================================ */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 24px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.modal-footer {
  padding: 16px 24px 24px;
  text-align: center;
  border-top: 1px solid #e5e7eb;
  margin-top: 24px;
}

.modal-footer a {
  color: #7c3aed;
  text-decoration: none;
  font-weight: 500;
}

.modal-footer a:hover {
  text-decoration: underline;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */

#signup-form,
#signin-form,
#whatsapp-verification-form {
  padding: 0 24px 24px;
}

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

.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s;
  background: white;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-input.invalid {
  border-color: #ef4444;
}

.form-input.invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 4px;
  font-weight: 500;
}

/* ============================================
   BOTÕES
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 48px;
}

.btn-primary {
  background: #7c3aed;
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: #6d28d9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-secondary {
  background: #6b7280;
  color: white;
  width: 100%;
  margin-bottom: 16px;
}

.btn-secondary:hover {
  background: #4b5563;
}

/* ============================================
   DASHBOARD
   ============================================ */

#dashboard-modal .modal-content {
  max-width: 800px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  padding: 0 24px 24px;
}

.dashboard-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  transition: all 0.2s;
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.dashboard-card h3 {
  margin: 0 0 16px 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  border-bottom: 2px solid #7c3aed;
  padding-bottom: 8px;
}

.dashboard-card p {
  margin: 8px 0;
  color: #4b5563;
  font-size: 0.875rem;
}

.dashboard-card p strong {
  color: #1f2937;
  font-weight: 600;
}

/* ============================================
   NOTIFICAÇÕES
   ============================================ */

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 10001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: notificationSlideIn 0.3s ease-out;
}

@keyframes notificationSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.notification.success {
  background: #10b981;
}

.notification.error {
  background: #ef4444;
}

/* ============================================
   LOADING
   ============================================ */

.loading {
  text-align: center;
  padding: 40px;
  color: #6b7280;
  font-size: 1.125rem;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #7c3aed;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error {
  text-align: center;
  padding: 40px;
  color: #ef4444;
  font-size: 1.125rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  margin: 20px;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

@media (max-width: 640px) {
  .modal-content {
    margin: 10px;
    max-height: calc(100vh - 20px);
    max-width: calc(100vw - 20px);
  }
  
  .modal-header {
    padding: 16px 16px 0;
  }
  
  #signup-form,
  #signin-form,
  #whatsapp-verification-form {
    padding: 0 16px 16px;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
    padding: 0 16px 16px;
  }
  
  .dashboard-card {
    padding: 16px;
  }
}

/* ============================================
   BOTÕES DE AÇÃO NA LANDING PAGE
   ============================================ */

.auth-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

.auth-buttons .btn {
  width: auto;
  padding: 12px 24px;
  font-size: 0.875rem;
}

.btn-outline {
  background: transparent;
  color: #7c3aed;
  border: 2px solid #7c3aed;
}

.btn-outline:hover {
  background: #7c3aed;
  color: white;
}

/* ============================================
   NAVEGAÇÃO
   ============================================ */

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  color: #6b7280;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-link:hover {
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
}

.nav-cta {
  background: #7c3aed;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.nav-cta:hover {
  background: #6d28d9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

@media (max-width: 768px) {
  .nav-actions {
    gap: 8px;
  }
  
  .nav-link {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  .nav-cta {
    padding: 8px 16px;
    font-size: 0.8rem;
  }
}

/* ============================================
   INTEGRAÇÃO COM FORMULÁRIO EXISTENTE
   ============================================ */

#lead-form .form-group:last-child {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-links {
  text-align: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.auth-links a {
  color: #7c3aed;
  text-decoration: none;
  font-weight: 500;
  margin: 0 8px;
}

.auth-links a:hover {
  text-decoration: underline;
}
