﻿/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px; /* Expanded width */
    height: 100vh;
    background-color: var(--color-surface);
    color: var(--color-text);
    transition: width 0.3s ease, left 0.3s ease;
    z-index: 100;
    overflow-x: hidden;
}

    .sidebar.collapsed {
        width: 70px; /* Collapsed width */
    }

/* Responsive Behavior for Medium Screens */
@media (min-width: 768px) {
    .sidebar {
        width: 240px; /* Default expanded width */
        justify-content: flex-start; /* Align items normally */
    }

        .sidebar.collapsed {
            width: 70px; /* Collapsed width */
            align-items: center; /* Center items when collapsed */
        }

    .sidebar-group-title.collapsed {
        align-items: center;
        width: 45px;
    }

    .sidebar-item.collapsed {
        width: 45px;
    }
}

/* Responsive Behavior for Small Screens */
@media (max-width: 767px) {
    .sidebar {
        left: 0; /* Default position */
    }

        .sidebar.collapsed {
            left: -100%; /* Slide out of view when collapsed */
        }
}

.sidebar .logo-text {
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .logo-text {
    display: none;
}

.sidebar .sidebar-item {
    transition: background-color 0.3s ease;
}

.sidebar.collapsed .nav-label {
    display: none;
}


/* Overlay */
.overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 90; /* Ensure overlay is below the sidebar but above the main content */
    transition: opacity 0.3s ease;
}

    .overlay.visible {
        display: block; /* Visible when explicitly toggled */
        pointer-events: auto;
        opacity: 0.5;
    }

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin-left: 240px; /* Expanded sidebar width */
    transition: margin-left 0.3s ease;
    position: relative;
    z-index: 50;
}

    .main-content.collapsed {
        margin-left: 70px; /* Collapsed sidebar width */
    }

/* Responsive Behavior for Small Screens */
@media (max-width: 767px) {
    .main-content {
        margin-left: 0; /* No margin when sidebar is hidden */
    }

        .main-content.collapsed {
            margin-left: 0; /* No margin when sidebar is collapsed */
        }

    .overlay {
        display: none; /* Hidden by default on small screens */
    }

        .overlay.visible {
            display: block; /* Only visible when 'visible' class is added */
        }
}

.btnCollapse {
    display: none;
}

.btnExpand {
    display: none;
}

.btnCollapse.visible {
    display: block;
}

.btnExpand.visible {
    display: block;
}

/* Content Area */
.content-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: var(--color-surface-light);
}
