/* =========================================================
   Bocca Piena — Mega Menu
   ========================================================= */

/* ========= Variables principales ========= */
:root {
  --bp-primary: var(--theme-palette-color-1);
  --bp-primary-dark: var(--theme-palette-color-2);
  --bp-text: var(--theme-palette-color-3);
  --bp-title: var(--theme-palette-color-4);
  --bp-border: var(--theme-palette-color-5);
  --bp-bg: var(--theme-palette-color-6);
  --bp-bg-alt: var(--theme-palette-color-7);
  --bp-white: var(--theme-palette-color-8);
}

/* ========= Panneau générique ========= */
.bwc-mega .bwc-mega-panel {
  display: none;
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  z-index: 9999;
  width: var(--theme-container-width);
  max-width: var(--theme-normal-container-max-width);
  padding: 40px 50px;
  background: var(--theme-palette-color-8);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  border-radius: 0 0 10px 10px;
  border: none;
}
.bwc-mega:hover .bwc-mega-panel,
.bwc-mega:focus-within .bwc-mega-panel {
  display: block;
}

/* ========= Grille ========= */
.bwc-mega-grid {
  display: grid;
  gap: 50px;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
}
.bwc-mega-grid.cols-1 {
  --cols: 1;
}
.bwc-mega-grid.cols-2 {
  --cols: 2;
}
.bwc-mega-grid.cols-3 {
  --cols: 3;
}

.bwc-mega-col {
  position: relative;
  display: flex;
  flex-direction: column;
}

.bwc-mega-col:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 0;
  right: -25px;
  width: 1px;
  height: 100%;
}

/* ========= Titres ========= */
.bwc-col-title {
  font-weight: 700;
  font-size: 0.95em;
  text-transform: uppercase;
  margin-bottom: 16px;
  color: var(--bp-title);
  transition: 0.3s;
}
.bwc-col-title:hover {
  color: var(--bp-primary-dark);
  transform: translateX(3px);
}

/* ========= Liste produits ========= */
.bwc-products {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #999 #f0f0f0;
}
.bwc-product {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 15px;
  border-radius: 6px;
  transition: 0.25s;
}
.bwc-product::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 60%;
  border-radius: 0 2px 2px 0;
  transition: width 0.25s;
}
.bwc-product:hover::before {
  width: 3px;
}
.bwc-product a {
  width: 100%;
  text-decoration: none;
}
.bwc-title {
  color: var(--bp-text);
  transition: color 0.3s;
  font-weight: 500;
  line-height: 1.5;
}
.bwc-product:hover .bwc-title {
  color: var(--bp-primary);
}

/* ===============
      VARIANTES 
   =============== */

/* 245 — Nos glaces */
#menu-item-245 .bwc-col-title {
  color: var(--theme-palette-color-2);
}

#menu-item-245 .bwc-product::before {
  background: var(--theme-palette-color-2);
}

#menu-item-245 .bwc-product:hover::before {
  background: var(--theme-palette-color-2);
}

#menu-item-245 .bwc-product:hover .bwc-title {
  color: var(--theme-palette-color-2);
}

#menu-item-245 .bwc-mega-col:not(:last-child)::after {
  background: linear-gradient(
    to bottom,
    transparent 0%,
    color-mix(in srgb, var(--theme-palette-color-2) 20%, transparent) 5%,
    color-mix(in srgb, var(--theme-palette-color-2) 60%, transparent) 15%,
    var(--theme-palette-color-2) 50%,
    color-mix(in srgb, var(--theme-palette-color-2) 60%, transparent) 85%,
    color-mix(in srgb, var(--theme-palette-color-2) 20%, transparent) 95%,
    transparent 100%
  );
}

/* 249 — Nos pâtisseries glacées */
#menu-item-249 .bwc-col-title {
  color: var(--theme-palette-color-9);
}
#menu-item-249 .bwc-product::before {
  background: var(--theme-palette-color-9);
}
#menu-item-249 .bwc-product:hover::before {
  background: var(--theme-palette-color-9);
}
#menu-item-249 .bwc-product:hover .bwc-title {
  color: var(--theme-palette-color-9);
}
#menu-item-249 .bwc-mega-col:not(:last-child)::after {
  background: linear-gradient(
    to bottom,
    transparent 0%,
    color-mix(in srgb, var(--theme-palette-color-9) 20%, transparent) 5%,
    color-mix(in srgb, var(--theme-palette-color-9) 60%, transparent) 15%,
    var(--theme-palette-color-9) 50%,
    color-mix(in srgb, var(--theme-palette-color-9) 60%, transparent) 85%,
    color-mix(in srgb, var(--theme-palette-color-9) 20%, transparent) 95%,
    transparent 100%
  );
}

/* ========= Mobile : on coupe le méga-menu ========= */
@media (max-width: 1024px) {
  .ct-panel[data-id="mobile-menu"] .bwc-mega,
  .ct-panel--mobile-menu .bwc-mega,
  .ct-drawer .bwc-mega {
    display: none !important;
  }
}
