/* رسائل النجاح والخطأ */
.success-message {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin: 15px 0;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    animation: slideIn 0.5s ease-out;
}

.error-message {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin: 15px 0;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* نصائح رفع الملفات */
.upload-tips {
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-radius: 10px;
    border: 1px solid #2196f3;
}

.upload-tips h4 {
    color: #1976d2;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.upload-tips ul {
    margin: 0;
    padding-right: 20px;
    color: #333;
}

.upload-tips li {
    margin-bottom: 5px;
    font-size: 0.95em;
    line-height: 1.4;
}

/* زر إعادة المحاولة */
.retry-btn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.retry-btn:hover {
    background: linear-gradient(135deg, #f57c00, #ef6c00);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

/* تحسين منطقة رفع الملفات */
.upload-area {
    border: 3px dashed #007bff;
    border-radius: 15px;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    transition: all 0.3s ease;
    cursor: pointer;
    margin: 20px 0;
}

.upload-area:hover {
    border-color: #0056b3;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.15);
}

.upload-area.dragover {
    border-color: #28a745;
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #007bff;
}

.upload-area h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.upload-area p {
    color: #666;
    margin-bottom: 20px;
}

.file-input {
    display: none;
}

.upload-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.upload-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

/* أدوات البحث */
.search-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

/* تحسين البحث */
.search-input {
    padding: 12px 20px;
    border: 2px solid #dee2e6;
    border-radius: 25px;
    font-size: 16px;
    width: 100%;
    max-width: 500px;
    transition: all 0.3s ease;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

/* تحسين الأزرار */
.clear-btn {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.clear-btn:hover {
    background: linear-gradient(135deg, #495057, #343a40);
    transform: translateY(-1px);
}

/* الإحصائيات */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1.1em;
    opacity: 0.9;
}

/* قسم النتائج */
.results-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: none;
}

/* تحسين البطاقات */
.student-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.student-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.student-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
}

.student-name {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.student-id {
    color: #666;
    font-size: 1.1em;
}

.expand-btn {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.expand-btn:hover {
    background: linear-gradient(135deg, #138496, #117a8b);
    transform: translateY(-1px);
}

/* تحسين المعلومات */
.student-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.info-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.info-label {
    font-weight: bold;
    color: #333;
    margin-left: 10px;
    min-width: 120px;
}

.info-value {
    color: #666;
    flex: 1;
}

/* قسم المقررات */
.courses-section {
    display: none;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f8f9fa;
}

.courses-section.expanded {
    display: block;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.course-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.course-card:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.course-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.course-code {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.course-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

.course-status.completed {
    background: #d4edda;
    color: #155724;
}

.course-status.pending {
    background: #fff3cd;
    color: #856404;
}

/* تحسين رسائل الخطأ */
.no-results {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    margin: 20px 0;
    border: 2px solid #dee2e6;
}

.no-results h3 {
    color: #dc3545;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.no-results p {
    color: #666;
    font-size: 1.1em;
    line-height: 1.6;
}

/* تحسين رسائل التحميل */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #007bff;
    font-size: 1.2em;
    font-weight: bold;
}

.loading::before {
    content: "⏳ ";
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* تحسينات إضافية */
.student-card:nth-child(even) {
    border-right-color: #764ba2;
}

.student-card:nth-child(odd) {
    border-right-color: #667eea;
}

/* تأثيرات بصرية */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* تحسين أداء التمرير */
.student-card {
    will-change: transform;
}

/* تحسين إمكانية الوصول */
.search-input:focus,
.upload-btn:focus,
.expand-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* تحسين التصميم العام */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
    line-height: 1.6;
}

.search-section {
    margin-bottom: 40px;
}

.search-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* تحسين Footer */
.footer {
    background: linear-gradient(135deg, #343a40, #495057);
    color: white;
    padding: 30px 0;
    margin-top: 60px;
    border-radius: 20px 20px 0 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-section {
    flex: 1;
    min-width: 250px;
    max-width: 600px;
}

.footer-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.footer-text {
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 8px;
    opacity: 0.9;
}

.footer-copyright {
    text-align: center;
    padding: 15px 0;
    background: rgba(0, 0, 0, 0.2);
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-copyright p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.8;
}

.footer-highlight {
    color: #17a2b8;
    font-weight: bold;
}

.footer-divider {
    width: 2px;
    height: 60px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.5), transparent);
    margin: 0 20px;
}

/* Responsive Design for Footer */
@media (max-width: 768px) {
    .footer {
        padding: 20px 15px;
        text-align: center;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .footer-section {
        width: 100%;
    }
    
    .footer-divider {
        display: none;
    }
}

/* تحسينات للأجهزة المحمولة */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .search-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        max-width: none;
    }
    
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .student-info {
        grid-template-columns: 1fr;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
    }
    
    .student-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .expand-btn {
        align-self: flex-end;
    }
    
    .upload-tips {
        margin-top: 15px;
        padding: 10px;
    }
    
    .upload-tips ul {
        padding-right: 15px;
    }
}

/* تنسيقات المستويات الجديدة */
.level-section {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    border: 2px solid #dee2e6;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.level-title {
    color: #007bff;
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
    text-align: center;
}

.course-level-badge {
    display: inline-block;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin: 5px 0;
    text-align: center;
    min-width: 30px;
}

.no-courses {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px dashed #dee2e6;
}

/* تحسين عرض المقررات حسب المستوى */
.courses-section .courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.course-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.course-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.course-code {
    color: #007bff;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.course-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 5px;
}

.course-status.completed {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.course-status.pending {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: white;
}

/* تحسينات للطباعة */
@media print {
    .upload-area,
    .search-controls,
    .expand-btn,
    .footer {
        display: none !important;
    }
    
    .student-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .courses-section {
        display: block !important;
    }
    
    .level-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
