/* ============================================================
   Header mega-menu dropdown (Max Mega Menu + custom HTML widget)
   Figma: okKz71Tz0fJUpG0W42z2eI / node 1287:2646

   Markup it styles:
     li.mega-menu-megamenu > ul.mega-sub-menu
       > li.mega-menu-row > ul > li.mega-menu-column > ul
         > li.mega-menu-item (custom HTML widget)
           > .textwidget.custom-html-widget > .menu-custom-dropdown
             > a > div > p + span
                 > div.dropdown-price

   The panel is selected with :has(.menu-custom-dropdown), so the rules
   follow the widget rather than a menu-item ID — drop the widget into any
   other mega-menu item and it picks the styling up. If :has() ever has to
   go, swap the scope selectors for `> li.mega-menu-item-2907`.
   ============================================================ */

:root {
  --im-dd-green: #00b67d;
  --im-dd-green-tint: #e6fcf4;
  --im-dd-ink: #0c1218;
  --im-dd-ink-soft: #2c3340;
  --im-dd-panel-width: 420px;
  --im-dd-panel-offset: 8px;
}

/* ---------- Panel ---------- */

/* MMM pins the panel to the menu wrapper (li is position:static);
   make it hang off the menu item instead, as in the design. */
#mega-menu-wrap-primary-menu
  #mega-menu-primary-menu
  > li.mega-menu-megamenu.mega-menu-item:has(.menu-custom-dropdown) {
  position: relative;
}

#mega-menu-wrap-primary-menu
  #mega-menu-primary-menu
  > li.mega-menu-megamenu
  > ul.mega-sub-menu:has(.menu-custom-dropdown) {
  left: 0;
  width: var(--im-dd-panel-width);
  max-width: calc(100vw - 32px);
  margin-top: var(--im-dd-panel-offset);
  padding: 8px;
  border-radius: 0;
  background-color: #ffffff;
  box-shadow: 0 12px 32px rgba(3, 38, 56, 0.28);
  overflow: visible;
}

/* Invisible bridge across the 8px gap so the panel does not close
   while the pointer travels from the menu item down to it. */
#mega-menu-wrap-primary-menu
  #mega-menu-primary-menu
  > li.mega-menu-megamenu
  > ul.mega-sub-menu:has(.menu-custom-dropdown)::before {
  content: "";
  display: block;
  position: absolute;
  top: calc(var(--im-dd-panel-offset) * -1);
  right: 0;
  left: 0;
  height: var(--im-dd-panel-offset);
  background: transparent;
}

/* Strip the grid widths, floats and 15px padding MMM generates around
   widgets. !important on purpose: these come from the plugin's generated
   stylesheet in /uploads/maxmegamenu/, which is rewritten whenever the menu
   theme is saved and carries deeper selectors than anything stable here. */
#mega-menu-wrap-primary-menu
  #mega-menu-primary-menu
  > li.mega-menu-megamenu
  > ul.mega-sub-menu:has(.menu-custom-dropdown) li.mega-menu-row,
#mega-menu-wrap-primary-menu
  #mega-menu-primary-menu
  > li.mega-menu-megamenu
  > ul.mega-sub-menu:has(.menu-custom-dropdown) li.mega-menu-column,
#mega-menu-wrap-primary-menu
  #mega-menu-primary-menu
  > li.mega-menu-megamenu
  > ul.mega-sub-menu:has(.menu-custom-dropdown) li.mega-menu-item {
  width: 100% !important;
  float: none !important;
  clear: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ---------- Widget ---------- */

.menu-custom-dropdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.menu-custom-dropdown *,
.menu-custom-dropdown *::before,
.menu-custom-dropdown *::after {
  box-sizing: border-box;
}

/* ---------- Item ---------- */

.menu-custom-dropdown > a {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px 14px 12px;
  border-radius: 6px;
  background-color: transparent;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.18s ease;
}

/* Left accent bar — 4 × 40, transparent until hover (Figma 1287:2698). */
.menu-custom-dropdown > a::before {
  content: "";
  display: block;
  flex: 0 0 4px;
  width: 4px;
  height: 40px;
  border-radius: 2px;
  background-color: var(--im-dd-green);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.menu-custom-dropdown > a:hover,
.menu-custom-dropdown > a:focus-visible,
.menu-custom-dropdown > a.is-active,
.menu-custom-dropdown > a[aria-current="page"] {
  background-color: var(--im-dd-green-tint);
  text-decoration: none;
}

.menu-custom-dropdown > a:hover::before,
.menu-custom-dropdown > a:focus-visible::before,
.menu-custom-dropdown > a.is-active::before,
.menu-custom-dropdown > a[aria-current="page"]::before {
  opacity: 1;
}

.menu-custom-dropdown > a:focus-visible {
  outline: 2px solid var(--im-dd-green);
  outline-offset: -2px;
}

/* ---------- Item text ---------- */

/* The unclassed div between the accent bar and the price. */
.menu-custom-dropdown > a > div:not(.dropdown-price) {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.menu-custom-dropdown > a p {
  margin: 0;
  padding: 0;
  color: var(--im-dd-ink);
  font-family: "Poppins", sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: 18px;
  line-height: 1.3;
}

.menu-custom-dropdown > a span {
  display: block;
  margin: 0;
  padding: 0;
  color: var(--im-dd-ink-soft);
  font-family: "Poppins", sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.35;
}

.menu-custom-dropdown > a .dropdown-price {
  flex: 0 0 auto;
  color: var(--im-dd-green);
  font-family: "Poppins", sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.35;
  white-space: nowrap;
}

/* ---------- Mobile / MMM accordion ---------- */

@media (max-width: 1024px) {
  #mega-menu-wrap-primary-menu
    #mega-menu-primary-menu
    > li.mega-menu-megamenu
    > ul.mega-sub-menu:has(.menu-custom-dropdown) {
    width: 100%;
    max-width: none;
    margin-top: 0;
    box-shadow: none;
  }

  #mega-menu-wrap-primary-menu
    #mega-menu-primary-menu
    > li.mega-menu-megamenu
    > ul.mega-sub-menu:has(.menu-custom-dropdown)::before {
    display: none;
  }

  .menu-custom-dropdown > a {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .menu-custom-dropdown > a .dropdown-price {
    flex: 0 0 100%;
    padding-left: 16px;
  }
}
