/* ----------------------------------------------------------------------------
   BARRA LATERAL (layout vertical_transparent = navbar-transparent)
   The menu is rendered as `navbar-dark` and Tabler paints it with !important
   rules meant for a dark background, so the colour rules below match that
   force (!important) per theme. Covers every link, including the "Admin"
   submenu that comes from another partial. Topbar buttons are left alone.

   Look: inset pill items (icon + label), a soft lavender pill for the active
   page, hairline dividers between groups with a small caption, and submenus
   without icons, indented under the parent's label.
   -------------------------------------------------------------------------- */
.navbar-vertical {
  --axis-nav-inset: 0.625rem; /* same gap on both sides of every pill */
  --axis-nav-pad-x: 0.75rem;
  --axis-nav-icon: 1.125rem;
  --axis-nav-gap: 0.75rem;
  --axis-nav-radius: 0.75rem;
  --axis-nav-ease: 160ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Tabler sets `overflow-y: scroll`, which keeps an empty 15px scrollbar track
   on the right and pushes the menu off-centre. Scroll only when needed, with
   a thin bar. */
.navbar-vertical {
  overflow-y: auto !important;
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-300) transparent;
}
[data-bs-theme="dark"] .navbar-vertical {
  scrollbar-color: var(--neutral-700) transparent;
}

/* Surface: soft grey panel next to the white page, with a hairline edge. */
[data-bs-theme="light"] .navbar-vertical {
  --tblr-navbar-color: var(--neutral-700);
  --tblr-navbar-active-color: var(--brand-700);
  background-color: var(--neutral-100) !important;
  box-shadow: inset -1px 0 0 var(--neutral-200) !important;
}
[data-bs-theme="dark"] .navbar-vertical {
  background-color: var(--neutral-950) !important;
  box-shadow: inset -1px 0 0 oklch(1 0 0 / 0.08) !important;
}

/* --- Items ---------------------------------------------------------------- */
.navbar-vertical .navbar-collapse .nav-link {
  display: flex;
  align-items: center;
  gap: var(--axis-nav-gap);
  min-height: 2.5rem;
  margin: 0.125rem var(--axis-nav-inset);
  padding: 0.5rem var(--axis-nav-pad-x);
  border-radius: var(--axis-nav-radius);
  font-size: 0.9375rem;
  font-weight: 400; /* Lato Regular; state is shown by colour, not weight */
  letter-spacing: -0.005em;
  transition: background-color var(--axis-nav-ease), color var(--axis-nav-ease);
}
/* Backpack tags icons `d-lg-none d-xl-block` (hidden 992–1199px); keep them. */
.navbar-vertical .navbar-collapse .nav-link .nav-icon {
  display: inline-block !important;
  flex: 0 0 var(--axis-nav-icon);
  width: var(--axis-nav-icon);
  margin: 0;
  font-size: var(--axis-nav-icon);
  line-height: 1;
  text-align: center;
  transition: color var(--axis-nav-ease);
}
/* Tabler's 3px bar on the active item's left edge — the pill replaces it. */
.navbar-vertical .nav-item.active::after,
.navbar-vertical .nav-item::after {
  content: none !important;
}

/* Light — rest */
[data-bs-theme="light"] .navbar-vertical a:not(.btn),
[data-bs-theme="light"] .navbar-vertical .nav-link,
[data-bs-theme="light"] .navbar-vertical .nav-link-title,
[data-bs-theme="light"] .navbar-vertical .dropdown-item,
[data-bs-theme="light"] .navbar-vertical .dropdown-toggle {
  color: var(--neutral-700) !important;
}
[data-bs-theme="light"] .navbar-vertical .nav-icon,
[data-bs-theme="light"] .navbar-vertical .nav-link-icon {
  color: var(--neutral-500) !important;
}
/* Light — current page */
[data-bs-theme="light"] .navbar-vertical .nav-link.active,
[data-bs-theme="light"] .navbar-vertical .nav-item.active > .nav-link {
  background-color: color-mix(in srgb, var(--brand-600) 10%, transparent) !important; /* #8A2BE21A */
  color: var(--brand-700) !important;
}
[data-bs-theme="light"] .navbar-vertical .nav-link.active .nav-icon,
[data-bs-theme="light"] .navbar-vertical .nav-item.active > .nav-link .nav-icon {
  color: var(--brand-600) !important;
}

