/**
 * Nopass Hamburger Menu — Public Styles
 * Mirrors the visual structure of JetMenu's mobile-menu component.
 */

/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --nhm-toggle-color:       #3a3a3a;
  --nhm-panel-bg:           #ffffff;
  --nhm-panel-width:        320px;
  --nhm-panel-z:            10000;
  --nhm-overlay-bg:         rgba(0, 0, 0, 0.5);
  --nhm-transition-speed:   0.3s;
  --nhm-item-color:         #3a3a3a;
  --nhm-item-hover-bg:      #f5f5f5;
  --nhm-item-divider:       1px solid #ececec;
  --nhm-item-padding:       12px 20px;
  --nhm-controls-bg:        transparent;
  --nhm-controls-padding:   8px 12px;
}

/* ── Wrapper ────────────────────────────────────────────────────────────────── */
.nhm {
  display: inline-flex;
  position: relative;
  align-items: center;
}

/* ── Toggle Button ──────────────────────────────────────────────────────────── */
.nhm-toggle {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  padding: 8px !important;
  color: var(--nhm-toggle-color) !important;
  line-height: 1 !important;
  transition: opacity var(--nhm-transition-speed) !important;
}

.nhm-toggle:hover { opacity: 0.75 !important; }
.nhm-toggle:focus { outline: 2px solid currentColor !important; outline-offset: 2px !important; }

/* Ensure SVG icons respond to color */
.nhm-toggle i,
.nhm-toggle svg { display: block !important; width: 24px !important; height: 24px !important; font-size: 20px !important; fill: currentColor !important; }

.nhm-toggle__text { font-size: 14px !important; white-space: nowrap !important; }

/* Fixed-position toggle variants */
.nhm--toggle-fixed_left .nhm-toggle,
.nhm--toggle-fixed-left .nhm-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: calc(var(--nhm-panel-z) + 1);
}

.nhm--toggle-fixed_right .nhm-toggle,
.nhm--toggle-fixed-right .nhm-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: calc(var(--nhm-panel-z) + 1);
}

/* ── Overlay ────────────────────────────────────────────────────────────────── */
.nhm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--nhm-overlay-bg);
  z-index: calc(var(--nhm-panel-z) - 1);
  opacity: 0;
  transition: opacity var(--nhm-transition-speed);
}

.nhm-overlay.is-visible {
  display: block;
  opacity: 1;
}

/* ── Panel ──────────────────────────────────────────────────────────────────── */
.nhm-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  width: var(--nhm-panel-width);
  max-width: 90vw;
  background: var(--nhm-panel-bg);
  z-index: var(--nhm-panel-z);
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--nhm-transition-speed) ease;
  display: flex;
  flex-direction: column;
}

/* Slide-out from right (default) */
.nhm--position-right .nhm-panel { right: 0;  transform: translateX(100%); }
.nhm--position-left  .nhm-panel { left: 0;   transform: translateX(-100%); }
.nhm:not(.nhm--position-left):not(.nhm--position-right) .nhm-panel { right: 0; transform: translateX(100%); }

/* open state */
.nhm.is-open .nhm-panel { transform: translateX(0) !important; }

/* ── Panel: Dropdown Layout ─────────────────────────────────────────────────── */
.nhm--layout-dropdown .nhm-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  bottom: auto;
  width: 100%;
  max-width: 100%;
  transform: translateY(-10px);
  opacity: 0;
  visibility: hidden;
  transition: transform var(--nhm-transition-speed), opacity var(--nhm-transition-speed), visibility var(--nhm-transition-speed);
}

.nhm--layout-dropdown.is-open .nhm-panel {
  transform: translateY(0) !important;
  opacity: 1;
  visibility: visible;
}

/* ── Panel: Full-Screen Layout ──────────────────────────────────────────────── */
/*
 * Because Elementor may add CSS transform on ancestor elements which
 * breaks position:fixed (it becomes relative to the transformed ancestor),
 * we move the panel to <body> via JS when layout = full-screen.
 * The panel receives class .nhm-panel--detached when moved.
 */
.nhm--layout-full-screen .nhm-panel,
.nhm-panel--detached {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  transform: translateX(-100%) !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

.nhm--layout-full-screen.is-open .nhm-panel,
.nhm-panel--detached.nhm-panel--open {
  transform: translateX(0) !important;
}

/* ── Panel Controls Bar ─────────────────────────────────────────────────────── */
.nhm-panel__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--nhm-controls-padding);
  background: var(--nhm-controls-bg);
  flex-shrink: 0;
  min-height: 44px;
}

