/* =====================================================================
   MediUniforme — Checkout (restyle complet)
   Desktop : formulaire + résumé côte à côte, champs en 2 colonnes.
   « Vos informations » : tout le contenu visible (scroll page OK).
   « Résumé de votre commande » : zone scrollable dédiée.
   ===================================================================== */

:root {
  --medi-checkout-primary: #48aa9d;
  --medi-checkout-primary-dark: #3a8a7f;
  --medi-checkout-bg: #f3f6f5;
  --medi-checkout-card: #ffffff;
  --medi-checkout-border: #e5ecea;
  --medi-checkout-text: #1a202c;
  --medi-checkout-muted: #64748b;
  --medi-checkout-radius: 14px;
  --medi-checkout-input-h: 42px;
  --medi-checkout-gap: 12px;
}

/* ------------------------------------------------------------------ */
/* Page shell                                                         */
/* ------------------------------------------------------------------ */
body.woocommerce-checkout {
  background: var(--medi-checkout-bg);
}

body.woocommerce-checkout .site-content,
body.woocommerce-checkout #content,
body.woocommerce-checkout .content-area,
body.woocommerce-checkout .site-main {
  background: transparent;
}

body.woocommerce-checkout .page-header,
body.woocommerce-checkout .woocommerce-breadcrumb {
  display: none;
}

body.woocommerce-checkout .content-area {
  padding-top: 14px;
  padding-bottom: 18px;
}

body.woocommerce-checkout .site-main > .container,
body.woocommerce-checkout .site-main > .container .content-area {
  max-width: 1360px;
  margin-left: auto;
  margin-right: auto;
}

/* ------------------------------------------------------------------ */
/* Bandeau client / connexion                                         */
/* ------------------------------------------------------------------ */
#customer-choice,
#logged-in-status {
  margin-bottom: 18px !important;
  padding: 18px 20px !important;
  background: var(--medi-checkout-card) !important;
  border: 1px solid var(--medi-checkout-border) !important;
  border-radius: var(--medi-checkout-radius) !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05) !important;
}

#customer-choice h3 {
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  color: var(--medi-checkout-text) !important;
  margin: 0 0 14px !important;
}

#customer-choice > div:first-of-type {
  display: flex !important;
  gap: 12px !important;
}

#customer-choice button,
#new-client,
#old-client,
#validate-old-client,
#custom-logout-btn {
  border-radius: 10px !important;
  font-weight: 700 !important;
  transition: background 0.2s ease, transform 0.15s ease !important;
}

#new-client,
#old-client {
  min-height: 46px !important;
}

#old-client-fields {
  margin-top: 14px !important;
  padding: 14px !important;
  border-radius: 12px !important;
  background: #f8faf9 !important;
  border: 1px solid var(--medi-checkout-border) !important;
}

#old-client-fields label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--medi-checkout-text);
  margin-bottom: 6px;
}

#old-client-fields input,
#old-client-fields select {
  width: 100% !important;
  min-height: var(--medi-checkout-input-h) !important;
  border: 1.5px solid var(--medi-checkout-border) !important;
  border-radius: 10px !important;
  padding: 0 12px !important;
  box-sizing: border-box !important;
}

#logged-in-status span {
  font-size: 1rem !important;
  color: var(--medi-checkout-text) !important;
}

/* ------------------------------------------------------------------ */
/* Coupon fidélité (visible uniquement si éligible)                   */
/* ------------------------------------------------------------------ */
.medi-checkout-coupon-wrap {
  max-width: none !important;
  margin: 0 0 14px !important;
}

.checkout_coupon.woocommerce-form-coupon,
.checkout_coupon.medi-checkout-coupon {
  max-width: none !important;
  margin: 0 0 16px !important;
  padding: 16px !important;
  border-radius: var(--medi-checkout-radius) !important;
  border: 1.5px dashed #f59e0b !important;
  background: #fffbeb !important;
}

.checkout_coupon.woocommerce-form-coupon label,
.checkout_coupon.medi-checkout-coupon label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--medi-checkout-text);
  margin-bottom: 6px;
}

.checkout_coupon.woocommerce-form-coupon .form-row-first,
.checkout_coupon.woocommerce-form-coupon .form-row-last,
.checkout_coupon.medi-checkout-coupon .form-row-first,
.checkout_coupon.medi-checkout-coupon .form-row-last {
  width: auto !important;
  flex: 1 1 auto;
}