/* Dark — rest */
[data-bs-theme="dark"] .navbar-vertical a:not(.btn),
[data-bs-theme="dark"] .navbar-vertical .nav-link,
[data-bs-theme="dark"] .navbar-vertical .nav-link-title,
[data-bs-theme="dark"] .navbar-vertical .dropdown-item,
[data-bs-theme="dark"] .navbar-vertical .dropdown-toggle {
  color: var(--neutral-300) !important;
}
[data-bs-theme="dark"] .navbar-vertical .nav-icon,
[data-bs-theme="dark"] .navbar-vertical .nav-link-icon {
  color: var(--neutral-400) !important;
}
/* Dark — current page */
[data-bs-theme="dark"] .navbar-vertical .nav-link.active,
[data-bs-theme="dark"] .navbar-vertical .nav-item.active > .nav-link {
  background-color: color-mix(in oklch, var(--brand-500) 24%, transparent) !important;
  color: #fff !important;
}
[data-bs-theme="dark"] .navbar-vertical .nav-link.active .nav-icon,
[data-bs-theme="dark"] .navbar-vertical .nav-item.active > .nav-link .nav-icon {
  color: var(--brand-300) !important;
}

/* --- Group dividers --------------------------------------------------------
   Backpack's menu-separator renders <span class="nav-separator">Title</span>.
   It becomes a hairline with a small caption, so groups read as the mockup's
   dividers while the group name (e.g. the school) stays visible. */
.navbar-vertical .nav-separator {
  display: block;
  margin: 1rem calc(var(--axis-nav-inset) + var(--axis-nav-pad-x)) 0.375rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--neutral-200);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--neutral-500) !important;
}
[data-bs-theme="dark"] .navbar-vertical .nav-separator {
  border-top-color: oklch(1 0 0 / 0.08);
  color: var(--neutral-500) !important;
}

/* --- Submenus (menu-dropdown) --------------------------------------------- */
/* Chevron: an SVG stroke tinted with currentColor (replaces Tabler's border
   triangle, whose transform Tabler pins); turns over when the group opens. */
.navbar-vertical .nav-link.dropdown-toggle::after {
  content: "";
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0 0 0 auto;
  border: 0 !important;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: none !important;
  rotate: 0deg;
  opacity: 0.5;
  transition: rotate var(--axis-nav-ease), opacity var(--axis-nav-ease);
}
.navbar-vertical .nav-link.dropdown-toggle.show::after,
.navbar-vertical .nav-link.dropdown-toggle[aria-expanded="true"]::after {
  rotate: 180deg;
  opacity: 0.85;
}
.navbar-vertical .navbar-collapse .nav-item.dropdown .dropdown-menu {
  margin: 0;
  padding: 0.125rem 0 0.25rem;
  border: 0;
  background: transparent !important;
  box-shadow: none;
}
/* Children sit one short step in from the parent (Tabler pins the padding). */
.navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  min-height: 2.125rem;
  margin: 0.0625rem var(--axis-nav-inset);
  padding: 0.375rem var(--axis-nav-pad-x) !important;
  /* Tabler pins the left padding; line the label up under the parent's. */
  padding-left: calc(var(--axis-nav-pad-x) + 1rem) !important; /* a short step in from the parent's icon */
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 400;
  transition: background-color var(--axis-nav-ease), color var(--axis-nav-ease);
}
.navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item {
  gap: 0.625rem;
}
.navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item .nav-icon {
  display: inline-block !important;
  margin: 0;
  font-size: 1rem;
}
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item {
  color: var(--neutral-600) !important;
}
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item.active {
  background-color: color-mix(in srgb, var(--brand-600) 10%, transparent) !important;
  color: var(--brand-700) !important;
}
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item {
  color: var(--neutral-400) !important;
}
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item.active {
  background-color: color-mix(in oklch, var(--brand-500) 24%, transparent) !important;
  color: #fff !important;
}

