/* Layout Base Variables */
:root {
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 80px;
    --header-height: 70px;
}

/* App Layout Wrapper */
.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal);
    z-index: 100;
}

.app-sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.sidebar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    white-space: nowrap;
    text-decoration: none;
}

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

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-item {
    margin: 0.25rem 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.nav-link i {
    font-size: 1.25rem;
    min-width: 30px;
}

.collapsed .nav-link span {
    display: none;
}

/* Main Content Area */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--background-color);
}

/* Header Navbar */
.app-header {
    height: var(--header-height);
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background-color: var(--border-color);
    color: var(--primary-color);
}

/* Content Container */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* Profile Dropdown */
.profile-dropdown img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

/* --- Mobile Responsiveness --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 95;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

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

@media (max-width: 768px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        left: calc(var(--sidebar-width) * -1);
        height: 100vh;
        z-index: 100;
        box-shadow: var(--shadow-lg);
    }
    
    .app-wrapper.sidebar-open .app-sidebar {
        left: 0;
    }

    .app-sidebar.collapsed {
        width: var(--sidebar-width);
    }

    .app-content {
        padding: 1rem;
    }
    
    .header-left .d-md-block {
        display: none !important;
    }
    
    .app-header {
        padding: 0 1rem;
    }
}
