/* assets/css/emimw/mobile-panel.css
 * EM Inline Menu — Mobile Panel
 *
 * UPDATED (Mobile tap/redirect hard fix):
 * - Closed panel is now moved fully off-screen (translateY(110%)).
 * - When [hidden] is present, the panel becomes display:none (hard removal).
 * - JS applies inert immediately on close and sets hidden after transition.
 */

/* ===== Full-width fixed mobile panel ===== */
.emimw-nav__panel {
  position: fixed;
  left: 0;
  right: 0;
  width: 100vw;
  display: flex;
  flex-direction: column;
  bottom: 0;

  height: calc(var(--emimw-vvh, 100dvh) - var(--emimw-panel-top, 0px));
  max-height: calc(var(--emimw-vvh, 100dvh) - var(--emimw-panel-top, 0px));

  background: #fff;

  opacity: 0;
  visibility: hidden;

  /* IMPORTANT: move fully off-screen when closed (prevents hit-testing bugs on iOS) */
  transform: translateY(110%);

  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;

  border-radius: 0;
  isolation: isolate;

  overflow: hidden;

  /* Closed panel must not capture taps */
  pointer-events: none;
}

/* HARD KILL: when hidden attribute is present, panel must not exist for hit testing */
.emimw-nav__panel[hidden] {
  display: none !important;
}

@supports not (height: 100dvh) {
  .emimw-nav__panel {
    height: calc(var(--emimw-vvh, 100vh) - var(--emimw-panel-top, 0px));
    max-height: calc(var(--emimw-vvh, 100vh) - var(--emimw-panel-top, 0px));
  }
}

/* Open */
.emimw-nav.is-open .emimw-nav__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);

  /* Only open panel can capture taps */
  pointer-events: auto;
}

/* ===== Real scroll target (set by JS) ===== */
.emimw-nav__panel [data-emimw-scroll-el="1"],
.emimw-nav__panel[data-emimw-scroll-el="1"] {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;

  padding-bottom: calc(
    var(--emimw-panel-bottom-pad, 50px) + env(safe-area-inset-bottom, 0px)
  ) !important;

  box-sizing: border-box;
}

/* ===== Panel list base ===== */
.emimw-nav__panel .emimw-nav__panel-list,
.emimw-nav__panel .menu {
  list-style: none;
  margin: 0;

  padding-top: 14px;
  padding-right: 14px;
  padding-left: 14px;

  display: flex;
  flex-direction: column;
  gap: 10px;

  flex: 1 1 auto;
  min-height: 0;
  box-sizing: border-box;

  height: auto !important;
  max-height: none !important;
}

/* Spacer appended by JS */
.emimw-scroll-spacer {
  display: block;
  width: 100%;
}

/* LI */
.emimw-nav__panel li {
  position: relative;
}

/* ===== Curtain reveal animation (class applied to PANEL) ===== */
.emimw-nav__panel.emimw-panel-curtain .emimw-panel-row.emimw-row-prep {
  opacity: 0;
  transform: translateY(-18px);
  pointer-events: none;
}

.emimw-nav__panel.emimw-panel-curtain .emimw-panel-row.emimw-row-in {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* While curtain is active, make the reveal itself slower (does not affect hover after cleanup) */
.emimw-nav__panel.emimw-panel-curtain .emimw-panel-row.emimw-row-prep,
.emimw-nav__panel.emimw-panel-curtain .emimw-panel-row.emimw-row-in {
  transition:
    opacity 900ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 900ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 220ms ease,
    background 220ms ease,
    border-color 220ms ease !important;
}

/* ===== Modern row “card” styling ===== */
.emimw-panel-row {
  position: relative;
  display: block;
  width: 100%;

  border-radius: 14px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);

  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.04),
    0 10px 18px rgba(15, 23, 42, 0.06);

  overflow: hidden;

  transition:
    transform 180ms ease,
    box-shadow 220ms ease,
    background 220ms ease,
    border-color 220ms ease,
    opacity 260ms ease;

  will-change: transform, opacity;
}