/* Keyboard focus: a visible ring, only for keyboard users. */
.navbar-vertical .nav-link:focus-visible,
.navbar-vertical .dropdown-item:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
  .navbar-vertical .nav-link,
  .navbar-vertical .nav-link .nav-icon,
  .navbar-vertical .dropdown-item,
  .navbar-vertical .nav-link.dropdown-toggle::after {
    transition: none;
  }
}

/* Logo (desktop sidebar): left edge on the menu icons' column, breathing
   room from the top. 141px wide at the SVG's own aspect = a 141 × 19
   wordmark (the SVG adds ~7px of air above and below the letters). */
@media (min-width: 992px) {
  .navbar-vertical .navbar-brand {
    /* !important: Tabler's .navbar-expand-lg brand rules centre it and pin the padding. */
    width: 100% !important;
    margin: 0 0 0.75rem !important;
    padding: 2.25rem 0 1rem calc(var(--axis-nav-inset) + var(--axis-nav-pad-x) + 0.25rem) !important; /* left = the menu icons' column */
    text-align: left !important;
    justify-content: flex-start !important;
  }
  .navbar-vertical .navbar-brand > a {
    display: block;
    line-height: 0;
  }
  .navbar-vertical .navbar-brand img {
    width: 141px;
    height: auto;
    max-height: none !important;
  }
}

/* Logótipo: mostra a versão certa por tema */
.navbar-brand .axis-logo-dark { display: none; }
[data-bs-theme="dark"] .navbar-brand .axis-logo-light { display: none; }
[data-bs-theme="dark"] .navbar-brand .axis-logo-dark { display: inline; }

/* --- Section active, child is the page ------------------------------------
   When the current page is a submenu child, only the child gets the pill (the
   same tint as a top-level active item). The parent drops its pill and keeps
   just the purple label/icon: "you are in this section", not "this page". */
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .nav-item.dropdown.active > .nav-link.dropdown-toggle {
  background-color: transparent !important;
  color: var(--brand-700) !important;
}
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .nav-item.dropdown.active > .nav-link.dropdown-toggle {
  background-color: transparent !important;
  color: var(--brand-300) !important;
}
/* Active child's icon follows its label (the generic grey icon rule is !important). */
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item.active .nav-icon {
  color: var(--brand-600) !important;
}
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item.active .nav-icon {
  color: var(--brand-300) !important;
}
/* Parent of the current page: icon purple too, like its label. */
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .nav-item.dropdown.active > .nav-link .nav-icon {
  color: var(--brand-600) !important;
}
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .nav-item.dropdown.active > .nav-link .nav-icon {
  color: var(--brand-300) !important;
}

/* --- Hover = the active look ------------------------------------------------
   Pointing at any item previews the "you are here" state: lavender pill,
   purple label and icon. Weight stays Regular, so nothing shifts. Declared
   last and at the submenu's specificity so it wins over every rest state. */
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .nav-link:hover,
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .nav-item.dropdown.active > .nav-link.dropdown-toggle:hover,
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item:hover {
  background-color: color-mix(in srgb, var(--brand-600) 10%, transparent) !important; /* #8A2BE21A */
  color: var(--brand-700) !important;
}
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .nav-link:hover .nav-icon,
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item:hover .nav-icon {
  color: var(--brand-600) !important;
}
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .nav-link:hover,
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .nav-item.dropdown.active > .nav-link.dropdown-toggle:hover,
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item:hover {
  background-color: color-mix(in oklch, var(--brand-500) 24%, transparent) !important;
  color: #fff !important;
}
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .nav-link:hover .nav-icon,
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item:hover .nav-icon {
  color: var(--brand-300) !important;
}

