/* Modal de checkout */
.checkout-modal, .payment-modal {
  display:none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4000;
}

.payment-modal .modal-content {
  top: 50%;
  transform: translateY(-50%);
}

.checkout-modal.active, .payment-modal.active {
  display: block;
}

.checkout-modal .modal-content , .payment-modal .modal-content {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  margin: 0 auto;
  display: block;
  background: #fff;
}

.checkout-modal h2 {
  margin-bottom: 1.5rem;
  color: var(--primary-color, #302CD7);
}

.checkout-modal h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  color: var(--text-color, #333);
}

/* Récapitulatif du panier */
.checkout-summary {
  background: #f9f9f9;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.delivery-message {
  color: red;
}

.checkout-summary h3 {
  margin-top: 0;
  font-size: 1.1rem;
}

#checkoutItems {
  margin-bottom: 1rem;
}

.checkout-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: white;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.checkout-item img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.checkout-item-info {
  flex: 1;
}

.checkout-item-name {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.checkout-item-qty {
  font-size: 0.9rem;
  color: #666;
}

.checkout-item-price {
  font-weight: 600;
  color: var(--primary-color, #302CD7);
}

.checkout-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 2px solid #ddd;
  font-size: 1.2rem;
  font-weight: 700;
}

.checkout-total-amount, .checkout-economies-amount, .checkout-livraison-amount {
  color: var(--primary-color, #302CD7);
}

.checkout-economies, .checkout-livraison {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 2px solid #ddd;
  font-size: 1.2rem;
  font-weight: 700;
}

.checkout-economies.display, .checkout-livraison.display {
  display: flex;
  margin-bottom: 14px;
}

/* Formulaire */
#checkoutForm {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.form-group.half {
  flex: 1;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #333;
}

.form-group input {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color, #302CD7);
}

.form-group input:invalid:not(:placeholder-shown) {
  border-color: #dc3545;
}

/* Message d'erreur */
.checkout-error {
  color: #dc3545;
  background: #f8d7da;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin: 1rem 0;
  display: none;
}

.checkout-error:not(:empty) {
  display: block;
}

/* Bouton de soumission */
#submitCheckout {
  margin-top: 1.5rem;
  padding: 1rem 2rem;
  background: var(--primary-color, #302CD7);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

#submitCheckout:hover:not(:disabled) {
  background: var(--primary-hover, #2420b0);
  transform: translateY(-1px);
}

#submitCheckout:disabled {
  background: #999;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
  .checkout-modal .modal-content {
    padding: 1.5rem;
    max-height: 95vh;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .form-group.half {
    width: 100%;
  }
  
  .checkout-item {
    flex-direction: row;
  }
  
  .checkout-item img {
    width: 50px;
    height: 50px;
  }
  
  .checkout-summary {
    padding: 1rem;
  }
}


.payment-card-element {
    margin: 20px;
    border: solid 1px grey;
    padding: 12px;
}

.payment-divider {
  margin: 12px;
}

.payment-security {
  margin-top: 24px;
  font-style: italic;
  font-size: 12px;
}

.payment-card-errors {
  color: red;
}

.payment-total {
  font-size: 20px;
  font-weight: bold;
  margin: 12px;
}