:root {
    --primary-color: #0481ff;
    --secondary-color: #123;
    --text-color: #fff;
    --bg-color: #001;
    --card-bg: #123;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

[data-theme="light"] {
    --primary-color: #0366d6;
    --secondary-color: #f5f5f5;
    --text-color: #333;
    --bg-color: #f9f9f9;
    --card-bg: #fff;
    --sidebar-bg: #fff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    transition: var(--transition);
}

.dashboard {
    display: flex;
    min-height: 100vh;
}

/* الشريط الجانبي */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-color);
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: var(--shadow);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .profile h2,
.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    color: var(--primary-color);
}

.profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.img-box {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--primary-color);
    flex-shrink: 0;
}

.img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile h2 {
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    transition: var(--transition);
    gap: 15px;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    background-color: var(--primary-color);
}

.nav-item i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.log-out {
    background-color: #a00;
    border-radius: var(--border-radius);
}

.log-out:hover {
    background-color: #c00;
}

/* المحتوى الرئيسي */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-content {
    margin-right: var(--sidebar-collapsed-width);
}

.header {
    height: var(--header-height);
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 5px 15px;
    width: 300px;
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    flex: 1;
    padding: 8px 0;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--primary-color);
}

.notifications {
    position: relative;
    cursor: pointer;
}

.notification-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* المحتوى */
.content-section {
    padding: 20px;
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.section-header p {
    color: #aaa;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #0366d6;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* بطاقات الإحصائيات */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info h3 {
    font-size: 16px;
    margin-bottom: 5px;
    color: #aaa;
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
}

/* الرسوم البيانية */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-box {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.chart-box h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

/* الأنشطة الحديثة */
.recent-activities {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.recent-activities h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

.activities-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-radius: var(--border-radius);
    background-color: rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.activity-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-content p {
    margin-bottom: 5px;
}

.activity-content span {
    font-size: 12px;
    color: #aaa;
}

/* الجداول */
.table-container {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.data-table th {
    background-color: rgba(0, 0, 0, 0.1);
    cursor: pointer;
    user-select: none;
}

.data-table th:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.edit-btn {
    background-color: #ffc107;
    color: #000;
}

.edit-btn:hover {
    background-color: #e0a800;
}

.delete-btn {
    background-color: #dc3545;
    color: white;
}

.delete-btn:hover {
    background-color: #c82333;
}

/* الترقيم */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    gap: 10px;
}

.pagination-btn {
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #0366d6;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: var(--transition);
}

.page-number.active,
.page-number:hover {
    background-color: var(--primary-color);
}

/* المحتلى المؤقت */
.placeholder-content {
    text-align: center;
    padding: 50px 20px;
}

.placeholder-content i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.placeholder-content h3 {
    margin-bottom: 10px;
}

.placeholder-content p {
    color: #aaa;
}

/* النماذج */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.modal-header {
    padding: 15px 20px;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: #ff4d4d;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* التجاوب مع الشاشات المختلفة */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
        width: var(--sidebar-width);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .stats-cards,
    .charts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .search-bar {
        width: 200px;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 576px) {
    .header {
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 15px;
    }
    
    .search-bar {
        width: 100%;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
}