/**
 * Z.One - Mega Menu - front styles
 *
 * The module ships with no front CSS of its own: on the original "ZOneTheme"
 * theme these styles lived in the theme itself (_dev/css/aone/_aonemegamenu.scss).
 * Since this shop runs the Cartzilla-based "lafrancaisedupoele" theme instead,
 * this stylesheet ports the same visual behaviour (desktop hover mega menu +
 * mobile accordion) as plain CSS scoped to the module's own markup, so it
 * works regardless of the active theme.
 *
 * Design tokens below are pulled from the theme's own palette/spacing scale
 * (see themes/cartzilla/_dev/css/helpers/_variables.scss) instead of the
 * Bootstrap defaults the module originally shipped with, and - where
 * possible - from the theme's own runtime CSS custom properties (written by
 * PrettyBlocks' theme settings into `:root`, e.g. `--nav-link-color`), so the
 * menu automatically follows whatever colors/fonts are configured in the
 * back office rather than a second, hardcoded source of truth:
 *   --font-family-sans-serif  (theme setting, e.g. "Poppins, sans-serif")
 *   --nav-link-color          (same color as the native .main-menu .nav-link)
 *   --nav-link-hover-color    (same hover color as the native .main-menu .nav-link)
 *   --nav-bar-bg              (background of the nav bar row, "nav-bar-bg")
 *   --body-color              (theme's $body-color, secondary/description text)
 *   --primary                 (theme's $primary, #fe696a)
 * Each has a hardcoded fallback matching the theme's SCSS defaults, in case
 * an older theme settings payload doesn't define it yet.
 *
 * @author Maxime Potier <contact@maximepotier.fr>
 */

/* ==========================================================================
   Desktop mega menu (#amegamenu, injected via the "displayNavFullWidth" hook)
   ========================================================================== */

/*
 * The module renders BOTH the desktop bar (#amegamenu) and the mobile
 * accordion (#mobile-amegamenu) on every request - which one is visible is
 * decided here by viewport width, matching the theme's own
 * "navbar-expand-lg" breakpoint (992px, see cartzilla's $grid-breakpoints).
 * This is more robust than the module's original server-side User-Agent
 * detection, which broke as soon as the real viewport was narrow but the UA
 * wasn't a real phone (desktop browser resized down, responsive mode
 * without device emulation, tablets in landscape, etc.).
 */
@media (max-width: 991.98px) {
  #amegamenu {
    display: none !important;
  }
}

@media (min-width: 992px) {
  #mobile-amegamenu {
    display: none !important;
  }
}

#amegamenu {
  position: relative;
  width: 100%;
  background: var(--nav-bar-bg, #fff);
  border-top: 1px solid #e3e9ef;
  font-family: var(--font-family-sans-serif, inherit);
}

#amegamenu .anav-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Deliberately NOT "position: relative" here: `.adropdown` is absolutely
   positioned and its "Dropdown Width" percentage (20/40/60/80/100%, see the
   .adrd1-.adrd5 rules below) needs to resolve against the FULL mega menu bar
   width, not against this tiny nav item (which is only as wide as its own
   label text) - percentage width/max-width on an absolutely positioned box
   always resolves against its nearest *positioned* ancestor's width, so this
   item must stay `position: static` and let `#amegamenu` (which already has
   `position: relative`, see above) be that containing block instead. Bug
   found 2026-07-13: with `position: relative` here, every "Dropdown Width"
   setting was silently clamped down near the item's own (tiny) width by the
   `max-width: 100%` rule below, making the setting look like it had no
   effect at all. Horizontal centering under the (now off-item) dropdown is
   still handled correctly by `mpZmmPositionDropdowns()` in front.js, which
   computes its own `margin-left` from `$item.position().left` regardless of
   which element is the CSS containing block. */
#amegamenu .amenu-item {
  margin: 0 2px;
}

#amegamenu .amenu-link {
  display: flex;
  align-items: center;
  padding: 14px 15px;
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--nav-link-color, #373f50);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.25s ease-in-out;
}

#amegamenu .amenu-link:hover,
#amegamenu .amenu-item.hover .amenu-link,
#amegamenu .amenu-item:hover .amenu-link {
  color: var(--nav-link-hover-color, var(--primary, #fe696a));
  text-decoration: none;
}

#amegamenu .amenu-link > img {
  max-height: 22px;
  width: auto;
  margin-right: 8px;
}

