/* Aperture Left 1.0.0 - sidebar overlay for DNN 10 Aperture */
:root { --aperture-left-width: 280px; --aperture-persona-width: 80px; }

@media (min-width: 768px) {
  .aperture-left-theme .aperture-left-layout { display: grid; grid-template-columns: var(--aperture-left-width) minmax(0, 1fr); min-height: 100vh; }
  .aperture-left-theme.aperture-persona-visible .aperture-left-layout { grid-template-columns: calc(var(--aperture-left-width) + var(--aperture-persona-width)) minmax(0, 1fr); }
  .aperture-left-theme .aperture-left-page { grid-column: 2; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
  .aperture-left-theme .aperture-main { flex: 1 0 auto; }

  .aperture-left-sidebar {
    grid-column: 1; position: fixed; inset: 0 auto 0 0; width: var(--aperture-left-width); height: 100vh;
    z-index: 100; display: flex !important; flex-direction: column !important; background: #252525 !important; color: #fff;
    border-right: 1px solid var(--dnn-color-neutral-light, #e5e7eb); overflow-y: auto;
  }
  .aperture-left-sidebar__inner { display: flex; flex-direction: column; min-height: 100%; padding: 2rem 1.5rem 1.5rem; }
  .aperture-left-theme.aperture-persona-visible .aperture-left-sidebar { left: var(--aperture-persona-width); }
  .aperture-left-logo { margin-bottom: 2rem; }
  .aperture-left-logo img, .aperture-left-logo svg { max-width: 100%; max-height: 72px; width: auto; height: auto; }
  .aperture-left-nav { flex: 1 1 auto; }
  .aperture-left-account { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding-top: 1.5rem; margin-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.18); font-size: .9rem; color: #fff; }

  .aperture-left-menu, .aperture-left-menu__children { list-style: none !important; margin: 0 !important; padding: 0 !important; }
  .aperture-left-menu, .aperture-left-menu__children, .aperture-left-menu__item { position: static !important; float: none !important; clear: both !important; }
  .aperture-left-menu { display: block !important; width: 100% !important; }
  .aperture-left-menu__item { display: block !important; width: 100% !important; height: auto !important; min-height: 0 !important; margin: .15rem 0 !important; }
  .aperture-left-menu__children { width: 100% !important; height: auto !important; min-height: 0 !important; overflow: visible !important; }
  .aperture-left-menu__link { display: block !important; width: 100%; padding: .65rem .8rem; border-radius: .35rem; text-decoration: none; line-height: 1.3; color: inherit; transition: background-color .15s ease, color .15s ease; }
  .aperture-left-menu__link:hover, .aperture-left-menu__link:focus-visible { background: rgba(255,255,255,.10); text-decoration: none; color: #fff; }
  .aperture-left-menu__item.selected > .aperture-left-menu__link { font-weight: 700; background: rgba(255,255,255,.14); color: #fff; }
  .aperture-left-menu__children {
    padding: .1rem 0 .35rem .85rem !important;
    margin: .1rem 0 .35rem !important;
    border-left: 1px solid rgba(255,255,255,.18);
    background: #252525 !important;
    box-sizing: border-box !important;
  }
  .aperture-left-menu__children .aperture-left-menu__link { padding-top: .48rem !important; padding-bottom: .48rem !important; font-size: .94em; background: #252525 !important; }

  /* Stock Aperture constrains inner content; keep that behavior in the content column. */
  .aperture-left-page .aperture-container { max-width: none; }
  /* Aperture already compensates its footer for the DNN Persona Bar.
     Our layout grid already accounts for that 80px column, so undo the
     stock footer offset when the Persona Bar is visible. */
  .aperture-left-theme.aperture-persona-visible .aperture-footer {
    margin-left: calc(-1 * var(--aperture-persona-width)) !important;
  }

}

@media (max-width: 767.98px) {
  .aperture-left-theme .aperture-left-layout { display: block; }
  .aperture-left-theme .aperture-left-page { min-width: 0; }
}

/* Edit mode: prevent Persona Bar / control UI from being hidden behind the sidebar. */
body.dnnEditState .aperture-left-sidebar { z-index: 10; }
body.dnnEditState .aperture-left-theme.aperture-persona-visible .aperture-left-sidebar { z-index: 100; }

/* Override stock Aperture/DDRMenu positioning for the sidebar. Submenus must stay in normal document flow. */
@media (min-width: 768px) {
  .aperture-left-sidebar .aperture-left-nav ul,
  .aperture-left-sidebar .aperture-left-nav li,
  .aperture-left-sidebar .aperture-left-nav a {
    position: static !important;
    float: none !important;
  }
  .aperture-left-sidebar .aperture-left-nav ul {
    box-sizing: border-box !important;
  }
}

/* Collapsible desktop navigation */
@media (min-width: 768px) {
  .aperture-left-menu__children { display: none !important; }
  .aperture-left-menu__item.expanded > .aperture-left-menu__children { display: block !important; }
  .aperture-left-menu__item.has-children > .aperture-left-menu__link::after {
    content: '›'; float: right; opacity: .65; transform: rotate(0deg); transition: transform .15s ease;
  }
  .aperture-left-menu__item.has-children.expanded > .aperture-left-menu__link::after {
    transform: rotate(90deg);
  }
  .aperture-left-menu__children .aperture-left-menu__children {
    padding-left: .75rem !important;
    margin-left: .15rem !important;
    background: #252525 !important;
  }
  .aperture-left-menu__children .aperture-left-menu__children .aperture-left-menu__link {
    background: #252525 !important;
    font-size: .9em;
    padding-top: .4rem;
    padding-bottom: .4rem;
  }
}

/* ============================================================
   Mobiel menu = accordion (< 768px). Aangestuurd door
   aperture-left-menu.js (initApertureMobileMenu): een kop krijgt
   class "expanded" en toont dan zijn .nav-expand-content.
   ============================================================ */
@media (max-width: 767.98px) {
  /* Submenu's standaard dicht; open bij .expanded op de kop. */
  .mobile-menu .nav-expand-content { display: none !important; }
  .mobile-menu .nav-item.nav-expand.expanded > .nav-expand-content { display: block !important; }

  /* Inspringing per niveau + subtiele achtergrond. */
  .mobile-menu .nav-expand-content {
    padding-left: 1rem !important;
    margin: .1rem 0 .35rem !important;
    border-left: 2px solid rgba(255,255,255,.25) !important;
  }
  .mobile-menu .nav-expand-content .nav-expand-content {
    padding-left: .85rem !important;
  }

  /* De 'Terug'-link hoort bij drill-down; in de accordion niet nodig. */
  .mobile-menu .nav-back-link { display: none !important; }

  /* Pijltje van een kop: roteer bij open. */
  .mobile-menu .nav-item.nav-expand > .nav-expand-link {
    margin-left: auto;
    transition: transform .15s ease;
    display: inline-block;
  }
  .mobile-menu .nav-item.nav-expand.expanded > .nav-expand-link {
    transform: rotate(90deg);
  }
}

/* ============================================================
   Mobiel menu inschuiven via de checkbox (< 768px).
   Stock Aperture skin.min.css zet .nav-drill op translateX(100%)
   (offscreen) en schuift 'm pas in beeld bij .nav-is-toggled — maar
   die class werd door de weggehaalde stock skin.min.js gezet. Wij
   doen het nu puur op de CSS checkbox-hack: checkbox aan => inschuiven.
   ============================================================ */
@media (max-width: 767.98px) {
  #menuToggle input:checked ~ .nav-drill {
    transform: translateX(0) !important;
  }
}