/* ============================================================================
   MOTION — submenus that open/close, press feedback, scroll fades.
   One curve for everything: fast start, soft settle, no overshoot (a
   critically-damped feel). CSS transitions retarget from the current value,
   so a second click mid-animation reverses smoothly instead of jumping.
   Behaviour (instant active state, active item in view, fade flags):
   public/js/axis-sidebar.js.
   ========================================================================= */
.navbar-vertical {
  --axis-ease-out: cubic-bezier(0.32, 0.72, 0, 1);
}

/* 1. Submenus. Bootstrap toggles `.show` between display:none and block,
   which cannot animate — so the list always renders and its height runs
   0 → auto instead (interpolate-size; browsers without it still fade).
   `visibility` keeps a closed submenu out of the tab order. */
.navbar-vertical .navbar-collapse .dropdown-menu {
  display: block !important;
  interpolate-size: allow-keywords;
  height: 0;
  overflow: hidden;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0;
  visibility: hidden;
}
.navbar-vertical .navbar-collapse .dropdown-menu.show {
  height: auto;
  padding-top: 0.125rem !important;
  padding-bottom: 0.25rem !important;
  opacity: 1;
  visibility: visible;
}
/* Transitions only once the page has settled (axis-sidebar.js adds
   .axis-motion): Backpack opens the current section by script after load,
   and that should not slide open on every page. */
.navbar-vertical.axis-motion .navbar-collapse .dropdown-menu {
  transition:
    height 220ms var(--axis-ease-out),
    padding 220ms var(--axis-ease-out),
    opacity 140ms ease,
    visibility 0s linear 220ms;
}
.navbar-vertical.axis-motion .navbar-collapse .dropdown-menu.show {
  transition:
    height 280ms var(--axis-ease-out),
    padding 280ms var(--axis-ease-out),
    opacity 200ms ease 40ms,
    visibility 0s;
}

/* 2. Press feedback — instant on pointer-down (a deeper tint, a hair
   smaller), settles back on release. Also stops Bootstrap painting a
   pressed .dropdown-item solid primary. */
.navbar-vertical .navbar-collapse .nav-link,
.navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item {
  transition:
    background-color var(--axis-nav-ease),
    color var(--axis-nav-ease),
    transform 240ms var(--axis-ease-out);
}
.navbar-vertical .navbar-collapse .nav-link:active,
.navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item:active {
  transform: scale(0.98);
  transition-duration: 60ms;
}
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .nav-link:active,
[data-bs-theme="light"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item:active {
  background-color: color-mix(in srgb, var(--brand-600) 18%, transparent) !important;
  color: var(--brand-800) !important;
}
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .nav-link:active,
[data-bs-theme="dark"] .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item:active {
  background-color: color-mix(in oklch, var(--brand-500) 34%, transparent) !important;
  color: #fff !important;
}

/* 3. Scroll fades — when the menu is taller than the screen, the edge it can
   still scroll towards fades out (axis-sidebar.js sets the two classes). */
@property --axis-fade-top {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@property --axis-fade-bottom {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@media (min-width: 992px) {
  .navbar-vertical {
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--axis-fade-top), #000 calc(100% - var(--axis-fade-bottom)), transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 var(--axis-fade-top), #000 calc(100% - var(--axis-fade-bottom)), transparent);
    transition: --axis-fade-top 200ms ease, --axis-fade-bottom 200ms ease;
  }
  .navbar-vertical.axis-can-scroll-up { --axis-fade-top: 2.5rem; }
  .navbar-vertical.axis-can-scroll-down { --axis-fade-bottom: 2.5rem; }
}

/* Reduced motion: no sliding or scaling — submenus just fade. */
@media (prefers-reduced-motion: reduce) {
  .navbar-vertical.axis-motion .navbar-collapse .dropdown-menu,
  .navbar-vertical.axis-motion .navbar-collapse .dropdown-menu.show {
    transition: opacity 120ms ease, visibility 0s;
  }
  .navbar-vertical .navbar-collapse .nav-link:active,
  .navbar-vertical .navbar-collapse .dropdown-menu .dropdown-item:active {
    transform: none;
  }
}
