/* Left navigation panel from the design proposals.
 *
 * Loaded by both base templates, which sit on different Bootstrap builds
 * (base.html on 5.1.3 from the CDN, base_hr_ui.html on the 5.3 bundle hr-ui
 * compiles). Everything here is therefore written with literal values rather
 * than Bootstrap custom properties, which differ between the two. */

:root {
  --sidebar-width: 244px;
  --sidebar-bg: #16253d;
  --sidebar-text: #cdd7e5;
  --sidebar-muted: #66799a;
  --sidebar-heading: #8fa3bd;
  --sidebar-secondary: #a9b8cc;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.app-main {
  flex: 1;
  /* `min-width: 0` lets the column shrink below its content, but the content
     still overflows *visibly* and drags the whole document sideways -- the
     sidebar scrolled out of view with it. Containing the overflow here keeps the
     panel put and gives wide tables their own scrollbar. */
  min-width: 0;
  overflow-x: auto;
}

.app-sidebar {
  width: var(--sidebar-width);
  flex: none;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding-bottom: 12px;
}

.app-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 10px;
}

.app-sidebar__brand img {
  display: block;
  max-width: 100%;
  height: auto;
}

.app-sidebar__role {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #0d1726;
  background: var(--sidebar-heading);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

.app-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 12px 10px;
  overflow-y: auto;
}

.app-sidebar__heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--sidebar-muted);
  padding: 8px 8px 3px;
}

.app-sidebar__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 5px 8px;
}

.app-sidebar__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--sidebar-text);
  text-decoration: none;
}

.app-sidebar__link:hover,
.app-sidebar__link:focus {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.app-sidebar__link[aria-current="page"] {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 2px 0 0 #4d8ef5;
}

/* The "VIAC" group sits a step back from the daily-work links above it. */
.app-sidebar__link--secondary {
  font-size: 12.5px;
  color: var(--sidebar-secondary);
}

.app-sidebar__dot {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--sidebar-muted);
  flex: none;
}

.app-sidebar__link[aria-current="page"] .app-sidebar__dot {
  background: var(--sidebar-heading);
}

.app-sidebar__link--secondary .app-sidebar__dot {
  background: #4a5a76;
}

.app-sidebar__count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  background: #2563eb;
  color: #fff;
}

.app-sidebar__count--warning {
  background: #f0b100;
  color: #3d2c00;
}

.app-sidebar__count--danger {
  background: #d0342c;
  color: #fff;
}

/* An emoji standing where a link's dot would be (the desktop link). */
.app-sidebar__emoji {
  flex: none;
  font-size: 13px;
  line-height: 1;
}

.app-sidebar__trophy {
  margin-left: auto;
  line-height: 1;
  color: #f0b100;
}

.app-sidebar__external {
  margin-left: auto;
  font-size: 12px;
  color: var(--sidebar-muted);
}

/* Everything under the brand row, so one collapse target folds the whole panel.
   Being a column itself keeps `__foot`'s `margin-top: auto` pushing against the
   bottom exactly as it did when these were direct children of `.app-sidebar`. */
.app-sidebar__body {
  display: flex;
  flex-direction: column;
}

.app-sidebar__toggle {
  margin-left: auto;
  flex: none;
  width: 38px;
  height: 38px;
  /* Grid so both icons stack in one cell; see `__toggle-icon`. */
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--sidebar-text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-sidebar__toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}

.app-sidebar__toggle:active {
  background: rgba(255, 255, 255, 0.18);
}

/* Keyboard users get a ring; a mouse press does not, which is why this is
   `:focus-visible` and not `:focus`. */
.app-sidebar__toggle:focus-visible {
  outline: 2px solid #4d8ef5;
  outline-offset: 2px;
}

/* Open, the button reads as "close": it takes the accent and swaps its icon. */
.app-sidebar__toggle[aria-expanded='true'] {
  color: #fff;
  background: rgba(77, 142, 245, 0.22);
  border-color: rgba(77, 142, 245, 0.55);
}

/* Both icons sit in the same grid cell so the button never changes size as they
   swap, and no layout depends on which one is showing. */
