/* Conteneur animé */
.step-section {
  position: absolute;
  width: 100%;
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.35s ease;
  pointer-events: none;
}

/* Section active */
.step-section.active {
  position: relative;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* Animation sortie vers gauche */
.step-section.exit-left {
  opacity: 0;
  transform: translateX(-40px);
}

/* Animation sortie vers droite */
.step-section.exit-right {
  opacity: 0;
  transform: translateX(40px);
}

/* Important : conteneur parent */
.gift-page-content {
  position: relative;
  overflow: hidden;
}

/* On affiche seulement la première au chargement */
.gift-formulas {
  display: block;
}

.gift-formulas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.carte-cadeau-order .preview-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 20px;
  border-radius: 12px;
  margin-top: 15px;
  text-align: left;
}

.gift-page-block {
  position: relative;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 16px;
  margin: 40px auto;
  max-width: 900px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  font-family: sans-serif;
  overflow: hidden; /* IMPORTANT pour que le header respecte les coins arrondis */
}

.gift-page-content {
  padding: 40px;
}

.gift-intro {
  text-align: center;
  font-size: 1.1rem;
  color: #555;
  max-width: 700px;
  margin: 0 auto 40px auto;
}

.gift-page-header, .gift-page-footer {
  text-align: center;
  margin-bottom: 40px;
}

.gift-header-full {
  background: var(--primary);
  color: #fff;
  padding: 22px 30px;
  text-align: center;
}

.gift-header-full h2 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.gift-page-header h1 {
  font-size: 2rem;
  margin-bottom: 16px;
}

.gift-page-header p {
  font-size: 1.1rem;
  color: #555;
}

.gift-page-footer p {
  font-size: 0.95rem;
  color: #666;
}

.gift-formulas h2, .gift-setup h2, .gift-payment h2 {
  font-size: 1.6rem;
  margin-bottom: 20px;
  text-align: center;
}

.forfaits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
}

.forfait-card {
  flex: 1 1 250px; /* largeur minimale de 250px, s’adapte */
  max-width: 300px; /* pour ne pas dépasser */
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  text-align: left;
  box-sizing: border-box;
}

.forfait-card h4 {
  text-align: center;
}

@media (max-width: 768px) {
  .gift-page-content {
    overflow: visible; /* autorise le contenu à dépasser */
    height: auto !important; /* ignore la hauteur fixée lors des transitions */
  }
  .gift-formulas {
    flex-direction: column;
    align-items: center;
  }
  .forfait-card {
    max-width: none;
  }
}

/* Aperçu carte cadeau */
.preview-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 15px;
  border-radius: 12px;
  margin-top: 15px;
  text-align: left;
}

/* Boutons */
button {
  cursor: pointer;
}

.forfait-card h3, .forfait-card .price {
  text-align:center !important;
}

/* Header spécial carte cadeau */
.gift-page-header {
  text-align: center;
  margin-bottom: 40px;
}

/* Bandeau bleu */
.gift-header-banner {
  background: var(--primary); /* couleur Eventipix */
  color: #fff;
  padding: 18px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

/* Titre dans le bandeau */
.gift-header-banner h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Texte sous le bandeau */
.gift-page-header p {
  font-size: 1.05rem;
  color: #555;
  max-width: 700px;
  margin: 0 auto;
}

/* Barre d'étapes */
.gift-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px 40px;
  background: #f9fafb;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.9rem;
  color: #9ca3af;
  font-weight: 500;
  transition: all 0.3s ease;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  font-weight: 600;
  background: #fff;
  transition: all 0.3s ease;
}

.step-line {
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  margin: 0 15px;
  transition: background 0.3s ease;
}

/* Étape active */
.step.active {
  color: var(--primary);
}

.step.active .step-number {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* Étape complétée */
.step.completed {
  color: var(--primary);
}

.step.completed .step-number {
  border-color: var(--primary);
  background: #fff;
  color: var(--primary);
}

.step.completed + .step-line {
  background: var(--primary);
}

/* Carte désactivée */
.forfait-card.coming-soon {
  opacity: 0.75;
  position: relative;
}

/* Bouton désactivé */
.select-formula.disabled,
.select-formula:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  border: none;
}

/* Empêche effet hover */
.select-formula.disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Grid layout */
.gift-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 30px;
}

