/* ==========================================================================
   Collapsible left sidebar
   Colors reuse the existing theme tokens (navy #0a2540, accent #214c89)
   already used across public/css/main.css so no new palette is introduced.
   ========================================================================== */

.app-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 90px);
}

.app-shell__content {
    flex: 1;
    min-width: 0;
}

.app-sidebar {
    flex-shrink: 0;
    width: 15.5rem;
    background-color: #0a2540;
    transition: width 0.25s ease-in-out;
    position: sticky;
    top: 0;
    align-self: stretch;
    min-height: 100vh;
    overflow: visible;
    z-index: 5;
}

.app-sidebar__nav {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1.25rem 0.75rem 1.25rem 0;
}

.app-sidebar__menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-sidebar__item {
    margin-bottom: 0.25rem;
}

.app-sidebar__item > a,
.app-sidebar__toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    padding: 0.625rem 0.75rem 0.625rem 1.5rem;
    border-radius: 0 0.5rem 0.5rem 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9375em;
    font-weight: 600;
    line-height: 1.375;
    white-space: nowrap;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out,
        gap 0.25s ease-in-out, padding 0.25s ease-in-out;
}

.app-sidebar__item > a::before,
.app-sidebar__toggle::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.25rem;
    bottom: 0.25rem;
    width: 0.25rem;
    border-radius: 0 0.25rem 0.25rem 0;
    background-color: #3fa9f5;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.app-sidebar__item > a:hover,
.app-sidebar__toggle:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.app-sidebar__item.is-active > a,
.app-sidebar__item.is-active > .app-sidebar__toggle {
    background:
        linear-gradient(90deg, rgba(63, 169, 245, 0.3) 0%, rgba(63, 169, 245, 0.08) 55%, rgba(63, 169, 245, 0) 100%),
        rgba(255, 255, 255, 0.04);
    box-shadow: inset 0.75rem 0 0.75rem -0.75rem rgba(63, 169, 245, 0.9);
    color: #ffffff;
}

.app-sidebar__item.is-active > a::before,
.app-sidebar__item.is-active > .app-sidebar__toggle::before {
    opacity: 1;
}

.app-sidebar__icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-sidebar__icon svg {
    width: 100%;
    height: 100%;
}

.app-sidebar__label {
    flex: 1;
    max-width: 12rem;
    opacity: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s ease-in-out, max-width 0.25s ease-in-out;
}

.app-sidebar__chevron {
    flex-shrink: 0;
    width: 0.75rem;
    height: 0.75rem;
    opacity: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out, width 0.25s ease-in-out;
}

.app-sidebar__item--parent.is-open .app-sidebar__chevron {
    transform: rotate(180deg);
}

.app-sidebar__submenu {
    list-style: none;
    margin: 0.125rem 0 0.25rem;
    padding: 0;
    display: none;
}

.app-sidebar__item--parent.is-open .app-sidebar__submenu {
    display: block;
}

.app-sidebar__submenu li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    padding: 0.5rem 0.75rem 0.5rem 2.75rem;
    border-radius: 0 0.5rem 0.5rem 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8125em;
    line-height: 1.42857;
    white-space: nowrap;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.app-sidebar__submenu-icon {
    flex-shrink: 0;
    width: 0.375rem;
    height: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-sidebar__submenu-icon svg {
    width: 100%;
    height: 100%;
}

.app-sidebar__submenu li a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.1875rem;
    bottom: 0.1875rem;
    width: 0.25rem;
    border-radius: 0 0.25rem 0.25rem 0;
    background-color: #3fa9f5;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.app-sidebar__submenu li a:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.app-sidebar__submenu li.is-active a {
    background:
        linear-gradient(90deg, rgba(63, 169, 245, 0.3) 0%, rgba(63, 169, 245, 0.08) 55%, rgba(63, 169, 245, 0) 100%),
        rgba(255, 255, 255, 0.04);
    box-shadow: inset 0.75rem 0 0.75rem -0.75rem rgba(63, 169, 245, 0.9);
    color: #ffffff;
}

.app-sidebar__submenu li.is-active a::before {
    opacity: 1;
}

.app-sidebar__collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 1.75rem;
    right: -0.75rem;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    background-color: #ffffff;
    border: 0;
    border-radius: 50%;
    color: #0a2540;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(10, 37, 64, 0.45);
    transition: box-shadow 0.2s ease-in-out, color 0.2s ease-in-out;
}

.app-sidebar__collapse:hover {
    color: #214c89;
    box-shadow: 0 6px 18px rgba(10, 37, 64, 0.55);
}

.app-sidebar__collapse svg {
    flex-shrink: 0;
    transition: transform 0.25s ease-in-out;
}

.app-sidebar__collapse::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 0.625rem);
    top: 50%;
    transform: translateY(-50%) translateX(-0.25rem);
    background-color: #0a2540;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    padding: 0.4375rem 0.625rem;
    border-radius: 0.375rem;
    box-shadow: 0 4px 10px rgba(10, 37, 64, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
    z-index: 10;
}

.app-sidebar__collapse:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    transition-delay: 1s;
}

.app-sidebar.is-collapsed {
    width: 4.5rem;
}

.app-sidebar.is-collapsed .app-sidebar__submenu {
    display: none;
}

.app-sidebar.is-collapsed .app-sidebar__label {
    opacity: 0;
    max-width: 0;
}

.app-sidebar.is-collapsed .app-sidebar__chevron {
    opacity: 0;
    width: 0;
}

.app-sidebar.is-collapsed .app-sidebar__item > a,
.app-sidebar.is-collapsed .app-sidebar__toggle {
    justify-content: center;
    gap: 0;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.app-sidebar.is-collapsed .app-sidebar__collapse svg {
    transform: rotate(180deg);
}


@media screen and (max-width: 991px) {
    .app-sidebar {
        width: 4.5rem;
        position: relative;
        /* height:auto here still needs align-self:stretch (it doesn't
           inherit from the base rule's own value once overridden) — without
           it, the sidebar shrink-wraps to just its icon list's height
           instead of filling the column, leaving the rest of the column
           with no navy background at all. */
        height: auto;
        align-self: stretch;
    }

    .app-sidebar .app-sidebar__label,
    .app-sidebar .app-sidebar__chevron,
    .app-sidebar .app-sidebar__submenu,
    .app-sidebar .app-sidebar__collapse {
        display: none;
    }

    .app-sidebar__item > a,
    .app-sidebar__toggle {
        justify-content: center;
    }
}

.cr.toast.is-show {
    z-index: 20;
    box-shadow: 0 8px 28px rgba(10, 37, 64, 0.55);
}