.checkout_coupon.woocommerce-form-coupon,
.checkout_coupon.medi-checkout-coupon {
  display: flex !important;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ------------------------------------------------------------------ */
/* Grille principale checkout                                         */
/* ------------------------------------------------------------------ */
form.checkout.woocommerce-checkout {
  clear: both;
  float: none !important;
  width: 100% !important;
  margin-top: 0 !important;
}

#customer_details {
  float: none !important;
  width: 100% !important;
  padding-right: 0 !important;
}

#customer_details .col-1,
#customer_details .col-2 {
  width: 100%;
  float: none;
}

.woocommerce-billing-fields {
  background: var(--medi-checkout-card);
  border: 1px solid var(--medi-checkout-border);
  border-radius: var(--medi-checkout-radius);
  padding: 18px 18px 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
  overflow: visible;
}

.woocommerce-billing-fields > h3 {
  display: block !important;
  font-size: 0 !important;
  line-height: 0 !important;
  font-weight: 800 !important;
  color: var(--medi-checkout-text) !important;
  margin: 0 0 14px !important;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(72, 170, 157, 0.25);
}

.woocommerce-billing-fields > h3::before {
  content: "Vos informations";
  display: block;
  font-size: 1.05rem;
  line-height: 1.3;
}

/* ------------------------------------------------------------------ */
/* Champs — grille 2 colonnes                                         */
/* ------------------------------------------------------------------ */
.woocommerce-billing-fields__field-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--medi-checkout-gap);
}

.woocommerce-billing-fields__field-wrapper::before,
.woocommerce-billing-fields__field-wrapper::after {
  display: none !important;
}

.woocommerce-billing-fields .form-row {
  float: none !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  clear: none !important;
}

.woocommerce-billing-fields .form-row label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--medi-checkout-text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.woocommerce-billing-fields .form-row .input-text,
.woocommerce-billing-fields .form-row select,
.woocommerce-billing-fields .form-row textarea {
  width: 100% !important;
  height: var(--medi-checkout-input-h) !important;
  min-height: var(--medi-checkout-input-h) !important;
  padding: 0 12px !important;
  border: 1.5px solid var(--medi-checkout-border) !important;
  border-radius: 10px !important;
  background: #fff !important;
  font-size: 0.92rem !important;
  color: var(--medi-checkout-text) !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.woocommerce-billing-fields .form-row .input-text:focus,
.woocommerce-billing-fields .form-row select:focus {
  border-color: var(--medi-checkout-primary) !important;
  box-shadow: 0 0 0 3px rgba(72, 170, 157, 0.15) !important;
  outline: none !important;
}

#billing_phone {
  height: var(--medi-checkout-input-h) !important;
  padding-left: 95px !important;
}

#billing_phone_field {
  position: relative !important;
}

#country_code_selector_absolute.country_code_element {
  top: calc(0.82rem * 1.3 + 6px + 1px) !important;
  height: calc(var(--medi-checkout-input-h) - 2px) !important;
}

/* ------------------------------------------------------------------ */
/* Résumé commande                                                    */
/* ------------------------------------------------------------------ */
#order_review_heading {
  display: none !important;
}

#order_review {
  float: none !important;
  width: 100% !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

.modern-order-summary {
  background: var(--medi-checkout-card) !important;
  border: 1px solid var(--medi-checkout-border) !important;
  border-radius: var(--medi-checkout-radius) !important;
  padding: 16px !important;
  margin: 0 0 14px !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05) !important;
  overflow: visible;
  flex: none;
  min-height: auto;
}

.modern-order-summary .summary-header {
  margin-bottom: 12px !important;
  padding-bottom: 10px !important;
}

.modern-order-summary .summary-title {
  font-size: 1.05rem !important;
}

.modern-order-summary .products-section,
.modern-order-summary .price-details-section {
  padding: 12px !important;
  margin-bottom: 12px !important;
}

.modern-order-summary .products-list {
  margin-top: 8px !important;
}

.modern-order-summary .products-list.is-collapsed {
  display: none;
}

.modern-order-summary .price-row,
.modern-order-summary .payment-row {
  padding: 6px 0 !important;
}

.modern-order-summary .payment-section {
  padding: 12px !important;
}

.modern-order-summary .total-row .price-value {
  font-size: 1.15rem !important;
}

/* Paiement WooCommerce */
#order_review #payment {
  background: var(--medi-checkout-card) !important;
  border: 1px solid var(--medi-checkout-border) !important;
  border-radius: var(--medi-checkout-radius) !important;
  padding: 14px !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

