/**
 * Layout sidebar kiri backend UHOku (pengganti navbar horizontal lama).
 * Vanilla CSS + Bootstrap 5 yang sudah dipakai project ini - TIDAK ada
 * library baru. Warna ikut custom property dari uhoku-theme.css.
 */

:root {
    --uhoku-sidebar-width: 250px;
    --uhoku-sidebar-collapsed-width: 64px;
    --uhoku-topbar-height: 56px;
}

html, body {
    height: 100%;
}

/* Scoped ke body.uhoku-layout-sidebar (ditambahkan di layout/main.php
   masing-masing app) - SENGAJA TIDAK memakai selector "body" polos,
   karena file ini juga ke-load di halaman login (layout blank.php,
   lewat AppAsset yang sama) dan flex disini akan merusak centering
   .uhoku-login-page di sana (login page bukan layout sidebar). */
body.uhoku-layout-sidebar {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.uhoku-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--uhoku-sidebar-width);
    background-color: var(--uhoku-navy);
    color: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1040;
    transition: width .15s ease, transform .2s ease;
    display: flex;
    flex-direction: column;
}

.uhoku-sidebar-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.uhoku-sidebar-brand:hover {
    color: #fff;
}

.uhoku-sidebar-brand img {
    height: 32px;
    width: auto;
    border-radius: .25rem;
    flex-shrink: 0;
}

.uhoku-sidebar-brand-label {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uhoku-sidebar-nav {
    flex: 1 1 auto;
    padding: .5rem 0 1rem;
}

.uhoku-nav-link,
.uhoku-nav-group-toggle {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    padding: .55rem 1rem;
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
    font-size: .92rem;
    white-space: nowrap;
}

.uhoku-nav-link:hover,
.uhoku-nav-group-toggle:hover {
    background-color: rgba(255, 255, 255, .08);
    color: #fff;
}

.uhoku-nav-link.active {
    background-color: var(--uhoku-gold);
    color: var(--uhoku-navy);
    font-weight: 600;
}

.uhoku-nav-icon {
    display: inline-flex;
    width: 1.35rem;
    flex-shrink: 0;
    justify-content: center;
    font-size: 1rem;
}

.uhoku-nav-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uhoku-nav-group-caret {
    flex-shrink: 0;
    transition: transform .15s ease;
    font-size: .7rem;
}

.uhoku-nav-group.show > .uhoku-nav-group-toggle .uhoku-nav-group-caret {
    transform: rotate(90deg);
}

.uhoku-nav-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height .2s ease;
}

.uhoku-nav-group.show > .uhoku-nav-group-items {
    max-height: 40rem;
}

.uhoku-nav-group-items .uhoku-nav-link {
    padding-left: 2.5rem;
    font-size: .87rem;
}

.uhoku-nav-group-label-note {
    font-size: .7rem;
    font-weight: 400;
    opacity: .7;
    white-space: normal;
}

/* ---------- Content wrapper & topbar ---------- */
.uhoku-content-wrapper {
    flex: 1 1 auto;
    margin-left: var(--uhoku-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .15s ease;
    min-width: 0;
}

.uhoku-topbar {
    height: var(--uhoku-topbar-height);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    background-color: #fff;
    border-bottom: 1px solid #e2e6ea;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.uhoku-sidebar-toggle {
    border: none;
    background: none;
    font-size: 1.25rem;
    line-height: 1;
    padding: .25rem .5rem;
    color: var(--uhoku-navy);
}

.uhoku-topbar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .9rem;
}

main.uhoku-main {
    flex: 1 1 auto;
    padding: 1.25rem 1.5rem 1.5rem;
    min-width: 0;
}

/* GridView & wide tables tetap bisa di-scroll horizontal, tidak terpotong,
   walau lebar konten berkurang karena sidebar (Bagian C.2). */
.grid-view {
    display: block;
    overflow-x: auto;
}

/* ---------- Sidebar collapsed (icon-only, desktop) ---------- */
body.uhoku-sidebar-collapsed .uhoku-sidebar {
    width: var(--uhoku-sidebar-collapsed-width);
}

body.uhoku-sidebar-collapsed .uhoku-content-wrapper {
    margin-left: var(--uhoku-sidebar-collapsed-width);
}

body.uhoku-sidebar-collapsed .uhoku-sidebar-brand-label,
body.uhoku-sidebar-collapsed .uhoku-nav-label,
body.uhoku-sidebar-collapsed .uhoku-nav-group-caret,
body.uhoku-sidebar-collapsed .uhoku-nav-group-items {
    display: none;
}

body.uhoku-sidebar-collapsed .uhoku-nav-link,
body.uhoku-sidebar-collapsed .uhoku-nav-group-toggle {
    justify-content: center;
    padding-left: .5rem;
    padding-right: .5rem;
}

/* ---------- Responsive: off-canvas di layar kecil ---------- */
.uhoku-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1030;
}

@media (max-width: 991.98px) {
    .uhoku-sidebar {
        transform: translateX(-100%);
        width: var(--uhoku-sidebar-width) !important;
    }

    body.uhoku-sidebar-mobile-open .uhoku-sidebar {
        transform: translateX(0);
    }

    body.uhoku-sidebar-mobile-open .uhoku-sidebar-overlay {
        display: block;
    }

    .uhoku-content-wrapper {
        margin-left: 0 !important;
    }

    /* Status collapse desktop tidak relevan di mobile - selalu icon+label penuh saat dibuka. */
    body.uhoku-sidebar-collapsed .uhoku-sidebar-brand-label,
    body.uhoku-sidebar-collapsed .uhoku-nav-label,
    body.uhoku-sidebar-collapsed .uhoku-nav-group-caret,
    body.uhoku-sidebar-collapsed .uhoku-nav-group-items {
        display: revert;
    }

    body.uhoku-sidebar-collapsed .uhoku-nav-link,
    body.uhoku-sidebar-collapsed .uhoku-nav-group-toggle {
        justify-content: flex-start;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
