/* Right collapsible side menu - nav.css */
#side-menu-toggle {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 9999;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg,#19c985,#0aa17a);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(20,160,120,0.18);
  cursor: pointer;
  border: none;
  color: white;
  font-weight: 700;
}

/* The side menu is kept visually hidden and non-interactive when closed.
   We use translateX to fully move it offscreen while keeping 'right' stable so the
   hamburger toggle remains positioned reliably. Visibility/pointer-events prevent
   any residual text from showing or being tabbable when closed. */
#side-menu {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: 320px;
  max-width: 88%;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(230,255,240,0.9));
  /* keep the heavy shadow when open, but remove when closed to avoid a visible sliver */
  box-shadow: -6px 0 30px rgba(10,150,110,0.10);
  transition: transform 260ms cubic-bezier(.2,.9,.2,1), visibility 260ms ease, box-shadow 180ms ease;
  /* move the menu completely offscreen when closed (extra offset prevents any sliver) */
  transform: translateX(calc(100% + 36px));
  z-index: 9998;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

/* remove shadow and make non-interactive when closed to avoid partial visible elements */
#side-menu:not(.open) {
  box-shadow: none;
  visibility: hidden;
  pointer-events: none;
}

#side-menu.open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

#side-menu.open {
  right: 0;
}

#side-menu .menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* When the menu is closed, keep the header visually hidden and non-tabbable so
   nothing (title/desc) peeks out at the right edge. The logo mark remains visible
   only when open via the .open state. */
#side-menu:not(.open) .menu-header,
#side-menu:not(.open) .menu-title-wrap {
  visibility: hidden;
  opacity: 0;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Ensure the toggle always sits above the menu so only the hamburger is visible */
#side-menu-toggle {
  z-index: 10001;
}

#side-menu .logo {
  width: 48px;
  height: 48px;
  background: radial-gradient(circle at 30% 25%, #34f0bd, #0ca576 45%, #0a7b6a 100%);
  border-radius: 10px;
  /* hide the logo tile to prevent layout bleed when it's not desired */
  display: none !important;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 3px 10px rgba(12,160,120,0.18), inset 0 -6px 12px rgba(255,255,255,0.06);
}

#side-menu .menu-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #095943;
}

#side-menu .menu-desc {
  font-size: 0.9rem;
  color: #1f6f57;
  margin-top: -6px;
}

#side-menu nav {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Remove default list bullets and spacing for the menu list */
#side-menu .menu-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
  list-style-position: outside !important;
}

/* Extra rules to ensure bullets are removed across browsers and layout modes */
#side-menu .menu-list li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

/* Hide native list markers where supported */
#side-menu .menu-list li::marker {
  content: none !important;
  display: none !important;
}

/* Fallback: hide any pseudo elements used as markers */
#side-menu .menu-list li::before,
#side-menu .menu-list li::after {
  content: none !important;
  display: none !important;
}

#side-menu a.menu-link,
#side-menu button.menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #07563f;
  background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(230,255,240,0.6));
  border: 1px solid rgba(10,120,90,0.06);
  transition: transform 120ms ease, box-shadow 120ms ease;
  background-clip: padding-box;
}

#side-menu a.menu-link:hover,
#side-menu button.menu-link:hover {
  transform: translateX(-4px);
  box-shadow: 0 8px 20px rgba(11,120,90,0.08);
}

#side-menu .menu-link .icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e9fff0;
  color: #0b6b4f;
  font-weight: 700;
}

#side-menu .menu-footer {
  margin-top: auto;
  font-size: 0.85rem;
  color: #0f5d47;
  opacity: 0.9;
}

/* --- Radial submenu styles --- */

/* Each menu-entry becomes a positioning context for its radial group */
#side-menu .menu-entry {
  position: relative;
  /* provide a bit of spacing so radial items can appear without overlapping adjacent entries */
  padding-bottom: 6px;
}

/* The radial-group is absolutely positioned relative to the entry.
   By default it occupies zero layout flow and its children are positioned absolutely. */
#side-menu .radial-group {
  position: absolute;
  left: 64px;   /* offset rightwards from the button */
  top: 8px;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Radial items are absolutely positioned and animated via transform from nav.js.
   They are visually styled similar to menu links but compact and non-wrapping. */
#side-menu .radial-item {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #07563f;
  background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(235,255,242,0.9));
  border: 1px solid rgba(10,120,90,0.06);
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(11,120,90,0.06);
  transform: translate(0,0);
  opacity: 0;
  transition: transform 320ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease;
  pointer-events: none;
  z-index: 10002;
  font-size: 0.95rem;
}

/* When a radial group is opened, radial items become interactive. */
#side-menu .menu-entry.radial-open .radial-item {
  pointer-events: auto;
}

/* Slight hover lift for radial items */
#side-menu .radial-item:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 10px 28px rgba(12,120,90,0.09);
}

/* Focus styles for keyboard users */
#side-menu .radial-item:focus {
  outline: 3px solid rgba(10,140,100,0.12);
  outline-offset: 2px;
}

/* Reduced motion preference: disable transitions */
@media (prefers-reduced-motion: reduce) {
  #side-menu .radial-item {
    transition: none;
  }
}

/* Small-screen fallback: stack radial items vertically in flow for accessibility and touch.
   This also ensures the menu remains usable on narrow viewports. */
@media (max-width: 640px) {
  #side-menu { width: 84%; padding: 18px; }
  #side-menu-toggle { right: 12px; top: 12px; }

  #side-menu .radial-group {
    position: static;
    width: auto;
    height: auto;
    margin-left: 8px;
    pointer-events: auto;
  }
  #side-menu .radial-item {
    position: relative;
    display: block;
    left: auto;
    top: auto;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    margin-top: 6px;
  }
  #side-menu .radial-item:hover {
    transform: none !important;
    box-shadow: 0 6px 14px rgba(12,120,90,0.06);
  }
}

/* Ensure the menu footer remains visible after adjustments */
#side-menu .menu-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(10,120,90,0.03);
}

/* Keep .menu-link appearance consistent when implemented as button */
#side-menu button.menu-link {
  background-clip: padding-box;
  text-align: left;
}

/* When an entry is opened, add a class for possible CSS-only tweaks if needed */
#side-menu .menu-entry.radial-open > .menu-link {
  background: linear-gradient(180deg, rgba(250,255,250,0.98), rgba(235,255,240,0.95));
}
