/* تنسيق مربع أبطال المسابقات */
.quiz-leaderboard-jbox {
    border-radius: 10px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

.quiz-leaderboard-modal {
    font-family: 'Cairo', 'Tahoma', sans-serif;
    direction: rtl;
    text-align: right;
}

/* رأس المربع */
.modal-header {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 30, 60, 0.7) 100%);
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255, 215, 0, 0.5);
}

.modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
    padding-left: 40px;
}

.modal-header h3::before {
    content: '👑';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    animation: crownFloat 3s ease-in-out infinite;
}

@keyframes crownFloat {
    0%, 100% { transform: translateY(-50%); }
    50% { transform: translateY(-65%); }
}

.close-btn {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
    color: #ffd700;
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 215, 0, 0.4);
    color: #fff;
    transform: rotate(90deg);
}

/* التابات */
.modal-tabs {
    display: flex;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 30, 60, 0.7) 100%);
    border-bottom: 2px solid rgba(255, 215, 0, 0.5);
    padding: 0 15px;
}

.tab-btn {
    flex: 1;
    padding: 12px 25px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-bottom: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s;
    position: relative;
    border-radius: 8px 8px 0 0;
    margin-right: 5px;
    margin-top: 5px;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.2), transparent);
    transition: all 0.5s ease;
}

.tab-btn.active {
    color: #000;
    background: linear-gradient(135deg, #b8860b 0%, #ffd700 50%, #b8860b 100%);
    border: 1px solid rgba(255, 215, 0, 0.6);
    border-bottom: none;
    box-shadow: 0 -5px 15px rgba(255, 215, 0, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #b8860b 0%, #ffd700 100%);
}

.tab-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
}

.tab-btn:hover::before {
    left: 100%;
}

/* محتوى المربع */
.modal-body {
    padding: 20px;
    max-height: 350px;
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(0, 10, 30, 0.9) 0%, rgba(0, 20, 50, 0.9) 100%);
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='rgba(255,215,0,0.05)' fill-rule='evenodd'/%3E%3C/svg%3E"), linear-gradient(135deg, rgba(0, 10, 30, 0.9) 0%, rgba(0, 20, 50, 0.9) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 0 0 10px 10px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content.active {
    display: block;
}

/* مؤشر التحميل */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 16px;
}

.loading-spinner i {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
}

/* رسائل الخطأ وعدم وجود بيانات */
.error-message, .no-data, .no-top-player {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* قائمة الليدربورد */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    border-right: 4px solid #dee2e6;
}

.leaderboard-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* تمييز المراكز الأولى */
.leaderboard-item.rank-1 {
    border-right-color: #ffd700;
    background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
}

.leaderboard-item.rank-2 {
    border-right-color: #c0c0c0;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
}

.leaderboard-item.rank-3 {
    border-right-color: #cd7f32;
    background: linear-gradient(135deg, #fdf2e9 0%, #ffffff 100%);
}

.leaderboard-item.rank-4,
.leaderboard-item.rank-5,
.leaderboard-item.rank-6,
.leaderboard-item.rank-7,
.leaderboard-item.rank-8,
.leaderboard-item.rank-9,
.leaderboard-item.rank-10 {
    border-right-color: #667eea;
    background: linear-gradient(135deg, #f0f2ff 0%, #ffffff 100%);
}

/* معلومات الترتيب */
.rank-info {
    display: flex;
    align-items: center;
    margin-left: 15px;
    min-width: 60px;
}

/* أيقونات المراكز */
.rank-icon {
    width: 30px;
    height: 30px;
    display: inline-block;
    vertical-align: middle;
}

.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
}

/* تحسين عرض المراكز العشرة الأولى */
.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-right: 4px solid #FF8C00;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
    border-right: 4px solid #808080;
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.4);
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, #CD7F32, #A0522D);
    border-right: 4px solid #8B4513;
    box-shadow: 0 4px 15px rgba(205, 127, 50, 0.4);
}

