/**
 * Styles pour l'intégration Stripe
 * Modale de paiement et éléments de carte
 */

/* Overlay de la modale */
.stripe-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

/* Animation d'apparition */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Conteneur principal de la modale */
.stripe-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 95vh;
  animation: slideIn 0.3s ease-out;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Animation d'apparition de la modale */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* En-tête de la modale */
.stripe-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: white;
  border-radius: 12px 12px 0 0;
}

.stripe-modal-header h3 {
  margin: 0;
  color: #e94e8a;
  font-size: 1.5rem;
  font-weight: 600;
}

.stripe-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.2s;
}

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

/* Contenu de la modale */
.stripe-modal-content {
  padding: 24px;
  padding-bottom: 32px; /* Extra space before footer */
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Récapitulatif de la réservation */
.booking-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.booking-summary h4 {
  margin: 0 0 16px 0;
  color: #374151;
  font-size: 1.1rem;
  font-weight: 600;
}

.booking-summary p {
  margin: 8px 0;
  color: #4b5563;
  font-size: 0.95rem;
}

.booking-summary strong {
  color: #374151;
  font-weight: 600;
}

/* Informations de paiement */
.payment-info h4 {
  margin: 0 0 16px 0;
  color: #374151;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Explication de l'empreinte */
.deposit-explanation {
  background: #fef3cd;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

/* Klarna info box spacing */
.klarna-info {
  margin-bottom: 1rem;
}

.deposit-explanation p {
  margin: 8px 0;
  color: #92400e;
  font-size: 0.9rem;
  line-height: 1.5;
}

.deposit-explanation strong {
  color: #78350f;
  font-weight: 600;
}

.payment-note {
  font-style: italic;
  border-top: 1px solid #fbbf24;
  padding-top: 12px;
  margin-top: 12px;
}

/* Conteneur de la carte Stripe */
.stripe-card-container {
  border: none; /* Removed border to avoid conflict with Payment Element */
  border-radius: 12px;
  padding: 0; /* Removed padding for Payment Element */
  background: transparent; /* Transparent for Payment Element */
  transition: border-color 0.3s ease;
  position: relative;
  min-height: 60px;
  margin-bottom: 24px; /* Space before footer */
}

/* Focus handled by Payment Element itself */

/* Élément de carte Stripe - styles minimaux pour ne pas interférer */
#stripe-card-element {
  padding: 8px;
  min-height: 44px;
  background: transparent;
  border: none;
  position: relative;
}

/* Payment Element container (for Klarna + card options) */
#payment-element {
  min-height: 200px;
  margin-bottom: 20px;
}

/* Ensure Payment Element borders are complete */
#payment-element > div {
  border-radius: 12px;
  overflow: visible;
}

/* Fix iframe container borders for card fields */
#payment-element iframe {
  border: none;
  display: block;
}

/* Accordion items spacing - styling handled by Stripe appearance config */
.p-AccordionItem {
  margin-bottom: 12px !important;
}

/* Styles pour les éléments Stripe intégrés */
.StripeElement {
  box-sizing: border-box;
  height: 40px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: white;
  box-shadow: 0 1px 3px 0 rgba(233, 78, 138, 0.1);
  transition: box-shadow 150ms ease;
}

.StripeElement--focus {
  box-shadow: 0 1px 3px 0 rgba(233, 78, 138, 0.25);
  border-color: #e94e8a;
}

.StripeElement--invalid {
  border-color: #fa755a;
}

.StripeElement--webkit-autofill {
  background-color: #fce9ec !important;
}

/* Messages d'erreur */
#stripe-card-errors {
  color: #dc2626;
  font-size: 0.9rem;
  margin-top: 8px;
  min-height: 0px;
  display: none;
}

#stripe-card-errors:not(:empty) {
  display: block;
  min-height: 20px;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  margin-top: 12px;
}

/* Pied de page de la modale */
.stripe-modal-footer {
  padding: 20px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-shrink: 0;
  background: white;
  border-top: 1px solid #e2e8f0;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

/* Boutons */
.stripe-modal-footer .btn-secondary,
.stripe-modal-footer .btn-primary {
  padding: 12px 32px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.stripe-cancel-btn {
  background: #fff;
  color: #a12659;
  border: 2px solid #c2336b;
}

.stripe-cancel-btn:hover {
  background: #fce9ec;
  border-color: #e94e8a;
  color: #d13e74;
}

.stripe-confirm-btn {
  background: #e94e8a;
  color: white;
  box-shadow: 0 4px 12px rgba(233, 78, 138, 0.25);
}

.stripe-confirm-btn:hover:not(:disabled) {
  background: #d13e74;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 78, 138, 0.35);
}

.stripe-confirm-btn:disabled {
  background: #fce9ec;
  color: #a12659;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.8;
}

/* Loader dans le bouton */
.btn-loader {
  display: none;
  margin-left: 8px;
}

.btn-loader .loader {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Animation du loader */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* État de chargement du bouton */
.stripe-confirm-btn.loading .btn-text {
  display: none;
}

.stripe-confirm-btn.loading .btn-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Responsive */
@media (max-width: 640px) {
  .stripe-modal-overlay {
    padding: 10px;
  }
  
  .stripe-modal {
    border-radius: 8px;
    max-height: 95vh;
  }
  
  .stripe-modal-header,
  .stripe-modal-content {
    padding: 20px 16px;
  }
  
  .stripe-modal-footer {
    padding: 12px 16px 20px;
    flex-direction: column;
  }
  
  .stripe-modal-footer .btn-secondary,
  .stripe-modal-footer .btn-primary {
    width: 100%;
    justify-content: center;
  }
  
  .booking-summary,
  .deposit-explanation {
    padding: 16px;
  }
}

/* États de focus pour l'accessibilité */
.stripe-modal-close:focus,
.stripe-cancel-btn:focus,
.stripe-confirm-btn:focus {
  outline: 2px solid #e94e8a;
  outline-offset: 2px;
}

/* Amélioration du contraste pour les messages d'erreur */

/* Style pour les champs Stripe valides */
.stripe-card-container.StripeElement--complete {
  border-color: #10b981;
  background: #ecfdf5;
}

/* Style pour les champs Stripe avec erreur */
.stripe-card-container.StripeElement--invalid {
  border-color: #dc2626;
  background: #fef2f2;
}

/* Style pour les champs Stripe en focus */
.stripe-card-container.StripeElement--focus {
  border-color: #e94e8a;
  box-shadow: 0 0 0 3px rgba(233, 78, 138, 0.15);
}

/* Options de paiement en 3 fois */
.installments-option {
  margin: 20px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.installments-option h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
}

.payment-choice {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-radio {
  display: flex;
  align-items: flex-start;
  padding: 16px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.payment-radio:hover {
  border-color: #e94e8a;
  background: #fce9ec;
}

.payment-radio input[type="radio"] {
  margin: 4px 12px 0 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.payment-radio input[type="radio"]:checked + .payment-label {
  color: #e94e8a;
  font-weight: 600;
}

.payment-radio input[type="radio"]:checked ~ .payment-desc {
  color: #a12659;
}

.payment-label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: #2c3e50;
  margin-bottom: 4px;
}

.payment-desc {
  display: block;
  font-size: 13px;
  color: #6c757d;
}