@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
    text-align: right;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    margin-top: 20px;
    margin-bottom: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid #667eea;
}

header h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 10px;
    font-weight: 700;
}

header h2 {
    font-size: 1.5rem;
    color: #667eea;
    font-weight: 500;
}

header h3 {
    font-size: 1.2rem;
    color: #764ba2;
    font-weight: 600;
    margin-top: 10px;
    font-style: italic;
}

/* التنقل */
.nav-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 5px;
}

.nav-btn {
    background: none;
    border: none;
    padding: 15px 25px;
    font-size: 1rem;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    cursor: pointer;
    border-radius: 10px 10px 0 0;
    transition: all 0.3s ease;
    color: #666;
    font-weight: 500;
}

.nav-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.nav-btn.active {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* المحتوى */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content h3 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

/* البحث */
.search-bar {
    margin-bottom: 20px;
    text-align: center;
}

.search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 25px;
    text-align: right;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    transition: border-color 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.2);
}

/* شبكة الطلاب */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.student-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-right: 4px solid #667eea;
}

.student-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.student-info h4 {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.student-info p {
    color: #666;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.student-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-edit {
    background: #4CAF50;
    color: white;
}

.btn-edit:hover {
    background: #45a049;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-delete:hover {
    background: #da190b;
}

.btn-grades {
    background: #2196F3;
    color: white;
}

.btn-grades:hover {
    background: #0b7dda;
}

/* النماذج */
.form-container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 1rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    text-align: right;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

.form-container button[type="submit"] {
    width: 100%;
    padding: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: 600;
}

.form-container button[type="submit"]:hover {
    background: #5a6fd8;
}

/* إدارة الدرجات */
.grade-management {
    max-width: 600px;
    margin: 0 auto;
}

.student-selector {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.student-selector label {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-weight: 500;
    font-size: 1rem;
}

.student-selector select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    text-align: right;
}

.grade-input-container {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.grade-input-container h4 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
}

.grades-form {
    display: grid;
    gap: 15px;
}

.grade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.grade-item label {
    font-weight: 500;
    color: #333;
    flex: 1;
}

.grade-item input {
    width: 80px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
}

.total-grade,
.grade-letter {
    text-align: center;
    padding: 15px;
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 1.1rem;
}

.total-grade span,
.grade-letter span {
    color: #667eea;
}

.grade-input-container button {
    width: 100%;
    padding: 15px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: 600;
    margin-top: 20px;
}

.grade-input-container button:hover {
    background: #218838;
}

/* التقارير */
.reports-controls {
    text-align: center;
    margin-bottom: 30px;
}

.reports-controls button {
    padding: 12px 25px;
    margin: 0 10px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-family: 'Noto Sans Arabic', Arial, sans-serif;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: 500;
}

.reports-controls button:hover {
    background: #5a6fd8;
}

.report-display {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-height: 200px;
}

/* الجداول */
.grades-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.grades-table th,
.grades-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.grades-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.grades-table tr:nth-child(even) {
    background: #f8f9fa;
}

.grades-table tr:hover {
    background: #e3f2fd;
}

/* الاستجابة للأجهزة المحمولة */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .nav-tabs {
        flex-direction: column;
    }
    
    .nav-btn {
        margin-bottom: 5px;
        border-radius: 5px;
    }
    
    .students-grid {
        grid-template-columns: 1fr;
    }
    
    .grade-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .grade-item input {
        width: 100%;
    }
    
    .reports-controls button {
        display: block;
        width: 100%;
        margin: 10px 0;
    }
    
    .grades-table {
        font-size: 0.9rem;
    }
    
    .grades-table th,
    .grades-table td {
        padding: 8px 4px;
    }
}

/* رسائل التنبيه */
.alert {
    padding: 15px;
    margin: 15px 0;
    border-radius: 5px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* تحسينات إضافية */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

.grade-excellent { color: #28a745; font-weight: 600; }
.grade-good { color: #17a2b8; font-weight: 600; }
.grade-average { color: #ffc107; font-weight: 600; }
.grade-poor { color: #dc3545; font-weight: 600; }