/* =====================================================================
   05 · CARTE DU RESTAURANT — catégories, produits, fenêtres de commande
   ---------------------------------------------------------------------
   Structure HTML générée par WooFood :
     .woofood-accordion
       > a > .panel-heading > img + h4.panel-title + .accordion-plus-icon
       > .panel-collapse > .panel-body > .woofood-products-wrapper
           > ul.woofood-products > li.woofood-product-loop
               > .product-image  .product-title  .product-price  .product-button
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. CATÉGORIES (accordéons)
   Fermée  : carte claire, liseré gauche et « + » de la couleur principale.
   Ouverte : bandeau de la couleur principale → on voit où l'on est.
   Couleurs : variables --ui-band-* de 01-tokens.css.
   Bootstrap pose la classe .collapsed sur le lien d'une catégorie fermée.
   --------------------------------------------------------------------- */
.woofood-accordion {
  float: none;
  width: 100%;
  margin: 0 0 .625rem;
  overflow: hidden;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--ui-shadow-sm);
}

/* Couleurs de la catégorie ouverte (état par défaut)… */
.woofood-accordion > a {
  --_band-bg: var(--ui-band-bg);
  --_band-text: var(--ui-band-text);
  --_band-accent: var(--ui-band-text);
  --_band-edge: transparent;
  --_icon-bg: var(--brand-surface);
  display: flex;
  text-decoration: none;
}

/* … et de la catégorie fermée */
.woofood-accordion > a.collapsed {
  --_band-bg: var(--ui-band-closed-bg);
  --_band-text: var(--ui-band-closed-text);
  --_band-accent: var(--ui-band-closed-accent);
  --_band-edge: var(--ui-band-closed-edge);
  --_icon-bg: var(--ui-band-closed-icon-bg);
}

/* Survol uniquement avec une souris : sur mobile, il « resterait collé » après un toucher */
@media (hover: hover) {
  .woofood-accordion > a:hover { --_band-bg: var(--ui-band-bg-hover); }
  .woofood-accordion > a.collapsed:hover { --_band-bg: var(--ui-band-closed-bg-hover); }
}

.woofood-accordion:has(> a.collapsed) {
  border-color: var(--ui-band-closed-border);
}

.woofood-accordion > a:focus-visible {
  outline: 3px solid var(--_band-accent);
  outline-offset: -4px;
}

.woofood-accordion .panel-heading {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  height: auto;
  min-height: 64px;
  padding: .5rem 1rem .5rem .875rem;
  border: 0;
  border-radius: 0;
  box-shadow: inset 4px 0 0 var(--_band-edge);
  transition: background-color var(--ui-speed), box-shadow var(--ui-speed);
}

/* Icône de la catégorie, sur une pastille ronde */
.woofood-accordion .panel-heading img,
.woofood-accordion .panel-heading::before {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--_icon-bg);
}

.woofood-accordion .panel-heading img {
  float: none;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 6px;
  object-fit: contain;
}

/* Catégorie sans icône (shortcode icon="") : une étoile au lieu d'une image cassée */
.woofood-accordion .panel-heading img[src=""],
.woofood-accordion .panel-heading img:not([src]) {
  display: none;
}

.woofood-accordion .panel-heading:has(> img[src=""])::before,
.woofood-accordion .panel-heading:not(:has(> img))::before {
  content: "★";
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--brand-primary);
}