#amegamenu .amenu-link > sup {
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 2px;
  background-color: var(--primary, #fe696a);
  color: #fff;
  font-size: 10px;
  font-weight: 400;
  line-height: 14px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Chevron indicator for menu items with a dropdown, using the theme's own
   icon font (cartzilla-icons, same glyph as ps_mainmenu's czi-arrow-down)
   so it stays visually consistent without needing to touch the module's
   .tpl markup. */
#amegamenu .amenu-item.plex > .amenu-link::after {
  content: "\e906";
  display: inline-block;
  margin-left: 6px;
  font-family: 'cartzilla-icons' !important;
  font-size: 10px;
  line-height: 1;
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  transition: transform 0.25s ease-in-out;
}

#amegamenu .amenu-item.plex:hover > .amenu-link::after,
#amegamenu .amenu-item.plex.hover > .amenu-link::after {
  transform: rotate(180deg);
}

/* Dropdown panel - clean, shadow-driven "card" instead of a hard-bordered
   box, matching the theme's own floating dropdowns/cards (cart preview,
   account menu, product cards: soft dual-layer shadow, no visible border,
   rounded corners - see $box-shadow / $border-radius in
   themes/cartzilla/_dev/css/helpers/_variables.scss). */
#amegamenu .adropdown {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 1000;
  min-width: 240px;
  max-width: 100%;
  max-height: calc(100vh - 220px);
  overflow: auto;
  margin-top: 0;
  visibility: hidden;
  opacity: 0;
  transform: translateY(6px);
  background: var(--nav-bar-bg, #fff);
  border: 0;
  border-radius: 0 0 0.3125rem 0.3125rem;
  box-shadow: 0 0.25rem 0.5625rem -0.0625rem rgba(0, 0, 0, 0.03), 0 0.275rem 1.25rem -0.0625rem rgba(0, 0, 0, 0.08);
  transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out, visibility 0.25s;
  pointer-events: none;
}

#amegamenu .amenu-item.plex:hover .adropdown,
#amegamenu .amenu-item.plex.hover .adropdown {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#amegamenu .adropdown.adrd1 { width: 20%; min-width: 220px; }
#amegamenu .adropdown.adrd2 { width: 40%; min-width: 420px; }
#amegamenu .adropdown.adrd3 { width: 60%; min-width: 620px; }
#amegamenu .adropdown.adrd4 { width: 80%; min-width: 760px; }
#amegamenu .adropdown.adrd5 { width: 100%; }

#amegamenu .dropdown-wrapper {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  padding: 14px 12px;
}

#amegamenu .dropdown-bgimage {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: cover;
  z-index: 0;
}

#amegamenu .dropdown-content {
  position: relative;
  z-index: 1;
  width: 100%;
}

#amegamenu .content-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  width: 100%;
}

#amegamenu .aitem {
  padding: 8px 14px;
  box-sizing: border-box;
}

/* flex-basis (not just width) is set explicitly here so the column count
   configured in the back office ("Columns: 1/2/3/4/5 colonnes") is never
   overridden by a flex item's own auto-sizing/shrinking behaviour. */
#amegamenu .acot1 .aitem { width: 100%; flex: 0 0 100%; }
#amegamenu .acot2 .aitem { width: 50%; flex: 0 0 50%; }
#amegamenu .acot3 .aitem { width: 33.3333%; flex: 0 0 33.3333%; }
#amegamenu .acot4 .aitem { width: 25%; flex: 0 0 25%; }
#amegamenu .acot5 .aitem { width: 20%; flex: 0 0 20%; }

/* Category / product / manufacturer dropdown content */
#amegamenu .category-title {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--dark, #2b3445);
}

#amegamenu .category-title a {
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  transition: color 0.25s ease-in-out;
}

#amegamenu .category-title a:hover {
  color: var(--nav-link-hover-color, var(--primary, #fe696a));
}

#amegamenu .category-title img {
  max-height: 22px;
  width: auto;
  margin-right: 8px;
}

#amegamenu .category-subs {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}

#amegamenu .category-subs li {
  padding: 4px 0;
}

#amegamenu .category-subs a {
  display: flex;
  align-items: center;
  color: var(--body-color, #4b566b);
  text-decoration: none;
  transition: color 0.25s ease-in-out;
}

