/* Menu Sidebar Structure */
.menu-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 280px;
    background-color: #fff;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transform: translateX(0);
    transition: transform 0.3s ease;
    overflow: visible;
}

.menu-sidebar.closed {
    transform: translateX(-240px);
}

/* Tab-style Toggle Button */
.menu-sidebar-toggle {
    position: absolute;
    top: 120px;
    right: -60px;
    width: 40px;
    height: 80px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-left: none;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

/* Prevent background color change on button hover/active states */
.menu-sidebar-toggle:hover,
.menu-sidebar-toggle:active,
.menu-sidebar-toggle:focus {
    background-color: #fff !important;
    color: inherit !important;
    outline: none !important;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1) !important;
    border-color: #ddd !important;
}

/* Ensure no background changes in any state */
.menu-sidebar-toggle {
    transition: none !important;
}

/* Arrow icon */
.toggle-icon {
    position: relative;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #333;
    margin-left: -4px;
}

/* Flip arrow when closed */
.menu-sidebar.closed .toggle-icon {
    border-right: none;
    border-left: 8px solid #333;
    margin-left: 4px;
}

/* Menu Content Container */
.menu-sidebar-content {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

/* Clear Genesis Menu Styling */
.menu-sidebar .menu,
.menu-sidebar .genesis-nav-menu {
    float: none;
    width: 100%;
    clear: both;
    display: block;
    text-align: left;
    padding: 0;
    margin: 0;
}

/* Primary Navigation Section */
.sidebar-nav.primary-nav {
    margin-bottom: 30px;
    padding-bottom: 15px;
    position: relative;
}

.sidebar-nav h4 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-weight: 600;
}

/* Menu Items Base Styling */
.menu-sidebar .menu-item {
    display: block;
    float: none;
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: left;
}

.menu-sidebar .menu-item a {
    display: block;
    padding: 8px 0;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
    transition: all 0.2s ease;
    background-color: transparent;
    width: 100%;
    text-align: left;
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
}

.menu-sidebar .menu-item a:hover,
.menu-sidebar .current-menu-item > a {
    color: #7c0800;
    font-weight: 600;
    background-color: transparent;
}

/* SubMenu Styling */
.menu-sidebar .sub-menu {
    display: block;
    position: static;
    background: transparent;
    border: none;
    margin-left: 15px;
    padding: 0;
    width: auto;
    opacity: 1;
}

.menu-sidebar .sub-menu .menu-item a {
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #eee;
    background-color: transparent;
    width: 100%;
}

/* Members Navigation Section - Strong Visual Separation */
.sidebar-nav.members-nav {
    margin-top: 40px;
    padding-top: 20px;
    position: relative;
    border-top: 2px solid #eee;
}

.sidebar-nav.members-nav h4 {
    color: #0073e5;
    margin-top: 0;
}

/* Members Menu Specific Styling */
.sidebar-members-menu {
    display: block;
    width: 100%;
}

/* Full Site Container Adjustment */
body {
    padding-left: 280px;
    transition: padding-left 0.3s ease;
}

body.sidebar-closed {
    padding-left: 40px;
}

/* Override ALL Genesis containers to be full width */
.site-container,
.wrap,
.site-inner,
.content-sidebar-wrap,
.content,
.site-header > .wrap,
.nav-primary > .wrap,
.site-footer > .wrap {
    width: 100% !important;
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    float: none !important;
}

/* Set inner content max-width for readability */
.site-inner > .wrap {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 30px !important;
}

/* Mobile Adjustments - IDENTICAL TO DESKTOP BUT DEFAULTING TO CLOSED */
@media (max-width: 960px) {
    body {
        padding-left: 0;
    }
    
    body.sidebar-open {
        overflow: hidden; /* Prevent scrolling when menu is open */
    }
    
    /* Menu Starts Closed on Mobile */
    .menu-sidebar {
        transform: translateX(-280px);
        /* Keep normal styles, just hidden by default */
    }
    
    /* When Open - Show Menu with Same Styling */
    .menu-sidebar.open {
        transform: translateX(0);
    }
    
    /* Reset default arrow behavior for mobile */
    .toggle-icon {
        /* Default mobile state is CLOSED, arrow points LEFT to open */
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        border-right: none;
        border-left: 8px solid #333;
        margin-left: 4px;
    }
    
    /* When open on mobile, arrow points RIGHT to close */
    .menu-sidebar.open .toggle-icon {
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        border-left: none;
        border-right: 8px solid #333;
        margin-left: -4px;
    }
    
    /* Override the desktop closed state which doesn't apply to mobile */
    .menu-sidebar.closed .toggle-icon {
        /* Mobile closed state already defined above */
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        border-right: none !important;
        border-left: 8px solid #333 !important;
        margin-left: 4px !important;
    }
    
    /* Site layout in mobile view */
    .site-inner > .wrap {
        padding: 0 15px !important;
    }
}

/* Overlay for Mobile */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

@media (max-width: 960px) {
    .menu-sidebar.open + .menu-overlay {
        display: block;
    }
}