/* Colonne gauche */
.form-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Groupe champ */
.form-group {
  display: flex;
  flex-direction: column;
}

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

.form-group input,
.form-group textarea {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.form-group small {
  font-size: 0.85rem;
  color: #6b7280; /* gris clair */
  margin-top: 4px;
}

/* Bouton principal */
.btn-primary {
  margin-top: 10px;
  padding: 14px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.25s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.form-right {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.preview-card-wrapper {
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.preview-card-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

#gift-preview-frame {
  width: 100%;
  border: none;
  background: white;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  border-radius: 8px;
}

.preview-header {
  font-weight: 600;
  font-size: 1.1rem;
  opacity: 0.9;
}

.preview-body {
  margin-top: 20px;
}

.preview-to,
.preview-from,
.preview-formula {
  margin: 10px 0;
  font-size: 0.95rem;
}

.preview-message-box {
  background: rgba(255,255,255,0.15);
  padding: 12px;
  border-radius: 8px;
  font-style: italic;
  margin: 15px 0;
  min-height: 60px;
}

#message-counter {
    display: block;
    font-size: 0.85rem;
    color: #555;
    margin-top: 4px;
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
  .gift-config-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 1024px) {
  .form-right {
    max-width: 100%;
  }
}

.carte-cadeau-order h4 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  text-align: center;
  color: #111827;
}

/* Tableau récap */
.order-summary {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.order-summary th,
.order-summary td {
  padding: 12px 15px;
  font-size: 0.95rem;
}

.order-summary th {
  background: #e5e7eb;
  text-align: left;
  font-weight: 600;
}

.order-summary .text-right {
  text-align: right;
}

/* Bloc personnalisation */
.order-personalization {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 15px;
  font-size: 0.95rem;
}

.order-personalization p {
  margin: 8px 0;
}

.personal-message {
  background: #fff;
  border: 1px solid #d1d5db;
  padding: 10px;
  border-radius: 8px;
  font-style: italic;
  min-height: 60px;
  white-space: pre-wrap;
}

#pay-now, .gift-payment > p:not(.carte-cadeau-order) {
  display: none;
}

/* Bouton Payer maintenant */
#pay-now-container {
  display: flex;
  flex-direction: column;
  justify-content: center; /* centre horizontalement */
  align-items: center;     /* centre verticalement si nécessaire */
}

.confirmation-checkbox, .confirmation-checkbox a {
    font-size: 0.95rem;
    color: #333;
    text-align: center;
    text-decoration: none;
}

.confirmation-checkbox a:hover {
    color: #333;
    text-decoration: none;
}

.confirmation-checkbox input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.gift-payment {
  display: none; /* masquée par défaut */
}

.step-section.active.gift-payment {
  display: block; /* visible uniquement quand active */
}

#card-element {
  max-width: 400px;       /* Limite la largeur sur grand écran */
  width: 100%;            /* Adaptable au parent */
  padding: 12px 14px;     /* Espacement interne */
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
  font-size: 16px;
}

#card-errors {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

/* Conteneur Stripe */
#stripe-container {
  display: none;
  flex-direction: column;
  margin-top: 20px;
}

/* Style du bouton payer */
#pay-now {
  padding: 12px 24px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  background: #3b82f6;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

#pay-now:hover {
  background: #2563eb;
}

#payment-message {
  font-weight: 500;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
}

/* Modal erreur */
.error-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.error-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.error-modal-content {
  background: #fff;
  padding: 30px;
  border-radius: 14px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 15px 40px rgba(0,0,0,0.25);
  animation: modalPop 0.25s ease;
}

.error-modal-content h3 {
  margin-top: 0;
  color: #B91C1C;
}

#error-modal-message {
  margin: 15px 0 25px 0;
  color: #374151;
}

@keyframes modalPop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Spinner bouton paiement */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top: 2px solid #fff;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

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

#pay-now:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Overlay si JS désactivé */
.gift-noscript-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 30px;
  text-align: center;
}

.gift-noscript-content {
  max-width: 420px;
}

.gift-noscript-content h3 {
  color: #B91C1C;
  margin-bottom: 15px;
}

.gift-noscript-content p {
  color: #374151;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.gift-refresh-btn {
  padding: 12px 20px;
  text-decoration: none;
}