#amegamenu .category-subs a:hover {
  color: var(--nav-link-hover-color, var(--primary, #fe696a));
}

#amegamenu .aproduct-content .product-container {
  max-width: 180px;
  margin: 0 auto;
  text-align: center;
}

#amegamenu .aproduct-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.3125rem;
}

#amegamenu .aproduct-content .product-name {
  display: block;
  padding: 10px 0 2px;
  font-size: 0.875rem;
  color: var(--dark, #2b3445);
  text-decoration: none;
  transition: color 0.25s ease-in-out;
}

#amegamenu .aproduct-content a:hover .product-name {
  color: var(--nav-link-hover-color, var(--primary, #fe696a));
}

#amegamenu .amanufacturer-content {
  text-align: center;
}

#amegamenu .amanufacturer-content .brand-logo img {
  max-height: 40px;
  width: auto;
  transition: opacity 0.25s ease-in-out;
}

#amegamenu .amanufacturer-content .brand-logo:hover img {
  opacity: 0.75;
}

#amegamenu .ahtml-content {
  width: 100%;
}

#amegamenu .ahtml-content h1,
#amegamenu .ahtml-content h2,
#amegamenu .ahtml-content h3,
#amegamenu .ahtml-content h4 {
  margin-top: 0;
  color: var(--dark, #2b3445);
}

/* Highlight the current page's menu entry (via breadcrumb match) */
#amegamenu .amenu-item.curr-menu > .amenu-link {
  color: var(--nav-link-hover-color, var(--primary, #fe696a));
}

/* ==========================================================================
   Mobile accordion menu (#mobile-amegamenu, injected inside #navbarCollapse
   via the "displayMobileMenu" hook, so it opens/closes with the header's
   hamburger button)
   ========================================================================== */

#mobile-amegamenu {
  width: 100%;
  padding: 6px 0;
  border-top: 1px solid #e3e9ef;
  font-family: var(--font-family-sans-serif, inherit);
}

#mobile-amegamenu .anav-top {
  margin: 0;
  padding: 0;
  list-style: none;
}

#mobile-amegamenu .amenu-item {
  border-bottom: 1px solid #eff2f6;
}

#mobile-amegamenu .amenu-item-row {
  display: flex;
  align-items: center;
}

#mobile-amegamenu .amenu-item-row > .amenu-link {
  flex: 1 1 auto;
  min-width: 0;
}

#mobile-amegamenu .amenu-link {
  display: flex;
  align-items: center;
  padding: 12px 5px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--nav-link-color, #373f50);
  text-decoration: none;
}

#mobile-amegamenu .amenu-link > img {
  max-height: 20px;
  width: auto;
  margin-right: 8px;
}

#mobile-amegamenu .mobile-toggle-plus {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin-left: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--body-color, #7d879c);
}

#mobile-amegamenu .mobile-toggle-plus .material-icons {
  font-size: 18px;
  line-height: 24px;
}

#mobile-amegamenu .mobile-toggle-plus .remove {
  display: none;
}

#mobile-amegamenu .amenu-item.expanded .mobile-toggle-plus .remove {
  display: inline-block;
}

#mobile-amegamenu .amenu-item.expanded .mobile-toggle-plus .add {
  display: none;
}

#mobile-amegamenu .amenu-item.expanded > .amenu-item-row > .amenu-link {
  color: var(--nav-link-hover-color, var(--primary, #fe696a));
}

#mobile-amegamenu .adropdown {
  display: none;
  padding: 4px 5px 12px 15px;
}

#mobile-amegamenu .dropdown-bgimage {
  display: none;
}

#mobile-amegamenu .content-grid {
  display: flex;
  flex-wrap: wrap;
}

#mobile-amegamenu .aitem {
  width: 100%;
  padding: 4px 0;
}

#mobile-amegamenu .category-title {
  margin: 6px 0 4px;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--dark, #2b3445);
}

#mobile-amegamenu .category-subs {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
}

#mobile-amegamenu .category-subs a,
#mobile-amegamenu .aproduct-content a,
#mobile-amegamenu .amanufacturer-content a {
  display: block;
  padding: 3px 0;
  color: var(--body-color, #4b566b);
  text-decoration: none;
}
