/* ==========================================
   Layout - التصميم الأساسي
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ==========================================
   Sidebar - القائمة الجانبية
   ========================================== */

.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
}

/* Logo Section */
.sidebar-logo {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-text span {
    font-size: 12px;
    color: var(--text-muted);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 28px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 12px;
    margin-bottom: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    margin-bottom: 6px;
    transition: var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.nav-item i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.nav-item span {
    font-size: 15px;
    font-weight: 500;
}

.nav-badge {
    margin-right: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-hover);
    border-radius: var(--radius);
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.user-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-info span {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==========================================
   Main Content - المحتوى الرئيسي
   ========================================== */

.main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    background: var(--bg-hover);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--primary);
}

.page-title h2 {
    font-size: 22px;
    font-weight: 700;
}

.page-title p {
    font-size: 14px;
    color: var(--text-muted);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-hover);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.header-btn:hover {
    background: var(--primary);
    color: white;
}

.header-btn .badge {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.server-status.online .status-dot {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.server-status.offline .status-dot {
    background: var(--danger);
}

/* Page Content */
.page-content {
    padding: 32px;
}

/* ==========================================
   Responsive - التجاوب
   ========================================== */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .overlay.show {
        display: block;
    }
}

@media (max-width: 640px) {
    .page-content {
        padding: 20px;
    }
    
    .header {
        padding: 0 20px;
    }
}
