/* === Freshy v2 — thème orienté commande en ligne === */
:root{
  /* Couleurs & surfaces */
  --freshy-primary:#383e13;    /* vert très foncé */
  --freshy-accent:#FDE354;     /* jaune accent */
  --freshy-bg:#f9f9f9;
  --freshy-card:#ffffff;
  --freshy-text:#333333;
  --freshy-muted:#6b6b6b;

  /* Rayons / ombres */
  --freshy-radius:14px;
  --freshy-shadow:0 10px 30px rgba(0,0,0,.08);

  /* Offsets sticky (calculés/ajustés par JS) */
  --mp-sticky-offset: 56px;   /* hauteur header approx */
  --catbar-height: 48px;      /* hauteur bandeau catégories approx */

  /* Boutons Ant-like compacts */
  --mp-btn-size: 24px;
  --mp-radius: 3px;
  --mp-icon-size: 14px;
  --mp-icon-stroke: 1.75;
  --mp-antd-fg: rgba(0,0,0,.85);
  --mp-antd-bg: #f9f9f9;
  --mp-antd-border: #d9d9d9;
  --mp-antd-bg-hover: #ffffff;
  --mp-antd-border-hover: #bfbfbf;
  --mp-antd-bg-active: #f0f0f0;
  --mp-antd-focus: #383E13;

  /* Drawer */
  --mp-drawer-width: 440px;
  --mp-drawer-radius: 20px;
  --mp-drawer-shadow: -16px 0 40px rgba(0,0,0,.12);
  --mp-backdrop: rgba(0,0,0,.35);
  --mp-drawer-bg: #fff;
  --mp-drawer-border: #eee;

  /* Chips catégories */
  --chip-h: 38px;
  --chip-gap: .35rem;
  --chip-px: .55rem;
  --chip-radius: 9999px;
  --chip-font: .88rem;
  --chip-icon: 24px;
  --chip-border: #e5e7eb;
  --chip-bg: #fff;
  --chip-bg-selected: #f3fff6;
  --chip-border-selected: #28a745;

  /* Badge panier */
  --mp-badge-bg: #ff3b30;
  --mp-badge-color: #fff;
}

