/* ══════════════════════════════════════════════════════════
   RedSim BranchedMenu — Navigasi Sidebar
   Semua warna menggunakan token --rs-* dari tokens.css
   ══════════════════════════════════════════════════════════ */

.branched-menu {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    padding-left: 0;
    color: var(--rs-text-2);
    font-family: var(--rs-font-sans);
    font-size: 14px;
    line-height: 1.2;
    box-sizing: border-box;
}

.branched-menu::before { display: none; }

/* Marker merah sliding (garis 2px penanda aktif) */
.branched-menu__marker {
    position: absolute;
    top: -1px;
    left: 0;
    z-index: 2;
    width: 2px;
    height: 16px;
    border-radius: 1px;
    background: var(--rs-red-500);
    box-shadow: none;
    opacity: 0;
    transition:
        top 220ms cubic-bezier(0.23, 1, 0.32, 1),
        opacity 150ms ease;
}
.branched-menu__marker[data-on] { opacity: 1; }

.branched-menu__section {
    display: flex;
    flex-direction: column;
    margin-bottom: 2px;
}

.branched-menu__section[data-admin]::before {
    content: '';
    display: block;
    height: 1px;
    background: var(--rs-border-subtle);
    margin: 8px 0;
}

/* Judul grup (head) — netral, kontras jelas, chevron berputar */
.branched-menu__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 6px 8px;
    border: 0;
    background: none;
    color: var(--rs-text-3);
    font-family: var(--rs-font-sans);
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    text-align: left;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--rs-dur-fast) var(--rs-ease), background var(--rs-dur-fast) var(--rs-ease);
    border-radius: var(--rs-r-sm);
    min-height: 34px;
}

@media (hover: hover) and (pointer: fine) {
    .branched-menu__head:hover {
        color: var(--rs-text);
        background: var(--rs-surface-2);
    }
}

.branched-menu__head-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.branched-menu__head-title > span:first-child[style*="border-radius:50%"] {
    display: none;
}

.branched-menu__head-chevron {
    width: 14px;
    height: 14px;
    opacity: 0.75;
    transition: transform 200ms var(--rs-ease), opacity var(--rs-dur-fast);
}
.branched-menu__section[data-open] .branched-menu__head-chevron {
    transform: rotate(90deg);
    opacity: 1;
}
.branched-menu__section[data-open] .branched-menu__head {
    color: var(--rs-text-2);
}

.branched-menu__body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--rs-dur-base) var(--rs-ease);
}
.branched-menu__section[data-open] .branched-menu__body {
    grid-template-rows: 1fr;
}
.branched-menu__fold {
    min-height: 0;
    overflow: hidden;
}

.branched-menu__tree {
    position: relative;
    padding: 2px 0;
    box-sizing: border-box;
}

.branched-menu__lines { display: none; }

/* Item menu */
.branched-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 36px;
    margin: 0;
    padding: 0 10px;
    border: 0;
    background: none;
    color: var(--rs-text-2);
    font-family: var(--rs-font-sans);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--rs-dur-fast) var(--rs-ease),
                background var(--rs-dur-fast) var(--rs-ease);
    border-radius: var(--rs-r-sm);
    position: relative;
}

@media (hover: hover) and (pointer: fine) {
    .branched-menu__item:hover {
        color: var(--rs-text);
        background: var(--rs-surface-2);
    }
}

@media (pointer: coarse) {
    .branched-menu__item { min-height: 44px; height: auto; padding: 10px; }
}

/* Item aktif: Latar netral surface-2 + bar kiri 2px merah (BUKAN latar tint merah!) */
.branched-menu__item[data-active] {
    color: var(--rs-text) !important;
    font-weight: 600;
    background: var(--rs-surface-2) !important;
    border-left: none !important;
    padding-left: 10px !important;
}
.branched-menu__item[data-active]::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--rs-red-500);
    border-radius: 0 2px 2px 0;
}
.branched-menu__item[data-active] .branched-menu__icon {
    color: var(--rs-text);
}

.branched-menu__item:focus-visible,
.branched-menu__head:focus-visible {
    outline: 2px solid var(--rs-red-ring);
    outline-offset: -2px;
}

.branched-menu__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 18px;
    height: 18px;
    color: inherit;
}

.branched-menu__label {
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    overflow: visible;
}

.branched-menu__badge,
.rs-tag-neutral {
    font-size: 11px;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: var(--rs-r-xs);
    line-height: 16px;
    border: 1px solid var(--rs-border);
    color: var(--rs-text-3);
    background: var(--rs-surface-2);
    white-space: nowrap;
    text-transform: none;
    letter-spacing: 0;
}

@media (prefers-reduced-motion: reduce) {
    .branched-menu__marker { transition: opacity 150ms ease; }
    .branched-menu__body   { transition: none; }
}
