/* ==========================================================
   SIDE MENU + HEADER LAYOUT (LTR / RTL + Responsive)
   ========================================================== */

:root {
    --sideMenuWidth: 250px;
    --headerPadding: 5rem;
    --headerGutter: 0px; /* Extra page padding if desired */
}

/* === Side Menu === */
#sideMenu {
    position: fixed;
    top: 60px;
    bottom: 0;
    width: var(--sideMenuWidth);
    background: var(--menu-bg);
    box-shadow: 0 0 20px rgba(var(--shadow-rgb), var(--shadow-opacity));
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s ease;
    padding-top: 20px;
}

    /* Header inside side menu */
    #sideMenu .sideMenu-header {
        text-align: center;
        padding: 10px;
        font-weight: bold;
        color: var(--menu-header-fg);
    }

    /* Links container */
    #sideMenu .sideMenu-links {
        display: flex;
        flex-direction: column;
    }

    /* Menu item link */
    #sideMenu a.item-link {
        display: flex;
        align-items: center;
        padding: 10px 15px;
        font-size: 16px;
        color: var(--menu-fg);
        text-decoration: none;
        transition: background 0.3s;
    }

        /* Icon in menu item */
        #sideMenu a.item-link i {
            margin-inline-end: 10px;
            font-size: 18px;
            color: var(--menu-icon);
        }

        /* Hover and active styles */
        #sideMenu a.item-link:hover,
        #sideMenu a.mmActive {
            background-color: var(--menu-active-bg);
            color: var(--menu-active-fg);
        }

            #sideMenu a.mmActive i {
                color: var(--menu-active-fg);
            }

    /* Footer of side menu */
    #sideMenu .sideMenu-footer {
        color: var(--menu-icon);
        background-color: var(--menu-bg);
        margin-top: auto;
        text-align: center;
        padding: 10px;
        font-size: 13px;
        border-top: 1px solid var(--menu-border);
    }

/* === Body Content Area === */
#mainContent {
    transition: margin 0.3s ease;
    margin-left: var(--sideMenuWidth);
    will-change: margin;
}

body[dir="rtl"] #mainContent {
    margin-left: 0;
    margin-right: var(--sideMenuWidth);
}

body.menu-closed #mainContent {
    margin-left: 0;
}

body[dir="rtl"].menu-closed #mainContent {
    margin-right: 0;
}

/* === Footer Area === */
#footerContent {
    transition: margin 0.3s ease;
    margin-left: var(--sideMenuWidth);
    will-change: margin;
}

body[dir="rtl"] #footerContent {
    margin-left: 0;
    margin-right: var(--sideMenuWidth);
}

body.menu-closed #footerContent {
    margin-left: 0;
}

body[dir="rtl"].menu-closed #footerContent {
    margin-right: 0;
}

/* Common area has 5rem margin */
body.common-area #footerContent {
    transition: margin 0.3s ease;
    margin-left: calc(var(--sideMenuWidth) + var(--headerPadding));
    will-change: margin;
}

body[dir="rtl"].common-area #footerContent {
    margin-left: 0;
    margin-right: calc(var(--sideMenuWidth) + var(--headerPadding));
}

body.menu-closed #footerContent {
    margin-left: 0;
}

body[dir="rtl"].menu-closed #footerContent {
    margin-right: 0;
}

/* ==== Two-level menu additions ==== */
#sideMenu .menu-group {
    border-top: 1px solid var(--menu-border);
}

#sideMenu .menu-toggle {
    color: var(--menu-fg);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
}

    #sideMenu .menu-toggle:hover {
        background: var(--menu-hover-bg);
    }

    #sideMenu .menu-toggle i {
        color: var(--menu-icon);
    }

    /* Chevron indicator */
    #sideMenu .menu-toggle .chevron {
        margin-inline-start: auto;
        transition: transform 0.2s ease;
        font-size: 14px;
        color: var(--menu-muted);
    }

#sideMenu .menu-group.open .menu-toggle .chevron {
    transform: rotate(180deg);
}

/* Collapsible submenu */
#sideMenu .submenu {
    display: block;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
    background: var(--submenu-bg);
    border-top: 1px solid var(--menu-border);
}

    /* Submenu links reuse item-link look */
    #sideMenu .submenu .item-link {
        padding-inline-start: 36px;
        background: var(--submenu-bg);
    }

/* Open state */
#sideMenu .menu-group.open .submenu {
    max-height: 1000px;
}

/* Active states */
#sideMenu .submenu a.mmActive {
    background-color: var(--menu-active-bg);
    color: var(--menu-active-fg);
}

    #sideMenu .submenu a.mmActive i {
        color: var(--menu-active-fg);
    }

/* RTL niceties for chevron */
[dir="rtl"] #sideMenu .menu-toggle .chevron {
    transform: scaleX(-1);
}

[dir="rtl"] #sideMenu .menu-group.open .menu-toggle .chevron {
    transform: scaleX(-1) rotate(180deg);
}

/* === Mobile View === */
@media (max-width: 768px) {
    #sideMenu.closed {
        left: -250px !important;
        right: auto !important;
    }

    body[dir="rtl"] #sideMenu.closed {
        right: -250px !important;
        left: auto !important;
    }

    #sideMenu.open {
        left: 0 !important;
    }

    body[dir="rtl"] #sideMenu.open {
        right: 0 !important;
        left: auto !important;
    }

    #mainContent {
        margin: 0 !important;
    }

    #footerContent {
        margin: 0 !important;
    }
}

/* === Navbar/Header === */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--header-bg);
    height: 60px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(var(--shadow-rgb), calc(var(--shadow-opacity) * 0.5));
    z-index: 1001;
    transition: padding 0.3s ease;
}

/* === Desktop View Toggle === */
@media (min-width: 769px) {
    #sideMenu.closed {
        display: none !important;
    }

    #sideMenu.open {
        display: block !important;
    }

    /* LTR */
    body[dir="ltr"] #header {
        padding-left: calc(var(--headerPadding) + var(--headerGutter));
        padding-right: calc(var(--headerPadding) + var(--headerGutter));
    }

    body[dir="ltr"].menu-closed #header {
        padding-left: calc(var(--headerPadding) + var(--headerGutter));
    }

    /* RTL */
    body[dir="rtl"] #header {
        padding-right: calc(var(--headerPadding) + var(--headerGutter));
        padding-left: calc(var(--headerPadding) + var(--headerGutter));
    }

    body[dir="rtl"].menu-closed #header {
        padding-right: calc(var(--headerPadding) + var(--headerGutter));
    }
}

/*--------------------------------------------------------------
# Header (logo area etc.)
--------------------------------------------------------------*/
.divLogOut,
.divLogo {
    display: flex;
    align-items: center;
}

.divLogOut {
    justify-content: flex-end;
    text-align: end;
}

.divLogo {
    justify-content: flex-start;
    text-align: start;
    margin-inline-end: auto;
}

/* === Profile Dropdown === */
.profile-dropdown .dropdown-toggle {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--menu-icon);
    transition: color 0.3s ease;
    padding: 5px;
}

    .profile-dropdown .dropdown-toggle:hover {
        color: var(--menu-active-fg);
    }

.profile-dropdown img {
    border: 2px solid var(--menu-border);
    transition: transform 0.2s ease;
}

    .profile-dropdown img:hover {
        transform: scale(1.05);
    }

.dropdown-menu {
    min-width: 200px;
    font-size: 14px;
}

.dropdown-item i {
    width: 18px;
    text-align: center;
}

/* RTL alignment fix */
body[dir="rtl"] .dropdown-menu-end {
    right: auto;
    left: 0;
}
