:root {
    --irtiqaa-blue: #2c3e50;
    --irtiqaa-gold: #c5a059;
    --irtiqaa-green: #27ae60;
    --irtiqaa-red: #e74c3c;
    --irtiqaa-purple: #8e44ad;
    --bg-light: #f4f7f6;
    --text-dark: #333;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'Cairo', sans-serif; 
    background-color: var(--bg-light); 
    color: var(--text-dark);
    line-height: 1.6;
}

/* التخطيط */
.app-container { display: flex; min-height: 100vh; }

.sidebar-main {
    width: 260px;
    background: var(--irtiqaa-blue);
    padding: 20px 0;
    position: fixed;
    height: 100%;
    overflow-y: auto;
}

.sidebar-logo {
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-main ul { list-style: none; padding-top: 20px; }
.sidebar-main li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    color: #bdc3c7;
    text-decoration: none;
    transition: 0.3s;
    font-size: 0.95rem;
}

.sidebar-main li a:hover, .sidebar-main li a.active {
    background: rgba(255,255,255,0.05);
    color: var(--irtiqaa-gold);
    border-right: 4px solid var(--irtiqaa-gold);
}

.content-body { flex: 1; margin-right: 260px; padding: 20px 40px; }

/* المقدمة (Top Bar) */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 40px 10px 260px;
    background: white;
    border-bottom: 1px solid #eee;
}

.page-title h1 { font-size: 22px; color: var(--irtiqaa-blue); }

.user-profile-section { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.user-info-display { font-size: 14px; color: #666; display: flex; gap: 15px; align-items: center; }
.btn-link-logout { background: none; border: none; color: var(--irtiqaa-red); cursor: pointer; font-family: inherit; font-size: 13px; }

.breadcrumb-nav { display: flex; gap: 8px; font-size: 13px; margin-top: 5px; }
.breadcrumb-nav a { text-decoration: none; color: var(--irtiqaa-blue); }
.breadcrumb-nav a.active { color: var(--irtiqaa-purple); font-weight: bold; }

/* بطاقة الفلترة والجدول */
.card { background: white; border-radius: 12px; padding: 25px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 25px; }
.filter-card { border-right: 6px solid var(--irtiqaa-gold); }

.filter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.filter-group label { display: block; margin-bottom: 8px; font-weight: bold; font-size: 14px; }
.filter-group select { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; }

/* الجدول الموحد */
.table-header-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.irtiqaa-table { width: 100%; border-collapse: collapse; min-width: 1300px; }
.irtiqaa-table th { background: var(--irtiqaa-blue); color: white; padding: 15px; font-size: 13px; white-space: nowrap; }
.irtiqaa-table td { padding: 10px; border-bottom: 1px solid #eee; text-align: center; }

/* المدخلات داخل الجدول */
.irtiqaa-table input, .irtiqaa-table select {
    width: 100%;
    padding: 7px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    text-align: center;
}

.readonly-name { font-weight: bold; color: var(--irtiqaa-blue); text-align: right !important; }

/* الأزرار */
.btn-save-all { background: var(--irtiqaa-green); color: white; border-radius: 20px; padding: 10px 25px; border: none; cursor: pointer; font-weight: bold; transition: 0.3s; }
.btn-add-new { background: var(--irtiqaa-blue); color: white; border-radius: 20px; padding: 10px 25px; border: none; cursor: pointer; transition: 0.3s; }
.btn-save-all:hover { opacity: 0.9; transform: scale(1.05); }

.empty-msg { padding: 50px; color: #999; font-style: italic; }
.loading { text-align: center; color: var(--irtiqaa-gold); font-weight: bold; }

@media (max-width: 1024px) {
    .filter-grid { grid-template-columns: 1fr 1fr; }
    .content-body, .top-bar { margin-right: 0; padding-right: 20px; }
    .sidebar-main { display: none; }
}
.stats-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stats-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-bottom: 4px solid #ddd;
    transition: transform 0.3s;
}

.stats-card:hover { transform: translateY(-5px); }

.stats-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-left: 15px;
}

.stats-icon.blue { background: #e3f2fd; color: #1565c0; }
.stats-icon.green { background: #e8f5e9; color: #2e7d32; }
.stats-icon.red { background: #ffebee; color: #c62828; }

.stats-content h3 { font-size: 28px; margin: 5px 0 0; color: #333; }
.stats-label { color: #666; font-size: 14px; font-weight: 600; }
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 10px;
}

.btn-pagination {
    background: var(--irtiqaa-blue);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-pagination:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-num {
    padding: 5px 10px;
    border: 1px solid var(--irtiqaa-blue);
    border-radius: 3px;
    cursor: pointer;
}

.page-num.active {
    background: var(--irtiqaa-gold);
    color: white;
    border-color: var(--irtiqaa-gold);
}
.search-box-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin-left: 20px;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

#smartSearchInput {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s ease;
}

#smartSearchInput:focus {
    border-color: var(--irtiqaa-blue);
    box-shadow: 0 0 8px rgba(44, 62, 80, 0.1);
    outline: none;
}
.btn-export-excel {
    background: #1d6f42; /* لون أخضر إكسل */
    color: white;
    border-radius: 20px;
    padding: 10px 25px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
    margin-right: 10px;
}

.btn-export-excel:hover {
    background: #145a32;
    transform: scale(1.05);
}
.grade-badge {
    background-color: var(--irtiqaa-gold);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.grades-badge-container {
    min-height: 30px;
    display: flex;
    align-items: center;
}
/* تنسيق النافذة المنبثقة */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center;
}
.modal-content {
    background: white; width: 90%; max-width: 500px; border-radius: 15px;
    padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header { display: flex; justify-content: space-between; border-bottom: 1px solid #eee; padding-bottom: 15px; }
.grades-grid-selection {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
    max-height: 300px; overflow-y: auto; padding: 10px;
}
.grade-checkbox-item {
    display: flex; align-items: center; gap: 10px; background: #f8f9fa;
    padding: 10px; border-radius: 8px; cursor: pointer; transition: 0.2s;
}
.grade-checkbox-item:hover { background: #e9ecef; }
.grade-checkbox-item input { width: 18px; height: 18px; cursor: pointer; }

.modal-footer { display: flex; gap: 10px; margin-top: 20px; border-top: 1px solid #eee; padding-top: 15px; }
.btn-save-modal { background: var(--irtiqaa-green); color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; flex: 1; font-weight: bold; }
.btn-cancel-modal { background: #95a5a6; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; }