/* TogetherTrack — small layout helpers (kept out of templates for CSP). */

/* Initials / photo avatars */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  object-fit: cover;
  flex: 0 0 auto;
}
.avatar-sm {
  width: 2rem;
  height: 2rem;
  font-size: 0.8rem;
}
.avatar-lg {
  width: 6rem;
  height: 6rem;
  font-size: 2rem;
}

/* Sidebar active state */
#sidebar .nav-link.active {
  background-color: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
  font-weight: 600;
}
#sidebar .nav-link {
  color: var(--bs-body-color);
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
}
#sidebar .nav-link .bi {
  font-size: 1.1rem;
  width: 1.25rem;
  text-align: center;
  flex: 0 0 auto;
}

/* Collapsible nav groups (Students, Reports, etc.) */
.nav-section {
  margin-top: 0.25rem;
}
.nav-group-toggle {
  text-align: left;
}
.nav-chevron {
  font-size: 0.8rem;
  transition: transform 0.15s ease-in-out;
}
.nav-group-toggle[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

/* Let the main column shrink so wide tables scroll instead of overflowing */
.app-main {
  min-width: 0;
}

/* Desktop: fixed-width sidebar that collapses to an icon-only rail.
   Sticky (not static) so it stays reachable while a long page scrolls —
   previously it was in-flow content and scrolled out of view on any page
   taller than one viewport. Its own nav list scrolls independently via
   overflow-y if it's ever taller than the viewport itself. */
@media (min-width: 992px) {
  .app-sidebar {
    flex: 0 0 auto;
    width: 240px;
    border-right: 1px solid var(--bs-border-color);
    position: sticky;
    /* sticky always makes a stacking context, so the collapsed-rail flyout's
       own z-index is trapped inside it. Lift the whole sidebar above page
       content (and dropdowns at 1000) but below the navbar (1020) and modals. */
    z-index: 1010;
    top: calc(var(--tt-navbar-height) + var(--tt-org-bar-height));
    height: calc(100vh - var(--tt-navbar-height) - var(--tt-org-bar-height));
    overflow-y: auto;
    transition: width 0.15s ease-in-out;
  }
  .app-shell.sidebar-collapsed .app-sidebar {
    width: 4rem;
  }
  /* Hide labels when collapsed, but keep them for screen readers */
  .app-shell.sidebar-collapsed .nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .app-shell.sidebar-collapsed #sidebar .nav-link {
    justify-content: center;
  }
  /* Icon-only rail: each group shows just its icon; its links open in a
     flyout beside the rail (hover or click, see the sidebar flyout script in
     base.html, which toggles .flyout-open on the .nav-section). The panel is
     position: fixed because .app-sidebar scrolls (overflow-y) and would clip
     an absolutely positioned popup; the script sets --tt-flyout-top/-left.
     The underlying collapse state is untouched, so expanding the rail back
     restores whatever the user had. */
  .app-shell.sidebar-collapsed .nav-section .collapse,
  .app-shell.sidebar-collapsed .nav-section .collapsing {
    display: none !important;
  }
  .app-shell.sidebar-collapsed .nav-section.flyout-open .collapse,
  .app-shell.sidebar-collapsed .nav-section.flyout-open .collapsing {
    display: block !important;
    position: fixed;
    top: var(--tt-flyout-top, 0);
    left: var(--tt-flyout-left, 4rem);
    z-index: 1035;
    min-width: 14rem;
    max-width: 18rem;
    max-height: calc(100vh - 1rem);
    height: auto !important;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    box-shadow: var(--bs-box-shadow);
  }
  .app-shell.sidebar-collapsed .nav-chevron {
    display: none;
  }
  /* Divider above each group so the icon rail reads as distinct clusters. */
  .app-shell.sidebar-collapsed .nav-section {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--bs-border-color);
  }
  .app-shell.sidebar-collapsed .nav-section nav[aria-label] {
    padding-left: 0 !important;
  }
  /* Flyout: show the labels the rail hides, titled with the group name. */
  .app-shell.sidebar-collapsed .nav-section.flyout-open .collapse nav[aria-label]::before {
    content: attr(aria-label);
    display: block;
    padding: 0.25rem 0.75rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color);
  }
  .app-shell.sidebar-collapsed .nav-section.flyout-open .collapse .nav-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
    border: 0;
  }
  .app-shell.sidebar-collapsed #sidebar .nav-section.flyout-open .collapse .nav-link {
    justify-content: flex-start;
  }
  /* The rail hides child links, so mark the group that holds the current page. */
  .app-shell.sidebar-collapsed .nav-section:has(.collapse .nav-link.active) > .nav-group-toggle {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
  }
}

/* ABLLS-R score-entry widget: 4 cumulative-fill boxes per skill item.
   Two colors only (filled/unfilled) — see assessments Phase C plan notes on
   why no other color meaning is modeled. */
.score-boxes {
  display: inline-flex;
  gap: 0.25rem;
}
.score-box {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.25rem;
  background-color: var(--bs-body-bg);
}
.score-box.filled {
  background-color: var(--bs-success);
  border-color: var(--bs-success);
}
.score-box:disabled {
  opacity: 0.6;
}