/* Link in row */
.emimw-nav__panel .emimw-panel-row > a {
  width: 100%;
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 12px;

  text-decoration: none;
  color: inherit;

  padding: 14px 14px;
  border-radius: 0;

  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ===== ICON SIZING (TOP LEVEL + GENERAL) ===== */
.emimw-nav__panel .emimw-panel-row > a .emimw-item-icon {
  width: var(--emimw-mi-w-m, var(--emimw-icon-size, 28px));
  height: var(--emimw-mi-h-m, var(--emimw-icon-size, 28px));

  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  line-height: 0;
}

/* Make icon media fill the icon box */
.emimw-nav__panel .emimw-panel-row > a .emimw-item-icon img,
.emimw-nav__panel .emimw-panel-row > a .emimw-item-icon .emimw-item-icon__img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Inline SVG icons fill the box */
.emimw-nav__panel .emimw-panel-row > a .emimw-item-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Dashicons fill the box */
.emimw-nav__panel .emimw-panel-row > a .emimw-item-icon .dashicons {
  width: 100%;
  height: 100%;
  font-size: 100%;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.emimw-panel-row:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.03),
    0 6px 12px rgba(15, 23, 42, 0.05);
}

@media (hover: hover) and (pointer: fine) {
  .emimw-panel-row:hover {
    background: rgba(15, 23, 42, 0.06);
    border-color: rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
    box-shadow:
      0 1px 0 rgba(15, 23, 42, 0.04),
      0 14px 24px rgba(15, 23, 42, 0.08);
  }
}

/* Open parent highlight */
.emimw-nav__panel li.emimw-sub-open > .emimw-panel-row {
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow:
    0 1px 0 rgba(37, 99, 235, 0.04),
    0 16px 26px rgba(37, 99, 235, 0.10);
}

/* Reserve space for toggle */
.emimw-panel-row[data-emimw-row-toggle="1"] > a {
  padding-right: 64px;
}

/* ===== Toggle button: ICON-ONLY (NO circle background) + fixed center ===== */
.emimw-sub-toggle {
  position: absolute;
  right: 12px;

  top: 50% !important;
  transform: translateY(-50%) !important;

  width: 42px;
  height: 42px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 !important;
  margin: 0 !important;

  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;

  line-height: 0;
  font-size: 0;

  transition: opacity 160ms ease;
}