body.mp-freshy{
  background:var(--freshy-bg);
  color:var(--freshy-text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* Header */
.mp-freshy .header{
  background:var(--freshy-primary);
  border-bottom:1px solid rgba(255,255,255,.06);
}
.mp-freshy .header .nav-right a,
.mp-freshy .header .nav-right i{ color:#fff !important; }

/* === Catégories (sticky + compact) === */
.mp-freshy .categories-menu{
  position:sticky;
  top:var(--mp-sticky-offset);
  z-index:20;
  display:flex;
  gap: var(--chip-gap);
  overflow-x:auto;
  padding:.5rem .25rem;
  margin:0 0 .75rem 0;
  background:var(--freshy-bg);
  border-bottom:1px solid #eee;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x proximity;
}
.mp-freshy .categories-menu::-webkit-scrollbar{ display:none; }

.category-chip{
  display:inline-flex;
  align-items:center;
  gap:.45rem;
  height: var(--chip-h);
  padding: 0 var(--chip-px);
  border:1px solid var(--chip-border);
  border-radius: var(--chip-radius);
  background: var(--chip-bg);
  color:#111;
  text-decoration:none;
  line-height:1;
  box-shadow:0 1px 2px rgba(0,0,0,.05);
  white-space:nowrap;
  scroll-snap-align:center;
  transition: box-shadow .12s ease, border-color .12s ease, background .12s ease;
}
.category-chip:hover{ box-shadow:0 2px 8px rgba(0,0,0,.08); }
.category-chip.selected,
.category-chip.active{
  border-color: var(--chip-border-selected);
  background: var(--chip-bg-selected);
}
.chip-icon{
  width: var(--chip-icon);
  height: var(--chip-icon);
  border-radius:50%;
  object-fit:cover;
  display:block;
}
.chip-label{
  font-weight:600;
  font-size: var(--chip-font);
  line-height:1;
}

/* === Grille produits === */
.mp-freshy .products-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(270px,1fr));
  gap:16px;
}
.mp-freshy .section-title{
  font-size:1.05rem; font-weight:800; margin:1rem 0 .35rem;
}

/* Ancres de sections (pour le scroll avec offset sticky) */
.cat-section{
  scroll-margin-top: calc(var(--mp-sticky-offset) + var(--catbar-height) + 12px);
}

/* === Carte produit === */
.mp-freshy .card.product-card{
  background:var(--freshy-card);
  border:none; border-radius:var(--freshy-radius);
  box-shadow:var(--freshy-shadow);
  padding:12px;
  display:flex; flex-direction:column; gap:10px;
}

/* Image carrée robuste (1 seule méthode) */
.mp-freshy .product-card .image-container{
  position: relative;
  overflow: hidden;
  border-radius: var(--freshy-radius);
  background: #f2f2f2;
  aspect-ratio: 1 / 1; /* carré moderne */
}

/* Fallback si aspect-ratio non supporté */
@supports not (aspect-ratio: 1 / 1) {
  .mp-freshy .product-card .image-container::before{
    content:"";
    display:block;
    padding-top:100%; /* carré */
  }
}

.mp-freshy .product-card .image-container img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ⚠️ À SUPPRIMER (elle casse la hauteur) :
.mp-freshy .product-card .product-image{
  width:100%; height:0; padding-bottom:100%;
  object-fit:cover; display:block; border-radius:0 !important;
}
*/



/* Prix (badge) */
.mp-freshy .product-card .mask{
  position:absolute; inset:auto auto 8px 8px;
  display:inline-flex; align-items:center; justify-content:center;
  background:rgba(56,62,19,.92);
  color:#fff; border-radius:10px; padding:6px 10px;
  box-shadow:0 6px 16px rgba(0,0,0,.2);
}
.mp-freshy .product-card .mask .badge{
  background:transparent !important; font-weight:700; font-size:14px; padding:0;
}

/* + flottant */
.mp-freshy .product-card .add-to-cart-smart{
  position:absolute; right:8px; bottom:8px; z-index:2;
  display:inline-flex; align-items:center; justify-content:center;
  width:48px; height:48px; border-radius:10px;
  background:var(--freshy-accent); border:none;
  box-shadow:0 6px 18px rgba(0,0,0,.18);
  transition:transform .12s ease;
}
.mp-freshy .product-card .add-to-cart-smart i{ display:none; }
.mp-freshy .product-card .add-to-cart-smart::before{
  content:"+"; font-size:26px; line-height:1; color:#222; font-weight:700;
}
.mp-freshy .product-card .add-to-cart-smart:hover{ transform:translateY(-2px); }

/* Texte */
.mp-freshy .product-card .card-body{ padding:0 2px; }
.mp-freshy .product-card .card-title{
  font-size:16px; font-weight:700; margin:0 0 4px 0; color:#111;
}
.mp-freshy .product-card p.text-muted{
  color:var(--freshy-muted) !important; font-size:13px; margin:0 0 6px 0;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}

/* Allergènes bouton */
.mp-freshy .product-card .btn-outline-success.btn-sm{
  border-color:#e5e5e5; color:#2d7a46;
  padding:.15rem .5rem; border-radius:999px; font-size:12px;
}

/* Toasts */
#notification.notification-container{
  right:16px; bottom:16px; background:#212121; border-radius:12px;
  padding:.75rem 1rem; box-shadow:var(--freshy-shadow);
}

/* === Drawer (panier) === */
#mp-backdrop{ background: var(--mp-backdrop); }
#mp-drawer{
  width: var(--mp-drawer-width);
  background: var(--mp-drawer-bg);
  box-shadow: var(--mp-drawer-shadow);
  border-radius: 0 0 0 var(--mp-drawer-radius);
}
#mp-drawer .hdr{ border-bottom:1px solid var(--mp-drawer-border); }

