/* Sidebar Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: #ffffff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 50;
}

.sidebar-header {
    padding: 1rem 0.75rem;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.sidebar-nav {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.nav-item.active {
    background-color: #eef2ff;
    color: var(--primary-color);
}

.main-wrapper {
    flex: 1;
    margin-left: 250px;
    /* Width of sidebar */
    display: flex;
    flex-direction: column;
    width: calc(100% - 250px);
}

.topbar {
    height: 70px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* Profile on the right */
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.content-area {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

/* Adjustments for existing elements */
.navbar {
    display: none !important;
}

/* Hide old navbar if present */

/* Mobile Toggle Button */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    margin-right: auto;
}

.mobile-close {
    display: none;
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-101%);
        /* Extra 1% to hide border shadow */
        transition: transform 0.3s ease;
        box-shadow: 10px 0 15px -3px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        padding: 0 1rem;
        justify-content: space-between;
    }

    .mobile-toggle {
        display: block;
    }

    .mobile-close {
        display: block;
    }

    .content-area {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }
}