.emimw-sub-toggle:hover,
.emimw-sub-toggle:active,
.emimw-sub-toggle:focus,
.emimw-sub-toggle:focus-visible {
  transform: translateY(-50%) !important;
  outline: none !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.emimw-nav__panel li.emimw-sub-open > .emimw-panel-row > .emimw-sub-toggle {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.emimw-sub-toggle,
.emimw-sub-toggle * {
  box-sizing: border-box;
}

/* ===== Toggle icon: single centered SVG that rotates 180deg ===== */
.emimw-sub-toggle__icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.emimw-sub-toggle__icon svg.emimw-sub-toggle__svg {
  width: 18px;
  height: 18px;
  display: block;

  transform: rotate(0deg);
  transform-origin: 50% 50%;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.emimw-nav__panel li.emimw-sub-open
  > .emimw-panel-row
  > .emimw-sub-toggle
  .emimw-sub-toggle__icon svg.emimw-sub-toggle__svg {
  transform: rotate(180deg);
}

.emimw-sub-toggle.emimw-tgl-opening .emimw-sub-toggle__icon,
.emimw-sub-toggle.emimw-tgl-closing .emimw-sub-toggle__icon {
  animation: none !important;
}

/* ===== PREMIUM COLLAPSE WRAPPER ===== */
.emimw-collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(10px);

  transition:
    grid-template-rows 620ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 520ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 520ms cubic-bezier(0.16, 1, 0.3, 1);

  will-change: grid-template-rows, opacity, transform;
  pointer-events: none;
}

.emimw-collapse__inner {
  overflow: hidden;
  min-height: 0;
}

.emimw-nav__panel li.emimw-sub-open > .emimw-collapse {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.emimw-collapse.emimw-collapse--waapi {
  display: block;
  grid-template-rows: none;
  transition: none;
  will-change: auto;
  pointer-events: none;
}

.emimw-nav__panel li.emimw-sub-open > .emimw-collapse.emimw-collapse--waapi {
  pointer-events: auto;
}

/* ===== PANEL SUBMENU VISIBILITY OVERRIDES (CRITICAL) ===== */
.emimw-nav__panel .emimw-panel-submenu,
.emimw-nav__panel .sub-menu,
.emimw-nav__panel .emimw-nav__submenu {
  position: static !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;

  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;

  pointer-events: auto !important;

  height: auto !important;
  max-height: none !important;

  list-style: none;
  margin: 10px 0 0 12px;
  padding: 0 0 0 12px;

  border-left: 1px solid rgba(15, 23, 42, 0.10);

  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Submenu links */
.emimw-nav__panel .emimw-panel-submenu a,
.emimw-nav__panel .sub-menu a,
.emimw-nav__panel .emimw-nav__submenu a {
  display: flex;
  align-items: center;
  gap: 12px;

  text-decoration: none;

  padding: 12px 12px;
  border-radius: 12px;

  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.06);

  transition: background 220ms ease, border-color 220ms ease, transform 180ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .emimw-nav__panel .emimw-panel-submenu a:hover,
  .emimw-nav__panel .sub-menu a:hover,
  .emimw-nav__panel .emimw-nav__submenu a:hover {
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.10);
    transform: translateY(-1px);
  }
}

/* Submenu icon sizing */
.emimw-nav__panel .emimw-panel-submenu .emimw-item-icon,
.emimw-nav__panel .sub-menu .emimw-item-icon,
.emimw-nav__panel .emimw-nav__submenu .emimw-item-icon {
  width: var(--emimw-sub-icon-size, 18px);
  height: var(--emimw-sub-icon-size, 18px);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

/* Ensure submenu icon media fills */
.emimw-nav__panel .emimw-panel-submenu .emimw-item-icon img,
.emimw-nav__panel .sub-menu .emimw-item-icon img,
.emimw-nav__panel .emimw-nav__submenu .emimw-item-icon img,
.emimw-nav__panel .emimw-panel-submenu .emimw-item-icon svg,
.emimw-nav__panel .sub-menu .emimw-item-icon svg,
.emimw-nav__panel .emimw-nav__submenu .emimw-item-icon svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.emimw-nav__panel .emimw-panel-submenu .emimw-item-icon .dashicons,
.emimw-nav__panel .sub-menu .emimw-item-icon .dashicons,
.emimw-nav__panel .emimw-nav__submenu .emimw-item-icon .dashicons {
  width: 100%;
  height: 100%;
  font-size: 100%;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Template block */
.emimw-panel-template {
  margin: 10px 0 0 12px;
  padding: 0 0 0 12px;

  border-left: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 12px;

  background: rgba(15, 23, 42, 0.02);
  overflow: hidden;

  position: static !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

.emimw-panel-template * {
  max-width: 100%;
}

.emimw-panel-template .elementor-section,
.emimw-panel-template .elementor-container {
  max-width: 100%;
}

/* ===== Burger close icon red (ONLY close icon) ===== */
.emimw-nav__burger.emimw-burger--close .emimw-burger__close,
.emimw-nav__burger.emimw-burger--close .emimw-close,
.emimw-nav__burger.emimw-burger--close .close-icon,
.emimw-nav__burger.emimw-burger--close .is-close,
.emimw-nav__burger.emimw-burger--close [data-icon="close"],
.emimw-nav__burger.emimw-burger--close [data-emimw-icon="close"] {
  color: #e11d48 !important;
  fill: #e11d48 !important;
  stroke: #e11d48 !important;
}

.emimw-nav__burger.emimw-burger--close span,
.emimw-nav__burger.emimw-burger--close i,
.emimw-nav__burger.emimw-burger--close .line,
.emimw-nav__burger.emimw-burger--close .bar {
  background-color: #e11d48;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .emimw-panel-row,
  .emimw-sub-toggle,
  .emimw-sub-toggle__icon,
  .emimw-sub-toggle__icon svg.emimw-sub-toggle__svg {
    animation: none !important;
    transition: none !important;
  }

  .emimw-collapse {
    transition: none !important;
    transform: none !important;
  }

  .emimw-nav__panel.emimw-panel-curtain .emimw-panel-row {
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
  }
}