.woofood-accordion .panel-heading .panel-title {
  flex: 1;
  float: none;
  max-width: none;
  margin: 0;
  padding: 0;
  font-family: var(--brand-font-display);
  font-size: clamp(1.25rem, 1.1rem + .6vw, 1.6rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: .005em;
  transition: color var(--ui-speed);
}

.woofood-accordion .accordion-plus-icon {
  flex: none;
  margin: 0;
  line-height: 1;
}

.woofood-accordion .accordion-plus-icon i {
  display: inline-block;
  font-size: 24px;
  transition: color var(--ui-speed);
}

.woofood-accordion .accordion-plus-icon i::before {
  transition: transform .25s var(--ui-ease);
}

.woofood-accordion .panel-body {
  padding: 0;
  background: var(--brand-surface);
}

/* Petits écrans : titres sur une ligne (« Nos pizzas crème fraîche » tient dès 360 px) */
@media (max-width: 480px) {
  .woofood-accordion .panel-heading {
    gap: .625rem;
    min-height: 58px;
    padding: .4375rem .875rem .4375rem .75rem;
  }

  .woofood-accordion .panel-heading img,
  .woofood-accordion .panel-heading::before {
    width: 36px;
    height: 36px;
  }

  .woofood-accordion .panel-heading img { padding: 5px; }

  .woofood-accordion .accordion-plus-icon i { font-size: 22px; }
}

@layer overrides {
  /* Le shortcode WooFood écrit la couleur en style inline (background:#cc0000) */
  .woofood-accordion .panel-heading {
    color: var(--_band-text) !important;
    background: var(--_band-bg) !important;
  }

  .woofood-accordion .panel-heading .panel-title {
    color: var(--_band-text) !important;
  }

  .woofood-accordion .accordion-plus-icon i {
    color: var(--_band-accent) !important;
  }
}

/* ---------------------------------------------------------------------
   2. LISTE DES PRODUITS
   1 colonne, puis 2 dès que le bloc fait 640px de large (container query :
   s'adapte à la place réellement disponible, pas à la taille de l'écran).
   --------------------------------------------------------------------- */
.woofood-products-wrapper {
  float: none;
  /* background: transparent; */
  container-type: inline-size;
}

.woofood-products-wrapper ul.woofood-products {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

@container (min-width: 640px) {
  .woofood-products-wrapper ul.woofood-products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

 
}

/* Une ligne produit :  [image] [nom + description      ]
                        [image] [prix]        [+ Ajouter] */
.woofood-products .woofood-product-loop {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  grid-template-areas:
    "image title title"
    "image price button";
  align-items: center;
  column-gap: 14px;
  row-gap: 6px;
  float: none;
  width: auto;
  max-width: none;
  flex: none;
  padding: 4px 4px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--brand-border);
  transition: background-color var(--ui-speed);
}

@media (hover: hover) {
  .woofood-products .woofood-product-loop:hover {
    background: var(--brand-surface-alt);
  }
}

/* Produit sans photo : pas de colonne vide */
.woofood-products .woofood-product-loop:not(:has(.product-image img)) {
  grid-template-columns: 0 minmax(0, 1fr) auto;
  column-gap: 0;
}

.woofood-product-loop .product-image {
  grid-area: image;
  float: none;
  width: 64px;
}

.woofood-product-loop .product-image img {
  display: block;
  width: 64px;
  height: 64px;
  max-width: none;
  object-fit: cover;
  background: var(--brand-surface-alt);
  border: 0;
  border-radius: var(--brand-radius-sm);
  box-shadow: none;
}

.woofood-product-loop .product-title {
  grid-area: title;
  float: none;
  width: auto;
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--ui-text);
  -webkit-text-fill-color: currentColor;
  white-space: normal;
}

.woofood-product-loop .product-title > span:first-child {
  display: block;
  font-weight: 600;
}

.woofood-product-loop .product-title .product-short-descr {
  margin-top: 2px;
}

.woofood-product-loop .product-title .product-short-descr,
.woofood-product-loop .product-title .product-short-descr span {
  font-size: .8125rem;
  line-height: 1.4;
  color: var(--ui-text-soft);
}

.woofood-product-loop .product-price {
  grid-area: price;
  float: none;
  width: auto;
  max-width: none;
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ui-price);
  white-space: nowrap;
}

.woofood-product-loop .product-price del {
  margin-right: .35em;
  font-size: .85em;
  font-weight: 400;
  color: var(--ui-text-soft);
}

.woofood-product-loop .product-price ins { text-decoration: none; }

.woofood-product-loop .product-button {
  grid-area: button;
  justify-self: end;
  float: none;
  width: auto;
}

.woofood-product-loop .product-button .button {
  float: none;
  min-height: 38px;
  padding: .35em 1.05em;
  font-size: .875rem;
}

.woofood-product-loop .product-button .button::before {
  content: "+";
  font-size: 1.2em;
  font-weight: 700;
  line-height: 1;
}

/* Variante « carrés » (option WooFood) */
.woofood-products-wrapper ul.woofood-products:has(> .square) {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.woofood-products .woofood-product-loop.square {
  display: block;
  padding: 0;
  border: 0;
}

li.woofood-product-loop.square .square-wrapper {
  height: 100%;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--ui-shadow-sm);
}

