/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

a {
    text-decoration: none;
    color: inherit;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (Desktop) */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
    transition: transform 0.3s ease-in-out;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    font-weight: 800;
    font-size: 1.25rem;
}

.logo-icon {
    font-size: 2rem;
}

.highlight {
    color: var(--text-main);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: var(--bg-surface-2);
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

:root.dark .nav-item.active {
    background-color: rgba(108, 92, 231, 0.2);
}

.nav-item .material-symbols-rounded {
    font-size: 1.5rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.info {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.info .name {
    font-weight: 700;
}

.info .rôle {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Icon Button */
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: var(--bg-surface-2);
    color: var(--text-main);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    /* RTL margin */
    padding: 2rem;
    transition: margin-right 0.3s ease;
    width: calc(100% - var(--sidebar-width));
}

.topbar {
    display: none;
    /* Desktop */
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* View Container */
.view-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Responsive (Mobile) */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        /* Hide Sidebar RTL */
        right: 0;
        border-left: 1px solid var(--border);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
        padding: 1rem;
        width: 100%;
    }

    .mobile-only {
        display: flex;
    }

    .topbar {
        display: flex;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 40;
        display: none;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .sidebar-overlay.open {
        display: block;
        opacity: 1;
    }
}