/* =====================================================
   FINANCIAL AUDIT - LEFT SIDEBAR LAYOUT
   FIXED: Proper sidebar positioning and toggle visibility
   ===================================================== */

/* Reset */
.audit-app * { box-sizing: border-box; }

/* =====================================================
   MAIN APP CONTAINER - FLEXBOX LEFT TO RIGHT
   ===================================================== */
.audit-app {
    display: flex !important;
    flex-direction: row !important;
    min-height: 100vh !important;
    width: 100% !important;
    background: #0a0a0f !important;
    position: relative !important;
}

#auditApp {
    display: block !important;
    min-height: 100vh !important;
    background: #0a0a0f !important;
}

/* =====================================================
   LEFT SIDEBAR - FIXED ON LEFT SIDE
   ===================================================== */
.audit-sidebar {
    width: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
    height: 100vh !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    background: rgba(15, 20, 30, 0.98) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 1000 !important;
    transition: transform 0.3s ease !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Sidebar collapsed state - slides off screen */
.audit-sidebar.collapsed {
    transform: translateX(-260px) !important;
}

/* =====================================================
   SIDEBAR HEADER
   ===================================================== */
.sidebar-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px 20px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex-shrink: 0 !important;
}

.sidebar-brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.brand-icon {
    width: 36px !important;
    height: 36px !important;
    background: linear-gradient(135deg, #4384ff 0%, #7b42ff 100%) !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 16px !important;
    box-shadow: 0 4px 15px rgba(123, 66, 255, 0.3) !important;
}

.brand-text {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #fff !important;
}

/* Close button in sidebar */
.sidebar-close {
    width: 28px !important;
    height: 28px !important;
    background: transparent !important;
    border: none !important;
    color: #718096 !important;
    cursor: pointer !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.sidebar-close:hover {
    background: rgba(255,255,255,0.1) !important;
    color: #fff !important;
}

.sidebar-close svg {
    width: 18px !important;
    height: 18px !important;
}

/* =====================================================
   SIDEBAR NAVIGATION MENU
   ===================================================== */
.sidebar-nav,
.sidebar-menu {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 12px 0 !important;
}

/* Menu Items */
.menu-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 20px !important;
    color: #a0aec0 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    border-left: 3px solid transparent !important;
    font-size: 14px !important;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
}

.menu-item.active {
    background: rgba(123, 66, 255, 0.15) !important;
    color: var(--audit-accent-purple, #7b42ff) !important;
    border-left-color: var(--audit-accent-purple, #7b42ff) !important;
}

.menu-icon {
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.menu-icon svg {
    width: 100% !important;
    height: 100% !important;
}

.menu-label {
    flex: 1 !important;
}

.menu-arrow {
    width: 16px !important;
    height: 16px !important;
    transition: transform 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.menu-arrow svg {
    width: 14px !important;
    height: 14px !important;
}

.menu-item.expanded .menu-arrow {
    transform: rotate(90deg) !important;
}

/* =====================================================
   SUBMENUS
   ===================================================== */
.menu-group {
    margin: 0 !important;
}

.submenu {
    max-height: 0 !important;
    overflow: hidden !important;
    background: rgba(0, 0, 0, 0.2) !important;
    transition: max-height 0.3s ease !important;
}

.submenu.open {
    max-height: 300px !important;
}

.submenu-item {
    display: block !important;
    padding: 10px 20px 10px 52px !important;
    color: #718096 !important;
    font-size: 13px !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
}

.submenu-item:hover {
    color: #a0aec0 !important;
    background: rgba(255,255,255,0.02) !important;
}

.submenu-item.active {
    color: var(--audit-accent-purple, #7b42ff) !important;
}

/* =====================================================
   MAIN CONTENT AREA - RIGHT OF SIDEBAR
   ===================================================== */
.audit-main {
    flex: 1 !important;
    margin-left: 260px !important;
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    transition: margin-left 0.3s ease !important;
    background: transparent !important;
}

/* When sidebar is collapsed, main takes full width */
.audit-app.sidebar-collapsed .audit-main {
    margin-left: 0 !important;
}

/* Also support sibling selector */
.audit-sidebar.collapsed ~ .audit-main {
    margin-left: 0 !important;
}

/* =====================================================
   TOGGLE BUTTON (HAMBURGER) - FIXED POSITION
   ===================================================== */
.sidebar-toggle {
    position: fixed !important;
    top: 16px !important;
    left: 16px !important;
    z-index: 1001 !important;
    width: 44px !important;
    height: 44px !important;
    background: rgba(30, 37, 56, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px !important;
    color: #a0aec0 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s, opacity 0.3s !important;
    /* Hidden by default when sidebar is open */
    opacity: 0 !important;
    pointer-events: none !important;
}

.sidebar-toggle:hover {
    background: rgba(50, 60, 80, 0.95) !important;
    color: #fff !important;
}

.sidebar-toggle svg {
    width: 22px !important;
    height: 22px !important;
}

/* Show toggle button when sidebar is collapsed */
.audit-app.sidebar-collapsed .sidebar-toggle {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Also support sibling selector (toggle comes after sidebar) */
.audit-sidebar.collapsed ~ .sidebar-toggle {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.main-content,
.audit-content {
    flex: 1 !important;
    padding: 24px !important;
    overflow-y: auto !important;
}

/* =====================================================
   HIDE ANY TOP BAR/TOPBAR ELEMENTS
   ===================================================== */
.audit-topbar,
.topbar,
[class*="topbar"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* =====================================================
   RESPONSIVE - MOBILE
   ===================================================== */
@media (max-width: 768px) {
    .audit-sidebar {
        transform: translateX(-260px) !important;
    }

    .audit-sidebar.open {
        transform: translateX(0) !important;
    }

    .audit-main {
        margin-left: 0 !important;
    }

    .sidebar-toggle {
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}