li.woofood-product-loop.square .square-wrapper:hover { box-shadow: var(--ui-shadow-md); }

/* ---------------------------------------------------------------------
   3. ONGLETS ET MENU LATÉRAL DE CATÉGORIES (autres affichages WooFood)
   --------------------------------------------------------------------- */
.woofood-tabs-wrapper {
  overflow: hidden;
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  box-shadow: var(--ui-shadow-sm);
}

.woofood-tabs-menu li a {
  font-weight: 600;
  color: var(--ui-text);
  transition: color var(--ui-speed);
}

.woofood-tabs-menu li a:hover,
.woofood-tabs-menu li a.active {
  color: var(--brand-primary);
}

.woofood-tabs-menu li a::before,
.woofood-tabs-menu li a::after {
  background: var(--brand-primary);
}

.woofood-side-menu li a {
  font-weight: 500;
  color: var(--ui-text);
}

.woofood-side-menu li a.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

ul.nav.justify-content-center.woofood-side-menu {
  background: var(--brand-surface);
  box-shadow: var(--ui-shadow-sm);
}

/* ---------------------------------------------------------------------
   4. FENÊTRE PRODUIT (clic sur « Ajouter »)
   Carte centrée sur ordinateur, plein écran sur mobile.
   C'est la carte entière qui défile : l'en-tête reste collé en haut et le
   bouton « Ajouter au panier » (pied de la fenêtre) reste collé en bas.
   --------------------------------------------------------------------- */
.modal.wf_product_view,
.modal.wf_category_view {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  width: 100%;
  height: 100%;
}

.wf_product_view .modal__overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.wf_product_view .content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  height: auto;
  max-height: 92vh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  box-shadow: var(--ui-shadow-lg);
  box-sizing: border-box;
}

/* Le contenu chargé en AJAX est enveloppé dans un .column-50-wf :
   il devient la colonne en-tête / contenu / pied, au moins aussi haute
   que la carte pour que le pied parte du bas de l'écran. */
.wf_product_view .content > .column-50-wf {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-height: 100%;
}

.wf_product_view .modal__header {
  position: sticky;
  top: 0;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 14px 56px;
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
  border-radius: 0;
  box-shadow: none;
}

.wf_product_view h2.modal__title {
  flex: 1;
  margin: 0;
  padding: 0;
  font-family: var(--brand-font-display);
  font-size: 1.6rem;
  letter-spacing: 0;
  color: var(--ui-title);
  text-align: center;
}

.wf_product_view .modal__close {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  transform: translateY(-50%);
}

.wf_product_view .modal__close::before {
  display: block;
  font-size: 26px;
  line-height: 1;
  color: var(--ui-text);
}

.wf_product_view .modal__container {
  flex: 1 0 auto;
  width: 100%;
  max-width: 100%;
  max-height: none;
  margin: 0;
  overflow: visible;
  background: var(--brand-surface);
  box-shadow: none;
  box-sizing: border-box;
}

/* Pied de la fenêtre = le bouton « Ajouter au panier » */
.wf_product_view .modal__footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
}

/* height:auto — le plugin fixe height:100%, ce qui masquait la fin
   du formulaire (quantité) derrière le bouton du bas. */
.wf_product_view .modal__content {
  height: auto;
  margin: 0;
  padding: 16px 20px;
  box-sizing: border-box;
}

.wf_product_view .column-50-wf {
  display: block;
  float: none;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.wf_product_view .column-50-wf.image-column img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: var(--brand-radius-sm);
}

.wf_product_view .woocommerce-product-details__short-description,
.wf_product_view .product-short-description {
  float: none;
  padding: 0;
  color: var(--ui-text-soft);
}

/* Groupes d'options (pizza au choix, boissons, suppléments…) */
.wf_product_view .woofood_flat_category {
  padding: 20px 14px 10px;
  border: 1.5px solid var(--brand-border);
  border-radius: var(--brand-radius-sm);
}

/* Titre du groupe posé sur la bordure (effet « légende »).
   Le plugin le place en position absolue : un titre sur 2 lignes recouvrait
   la première option. Ici il reste dans le flux et repousse les options. */
