/* BPBytes sidebar navigation: categories -> modules (blue-to-violet gradient) */

/* Level 1: category = bold header with a count chip; an open group sits on a soft panel */
.bpbytes-nav-category {
    margin: 8px 0 4px;
    border-radius: 14px;
    transition: background var(--bp-transition);
}

.bpbytes-nav-category:not(.is-collapsed) {
    background: rgba(255, 255, 255, 0.045);
    padding-bottom: 6px;
}

.bpbytes-nav-category:not(.is-collapsed) > .bpbytes-nav-category__label .bpbytes-cat-swatch {
    background: #02c5f3;
}

.bpbytes-nav-category__label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 14px;
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
}

.bpbytes-cat-count {
    flex: 0 0 auto;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 18px;
    text-align: center;
}

.bpbytes-nav-category__label:hover {
    color: #fff;
    background: var(--bp-sidebar-hover);
}

.bpbytes-cat-swatch {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.85);
}


.bpbytes-nav-category__label .bpbytes-caret {
    margin-left: auto;
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    transition: transform var(--bp-transition);
}

.bpbytes-nav-category.is-collapsed .bpbytes-caret {
    transform: rotate(-90deg);
}

.bpbytes-nav-category.is-collapsed .bpbytes-nav-list {
    display: none;
}

.bpbytes-nav-list {
    list-style: none;
    margin: 2px 0 8px;
    padding: 0;
}

/* Level 2: modules are indented along a thin guide line, smaller and lighter than the header */
.bpbytes-nav-category .bpbytes-nav-list {
    margin: 0 4px 2px 14px;
    padding-left: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.bpbytes-nav-category .bpbytes-nav-item__link {
    font-size: 13px;
    font-weight: 400;
    padding: 6px 6px;
    gap: 8px;
    white-space: normal;
    overflow: visible;
}

.bpbytes-nav-category .bpbytes-nav-item__icon {
    flex: 0 0 auto;
}

.bpbytes-nav-category .bpbytes-nav-item__label {
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
}

.bpbytes-nav-category .bpbytes-nav-item__icon {
    width: 24px;
    height: 24px;
}

.bpbytes-nav-category .bpbytes-nav-item.is-active > .bpbytes-nav-item__link {
    font-weight: 700;
}

.bpbytes-nav-list--pinned {
    margin: 0 0 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bp-sidebar-border);
}

.bpbytes-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    padding-right: 8px;
}

.bpbytes-nav-item .bpbytes-nav-item__link {
    flex: 1 1 auto;
    min-width: 0;
}

.bpbytes-nav-item__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    margin: 1px 0;
    border-radius: var(--bp-radius-sm);
    color: var(--bp-sidebar-text);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
}

.bpbytes-nav-item__link:hover {
    background: var(--bp-sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.bpbytes-nav-item.is-active > .bpbytes-nav-item__link {
    background: var(--bp-sidebar-active);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(85, 71, 181, 0.35);
}

/*
 * Colored icon chip — each module's suitepicon glyph sits on a small rounded, colored square
 * (glyph rendered in white via the inherited color below) instead of a flat muted-gray icon.
 * Colors cycle through the same --bp-cat-1..8 palette already used for the category swatches
 * above and the profile-avatar fallback (topbar.css), keyed by position within each nav list —
 * nth-of-type resets per <ul>, so every category's module list gets its own fresh 1-8 cycle.
 */
.bpbytes-nav-item__icon {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--bp-radius-sm);
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    transition: transform 0.15s ease;
}

.bpbytes-nav-item:hover .bpbytes-nav-item__icon {
    transform: scale(1.08);
}


.bpbytes-nav-item__icon img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.bpbytes-nav-item__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.bpbytes-nav-item__quick {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--bp-sidebar-text-muted);
    background: transparent;
}

/* The hover "+" create shortcut is not used; records are created from inside the module */
.bpbytes-nav-item:hover .bpbytes-nav-item__quick {
    display: none;
}

.bpbytes-nav-item__quick:hover {
    background: var(--bp-accent-soft);
    color: var(--bp-accent);
}

