/* ====== Left Menu Styles ====== */

/* ====== Sidebar ====== */
#sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: #ffffff;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
    text-align: left;
    padding: 0 10px;
    /* Ensure sidebar stays above content but below top menu */
    z-index: 1000;
}

/* Collapsed state */
#sidebar.collapsed {
    width: 80px;
    text-align: center;
    /* Adjust z-index to ensure proper layering */
    z-index: 1000;
}

#sidebar.collapsed .menu-text,
#sidebar.collapsed .submenu,
#sidebar.collapsed .submenu-item,
#sidebar.collapsed .submenu-toggle {
    display: none !important;
}

/* Hide text and submenu when collapsed */
#sidebar.collapsed .menu-text,
#sidebar.collapsed .submenu,
#sidebar.collapsed .submenu-item,
#sidebar.collapsed .submenu-toggle {
    display: none !important;
}

/* Submenu styles */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    padding-left: 20px;
    height: auto;
}

.submenu.show {
    max-height: none;
    height: auto;
}

.submenu-item {
    padding: 8px 15px;
    margin: 2px 0;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    color: #555;
    text-decoration: none;
    font-size: 0.85em;
}

.submenu-item.active {
    background-color: rgba(26, 154, 154, 0.1);
    color: #1a9a9a;
    border-radius: 4px;
}

.submenu-item:hover {
    background-color: rgba(26, 154, 154, 0.1);
    color: #1a9a9a;
    border-radius: 4px;
}

/* Submenu toggle indicator */
.submenu-toggle {
    transition: transform 0.3s ease;
    margin-left: auto;
    font-size: 12px;
    color: #666;
}

.submenu-toggle.rotated {
    transform: rotate(180deg);
}

/* Menu item with submenu */
.has-submenu {
    position: relative;
}

/* Sidebar for mobile */
@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.active {
        transform: translateX(0);
    }
}

.sidebar-logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 10px;
    position: relative;
    /* background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); */
    gap: 10px;
}

.sidebar-logo .small-logo {
    max-width: 40px;
    height: auto;
    margin: 0 5px 0 0;
}

.sidebar-logo .main-logo {
    max-width: 130px;
    height: auto;
    margin: 0;
    transition: all 0.3s ease;
}

#sidebar.collapsed .main-logo {
    display: none;
}

#sidebar.collapsed .small-logo {
    max-width: 35px;
    margin: 5px 0;
}

.sidebar-logo .small-logo {
    max-width: 35px;
    /* margin-bottom: 10px; */
}

.sidebar-logo .main-logo {
    max-width: 120px;
    /* margin-bottom: 10px; */
}

#sidebar .nav-link {
    color: #333333;
    padding: 12px 15px;
    margin: 2px 5px;
    border-radius: 6px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    text-decoration: none;
}

#sidebar .nav-link:hover, .nav-link.active {
    color: #1a9a9a;
    background-color: rgba(26, 154, 154, 0.1);
    text-decoration: none;
    font-weight: 500;
}

.menu-item-vertical {
    display: flex;
    align-items: center;
    width: 100%;
}

.menu-text {
    font-size: 14px;
    margin-left: 12px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebar .nav-link:hover, #sidebar .nav-link.active {
    color: #1a9a9a;
    background-color: rgba(26, 154, 154, 0.1);
    border-left: 4px solid #ff7b00;
    text-decoration: none;
    font-weight: 500;
}

.menu-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.menu-icon i {
    color: white;
}

.red-circle {
    background-color: #ff3b30;
}

.blue-circle {
    background-color: #007aff;
}

.orange-circle {
    background-color: #ff9500;
}

.purple-circle {
    background-color: #af52de;
}

.gray-circle {
    background-color: #656565;
}

.green-circle {
    background-color: #1a9a9a;
}

/* ====== Sidebar Toggle ====== */
.sidebar-toggle-btn {
    background: #fff;
    color: #656565;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 1.2rem;
    transition: background 0.2s, transform 0.3s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

/* Toggle button position for desktop */
@media (min-width: 992px) {
    .sidebar-logo {
        justify-content: left;
    }
}

/* Toggle button position for mobile */
@media (max-width: 991.98px) {
    .sidebar-logo {
        justify-content: flex-start;
    }
}

.sidebar-toggle-btn:active,
.sidebar-toggle-btn:focus {
    background: #148080;
    outline: none;
}

/* Menu Background Overlay */
.menu-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.menu-bg-overlay.show {
    display: block;
    opacity: 1;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
    z-index: 9999;
    display: none;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
}

.menu-overlay.show {
    display: flex;
    transform: translateX(0);
}

@media (min-width: 768px) {
    .menu-overlay {
        width: 20%;
        min-width: 280px;
        transform: translateX(-100%);
    }

    .menu-overlay.show {
        transform: translateX(0);
    }
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #1a9a9a;
    color: white;
}

.menu-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.overlay-logo {
    width: 30px;
    height: 30px;
}

.overlay-title {
    font-size: 14px;
    line-height: 1.2;
    text-align: left;
    color: white;
}

.menu-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.menu-nav {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: #e9ecef;
}

.menu-item i {
    margin-right: 15px;
    width: 24px;
    text-align: center;
    font-size: 18px;
}

.menu-footer {
    padding: 15px;
    border-top: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-footer-link {
    color: #6c757d;
    text-decoration: none;
    font-size: 13px;
}

.menu-footer-link:hover {
    color: #1a9a9a;
    text-decoration: underline;
}

/* ===== Dark Mode Styles ===== */
[data-bs-theme="dark"] #sidebar {
    background-color: #0C1427;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .sidebar-logo {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] #sidebar .nav-link {
    color: #e2e8f0;
}

[data-bs-theme="dark"] #sidebar .nav-link:hover,
[data-bs-theme="dark"] #sidebar .nav-link.active {
    color: #63b3ed;
    background-color: rgba(99, 179, 237, 0.1);
    border-left-color: #63b3ed;
}

/* Menu Overlay Dark Mode */
[data-bs-theme="dark"] .menu-overlay {
    background-color: #0C1427;
}

[data-bs-theme="dark"] .menu-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .overlay-title {
    color: #fff;
}

[data-bs-theme="dark"] .menu-close-btn {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .menu-close-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .menu-item {
    color: #e2e8f0;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #63b3ed;
}

[data-bs-theme="dark"] .menu-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .menu-footer-link {
    color: #a0aec0;
}

[data-bs-theme="dark"] .menu-footer-link:hover {
    color: #63b3ed;
}

/* Menu Background Overlay */
[data-bs-theme="dark"] .menu-bg-overlay {
    background-color: rgba(0, 0, 0, 0.7);
}

[data-bs-theme="dark"] .sidebar-toggle-btn {
    background-color: #0C1427;
    border-color: #8695AA;
    color: #8695AA;
}

[data-bs-theme="dark"] .sidebar-toggle-btn:hover {
    background-color: #8695AA;
    border-color: #8695AA;
    color: #fff;
}

[data-bs-theme="dark"] .submenu-item {
    color: #e2e8f0;
}

/* Adjust main content when sidebar is open on mobile */
@media (max-width: 991.98px) {
    #main-content {
        margin-left: 0 !important;
    }
}