.app-sidebar__toggle-icon {
  grid-area: 1 / 1;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.app-sidebar__toggle-icon--close,
.app-sidebar__toggle[aria-expanded='true'] .app-sidebar__toggle-icon--open {
  opacity: 0;
  transform: scale(0.8);
}

.app-sidebar__toggle[aria-expanded='true'] .app-sidebar__toggle-icon--close {
  opacity: 1;
  transform: none;
  font-size: 15px;
}

/* Folding is a phone affordance only. From `md` up the panel is open and the
   button is out of the document -- `display: none` also keeps it off the tab
   order. The button is hidden at exactly the width the panel stops folding,
   because forcing `.collapse:not(.show)` visible makes the fold one-way: the
   panel could be opened but never closed again.

   Both rules match the plain ones above on specificity, so this block has to
   come after them to win. `flex: 1` waits for `lg`: it is what leaves `__foot`
   free space to push against, and only the full-height column has any. On a
   phone the band is as tall as its content, and a growing flex item would
   fight the inline height Bootstrap animates the fold with. */
@media (min-width: 768px) {
  .app-sidebar__body.collapse:not(.show) {
    display: flex;
  }

  .app-sidebar__toggle {
    display: none;
  }
}

@media (min-width: 992px) {
  .app-sidebar__body {
    flex: 1;
    min-height: 0;
  }
}

/* The "Moje objednávky" group: a header that folds its three children away.
   Reuses `.app-sidebar__link` for the row, so it lines up with the real links
   around it, and resets what `<button>` brings with it. */
.app-sidebar__link--group {
  width: 100%;
  background: none;
  border: 0;
  padding: 5px 10px;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #e8eef7;
}

.app-sidebar__link--group .app-sidebar__dot {
  background: var(--sidebar-heading);
}

.app-sidebar__group-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.app-sidebar__chevron {
  font-size: 11px;
  color: var(--sidebar-heading);
  transition: transform 0.15s ease;
}

.app-sidebar__link--group[aria-expanded='false'] .app-sidebar__chevron {
  transform: rotate(-90deg);
}

.app-sidebar__subnav {
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 4px;
}

/* Bootstrap's `.collapse.show` leaves the element's own display alone, but
   `.collapsing` needs a display too or the fold animates from nothing. */
.app-sidebar__subnav.show,
.app-sidebar__subnav.collapsing {
  display: flex;
}

/* Indented in place of a dot -- the indent is what says "child" here, and the
   proposal drops the dot on these rows. */
.app-sidebar__link--child {
  padding-left: 24px;
  font-size: 13px;
  color: var(--sidebar-secondary);
}

.app-sidebar__subcount {
  margin-left: auto;
  font-size: 12px;
  color: var(--sidebar-heading);
}

/* A folding panel (SPRÁVA): its heading is the toggle, styled as the heading it
   replaces, with the group's chevron. Folded by default. */
.app-sidebar__heading--toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: 0;
  border-radius: 6px;
  text-align: left;
  font-family: inherit;
}

.app-sidebar__heading--toggle:hover,
.app-sidebar__heading--toggle:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.app-sidebar__heading--toggle .app-sidebar__chevron {
  margin-right: 2px;
}

.app-sidebar__heading--toggle[aria-expanded='false'] .app-sidebar__chevron {
  transform: rotate(-90deg);
}

.app-sidebar__panel {
  flex-direction: column;
  gap: 2px;
}

/* Bootstrap's `.collapse` hides it when folded; open, it lays out like the nav. */
.app-sidebar__panel.show,
.app-sidebar__panel.collapsing,
.app-sidebar__panel--open {
  display: flex;
}

.app-sidebar__foot {
  margin-top: auto;
  padding: 10px 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Below `lg` the panel becomes a band above the content, so a narrow screen is
   not left with a 244px column and nowhere to read. */
@media (max-width: 991.98px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    width: 100%;
  }

  .app-sidebar__nav {
    max-height: 60vh;
  }
}

.app-sidebar__action {
  padding: 0 12px 10px;
}