/* ── Close Button ───────────────────────────────────────────────────────────── */
.nhm-close {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  padding: 6px !important;
  color: var(--nhm-close-color, var(--nhm-toggle-color, #3a3a3a)) !important;
  margin-left: auto !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
}

.nhm-close i,
.nhm-close svg { width: 20px !important; height: 20px !important; display: block !important; font-size: 18px !important; fill: currentColor !important; }
.nhm-close:hover { opacity: 0.75 !important; }

/* Close button position: adapts to panel slide direction.
   Left panel  (slides from left)  → close stays on the RIGHT  (default, margin-left:auto).
   Right panel (slides from right) → close goes to the LEFT.
   Uses data-nhm-position on the panel so it works even when panel is
   detached to <body> for full-screen layouts. */
.nhm-panel[data-nhm-position="right"] .nhm-panel__controls { flex-direction: row-reverse !important; }
.nhm-panel[data-nhm-position="right"] .nhm-close { margin-left: 0 !important; margin-right: auto !important; }

/* ── Breadcrumbs / Back ─────────────────────────────────────────────────────── */
.nhm-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.nhm-back {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  padding: 4px 0 !important;
  font-size: 13px !important;
  color: var(--nhm-close-color, var(--nhm-item-color, #3a3a3a)) !important;
  flex-shrink: 0 !important;
}

.nhm-back:hover { opacity: 0.75 !important; }

.nhm-back i,
.nhm-back svg { width: 16px !important; height: 16px !important; font-size: 14px !important; fill: currentColor !important; }

.nhm-back__text { white-space: nowrap; }

.nhm-breadcrumbs__path {
  font-size: 13px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ── Template Zones ─────────────────────────────────────────────────────────── */
.nhm-panel__header-template,
.nhm-panel__before-template,
.nhm-panel__after-template {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Footer template sticks to the bottom */
.nhm-panel__after-template {
  margin-top: auto;
  border-top: var(--nhm-item-divider);
}

/* ── Nav / List ─────────────────────────────────────────────────────────────── */
.nhm-nav { flex: 1; overflow-y: auto; overflow-x: hidden; }

.nhm-list { list-style: none; margin: 0; padding: 0; }

/* ── Items ──────────────────────────────────────────────────────────────────── */
/* Item divider — controlled purely via Elementor (border-top-width defaults to 0). */

.nhm-item__inner {
  display: flex;
  align-items: stretch;
}

.nhm-item__link {
  display: flex !important;
  align-items: center !important;
  flex: 1 !important;
  padding: var(--nhm-item-padding) !important;
  color: var(--nhm-item-color) !important;
  text-decoration: none !important;
  transition: background var(--nhm-transition-speed) !important;
  gap: 8px !important;
  min-width: 0 !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
}

.nhm-item__link:hover { background: var(--nhm-item-hover-bg) !important; }
.nhm-item--current > .nhm-item__inner .nhm-item__link { background: var(--nhm-item-hover-bg) !important; }

.nhm-item__title { font-size: 14px; font-weight: 500; flex: 1; min-width: 0; }

.nhm-item__desc {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 2px;
  white-space: normal;
}

.nhm-item__badge {
  display: inline-block;
  font-size: 11px;
  background: #e74c3c;
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Arrow / Sub-menu Toggle ────────────────────────────────────────────────── */
.nhm-item__arrow {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  padding: 0 14px !important;
  color: var(--nhm-item-color) !important;
  border-left: var(--nhm-item-divider) !important;
  flex-shrink: 0 !important;
  transition: background var(--nhm-transition-speed) !important;
  min-width: 44px !important;
}

.nhm-item__arrow:hover { background: var(--nhm-item-hover-bg) !important; }

.nhm-item__arrow i,
.nhm-item__arrow svg { width: 16px !important; height: 16px !important; font-size: 14px !important; display: block !important; }

/* ── Sub Lists (Slide-in / Dropdown) ────────────────────────────────────────── */
.nhm-list--sub {
  padding-left: 16px;
  border-top: var(--nhm-item-divider);
}

/* ── Loader ─────────────────────────────────────────────────────────────────── */
.nhm-loader {
  display: flex;
  justify-content: center;
  padding: 20px;
}

.nhm-loader__spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #eee;
  border-top-color: var(--nhm-toggle-color);
  border-radius: 50%;
  animation: nhm-spin 0.7s linear infinite;
}

@keyframes nhm-spin { to { transform: rotate(360deg); } }

/* ── Mega Menu Panel ────────────────────────────────────────────────────────── */
.nhm-mega {
  width: 100%;
  background: var(--nhm-panel-bg);
  padding: 16px 20px;
  border-top: var(--nhm-item-divider);
  box-sizing: border-box;
}

.nhm-mega__content { width: 100%; }

.nhm-mega__content .elementor-column { padding: 0; }

.nhm-mega__content img { max-width: 100%; height: auto; }

/* ── FontAwesome / custom icon sizing ────────────────────────────────────────── */
.nhm-toggle i,
.nhm-close i,
.nhm-back i,
.nhm-item__arrow i {
  line-height: 1;
}

/* Ensure all SVG icons respond to currentColor */
.nhm-toggle svg,
.nhm-close svg,
.nhm-back svg,
.nhm-item__arrow svg,
.nhm-toggle__icon svg {
  fill: currentColor;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media ( min-width: 1025px ) {
  .nhm--hide-on-desktop { display: none !important; }
}

@media ( max-width: 1024px ) {
  .nhm--hide-on-mobile { display: none !important; }
}
