/*
 * MoSJE Side Navigation widget (custom-functions/elementor-widgets/).
 * Visual match for the old Mega Menu based left menu (.page-left-menu),
 * but self-contained: nothing here depends on Elementor's n-menu markup.
 */

.elementor-widget-mosje-side-nav {
  --mosje-sidenav-heading-bg: var(--neutral-100, #F3F4F6);
  --mosje-sidenav-heading-color: #1F2124;
  --mosje-sidenav-link-color: #1F2124;
  --mosje-sidenav-hover-bg: var(--primary-50, #E8F2FD);
  --mosje-sidenav-active-bg: var(--e-global-color-primary, #0373DF);
  --mosje-sidenav-active-color: #FFFFFF;
  --mosje-sidenav-border: var(--e-global-color-4c32af6, #E5E7EB);
  /* Width of the old left menu. Change it with the widget's "Menu width"
     control; without it the menu would stretch to its longest item, because
     the left column it sits in is absolutely positioned and full width. */
  --mosje-sidenav-width: 300px;
}

.mosje-sidenav {
  background: #FFFFFF;
  border: 1px solid var(--mosje-sidenav-border);
  border-radius: 20px;
  box-shadow: 0 6px 8px -2px rgba(0, 0, 0, 0.24);
  letter-spacing: 0.5px;
  font-size: 16px;
  line-height: 24px;
}

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

/* Section heading (item without a link) */
.mosje-sidenav__heading {
  margin: 8px 0;
  padding: 11px 16px;
  background: var(--mosje-sidenav-heading-bg);
  color: var(--mosje-sidenav-heading-color);
  font-size: 14px;
  line-height: 21px;
  font-weight: 500;
  text-transform: uppercase;
}

.mosje-sidenav__heading:first-child {
  margin-top: 0;
}

/* Link item */
.mosje-sidenav__item {
  padding: 5px 10px;
}

.mosje-sidenav__link {
  display: block;
  padding: 7px 16px;
  border-radius: 8px;
  color: var(--mosje-sidenav-link-color);
  font-weight: 400;
  text-decoration: none;
  transition: background-color 0.2s ease-in-out;
}

a.mosje-sidenav__link:hover,
a.mosje-sidenav__link:focus-visible {
  background-color: var(--mosje-sidenav-hover-bg);
  color: var(--mosje-sidenav-link-color);
}

a.mosje-sidenav__link:focus-visible {
  outline: 2px solid var(--mosje-sidenav-active-bg);
  outline-offset: 1px;
}

/* --- Sub items ------------------------------------------------------- */

/* Parent row: link takes the space, the toggle sits at the end */
.mosje-sidenav__row {
  display: flex;
  align-items: center;
}

.mosje-sidenav__row .mosje-sidenav__link {
  flex: 1 1 auto;
  min-width: 0;
}

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

/* A heading that owns a group: the <li> carries the spacing the plain
   heading has, and the row inside keeps the heading's own look. */
.mosje-sidenav__heading-item {
  margin: 8px 0;
}

.mosje-sidenav__heading-item:first-child {
  margin-top: 0;
}

.mosje-sidenav__heading--group {
  margin: 0;
  padding-right: 8px;
}

.mosje-sidenav__heading-text {
  flex: 1 1 auto;
  min-width: 0;
}

.mosje-sidenav__item--sub {
  padding: 2px 10px 2px 22px;
}

.mosje-sidenav__link--sub {
  font-size: 15px;
  border-left: 2px solid var(--mosje-sidenav-border);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.mosje-sidenav__link--sub.is-active {
  border-left-color: var(--mosje-sidenav-active-bg);
}

/* Collapse toggle. Drawn in CSS so no icon font is needed. */
.elementor-widget-mosje-side-nav .mosje-sidenav__sub-toggle,
.elementor-widget-mosje-side-nav .mosje-sidenav__sub-toggle:hover,
.elementor-widget-mosje-side-nav .mosje-sidenav__sub-toggle:focus {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--mosje-sidenav-link-color);
  box-shadow: none;
  cursor: pointer;
}

.mosje-sidenav__sub-toggle:hover {
  background-color: var(--mosje-sidenav-hover-bg) !important;
}

.mosje-sidenav__sub-toggle:focus-visible {
  outline: 2px solid var(--mosje-sidenav-active-bg);
  outline-offset: -2px;
}

.mosje-sidenav__caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s ease-in-out;
}

/* .has-children sits on a link <li> or a heading <li>, so these two rules
   match on it alone rather than on either item class. */
.mosje-sidenav .has-children.is-open > .mosje-sidenav__row .mosje-sidenav__caret {
  transform: translateY(2px) rotate(-135deg);
}

/* Collapsing only applies once the script has run, so without JS every group
   stays open (same approach as the mobile toggle above). */
.mosje-sidenav.is-ready .has-children:not(.is-open) > .mosje-sidenav__sublist {
  display: none;
}

/* Links that leave the page get a chevron */
.mosje-sidenav__link.is-page {
  padding-right: 32px;
  background-image: url("../images/arrow.svg");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) 50%;
}

.mosje-sidenav__link.is-active,
.mosje-sidenav__link.is-active:hover {
  background-color: var(--mosje-sidenav-active-bg);
  color: var(--mosje-sidenav-active-color);
}

/* Mobile toggle: hidden on desktop, and on mobile until the script has run
   (.is-ready), so without JS the list simply stays open. */
.mosje-sidenav__toggle {
  display: none;
}

@media (max-width: 1024px) {
  .mosje-sidenav:not(.is-ready) .mosje-sidenav__toggle {
    display: none !important;
  }
}

@media (min-width: 1025px) {
  /* The widget box itself must be menu-wide too. The left column it sits in
     is absolute, full width and z-index 9, so a full-width widget box lies on
     top of the right-hand content and swallows its clicks (front end and
     Elementor editor alike). The old Mega Menu avoided this by being absolute
     itself, which left the column 0px tall. */
  .elementor-widget.elementor-widget-mosje-side-nav {
    width: var(--mosje-sidenav-width);
  }

  /* The column (and any inner container) still spans the full width at the
     menu's height, so let clicks pass through it; only the menu and the
     editor's own handles take them. */
  #left-sticky-menu:has(.elementor-widget-mosje-side-nav),
  .e-con:has(> .elementor-widget-mosje-side-nav),
  .e-con:has(> .e-con-inner > .elementor-widget-mosje-side-nav),
  .e-con:has(> .e-con > .elementor-widget-mosje-side-nav),
  .e-con:has(> .e-con-inner > .e-con > .elementor-widget-mosje-side-nav) {
    pointer-events: none;
  }

  .elementor-widget-mosje-side-nav .mosje-sidenav,
  .e-con:has(.elementor-widget-mosje-side-nav) .elementor-editor-element-settings {
    pointer-events: auto;
  }

  .mosje-sidenav {
    width: 100%;
    max-width: var(--mosje-sidenav-width);
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    overflow-x: hidden;
  }
}

@media (max-width: 1024px) {
  .elementor-widget-mosje-side-nav {
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    top: auto !important;
  }

  .mosje-sidenav {
    position: relative;
    border-radius: 12px;
  }

  /* Widget-scoped so theme/kit button styles (blue border, hover fill) lose */
  .elementor-widget-mosje-side-nav .mosje-sidenav__toggle,
  .elementor-widget-mosje-side-nav .mosje-sidenav__toggle:hover,
  .elementor-widget-mosje-side-nav .mosje-sidenav__toggle:focus {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--mosje-sidenav-link-color);
    font: inherit;
    font-weight: 500;
    letter-spacing: inherit;
    text-align: left;
    text-transform: none;
    box-shadow: none;
    cursor: pointer;
  }

  .mosje-sidenav__toggle:focus-visible {
    outline: 2px solid var(--mosje-sidenav-active-bg);
    outline-offset: -2px;
  }

  /* Hamburger / close icon drawn in CSS so no icon font is needed */
  .mosje-sidenav__toggle-icon,
  .mosje-sidenav__toggle-icon::before,
  .mosje-sidenav__toggle-icon::after {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.2s ease, background-color 0.2s ease;
  }

  .mosje-sidenav__toggle-icon {
    position: relative;
    flex: none;
  }

  .mosje-sidenav__toggle-icon::before,
  .mosje-sidenav__toggle-icon::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .mosje-sidenav__toggle-icon::before { top: -6px; }
  .mosje-sidenav__toggle-icon::after  { top: 6px; }

  .mosje-sidenav.is-open .mosje-sidenav__toggle-icon { background: transparent; }
  .mosje-sidenav.is-open .mosje-sidenav__toggle-icon::before { transform: translateY(6px) rotate(45deg); }
  .mosje-sidenav.is-open .mosje-sidenav__toggle-icon::after  { transform: translateY(-6px) rotate(-45deg); }

  /* Dropdown panel overlays the content below (only once the script runs) */
  .mosje-sidenav.is-ready .mosje-sidenav__list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 70vh;
    overflow-y: auto;
    padding: 16px;
    background: #FFFFFF;
    border: 1px solid var(--mosje-sidenav-border);
    border-radius: 12px;
    box-shadow: 0 6px 8px -2px rgba(0, 0, 0, 0.24);
  }

  .mosje-sidenav.is-open .mosje-sidenav__list {
    display: block;
  }
}

/* Editor: always show the list, and every group of sub items, so all items
   can be seen while editing whatever the collapse settings are */
.elementor-editor-active .mosje-sidenav__list {
  display: block;
  position: static;
  box-shadow: none;
  border: 0;
}

/* !important because the collapsed-group rule above is more specific */
.elementor-editor-active .mosje-sidenav__sublist {
  display: block !important;
}