/* Badge panier */
#cart-counter{
  position:absolute; top:-6px; right:-6px;
  min-width: 1.25rem; height: 1.25rem; line-height:1.25rem;
  font-size:.75rem; text-align:center; padding:0 .35rem;
  border-radius:9999px; color: var(--mp-badge-color); background: var(--mp-badge-bg);
  box-shadow:0 2px 6px rgba(0,0,0,.2);
}

/* === Boutons Ant Design-like === */
.mp-icon{ width:var(--mp-icon-size); height:var(--mp-icon-size); display:inline-block; vertical-align:middle; }
.mp-icon *{ stroke:currentColor; stroke-width:var(--mp-icon-stroke); }

.mp-icon-btn{
  -webkit-text-size-adjust:100%;
  -webkit-tap-highlight-color:rgba(0,0,0,0);
  pointer-events:auto;
  display:inline-flex; align-items:center; justify-content:center;
  width:var(--mp-btn-size); height:var(--mp-btn-size); box-sizing:border-box;
  font-family:inherit; font-size:14px; line-height:1.5715; font-weight:400;
  white-space:nowrap; text-align:center; text-align-last:center; text-transform:none;
  user-select:none; cursor:pointer;
  color:var(--mp-antd-fg);
  background:var(--mp-antd-bg);
  border:1px solid var(--mp-antd-border);
  border-radius:var(--mp-radius);
  text-shadow:none; box-shadow:none;
  transition:background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .03s ease;
}
.mp-icon-btn:hover{ background:var(--mp-antd-bg-hover); border-color:var(--mp-antd-border-hover); }
.mp-icon-btn:active{ background:var(--mp-antd-bg-active); transform:translateY(0.5px); }
.mp-icon-btn:focus-visible{ outline:0; box-shadow:0 0 0 2px color-mix(in srgb, var(--mp-antd-focus) 30%, transparent); }
.mp-qty-btn{ width:var(--mp-btn-size); height:var(--mp-btn-size); }
.mp-icon-btn.mp-danger{ color:#a8071a; background:#fff1f0; border-color:#ffa39e; }
.mp-icon-btn.mp-danger:hover{ background:#fff2f0; border-color:#ff7875; }
.mp-icon-btn.mp-accent{ background:var(--mp-accent); border-color:var(--mp-accent); color:#fff; }
.mp-icon-btn.mp-accent .mp-icon *{ stroke:#fff; }
.mp-icon-btn[disabled], .mp-icon-btn[aria-disabled="true"]{ cursor:not-allowed; opacity:.55; pointer-events:none; }

/* Petits écrans */
@media (max-width: 576px){
  .mp-freshy .categories-menu{ top: calc(var(--mp-sticky-offset) - 4px); }
  #mp-drawer{ width:100%; border-radius:0; }
}
/* Permet au sticky de fonctionner si un parent posait overflow/transform */
.app, .layout, .page-container, .main-content {
  overflow: visible !important;
  transform: none !important;
}
/* Force square image to render, independent of other CSS order */
.image-container { position: relative; }
.image-container .ratio-1x1 { position: relative; padding-top: 100%; }
.image-container .ratio-1x1 > .product-image {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}

/* If theme draws the + with ::before, hide the fallback SVG */
.mp-freshy .product-card .add-to-cart-smart .mp-icon { display: none; }
/* 2 vignettes par ligne sur mobile (Bootstrap xs: <576px) */
@media (max-width: 575.98px){
  .mp-freshy .products-grid,
  .products-grid{
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px; /* optionnel: resserre l'espacement */
  }

  /* Petites retouches optionnelles pour tenir sur 2 colonnes */
  .mp-freshy .product-card{ padding: 8px; }
  .mp-freshy .product-card .card-title{ font-size: 14px; }
  .mp-freshy .product-card p.text-muted{ font-size: 12px; }
  .mp-freshy .product-card .add-to-cart-smart{ width: 42px; height: 42px; }
  .mp-freshy .product-card .mask .badge{ font-size: 13px; }
}