.wf_product_view .extra-options-accordion .wf-flat-style-title {
  position: relative;
  display: table;
  max-width: 100%;
  margin: -35px 0 8px -8px;
  padding: 4px 8px;
  line-height: 1.3;
  letter-spacing: .04em;
  color: var(--ui-text);
  text-decoration: none;
  background: var(--brand-surface);
}

.wf_product_view .woofood_flat_category > ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wf_product_view .wf_select_wrapper select { width: 100%; }

.wf_product_view .extra_options_checkbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .3rem 0;
  border-bottom: 1px dashed var(--brand-border);
}

.wf_product_view .extra_options_checkbox:last-of-type { border-bottom: 0; }

.wf_product_view .extra_options_label,
.wf_product_view .extra_options_value {
  float: none;
  width: auto;
}

.wf_product_view .extra_options_label label { margin: 0; }

.wf_product_view .woofood_additional_comments {
  width: 100%;
  min-height: 80px;
  margin: 1rem 0 0;
}

.woofood-cbx span:first-child { border-color: var(--ui-border-strong); }

.wf_product_view .extra-options-title {
  float: none;
  margin-top: 1rem;
  padding: .6rem .9rem;
  font-weight: 600;
  border-radius: var(--brand-radius-sm);
}

/* Cases à cocher des options WooFood */
.woofood-cbx:hover span:first-child { border-color: var(--brand-primary); }

.woofood-cbx span:first-child::before { background: var(--brand-primary); }