.leaderboard-item.rank-4 {
    background: linear-gradient(135deg, #B9F2FF, #87CEEB);
    border-right: 4px solid #00BFFF;
}

.leaderboard-item.rank-5 {
    background: linear-gradient(135deg, #50C878, #228B22);
    border-right: 4px solid #32CD32;
}

.leaderboard-item.rank-6 {
    background: linear-gradient(135deg, #E0115F, #DC143C);
    border-right: 4px solid #FF1493;
}

.leaderboard-item.rank-7 {
    background: linear-gradient(135deg, #0F52BA, #000080);
    border-right: 4px solid #4169E1;
}

.leaderboard-item.rank-8 {
    background: linear-gradient(135deg, #9966CC, #8A2BE2);
    border-right: 4px solid #BA55D3;
}

.leaderboard-item.rank-9 {
    background: linear-gradient(135deg, #FFC87C, #FF8C00);
    border-right: 4px solid #FFB347;
}

.leaderboard-item.rank-10 {
    background: linear-gradient(135deg, #E5E4E2, #C0C0C0);
    border-right: 4px solid #D3D3D3;
}

.rank-icon.bronze {
    color: #cd7f32;
}

.rank-icon.rank-4,
.rank-icon.rank-5,
.rank-icon.rank-6,
.rank-icon.rank-7,
.rank-icon.rank-8,
.rank-icon.rank-9,
.rank-icon.rank-10 {
    color: #667eea;
}

.rank-number {
    font-size: 18px;
    font-weight: bold;
    color: #495057;
}

.rank-number-only {
    font-size: 18px;
    font-weight: bold;
    color: #6c757d;
    background-color: #e9ecef;
    padding: 5px 10px;
    border-radius: 50%;
    min-width: 30px;
    text-align: center;
    display: inline-block;
}

/* معلومات المستخدم */
.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.user-name {
    font-size: 16px;
    font-weight: bold;
    color: #212529;
}

.user-points {
    font-size: 14px;
    color: #667eea;
    font-weight: 500;
}

/* معلومات مستوى المستخدم */
.user-level-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.level-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.level-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
}

.level-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.level-details {
    padding: 20px;
}

.level-number {
    text-align: center;
    margin-bottom: 20px;
}

.level-number i {
    font-size: 32px;
    color: #ffd700;
    margin-bottom: 10px;
    display: block;
}

.level-number span {
    font-size: 24px;
    font-weight: bold;
    color: #212529;
}

.points-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.current-points,
.points-to-next,
.user-rank {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(20, 26, 54, 0.9), rgba(32, 40, 78, 0.95));
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.25);
    color: #f5f7ff;
    overflow: hidden;
}

.label {font-size: 14px;color: #ff3333;font-weight: 700;}
.value { font-size: 16px; font-weight: 800; color: #fff; }

/* شريط التقدم داخل كارت النقاط المطلوبة للمستوى التالي */
.points-to-next .progress-bar { width: 55%; height: 10px; border-radius: 999px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.15); overflow: hidden; margin-inline-start: 10px; }
.points-to-next .progress-bar .progress-inner { height: 100%; width: 0%; background: linear-gradient(90deg, #6b5cff, #9a6bff); box-shadow: 0 0 10px rgba(154,107,255,0.6); transition: width 0.5s ease; }
.points-to-next .remaining { display: block; font-size: 12px; color: #dfe3ff; margin-top: 8px; width: 100%; text-align: start; }

/* بطاقة أفضل لاعب */
.top-player-card {
    background: linear-gradient(135deg, #000428 0%, #004e92 100%);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3),
                inset 0 0 20px rgba(255, 215, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.6);
    position: relative;
    overflow: hidden;
    color: #fff;
    transform-style: preserve-3d;
    transition: all 0.5s ease;
}

.top-player-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M50 5 L60 40 L95 40 L65 60 L75 95 L50 75 L25 95 L35 60 L5 40 L40 40 Z" fill="rgba(255,215,0,0.1)"/></svg>');
    background-size: 80px 80px;
    opacity: 0.2;
    pointer-events: none;
}

.top-player-card:hover {
    transform: translateY(-10px) rotateX(5deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4),
                inset 0 0 30px rgba(255, 215, 0, 0.4);
}

.top-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 10px;
}

.top-player-header h4 {
    margin: 0;
    font-size: 20px;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: bold;
    letter-spacing: 1px;
}

.top-player-crown {
    font-size: 28px;
    color: #ffd700;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    animation: crownGlow 2s infinite alternate;
}

@keyframes crownGlow {
    from { text-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
    to { text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.5); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.top-player-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.top-player-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #8b4513;
}

.top-player-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-player-level,
.top-player-points {
    font-size: 14px;
    font-weight: 500;
    color: #8b4513;
    background-color: rgba(255, 255, 255, 0.85);
    border: 1px solid #f2d16b;
    padding: 5px 10px;
    border-radius: 15px;
}

/* تحسينات للشاشات الصغيرة */
@media (max-width: 600px) {
    .quiz-leaderboard-modal {
        margin: 10px;
    }
    
    .modal-body {
        padding: 15px;
        max-height: 300px;
    }
    
    .leaderboard-item {
        padding: 12px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .user-points {
        font-size: 12px;
    }
    
    .level-details {
        padding: 15px;
    }
    
    .top-player-card {
        padding: 15px;
    }
}

/* تحسين شريط التمرير */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

/* Profile Quiz Styles */
.profile-quiz-container {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.profile-quiz-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.profile-quiz-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

.profile-quiz-header i {
    margin-right: 10px;
    font-size: 28px;
}

.profile-quiz-content {
    padding: 20px;
}

.profile-quiz-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* تصميم ملكي فخم لكروت تبويب المسابقات داخل الملف الشخصي */
.profile-quiz-container .quiz-card {
    position: relative;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 
                inset 0 0 15px rgba(255, 215, 0, 0.3),
                0 0 10px rgba(255, 215, 0, 0.2);
    overflow: hidden;
    color: #fff;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.profile-quiz-container .gradient-card::before {
    opacity: 0.3;
}
.profile-quiz-container .quiz-card::after {
    content: "";
    position: absolute;
    top: -30%;
    left: -20%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle at 30% 20%, rgba(255, 215, 0, 0.4), rgba(255, 215, 0, 0) 60%);
    transform: rotate(15deg);
    pointer-events: none;
    animation: shine 1.5s infinite alternate;
}
.profile-quiz-container .hover-lift:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 
                inset 0 0 20px rgba(255, 215, 0, 0.5),
                0 0 15px rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.6);
}

@keyframes shine {
    from { opacity: 0.3; }
    to { opacity: 0.7; }
}

/* أيقونة الإحصائيات داخل الكروت الزجاجية */
.profile-quiz-container .stat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 8px 18px rgba(118,75,162,0.35), inset 0 0 12px rgba(255,255,255,0.6);
}

.profile-quiz-container .stat-info h4 {
    color: #fdfdfd;
}

.profile-quiz-container .stat-value {
    color: #e30f0f;
}

/* تحسين بطاقة أفضل لاعب داخل تبويب الملف الشخصي لتكون زجاجية مع لمعة */
.profile-quiz-container .top-player-card {
    position: relative;
    border-radius: 16px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(227,231,243,0.85);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    backdrop-filter: blur(12px) saturate(140%);
    box-shadow: 0 12px 30px rgba(255,215,0,0.2);
    padding: 16px 18px;
    overflow: hidden;
}
.profile-quiz-container .top-player-card::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -40%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, transparent 70%);
}
.profile-quiz-container .top-player-header h4 { color: #212529; }
.profile-quiz-container .top-player-crown { color: #ffd54f; }
.profile-quiz-container .top-player-details { color: #8b4513; }

/* الأنماط السابقة للكروت القديمة تبقى كنسخة احتياطية */
.quiz-stat-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quiz-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.stat-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #b8860b 0%, #ffd700 50%, #b8860b 100%);
    border-radius: 50%;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(184, 134, 11, 0.6), 
                inset 0 0 10px rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.4);
    position: relative;
    overflow: hidden;
}

.stat-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: iconShine 3s infinite;
}

@keyframes iconShine {
    0% { left: -100%; }
    20% { left: 100%; }
    100% { left: 100%; }
}

.stat-icon i {
    font-size: 28px;
    color: #24243e;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    z-index: 2;
}

.stat-info h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 14px;
    font-weight: normal;
}

.stat-value {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.level-progress {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.level-progress h4 {
    margin: 0 0 15px 0;
    color: #333;
    text-align: center;
}

.progress-bar {
    background: #e9ecef;
    border-radius: 25px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    border-radius: 25px;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    color: #666;
    margin: 0;
    font-size: 14px;
}

.top-player-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid #ffd700;
}

.top-player-icon {
    font-size: 40px;
}

.top-player-info h4 {
    margin: 0 0 5px 0;
    color: #1a1a2e;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.top-player-info p {
    margin: 0;
    color: #2a2a4e;
    font-size: 14px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .profile-quiz-stats {
        grid-template-columns: 1fr;
    }
    
    .quiz-stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 20px;
    }
}

/* إضافات تصميم كروت احترافية وتأثيرات متحركة لواجهة المسابقات */
.quiz-leaderboard-modal.gradient-frame {
  /* لوحة ألوان جديدة: ثيم فاتح واضح ومريح */
  --brand-bg: #f7f9fc;
  --brand-bg-alt: #ffffff;
  --card-bg: #ffffff;
  --surface: #ffffff;
  --border-color: #e3e7f3;
  --text-primary: #212529;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --tab-gradient-1: var(--gradient-1);
  --tab-gradient-2: var(--gradient-1);
  --shadow-1: 0 6px 14px rgba(0,0,0,.08);
  --shadow-2: 0 10px 28px rgba(0,0,0,.12);
}

/* تم إلغاء فرض خط Cairo على جميع العناصر لتفادي ظهور مربعات في الأيقونات */

/* تغيير الخلفية السوداء إلى أرجوانية داكنة */
.quiz-leaderboard-modal.gradient-frame {
  background: var(--brand-bg);
  color: var(--text-primary);
}

/* تحسين تباين النصوص في العناوين والمحتوى (داخل نافذة المسابقات فقط) */
.quiz-leaderboard-modal.gradient-frame .modal-header h3,
.quiz-leaderboard-modal.gradient-frame .level-progress h4,
.quiz-leaderboard-modal.gradient-frame .card-header h4,
.quiz-leaderboard-modal.gradient-frame .stat-value,
.quiz-leaderboard-modal.gradient-frame .user-line .user-name,
.quiz-leaderboard-modal.gradient-frame .points-line .user-points,
.quiz-leaderboard-modal.gradient-frame .label,
.quiz-leaderboard-modal.gradient-frame .value,
.quiz-leaderboard-modal.gradient-frame .top-player-name span,
.quiz-leaderboard-modal.gradient-frame .top-player-details span,
.quiz-leaderboard-modal.gradient-frame .progress-text {
  color: #e9b20d;
}

/* ألوان ثانوية للنصوص الضعيفة (داخل نافذة المسابقات فقط) */
.quiz-leaderboard-modal.gradient-frame .no-data,
.quiz-leaderboard-modal.gradient-frame .error-message p,
.quiz-leaderboard-modal.gradient-frame .loading-spinner p,
.quiz-leaderboard-modal.gradient-frame .user-rank .label {
  color: #e9b20d;
}

/* تحسين ألوان شريط التبويبات والخلفية المتحركة (داخل نافذة المسابقات فقط) */
.quiz-leaderboard-modal.gradient-frame .modal-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border-color);
}
.quiz-leaderboard-modal.gradient-frame .modal-tabs::before {
  background: var(--tab-gradient-2);
  opacity: 0.18;
}
.quiz-leaderboard-modal.gradient-frame .tab-btn {
  background: var(--card-bg);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.quiz-leaderboard-modal.gradient-frame .tab-btn.active {
  background: var(--tab-gradient-1);
  border-color: rgba(255,255,255,0.28);
}

/* بطاقات الليدربورد داخل النافذة */
.quiz-leaderboard-modal.gradient-frame .quiz-card,
.quiz-leaderboard-modal.gradient-frame .gradient-card {
  background: #764ba2;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.quiz-leaderboard-modal.gradient-frame .card-header .level-badge,
.quiz-leaderboard-modal.gradient-frame .rank-badge .rank-number {
  color: var(--text-primary);
}

/* تحسين شريط التقدم ليتماشى مع الثيم الفاتح داخل النافذة */
.quiz-leaderboard-modal.gradient-frame .progress-bar {
  background: #e9ecef;
}
.quiz-leaderboard-modal.gradient-frame .progress-fill {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  box-shadow: none;
}

/* ضمان ظهور الأيقونات بوضوح داخل النافذة */
.quiz-leaderboard-modal.gradient-frame .stat-icon i,
.quiz-leaderboard-modal.gradient-frame .top-player-crown,
.quiz-leaderboard-modal.gradient-frame .level-number i {
  color: #764ba2;
}

/* ملاحظة: لتفعيل الخلفية الحمراء الداكنة بدلاً من الأرجوانية، استبدل --brand-bg بـ --brand-bg-alt في .quiz-leaderboard-modal.gradient-frame */

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

/* Profile Quiz Styles */
.profile-quiz-container {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.profile-quiz-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.profile-quiz-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

.profile-quiz-header i {
    margin-right: 10px;
    font-size: 28px;
}

.profile-quiz-content {
    padding: 20px;
}

.profile-quiz-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.quiz-stat-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quiz-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.stat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-info h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 14px;
    font-weight: normal;
}

.stat-value {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.level-progress {
    background: #ff3366;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.level-progress h4 {
    margin: 0 0 15px 0;
    color: #333;
    text-align: center;
}

.progress-bar {
    background: #e9ecef;
    border-radius: 25px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    border-radius: 25px;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    color: #666;
    margin: 0;
    font-size: 14px;
}

.top-player-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid #ffd700;
}

.top-player-icon {
    font-size: 40px;
}

.top-player-info h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 18px;
}

.top-player-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

@media (max-width: 768px) {
    .profile-quiz-stats {
        grid-template-columns: 1fr;
    }
    
    .quiz-stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 20px;
    }
}

/* إضافات تصميم كروت احترافية وتأثيرات متحركة لواجهة المسابقات */
.quiz-leaderboard-modal.gradient-frame {
  background: linear-gradient(135deg, #000428 0%, #004e92 100%);
  color: #fff;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4),
              inset 0 0 20px rgba(255, 215, 0, 0.2);
  border: 2px solid rgba(255, 215, 0, 0.5);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  /* background: rgba(255,255,255,0.06); */
  backdrop-filter: blur(6px);
}
.animated-title {
  background: var(--gradient-2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hueShift 6s linear infinite;
}
.close-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}
.quiz-leaderboard-modal.gradient-frame .modal-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface);
}
.quiz-leaderboard-modal.gradient-frame .tab-btn {
  padding: 10px 14px;
  border-radius: 10px;
  background: #f8f9ff;
  color: #333;
  border: 1px solid #e3e7f3;
  cursor: pointer;
  font-weight: 700;
  font-family: 'Cairo';
  transition: all .2s ease;
}
.quiz-leaderboard-modal.gradient-frame .tab-btn.active {
  background: var(--gradient-1);
  color: #fff;
  border-color: #6f7edf;
}
.modal-body { padding: 18px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* شبكة بطاقات الليدربورد */
.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* الكروت الأساسية */
.quiz-card {
  position: relative;
  border-radius: var(--card-radius);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.quiz-card.card-highlight {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.16);
}
.hover-lift { transition: transform .18s ease, box-shadow .18s ease; }
.hover-lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }

