* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}
        
:root {
    --primary-color: #1a6ed8;
    --secondary-color: #2d8cf0;
    --accent-color: #36c2e6;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --gray-color: #6c757d;
    --border-color: #dee2e6;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 70px;
    --transition-speed: 0.3s;
}
        
body {
    background-color: #f5f7fb;
    color: #333;
    direction: rtl;
    min-height: 100vh;
}
        
.app-container {
    display: flex;
    min-height: 100vh;
}
        
/* القائمة الجانبية */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, #0d4b9e 100%);
    color: white;
    transition: width var(--transition-speed);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.1);
}
        
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}
        
.sidebar-header {
    padding: 20px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    height: var(--header-height);
}
        
.sidebar-header h3 {
    font-weight: 700;
    font-size: 1.3rem;
    white-space: nowrap;
    overflow: hidden;
}
        
.toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
        
.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
        
.sidebar-menu {
    padding: 15px 0;
}
        
.menu-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}
        
.menu-item:hover, .menu-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
        
.menu-item i {
    font-size: 1.2rem;
    width: 30px;
    margin-left: 10px;
}
        
.menu-text {
    transition: opacity var(--transition-speed);
}
        
.sidebar.collapsed .menu-text {
    opacity: 0;
    width: 0;
}
        
.menu-badge {
    background-color: var(--accent-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    position: absolute;
    left: 20px;
}
        
.sidebar.collapsed .menu-badge {
    display: none;
}
        
/* المحتوى الرئيسي */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    transition: margin-right var(--transition-speed);
}
        
.sidebar.collapsed ~ .main-content {
    margin-right: var(--sidebar-collapsed-width);
}
        
/* الهيدر */
.header {
    background-color: white;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}
        
.header-left h1 {
    font-size: 1.5rem;
    color: var(--dark-color);
    font-weight: 600;
}
        
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}
        
.search-box {
    position: relative;
}
        
.search-box input {
    padding: 10px 15px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 250px;
    transition: all 0.3s;
    font-size: 0.9rem;
}
        
.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    width: 300px;
    box-shadow: 0 0 0 3px rgba(26, 110, 216, 0.1);
}
        
.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
}
        
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
        
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}
        
/* المحتوى */
.content {
    padding: 30px;
}
        
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
        
.content-title {
    font-size: 1.8rem;
    color: var(--dark-color);
    font-weight: 700;
}
        
.content-subtitle {
    color: var(--gray-color);
    margin-top: 5px;
}
        
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
        
.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
        
.btn-primary:hover {
    background-color: #0d4b9e;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 110, 216, 0.2);
}
        
.btn-success {
    background-color: var(--success-color);
    color: white;
}
        
.btn-warning {
    background-color: var(--warning-color);
    color: var(--dark-color);
}
        
.btn-danger {
    background-color: var(--danger-color);
    color: white;
}
        
/* البطاقات */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
        
.stat-card {
    background-color: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s;
}
        
.stat-card:hover {
    transform: translateY(-5px);
}
        
.stat-info h3 {
    font-size: 1.8rem;
    color: var(--dark-color);
    margin-bottom: 5px;
}
        
.stat-info p {
    color: var(--gray-color);
    font-size: 0.9rem;
}
        
.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}
        
.stat-icon.users {
    background-color: rgba(26, 110, 216, 0.1);
    color: var(--primary-color);
}
        
.stat-icon.doctors {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}
        
.stat-icon.appointments {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
}
        
.stat-icon.specialties {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* إحصائيات المواعيد حسب الحالة */
.section-title {
    font-size: 1.1rem;
    color: var(--dark-color);
    margin: 30px 0 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary-color);
}

.appointment-stats .stat-card {
    position: relative;
    overflow: hidden;
}

.appointment-stats .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
}

.stat-card.stat-pending::before {
    background-color: var(--warning-color);
}

.stat-card.stat-confirmed::before {
    background-color: var(--success-color);
}