#order_review #payment ul.payment_methods {
  margin: 0 0 12px !important;
  padding: 0 !important;
  border: none !important;
}

#order_review #payment .place-order {
  margin: 0 !important;
  padding: 0 !important;
}

#order_review #payment #place_order {
  width: 100% !important;
  min-height: 48px !important;
  background: var(--medi-checkout-primary) !important;
  border: none !important;
  border-radius: 12px !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  letter-spacing: 0.02em;
  transition: background 0.2s ease, transform 0.15s ease;
}

#order_review #payment #place_order:hover {
  background: var(--medi-checkout-primary-dark) !important;
}

#custom-payment-selector {
  gap: 10px !important;
  margin-bottom: 12px !important;
}

.custom-payment-method {
  padding: 10px !important;
  border-radius: 12px !important;
}

.custom-payment-method img {
  max-width: 64px !important;
  margin-bottom: 6px !important;
}

.custom-payment-method span {
  font-size: 0.85rem !important;
}

/* Bouton Commander toujours visible */
#order_review #payment .place-order,
#order_review #payment #place_order {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* ------------------------------------------------------------------ */
/* Desktop — layout 2 colonnes                                        */
/* ------------------------------------------------------------------ */
@media (min-width: 992px) {
  body.woocommerce-checkout .content-area {
    padding-top: 10px;
    padding-bottom: 24px;
    overflow: visible;
    max-height: none;
  }

  form.checkout.woocommerce-checkout {
    display: grid;
    grid-template-columns: minmax(420px, 1.05fr) minmax(400px, 0.95fr);
    grid-template-areas:
      "top top"
      "fields summary";
    column-gap: 28px;
    row-gap: 12px;
    align-items: start;
    overflow: visible;
    max-height: none;
  }

  #customer-choice,
  #logged-in-status,
  .medi-checkout-coupon-wrap,
  .woocommerce-notices-wrapper,
  form.checkout > .woocommerce-NoticeGroup {
    grid-area: top;
  }

  /* Vos informations — tout affiché, scroll page si besoin */
  #customer_details {
    grid-area: fields;
    align-self: start;
    min-height: auto;
    overflow: visible;
    width: 100%;
  }

  .woocommerce-billing-fields,
  .woocommerce-billing-fields__field-wrapper {
    overflow: visible;
    width: 100%;
  }

  /* Colonne droite : résumé + paiement + bouton Commander (scroll unique) */
  form.checkout.woocommerce-checkout #order_review {
    grid-area: summary;
    position: sticky;
    top: calc(var(--medi-header-h, 72px) + 12px);
    align-self: start;
    width: 100%;
    min-width: 0;
    max-height: calc(100svh - var(--medi-header-h, 72px) - 24px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(72, 170, 157, 0.55) transparent;
    display: block;
    padding-bottom: 8px;
  }

  form.checkout.woocommerce-checkout #order_review::-webkit-scrollbar {
    width: 6px;
  }

  form.checkout.woocommerce-checkout #order_review::-webkit-scrollbar-thumb {
    background: rgba(72, 170, 157, 0.45);
    border-radius: 999px;
  }

  form.checkout.woocommerce-checkout .modern-order-summary {
    margin-bottom: 14px !important;
  }

  form.checkout.woocommerce-checkout #order_review #payment {
    margin-top: 0;
  }

  /* Orange Money + Wave côte à côte pour gagner de la place */
  #custom-payment-selector {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px !important;
  }

  .woocommerce-billing-fields__field-wrapper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
  }

  .woocommerce-billing-fields__field-wrapper .form-row-wide {
    grid-column: 1 / -1;
  }

  .woocommerce-billing-fields {
    padding: 16px 16px 14px;
  }

  .checkout_coupon.woocommerce-form-coupon .form-row-first {
    flex: 1 1 220px;
  }

  .checkout_coupon.woocommerce-form-coupon .form-row-last {
    flex: 0 0 auto;
  }
}

/* ------------------------------------------------------------------ */
/* Mobile — inchangé fonctionnellement, style harmonisé               */
/* ------------------------------------------------------------------ */
@media (max-width: 991px) {
  .woocommerce-billing-fields,
  .modern-order-summary,
  #order_review #payment {
    border-radius: 12px;
  }

  .modern-order-summary.step-active,
  .modern-order-summary {
    max-height: none;
  }

  #customer-choice > div:first-of-type {
    flex-direction: column !important;
  }

  #customer-choice button {
    width: 100% !important;
  }
}
