/* ============================================
   POPUP NEWSLETTER KYOOL
   Style moderne et responsive
   ============================================ */

/* Overlay sombre derrière le popup */
.newsletter-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9998;
  animation: fadeIn 0.3s ease;
}

.newsletter-overlay.active {
  display: block;
}

/* Container du popup */
.newsletter-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(36, 199, 235, 0.3);
  z-index: 9999;
  animation: slideIn 0.4s ease;
  overflow: hidden;
}

.newsletter-popup.active {
  display: block;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Header du popup avec gradient */
.newsletter-header {
  background: linear-gradient(135deg, #24C7EB 0%, #1e9fb8 100%);
  padding: 30px 20px;
  text-align: center;
  position: relative;
}

/* Bouton fermer (X) */
.newsletter-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  color: white;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.newsletter-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Titre et description */
.newsletter-header h2 {
  margin: 0 0 10px 0;
  font-size: 28px;
  color: white;
  font-weight: 700;
}

.newsletter-header p {
  margin: 0;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

/* Corps du formulaire */
.newsletter-body {
  padding: 30px 25px;
}

/* Groupes de champs */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 500;
}

.form-group label .required {
  color: #24C7EB;
  margin-left: 3px;
}

.form-group label .optional {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-weight: 400;
  margin-left: 5px;
}

.required-label {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  margin-left: 5px;
}

/* Champs input et select */
.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: white;
  font-size: 15px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #24C7EB;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 3px rgba(36, 199, 235, 0.1);
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* Select dropdown */
.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 40px;
}

.form-group select option {
  background: #1a1a2e;
  color: white;
}

/* Checkbox RGPD */
.form-checkbox {
  display: flex;
  align-items: flex-start;
  margin: 25px 0;
  gap: 12px;
}

.form-checkbox input[type="checkbox"] {
  width: auto;
  min-width: 20px;
  height: 20px;
  cursor: pointer;
  margin-top: 2px;
}

.form-checkbox label {
  flex: 1;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
  cursor: pointer;
  margin: 0;
}

.form-checkbox label a {
  color: #24C7EB;
  text-decoration: underline;
}

.form-checkbox label a:hover {
  color: #1e9fb8;
}

/* Boutons */
.newsletter-buttons {
  display: flex;
  gap: 10px;
  margin-top: 25px;
  flex-wrap: wrap; /* Permet le retour à la ligne si nécessaire */
}

/* Pour la section "Vous êtes déjà inscrit" avec 3 boutons, empiler verticalement */
#step2-existing .newsletter-buttons {
  flex-direction: column;
}

.btn-submit,
.btn-later {
  flex: 1;
  min-width: 140px; /* Largeur minimum pour que le texte soit visible */
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-submit {
  background: linear-gradient(135deg, #24C7EB 0%, #1e9fb8 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(36, 199, 235, 0.3);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(36, 199, 235, 0.4);
}

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

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-later {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-later:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Styles pour les nouveaux boutons */
.btn-primary {
  flex: 1;
  min-width: 140px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #24C7EB 0%, #1e9fb8 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(36, 199, 235, 0.3);
}

/* Dans la section "déjà inscrit", boutons pleine largeur */
#step2-existing .btn-primary,
#step2-existing .btn-secondary,
#step2-existing .btn-danger {
  width: 100%;
  flex: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(36, 199, 235, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  flex: 1;
  min-width: 120px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Messages de succès et d'erreur */
.newsletter-message {
  padding: 15px 20px;
  border-radius: 10px;
  margin-top: 15px;
  font-size: 14px;
  text-align: center;
  display: none;
}

.newsletter-message.success {
  background: rgba(46, 213, 115, 0.2);
  border: 2px solid rgba(46, 213, 115, 0.5);
  color: #2ed573;
  display: block;
}

.newsletter-message.error {
  background: rgba(255, 71, 87, 0.2);
  border: 2px solid rgba(255, 71, 87, 0.5);
  color: #ff4757;
  display: block;
}

/* Responsive mobile */
@media (max-width: 600px) {
  .newsletter-popup {
    width: 95%;
    max-width: none;
    max-height: 90vh; /* Limite la hauteur à 90% de l'écran */
    overflow-y: auto; /* Permet le scroll si le contenu dépasse */
    top: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Bouton X plus grand et plus visible sur mobile */
  .newsletter-close {
    width: 40px;
    height: 40px;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.3);
    top: 10px;
    right: 10px;
    z-index: 10;
  }
  
  .newsletter-close:active {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0.95);
  }
  
  .newsletter-header {
    padding: 20px 15px 20px 15px;
    padding-top: 20px; /* Réduire l'espace en haut */
  }
  
  .newsletter-header h2 {
    font-size: 22px;
    margin-bottom: 8px;
  }
  
  .newsletter-header p {
    font-size: 13px;
  }
  
  .newsletter-body {
    padding: 15px 15px 20px 15px;
  }
  
  /* Réduire l'espace des inputs */
  .form-group {
    margin-bottom: 12px;
  }
  
  .form-input {
    padding: 12px 15px;
    font-size: 15px;
  }
  
  /* Checkbox RGPD plus compact */
  .checkbox-group {
    margin: 12px 0;
  }
  
  .checkbox-group label {
    font-size: 12px;
    line-height: 1.4;
  }
  
  .newsletter-buttons {
    flex-direction: column;
    gap: 10px;
  }
  
  .btn-submit,
  .btn-later {
    width: 100%;
    padding: 12px;
    font-size: 15px;
  }
  
  /* S'assurer que TOUS les boutons (primary, secondary, danger) sont empilés */
  .btn-primary,
  .btn-secondary,
  .btn-danger {
    width: 100%;
    padding: 12px;
    font-size: 15px;
  }
}

/* Styles pour les étapes */
.step-container {
  margin-bottom: 15px;
}

.step-intro {
  margin-bottom: 15px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
}

.step-success {
  padding: 12px 15px;
  background: rgba(36, 199, 235, 0.1);
  border-left: 4px solid var(--kyool-blue, #24C7EB);
  border-radius: 5px;
  margin-bottom: 15px;
  color: rgba(255, 255, 255, 0.9);
}

.existing-info {
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin: 10px 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
}

.existing-actions {
  margin: 15px 0 10px 0;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

/* Bouton danger pour désinscription */
.btn-danger {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 53, 69, 0.3);
}

.btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Form row pour aligner 2 champs côte à côte */
.form-row-2 {
  display: flex;
  gap: 15px;
}

.form-row-2 .form-group {
  flex: 1;
}

@media (max-width: 600px) {
  .form-row-2 {
    flex-direction: column;
    gap: 0;
  }
}

/* Animation de chargement pour le bouton submit */
.btn-submit.loading::after {
  content: "";
  width: 16px;
  height: 16px;
  margin-left: 10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.6s linear infinite;
}

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