* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: linear-gradient(135deg, #667eea, #764ba2);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.search-card {
    background: white;
    border-radius: 40px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.search-card i {
    font-size: 4rem;
    color: #4361ee;
    margin-bottom: 15px;
}

.search-card h2 {
    font-size: 2rem;
    color: #1e1e2f;
    margin-bottom: 10px;
}

.search-card p {
    color: #6c757d;
    margin-bottom: 25px;
}

.search-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    font-size: 1rem;
    font-family: 'Tajawal', sans-serif;
    text-align: center;
    margin-bottom: 15px;
}

.search-input:focus {
    outline: none;
    border-color: #4361ee;
}

.search-btn {
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    width: 100%;
    cursor: pointer;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(67, 97, 238, 0.3);
}

.profile-card {
    background: white;
    border-radius: 30px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    animation: fadeInUp 0.4s ease;
}

.profile-header {
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    color: white;
    padding: 30px;
    text-align: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
}

.profile-avatar i {
    font-size: 2.5rem;
}

.profile-header h2 {
    font-size: 1.6rem;
    margin-bottom: 5px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.stat-badge {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-badge i {
    font-size: 2rem;
    color: #4361ee;
    margin-bottom: 8px;
}

.stat-badge .stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e1e2f;
}

.stat-badge .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
}

.analysis-card {
    padding: 25px;
    border-bottom: 1px solid #eee;
}

.analysis-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1e1e2f;
    margin-bottom: 20px;
}

.progress-item {
    margin-bottom: 20px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: #555;
}

.progress-bar {
    height: 12px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4361ee, #3f37c9);
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease;
}

.tip-box {
    margin-top: 15px;
    padding: 12px;
    background: #e8f0fe;
    border-radius: 12px;
    font-size: 0.9rem;
}

.tip-box i {
    color: #4361ee;
    margin-left: 8px;
}

.trend-up {
    color: #4caf50;
}

.trend-down {
    color: #f44336;
}

.exams-list {
    padding: 0 25px 25px;
}

.exams-list h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1e1e2f;
    margin-bottom: 20px;
}

.exam-item {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-right: 4px solid #4361ee;
}

.exam-item:hover {
    transform: translateX(-5px);
    background: #e8f0fe;
}

.exam-item .exam-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e1e2f;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.exam-score {
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
}

.exam-score.high {
    background: #4caf50;
    color: white;
}

.exam-score.medium {
    background: #ff9800;
    color: white;
}

.exam-score.low {
    background: #f44336;
    color: white;
}

.exam-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #6c757d;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #5a6268;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 30px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
}

.modal-close {
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    color: white;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    border-top: 1px solid #eee;
}

.answer-item {
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
}

.answer-item.correct {
    background: #e8f5e9;
    border-right: 4px solid #4caf50;
}

.answer-item.wrong {
    background: #ffebee;
    border-right: 4px solid #f44336;
}

.answer-item .question-text {
    font-weight: 600;
    margin-bottom: 10px;
}

.answer-details {
    font-size: 0.9rem;
    color: #555;
    margin-top: 8px;
}

.btn-print {
    background: #4361ee;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 30px;
    cursor: pointer;
}

.btn-print.btn-close {
    background: #6c757d;
}

.loading {
    display: none;
    text-align: center;
    padding: 30px;
}

.loading i {
    font-size: 2rem;
    color: #4361ee;
    animation: spin 1s linear infinite;
}

.error-msg {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 30px;
    margin-top: 15px;
    display: none;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
    .search-card {
        padding: 25px;
    }
    .stats-row {
        grid-template-columns: 1fr;
    }
    .exam-title {
        flex-direction: column;
        align-items: flex-start;
    }
    .modal-footer {
        flex-direction: column;
    }
    .btn-print {
        width: 100%;
    }
}

/* أضف في نهاية الملف */

.rank-badge {
    background: rgba(255,255,255,0.2);
    padding: 8px 20px;
    border-radius: 50px;
    display: inline-block;
    margin-top: 15px;
    font-size: 0.9rem;
    font-weight: bold;
}

.rank-badge i {
    margin-left: 8px;
    color: #ffd700;
}

.logout-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    margin-top: 15px;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

/* حالة عدم وجود جلسة */
.search-card {
    transition: all 0.3s ease;
}

/* تحسين زر تسجيل الخروج */
.logout-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 10px 25px;
    border-radius: 50px;
    margin-top: 15px;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #f44336;
    transform: translateY(-2px);
}