.gradient-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-2);
  opacity: 0.22;
  animation: gradientFlow 8s ease infinite;
}
.gradient-card > * { position: relative; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}
.rank-badge { display: flex; align-items: center; gap: 8px; }
.rank-badge-wrap { display: inline-flex; align-items: center; }
.rank-icon-png { width: 32px; height: 32px; object-fit: contain; }
.rank-number { font-weight: 700; color: #fff; }
.level-badge {
  padding: 6px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-weight: 600;
  color: #fff;
}
.card-body { padding: 12px 14px 16px; }
.user-line, .points-line { display: flex; justify-content: space-between; }
.user-name { font-weight: 600; color: #f5f7ff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.user-points { color: #ffd700; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* قسم مستوى المستخدم */
.user-level-info { display: grid; gap: 16px; }
.level-number { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.level-number i { color: #ffd700; animation: crownGlow 2s infinite alternate; }
.points-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* كروت منفصلة لكل معلومة مع تباين واضح */
.points-info .current-points,
.points-info .points-to-next,
.points-info .user-rank {
  position: relative;
  background: linear-gradient(135deg, rgba(20, 26, 54, 0.9), rgba(32, 40, 78, 0.95));
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  color: #f5f7ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.points-info .label { color: #e9eaff; font-weight: 700; }
.points-info .value { color: #fff; font-weight: 700; }

/* شريط تقدم للنقاط المطلوبة للمستوى التالي */
.points-to-next .progress-bar {
  width: 55%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  margin-inline-start: 10px;
}

.points-to-next .progress-bar .progress-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6b5cff, #9a6bff);
  box-shadow: 0 0 10px rgba(154, 107, 255, 0.6);
  transition: width 0.5s ease;
}

.points-to-next .remaining {
  display: block;
  font-size: 12px;
  color: #dfe3ff;
  margin-top: 8px;
  width: 100%;
  text-align: start;
}

/* تأثيرات متحركة للبطاقات */
.quiz-card {
    position: relative;
    border-radius: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(16, 22, 46, 0.92), rgba(28, 36, 72, 0.96));
    border: 1px solid rgba(255, 215, 0, 0.25);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    color: #f5f7ff;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.quiz-card .card-header h4,
.quiz-card .card-body,
.quiz-card .label,
.quiz-card .value {
    color: #f5f7ff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

/* تأثير تحويم أنيق بدون تغطية النص */
.quiz-card:hover,
.quiz-stat-card:hover,
.top-player-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 
                0 0 20px rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.4);
}

.top-player-card {
    position: relative;
    border-radius: 14px;
    padding: 18px;
    background: linear-gradient(135deg, rgba(12, 18, 40, 0.95), rgba(24, 32, 64, 0.98));
    border: 1px solid rgba(255, 215, 0, 0.35);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    color: #f5f7ff;
    overflow: hidden;
}

/* تحسين وضوح التاج بلون ذهبي مشرق ومتناسق */
.top-player-header i.top-player-crown,
.stat-icon i.fa-crown {
    color: #ffdf6b;
    filter: drop-shadow(0 2px 6px rgba(255, 215, 0, 0.6));
    text-shadow: 0 2px 8px rgba(255, 215, 0, 0.55);
    animation: crownGlow 3s ease-in-out infinite;
}

/* تبويب الملف الشخصي - إحصائيات */
.profile-quiz-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 14px;
}
.stat-icon { font-size: 22px; color: #ffd700; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.stat-info h4 {margin: 6px 0;color: #f5f7ff;text-shadow: 0 1px 2px rgba(0,0,0,0.3);}
.stat-value {font-size: 20px; font-weight: 700; color: #ffd700; text-shadow: 0 1px 2px rgba(0,0,0,0.3);}

.level-progress h4 { color: #f5f7ff; margin-bottom: 8px; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.progress-bar { height: 20px; border-radius: 25px; background: rgba(255,255,255,0.15); overflow: hidden; border: 1px solid rgba(255,255,255,0.2); }
.progress-fill { height: 100%; background: linear-gradient(90deg, #6b5cff 0%, #9a6bff 100%); transition: width .3s ease; box-shadow: 0 0 10px rgba(154, 107, 255, 0.4); }
.progress-text { color: #e9eaff; margin-top: 6px; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* سبينر التحميل */
.loading-spinner { display: flex; align-items: center; gap: 8px; color: #e9ecff; }
.no-data, .error-message { color: #e9ecff; }

/* أنيميشين */
@keyframes hueShift { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }
@keyframes gradientFlow {
  0% { opacity: 0.22; }
  50% { opacity: 0.35; }
  100% { opacity: 0.22; }
}