.inp-woofood-cbx:checked + .woofood-cbx span:first-child {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

@layer overrides {
  .wf_product_view .modal__container {
    padding: 0 !important;
  }

  /* Prix : le thème parent le met sur un fond rouge flottant */
  .wf_product_view .price {
    float: none !important;
    margin: .75rem 0 !important;
    padding: 0 !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    text-align: left !important;
    color: var(--ui-price) !important;
    background: transparent !important;
    border: 0 !important;
  }

  .wf_product_view .extra-options-title {
    color: var(--ui-text) !important;
    background: var(--brand-surface-alt) !important;
  }

  /* Sélecteur de quantité : même rendu « pilule » que partout ailleurs.
     float:none — le style inline float:left le cachait derrière le bouton. */
  .wf_product_view .quantity {
    display: inline-flex !important;
    float: none !important;
    gap: 0 !important;
    width: auto !important;
    margin: 1rem 0 !important;
    border: 1.5px solid var(--ui-border-strong) !important;
    border-radius: var(--brand-radius-btn) !important;
  }

  .wf_product_view .qty-change-button {
    width: 44px !important;
    height: 44px !important;
    color: var(--ui-text) !important;
    background: transparent !important;
    border-radius: 0 !important;
  }

  .wf_product_view .qty-change-button:hover {
    color: var(--brand-primary) !important;
    background: var(--ui-primary-soft) !important;
  }

  .wf_product_view input.qty {
    width: 48px !important;
    height: 44px !important;
    color: var(--ui-text) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
  }

  /* Bouton « Ajouter au panier » : occupe le pied collé en bas de la fenêtre */
  .wf_product_view .single_add_to_cart_button {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 60px !important;
    margin: 0 !important;
    padding: 1rem 1.25rem !important;
    font-family: var(--brand-font-body) !important;
    font-size: 1.0625rem !important;
    font-weight: 600 !important;
    letter-spacing: .01em !important;
    text-transform: none !important;
    color: var(--ui-btn-text) !important;
    -webkit-text-fill-color: var(--ui-btn-text) !important;
    background: var(--ui-btn-bg) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: 0 -4px 14px color-mix(in srgb, var(--brand-ink) 10%, transparent) !important;
  }

  .wf_product_view .single_add_to_cart_button:hover {
    background: var(--ui-btn-bg-hover) !important;
  }

  .wf_product_view .single_add_to_cart_button * {
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
  }
}

@media (max-width: 768px) {
  .wf_product_view .modal__overlay {
    align-items: stretch;
    padding: 0;
  }

  .wf_product_view .content {
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }

  /* Certains navigateurs posent leur barre du bas PAR-DESSUS la page
     (Chrome sur iPhone et sa nouvelle barre « Posez une question ») :
     le bouton collé en bas passait dessous. Cet espace en fin de fenêtre
     permet de le faire remonter au-dessus en faisant défiler. */
  .wf_product_view .content::after {
    content: "";
    flex: none;
    height: 5.5rem;
  }

  /* Chrome sur iPhone : le rouge du bouton se prolonge sous la barre du
     navigateur, le texte reste visible dès l'ouverture (01-tokens.css). */
  @layer overrides {
    .wf_product_view .single_add_to_cart_button {
      padding-bottom: calc(1rem + var(--ui-bottom-overlap)) !important;
    }
  }

  .wf_product_view h2.modal__title { font-size: 1.35rem; }

  .wf_product_view .modal__content { padding: 12px 16px; }
}

/* ---------------------------------------------------------------------
   5. FENÊTRES « VÉRIFIER LES DISPONIBILITÉS » ET « CHANGER D'ADRESSE »
   --------------------------------------------------------------------- */
.wf_availability_popup .modal__container,
.wf_address_change_modal .modal__container {
  padding: 0;
  overflow: hidden;
  border-radius: var(--brand-radius);
  box-shadow: var(--ui-shadow-lg);
}

.wf_availability_popup .modal__header,
.wf_address_change_modal .modal__header {
  justify-content: center;
  padding: 1.1rem 1.25rem;
}

.wf_availability_popup .modal__content,
.wf_address_change_modal .modal__content {
  margin: 0;
  padding: 1.25rem;
}

/* Le titre est déjà dans l'en-tête de la fenêtre */
.wf_availability_popup .woofood-address-title { display: none; }

.woofood-address-wrapper {
  margin: 0;
  padding: 0;
  background: transparent;
}

/* Choix Livraison / À emporter */
.woofood_order_type {
  display: flex;
  justify-content: center;
  gap: .75rem;
  margin: 0 0 1rem;
}

.woofood_order_type .wf_field_wrapper {
  flex: 1;
  width: auto;
  margin: 0;
  padding: .7rem .9rem .7rem 2.75rem;
  font-family: var(--brand-font-body);
  font-size: 1rem;
  font-weight: 600;
  border: 1.5px solid var(--brand-border);
  border-radius: var(--brand-radius-sm);
  cursor: pointer;
  transition: border-color var(--ui-speed), background-color var(--ui-speed);
}

.woofood_order_type .wf_field_wrapper:has(input:checked) {
  background: var(--ui-primary-soft);
  border-color: var(--brand-primary);
}

.wf_field_wrapper .checkmark {
  top: 50%;
  left: .75rem;
  width: 22px;
  height: 22px;
  background-color: var(--brand-surface);
  border: 1.5px solid var(--ui-border-strong);
  border-radius: 6px;
  transform: translateY(-50%);
}

.wf_field_wrapper:hover input ~ .checkmark { background-color: var(--ui-primary-soft); }

.wf_field_wrapper input:checked ~ .checkmark {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.wf_field_wrapper .checkmark::after {
  top: 3px;
  left: 6px;
}

/* Code postal + bouton Vérifier */
.woofood-address-wrapper .woofood-address-input {
  gap: .5rem;
  margin: 0;
}

.woofood-address-wrapper .woofood-address-input input {
  flex: 1;
  width: auto;
  min-width: 0;
}

.woofood-address-wrapper .woofood-address-check-btn {
  flex: none;
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.woofood-address-wrapper .woofood-address-results .availability-result {
  margin-top: 1rem;
  font-size: 1.05rem;
}

a.wf_start_order_btn {
  display: flex;
  width: 100%;
  min-height: 52px;
  margin: 1rem 0 0;
  font-size: 1.0625rem;
}

/* Temps de livraison / préparation */
.delivery_time h3,
span.wf_minutes_format.mins,
span.wf_minutes_format.minutes {
  color: var(--brand-primary-dark);
  background: var(--ui-primary-soft);
  border: 0;
  border-radius: var(--brand-radius-sm);
}

@media (max-width: 768px) {
  .wf_availability_popup .modal__overlay,
  .wf_address_change_modal .modal__overlay {
    padding: 12px;
  }

  .wf_availability_popup .modal__container,
  .wf_address_change_modal .modal__container {
    min-width: 0;
    min-height: 0;
  }

  .woofood_order_type { flex-direction: column; }
}