.stat-card.stat-completed::before {
    background-color: var(--primary-color);
}

.stat-card.stat-cancelled::before {
    background-color: var(--danger-color);
}

.stat-icon.pending {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
}

.stat-icon.confirmed {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.stat-icon.completed {
    background-color: rgba(26, 110, 216, 0.1);
    color: var(--primary-color);
}

.stat-icon.cancelled {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.date-badge {
    font-size: 0.85rem;
    font-weight: normal;
    color: var(--gray-color);
    margin-right: 10px;
}

.count-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.table-responsive {
    overflow-x: auto;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--gray-color);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
}

/* الجداول */
.table-container {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    overflow-x: auto;
}
        
.table-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}
        
table {
    width: 100%;
    border-collapse: collapse;
}
        
thead {
    background-color: #f8f9fa;
}
        
th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}
        
td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: #555;
}
        
tr:hover {
    background-color: #f8f9fa;
}
        
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}
        
.status-pending {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
}
        
.status-confirmed {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}
        
.status-cancelled {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}
        
.status-completed {
    background-color: rgba(26, 110, 216, 0.1);
    color: var(--primary-color);
}
        
.action-buttons {
    display: flex;
    gap: 8px;
}
        
.action-btn {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}
        
.action-btn.view {
    background-color: rgba(26, 110, 216, 0.1);
    color: var(--primary-color);
}
        
.action-btn.edit {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}
        
.action-btn.delete {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}
        
.action-btn:hover {
    transform: scale(1.1);
}
        
/* النماذج */
.form-container {
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    max-width: 800px;
    margin: 0 auto;
}
        
.form-group {
    margin-bottom: 20px;
}
        
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}
        
.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}
        
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}
        
input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}
        
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 110, 216, 0.1);
}
        
textarea {
    min-height: 120px;
    resize: vertical;
}
        
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}
        
/* الوسائط المتعددة */
@media (max-width: 1200px) {
    .stats-cards {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}
        
@media (max-width: 992px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    
    .sidebar:not(.collapsed) {
        width: var(--sidebar-width);
    }
    
    .main-content {
        margin-right: var(--sidebar-collapsed-width);
    }
    
    .sidebar:not(.collapsed) ~ .main-content {
        margin-right: var(--sidebar-width);
    }
    
    .search-box input {
        width: 200px;
    }
    
    .search-box input:focus {
        width: 250px;
    }
}
        
@media (max-width: 768px) {
    .header {
        padding: 0 20px;
    }
    
    .content {
        padding: 20px;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .search-box input {
        width: 180px;
    }
    
    .search-box input:focus {
        width: 200px;
    }
}
        
@media (max-width: 576px) {
    .header-right {
        gap: 10px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .search-box input {
        width: 150px;
    }
}
        
/* الصفحات المخفية */
.page {
    display: none;
}
        
.page.active {
    display: block;
    animation: fadeIn 0.5s;
}
        
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
        
/* التنبيهات */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
        
.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border-right: 4px solid var(--success-color);
}
        
.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
    border-right: 4px solid var(--warning-color);
}
        
.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border-right: 4px solid var(--danger-color);
}
        
/* زر العودة */
.back-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 0;
}
        
/* إخفاء القائمة الجانبية على الهواتف */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        width: var(--sidebar-width);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
}
        
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-color);
    cursor: pointer;
}
        
.overlay {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}
        
.overlay.show {
    display: block;
}
        
/* تخصيص شريط التمرير */
.sidebar::-webkit-scrollbar {
    width: 5px;
}
        
.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}
        
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}
        
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Modal styles for centered forms and confirmations */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 2000;
}
.modal-overlay.show {
    display: block;
}
.modal {
    display: none;
    position: fixed;
    z-index: 2001;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.modal.show {
    display: block;
    animation: fadeIn 0.18s ease-out;
}
.modal .form-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-buttons { display:flex; gap:10px; justify-content:flex-end; margin-top:16px; }