/* ==================== General ==================== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

#wrapper {
    min-height: 100vh;
    display: flex;
}

/* ==================== Sidebar ==================== */
.sidebar {
    width: 240px;
    background-color: #1e293b;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: margin-right 0.3s, transform 0.3s;
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
    border-left: 1px solid #334155;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.sidebar.collapsed {
    margin-right: -240px;
}

.sidebar-header {
    padding: 1.2rem 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 1px solid #334155;
    color: #60a5fa;
}

.sidebar-header i {
    font-size: 1.6rem;
}

.sidebar-title {
    white-space: nowrap;
}

.sidebar-nav {
    padding: 0.8rem 0;
    flex: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.65rem 1rem;
    color: #cbd5e1;
    text-decoration: none;
    border-right: 3px solid transparent;
    transition: all 0.2s;
}

.sidebar-nav .nav-link:hover {
    background-color: #334155;
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background-color: #334155;
    color: #60a5fa;
    border-right-color: #60a5fa;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav small {
    display: block;
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    color: #64748b;
}

/* ==================== Overlay (موبایل) ==================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ==================== Main Content ==================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

.topbar {
    display: flex;
    align-items: center;
    padding: 0.7rem 1rem;
    background-color: #0f172a;
    border-bottom: 1px solid #334155;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 0.5rem;
}

.content {
    padding: 1.5rem;
    flex: 1;
}

/* ==================== Theme Light ==================== */
[data-bs-theme="light"] body {
    background-color: #f1f5f9;
    color: #0f172a;
}

[data-bs-theme="light"] .sidebar {
    background-color: #fff;
    color: #1e293b;
    border-left-color: #e2e8f0;
}

[data-bs-theme="light"] .sidebar-header {
    border-bottom-color: #e2e8f0;
}

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

[data-bs-theme="light"] .sidebar-nav .nav-link:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

[data-bs-theme="light"] .sidebar-nav .nav-link.active {
    background-color: #eff6ff;
    color: #2563eb;
    border-right-color: #2563eb;
}

[data-bs-theme="light"] .topbar {
    background-color: #fff;
    border-bottom-color: #e2e8f0;
}

/* ==================== Responsive (موبایل) ==================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        right: 0;
        top: 0;
        transform: translateX(0);
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
        margin-right: 0 !important;
    }
    
    .sidebar.collapsed {
        transform: translateX(100%);
    }
}
