/* CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Theme Colors */
    --primary-color: #2a5d3e;
    --secondary-color: #4a9c6d;
    --accent-color: #d4af37;
    --light-color: #f8f5f0;
    --dark-color: #1a1a1a;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #fefefe;
    --card-bg: #ffffff;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

.dark-mode {
    /* Dark Theme Colors */
    --primary-color: #3a8d5e;
    --secondary-color: #5aac7d;
    --accent-color: #e4c158;
    --light-color: #2d2d2d;
    --dark-color: #f8f5f0;
    --text-color: #f0f0f0;
    --text-light: #aaa;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
    direction: rtl;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.theme-toggle:hover {
    transform: rotate(30deg);
}

.theme-toggle .fa-sun {
    display: none;
}

.dark-mode .theme-toggle .fa-moon {
    display: none;
}

.dark-mode .theme-toggle .fa-sun {
    display: block;
}

/* Main Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 80vh;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

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

/* Welcome Screen */
.welcome-content {
    text-align: center;
    padding: 2rem 1rem;
}

.welcome-header {
    margin-bottom: 3rem;
}

.welcome-header .islamic-decoration {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.welcome-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.welcome-header .subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
}

.welcome-body {
    max-width: 800px;
    margin: 0 auto;
}

.islamic-quote {
    background-color: var(--card-bg);
    border-right: 5px solid var(--accent-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    position: relative;
}

.islamic-quote i {
    font-size: 2rem;
    color: var(--accent-color);
    position: absolute;
    top: -15px;
    right: 15px;
    background-color: var(--bg-color);
    padding: 0 10px;
}

.islamic-quote p {
    font-size: 1.3rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.islamic-quote .quote-author {
    font-size: 1rem;
    color: var(--text-light);
    text-align: left;
}

.features-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.feature {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature:hover {
    transform: translateY(-5px);
}

.feature i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.feature p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-back, .btn-level {
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(42, 93, 62, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: rgba(42, 93, 62, 0.1);
}

.btn-back {
    background-color: transparent;
    color: var(--text-light);
    font-size: 1rem;
    padding: 0.7rem 1.5rem;
}

.btn-back:hover {
    color: var(--primary-color);
}

.btn-level {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
    margin-top: 1rem;
    padding: 0.8rem;
    font-size: 1rem;
}

.btn-level:hover {
    background-color: var(--secondary-color);
}

/* Level Selection */
.screen-header {
    text-align: center;
    margin-bottom: 2rem;
}

.screen-header h2 {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.screen-description {
    color: var(--text-light);
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto 2rem;
}

.levels-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.level-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 2px solid transparent;
}

.level-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
}

.level-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.level-card h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.level-card p {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.level-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* Quiz Screen */
.quiz-header {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.quiz-level, .quiz-progress, .quiz-score {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    background-color: var(--light-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
}

.quiz-level i, .quiz-score i {
    color: var(--primary-color);
}

.quiz-progress {
    background-color: var(--accent-color);
    color: white;
    font-weight: 600;
}

.timer-container {
    margin-bottom: 1rem;
}

.timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.timer-bar {
    height: 8px;
    background-color: var(--light-color);
    border-radius: 4px;
    overflow: hidden;
}

.timer-bar-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 100%;
    border-radius: 4px;
    transition: width 1s linear;
}

.quiz-body {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.question-container {
    margin-bottom: 2.5rem;
}

.question-container h3 {
    font-size: 1.8rem;
    color: var(--text-color);
    line-height: 1.5;
}

.options-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.option {
    background-color: var(--light-color);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    padding: 1.2rem 1.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.option:hover:not(.selected) {
    border-color: var(--primary-color);
    transform: translateX(-5px);
}

.option.selected.correct {
    background-color: rgba(74, 156, 109, 0.2);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.option.selected.incorrect {
    background-color: rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
    color: #dc3545;
}

.option .correct-answer {
    color: var(--secondary-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.quiz-navigation {
    display: flex;
    justify-content: flex-start;
}

/* Results Screen */
.results-container {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
}

.results-header {
    text-align: center;
    margin-bottom: 3rem;
}

.result-icon {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
}

.results-header h2 {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.results-header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.results-content {
    text-align: center;
}

.score-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.score-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(42, 93, 62, 0.3);
}

.score-percentage {
    text-align: right;
}

.score-percentage span {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    line-height: 1;
}

.score-percentage p {
    color: var(--text-light);
    font-size: 1.2rem;
}

.result-message {
    background-color: var(--light-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2.5rem;
}

.result-message h3 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.result-message p {
    font-size: 1.2rem;
    color: var(--text-color);
    line-height: 1.6;
}

.badges-earned {
    margin-bottom: 2.5rem;
}

.badges-earned h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.badges-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.badge {
    background-color: var(--light-color);
    border-radius: 50px;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-color);
    box-shadow: var(--shadow);
}

.badge i {
    color: var(--accent-color);
    font-size: 1.2rem;
}

.badge.earned {
    background-color: rgba(212, 175, 55, 0.2);
    border: 2px solid var(--accent-color);
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Badges Modal */
.badges-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.badges-modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--light-color);
}

.modal-header h3 {
    font-size: 1.8rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2.5rem;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--primary-color);
}

.modal-body {
    padding: 2rem;
}

.all-badges {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.badge-card {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

.badge-card.earned {
    border: 2px solid var(--accent-color);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
}

.badge-icon {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.badge-card h4 {
    font-size: 1.3rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.badge-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.badge-requirements {
    font-size: 0.85rem;
    color: var(--text-light);
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    border-radius: 5px;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    color: var(--text-light);
    border-top: 1px solid var(--light-color);
}

footer p {
    margin-bottom: 1rem;
}

.btn-badges {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    font-family: 'Cairo', sans-serif;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.btn-badges:hover {
    background-color: rgba(42, 93, 62, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .welcome-header h1 {
        font-size: 2rem;
    }
    
    .welcome-header .subtitle {
        font-size: 1rem;
    }
    
    .islamic-quote p {
        font-size: 1.1rem;
    }
    
    .features-list {
        grid-template-columns: 1fr;
    }
    
    .screen-header h2 {
        font-size: 1.8rem;
    }
    
    .levels-container {
        grid-template-columns: 1fr;
    }
    
    .quiz-info {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quiz-level, .quiz-progress, .quiz-score {
        justify-content: center;
    }
    
    .question-container h3 {
        font-size: 1.5rem;
    }
    
    .option {
        font-size: 1.1rem;
        padding: 1rem;
    }
    
    .score-display {
        flex-direction: column;
        gap: 2rem;
    }
    
    .score-circle {
        width: 150px;
        height: 150px;
        font-size: 2.5rem;
    }
    
    .score-percentage span {
        font-size: 3rem;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions button {
        width: 100%;
    }
    
    .modal-content {
        margin: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 10px;
    }
    
    .theme-toggle {
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .welcome-header .islamic-decoration {
        font-size: 3rem;
    }
    
    .islamic-quote {
        padding: 1rem;
    }
    
    .quiz-body, .results-container {
        padding: 1.5rem;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
        font-size: 2rem;
    }
    
    .score-percentage span {
        font-size: 2.5rem;
    }
}