/* Per-module quick-action flyout (from $shortcutTopMenu) */
.bpbytes-nav-flyout {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 200px;
    background: var(--bp-surface);
    color: var(--bp-text);
    border-radius: var(--bp-radius-sm);
    box-shadow: var(--bp-shadow-lg);
    padding: 6px;
    z-index: var(--bp-z-dropdown);
    border: 1px solid var(--bp-border);
}

/* The hover flyout (white box to the right of the item) is not used */
.bpbytes-nav-item:hover .bpbytes-nav-flyout {
    display: none;
}

.bpbytes-nav-flyout a {
    display: block;
    padding: 8px 10px;
    border-radius: var(--bp-radius-sm);
    color: var(--bp-text);
    text-decoration: none;
    font-size: 13px;
}

.bpbytes-nav-flyout a:hover {
    background: var(--bp-surface-alt);
    text-decoration: none;
}

/*
 * Collapsed rail: hide text, center icons, categories always "open" (icon-only list). The whole
 * category label row (including its color swatch) is hidden rather than just its text — a bare
 * colored square with no caret and no label reads as a meaningless, unclickable icon sitting
 * among the real module icons, not a category header.
 */
body.bpbytes-sidebar-collapsed .bpbytes-nav-category__label,
body.bpbytes-sidebar-collapsed .bpbytes-nav-item__label,
body.bpbytes-sidebar-collapsed .bpbytes-cat-count {
    display: none;
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-category.is-collapsed .bpbytes-nav-list {
    display: block;
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-item__link {
    justify-content: center;
    padding: 10px 0;
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-item__quick {
    display: none !important;
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-item__link:hover .bpbytes-nav-item__label {
    display: block;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bp-text);
    color: #fff;
    padding: 6px 10px;
    border-radius: var(--bp-radius-sm);
    box-shadow: var(--bp-shadow-lg);
    margin-left: 6px;
    white-space: nowrap;
    z-index: var(--bp-z-dropdown);
}

.bpbytes-nav-item.is-active .bpbytes-nav-item__icon {
    background: #fff;
    color: #3f56c4;
}

/* ---- Collapsed icon rail: no guide lines or panels; a divider between groups; the selected
   module is a filled violet square ---- */
body.bpbytes-sidebar-collapsed .bpbytes-nav-category,
body.bpbytes-sidebar-collapsed .bpbytes-nav-category:not(.is-collapsed) {
    margin: 0 0 8px;
    padding: 0 0 8px;
    background: none;
    border-radius: 0;
    border-bottom: 1px solid var(--bp-sidebar-border);
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-category .bpbytes-nav-list {
    margin: 0;
    padding: 0;
    border-left: 0;
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-item {
    padding-right: 0;
    justify-content: center;
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-category .bpbytes-nav-item__link {
    flex: 0 0 auto;
    width: auto;
    padding: 4px 0;
    background: none;
    box-shadow: none;
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-item__link:hover {
    background: none;
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-item__link:hover .bpbytes-nav-item__icon {
    background: rgba(255, 255, 255, 0.22);
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-item.is-active > .bpbytes-nav-item__link {
    background: none;
    box-shadow: none;
}

body.bpbytes-sidebar-collapsed .bpbytes-nav-item.is-active .bpbytes-nav-item__icon {
    background: #7c6af0;
    color: #fff;
    box-shadow: 0 0 0 3px rgba(124, 106, 240, 0.4);
}

/* Tooltip with the module name beside a hovered icon in the collapsed rail (see style.js) */
.bpbytes-nav-tooltip {
    position: fixed;
    z-index: 1200;
    transform: translateY(-50%);
    padding: 6px 12px;
    border-radius: var(--bp-radius-sm);
    background: var(--bp-sidebar-bg);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--bp-shadow-lg);
    pointer-events: none;
}

.bpbytes-nav-tooltip::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 50%;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    background: var(--bp-sidebar-bg);
    transform: rotate(45deg);
    border-radius: 2px;
}

/* the old in-sidebar label pop-out is clipped by the sidebar, so it is replaced by the tooltip */
body.bpbytes-sidebar-collapsed .bpbytes-nav-item__link:hover .bpbytes-nav-item__label {
    display: none;
}
