/* إعدادات عامة */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --gradient-start: #3498db;
    --gradient-end: #2c3e50;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* الترويسة */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
    display: inline-block;
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding: 10px;
    background-color: var(--light-color);
    border-radius: 8px;
    font-weight: 500;
}

/* العناصر الرئيسية */
main {
    margin-bottom: 40px;
}

.welcome-box, .quiz-box, .result-box, .leaderboard-box {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8rem;
}

h3 {
    color: var(--dark-color);
    margin-bottom: 15px;
    font-size: 1.4rem;
}

/* نموذج البدء */
.start-form {
    max-width: 400px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-family: 'Tajawal', sans-serif;
}

/* الأزرار */
button, .btn-start, .btn-home, .btn-leaderboard {
    display: inline-block;
    background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
}

button:hover, .btn-start:hover, .btn-home:hover, .btn-leaderboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.btn-start {
    width: 100%;
    margin-top: 10px;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

/* قائمة المتصدرين المصغرة */
.leaderboard-preview {
    margin-top: 40px;
}

.top-players {
    list-style-type: none;
}

.top-players li {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 8px;
    background-color: var(--light-color);
    border-radius: 6px;
}

.top-players li:nth-child(1) {
    background-color: rgba(255, 215, 0, 0.2);
    border-right: 3px solid gold;
}

.top-players li:nth-child(2) {
    background-color: rgba(192, 192, 192, 0.2);
    border-right: 3px solid silver;
}

.top-players li:nth-child(3) {
    background-color: rgba(205, 127, 50, 0.2);
    border-right: 3px solid #cd7f32;
}

.player-name {
    font-weight: 500;
}

.player-score {
    font-weight: 700;
    color: var(--secondary-color);
}

.view-all {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: var(--secondary-color);
    text-decoration: none;
}

/* صفحة الأسئلة */
.progress-bar {
    height: 10px;
    background-color: #eee;
    border-radius: 5px;
    margin-bottom: 25px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
    transition: width 0.3s ease;
}

.question-container {
    text-align: center;
}

.question-text {
    font-size: 1.6rem;
    margin-bottom: 30px;
    line-height: 1.4;
}

.options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 20px;
}

.option-btn {
    width: 100%;
    padding: 15px;
    text-align: center;
    background-color: var(--light-color);
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: var(--dark-color);
    font-weight: 500;
    background: none;
}

.option-btn:hover {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* صفحة النتائج */
.user-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--light-color);
    border-radius: 10px;
}

.user-details {
    text-align: right;
}

.username {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.level {
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.score-circle {
    width: 100px;
    height: 100px;
    background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
}

.score-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.score-max {
    font-size: 0.9rem;
    opacity: 0.8;
}

.result-details {
    margin-top: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 6px;
}

.result-label {
    font-weight: 500;
}

.result-value {
    font-weight: 700;
}

.result-message {
    text-align: center;
    margin: 25px 0;
    padding: 15px;
    background-color: var(--light-color);
    border-radius: 8px;
    font-weight: 500;
    color: var(--primary-color);
}

/* قائمة المتصدرين */
.leaderboard-table-container {
    overflow-x: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.leaderboard-table th, .leaderboard-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

.leaderboard-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

.leaderboard-table tr:hover {
    background-color: #f5f5f5;
}

.top-player {
    font-weight: 500;
}

.rank-1 {
    background-color: rgba(255, 215, 0, 0.1);
}

.rank-2 {
    background-color: rgba(192, 192, 192, 0.1);
}

.rank-3 {
    background-color: rgba(205, 127, 50, 0.1);
}

.no-data {
    text-align: center;
    padding: 20px;
    color: #888;
}

/* تذييل الصفحة */
footer {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-top: 20px;
}

/* تحسينات للأجهزة المحمولة */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .quiz-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .welcome-box, .quiz-box, .result-box, .leaderboard-box {
        padding: 20px;
    }
    
    .question-text {
        font-size: 1.3rem;
    }
    
    .user-result {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .user-details {
        text-align: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-home, .btn-leaderboard {
        width: 100%;
    }
}

@media (min-width: 768px) {
    .options {
        grid-template-columns: repeat(3, 1fr);
    }
}
