/* Sidebar layout */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background-color: #1f1f1f;
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 9999;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
}

/* Logo section (fixed at top) */
.site-logo {
    flex-shrink: 0;
    text-align: center;
}

/* Logo */
.site-logo img {
    max-width: 50px;
    height: auto;
}

.company-logo {
    text-align: center;
    margin: 1rem 0;
}

.company-logo img {
    max-width: 120px;
    height: auto;
}

/* Hide scrollbar on WebKit for a clean look */
.site-navigation::-webkit-scrollbar {
    width: 6px;
}

.site-navigation::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.site-navigation::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

/* Navigation area (scrollable) */
.site-navigation {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

/* Vertical menu */
.vertical-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    text-align: left;
}

.vertical-menu li {
    margin-bottom: 1rem;
}

.vertical-menu a {
    color: #ccc;
    text-decoration: none;
    display: block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background 0.3s, color 0.3s;
}

/* Hover + active states */
.vertical-menu a:hover,
.vertical-menu .current-menu-item>a {
    background-color: var(--kru-color-primary);
    color: #fff;
}

/* Submenu base — always hidden initially */
.vertical-menu .sub-menu {
    display: none;
    margin-left: 1rem;
    padding-left: 0.5rem;
    margin-top: .3rem;
    list-style-type: none;
}

/* Expanded submenu (via JS) */
.vertical-menu .submenu-open>.sub-menu {
    display: block;
}

/* Optional: auto-open if current page is inside */
.vertical-menu .current-menu-ancestor>.sub-menu {
    display: none;
    /* JS will handle this if needed */
}

/* Parent link styling */
.vertical-menu .menu-item-has-children>a {
    position: relative;
    cursor: pointer;
    padding-right: 1.5rem;
}

/* Add small arrow indicator */
.vertical-menu .menu-item-has-children>a::after {
    content: "▸";
    position: absolute;
    right: 0.75rem;
    transition: transform 0.2s;
}

/* Rotate arrow when open */
.vertical-menu .submenu-open>a::after {
    transform: rotate(90deg);
}

/* Hide hamburger by default (desktop) */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {

    /* Prevent any accidental horizontal overflow */
    html,
    body {
        overflow-x: hidden;
        overscroll-behavior-y: none;
    }

    .site-header {
        overflow-x: hidden;
    }

    /* Main content should start below fixed header */
    .site-content,
    .site-footer {
        margin-left: 0;
        margin-top: 70px;
        /* enough to clear fixed header */
    }

    /* Sidebar becomes top header */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        /*width: 100%;*/
        height: auto;
        max-height: 100vh;
        overflow-y: visible;
        background-color: #1f1f1f;
        display: flex;
        flex-direction: column;
        padding: 0.5rem 1rem;
        z-index: 9999;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        transition: transform 0.3s ease;

        width: 100vw;
        /* ensure full viewport width */
        max-width: 100vw;
        box-sizing: border-box;
    }

    .site-navigation::-webkit-scrollbar {
        width: 0;
    }

    /* Scroll behavior */
    .sidebar.hidden {
        transform: translateY(-100%);
    }

    /* Logo + toggle row */
    .header-inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 0.5rem;
        padding: 0.25rem 0;
    }


    /* Distribute space: logo left, company middle, bell/hamburger right */
    .header-left,
    .company-logo,
    .header-right {
        flex: 1;
        display: flex;
        align-items: center;
    }

    /* Left logo aligned to start */
    .header-left {
        justify-content: flex-start;
    }

    /* Bell + hamburger aligned to end */
    .header-right,
    .mobile-menu-container {
        display: flex;
        align-items: center;
        /* vertically center bell + hamburger */
        justify-content: flex-end;
        gap: 0.75rem;
    }

    .site-logo {
        padding: 0;
        margin: 0;
    }

    .site-logo img {
        max-width: 45px;
        margin-bottom: 0;
        /* smaller logo */
        height: auto;
    }

    /* Company logo centered */
    .company-logo {
        justify-content: center;
    }

    .company-logo img {
        max-width: 60px;
        height: auto;
    }

    .notification-bell img {
        max-width: 24px;
        height: auto;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        margin: 0;
        color: #fff;
        /* or your header icon color */
        line-height: 1;
    }

    .mobile-menu-toggle svg {
        width: 30px;
        height: 30px;
        stroke: currentColor;
        /* inherits color from parent */
    }

    /* Hide navigation by default */
    .site-navigation {
        display: none;
        width: 100%;
        margin-top: 1rem;
    }

    /* Show menu when active */
    .site-navigation.active {
        display: block;
    }

    /* Vertical menu items become horizontal if desired */
    .vertical-menu {
        flex-direction: column;
        width: 100%;
    }

    .vertical-menu li {
        margin-bottom: 1rem;
    }

    /*testing*/
    .vertical-menu a {
        display: block;
        width: 100%;
        padding: 0.75rem 1rem;
        box-sizing: border-box;
    }
}