/* General Body Styles */
:root {
    --primary-color: #008080; /* Teal */
    --secondary-color: #20B2AA; /* LightSeaGreen */
    --accent-color: #F4A460; /* SandyBrown */
    --light-bg: #F5F5F5;
    --white-bg: #FFFFFF;
    --dark-text: #333333;
    /* Font Scaling Factors */
    --scale-arabic: 1;
    --scale-latin: 1;
    --scale-norsk: 1;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-text);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.arabic-text {
    direction: rtl;
}

/* Header Styles */
header {
    width: 100%;
    background-color: var(--primary-color);
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-bottom: 5px solid var(--accent-color);
}

header h1 {
    margin: 0;
    font-size: 3em;
    color: var(--white-bg);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

/* Navigation Bar */
nav {
    width: 100%;
    background-color: var(--secondary-color);
    padding: 10px 0;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

#nav-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

nav a {
    color: white;
    margin: 0 15px;
    text-decoration: none;
    font-size: 1.5em;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background-color 0.3s, transform 0.3s;
    cursor: pointer;
}

nav a:hover, nav a.active {
    background-color: var(--accent-color);
    transform: scale(1.1);
}

/* Main Content Area */
main {
    flex: 1;
    width: 90%;
    max-width: 1200px;
    margin: 20px 0;
    padding: 20px;
    background-color: var(--white-bg);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    text-align: center; /* Generally center content */
}

h2 {
    color: var(--primary-color);
    text-align: center;
    font-size: 2.5em;
    border-bottom: 3px dashed var(--accent-color);
    padding-bottom: 10px;
    margin-top: 0;
}

h3 {
    text-align: left;
    color: var(--secondary-color);
}

p, ul {
    text-align: left;
    font-size: 1.1em;
    line-height: 1.6;
}

ul {
    list-style-position: inside;
}

/* Flashcard Styles */
.flashcard-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px 0;
}

.flashcard {
    background-color: var(--white-bg);
    border: 3px solid var(--primary-color);
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4em;
    color: var(--dark-text);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.flashcard:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.flashcard.playing {
    border-color: var(--accent-color);
    background-color: #fff3e0; /* Light orange background */
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--accent-color);
}

/* Button Styles */
.button, button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    margin: 10px;
    transition: background-color 0.3s, transform 0.3s;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.button:hover, button:hover {
    background-color: #d98c48; /* Darker SandyBrown */
    transform: scale(1.05);
}

/* Footer Styles */
footer {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 15px 0;
    margin-top: 20px;
    box-shadow: 0 -4px 8px rgba(0,0,0,0.1);
    border-top: 5px solid var(--accent-color);
}

footer p {
    margin: 0;
    font-size: 1.2em;
    text-align: center;
}

footer a {
    color: white;
    text-decoration: underline;
}

/* Feedback Form Styles */
.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

.feedback-form input,
.feedback-form textarea {
    width: 100%;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    font-size: 1em;
    font-family: 'Arial', sans-serif;
    box-sizing: border-box;
}

.feedback-form textarea {
    resize: vertical;
    min-height: 150px;
}

.feedback-form button {
    align-self: center;
}

/* Challenge Page Styles */
.challenge-options {
    text-align: center;
    margin-bottom: 20px;
}

#challenge-container {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
}

#choices-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.choice-card {
    background-color: #fff;
    border: 2px solid #4682b4;
    border-radius: 10px;
    padding: 20px;
    font-size: 2em;
    cursor: pointer;
    transition: background-color 0.3s;
}

.choice-card:hover {
    background-color: #f0f8ff;
}

/* Gamification Stats */
.gamification-stats {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    background-color: #e0f7fa;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 1.2em;
}

#feedback-notification {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-size: 1.2em;
    z-index: 1000;
}

#feedback-notification.correct {
    background-color: #28a745;
}

#feedback-notification.incorrect {
    background-color: #dc3545;
}

/* Quran Page Styles */
.verse {
    margin-bottom: 20px;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    transition: background-color 0.3s, border-left 0.3s;
}

.verse.verse-highlight {
    background-color: #e8f5e9;
    border-radius: 8px;
    border-left: 5px solid #4CAF50;
    border-bottom: none;
}

.verse:last-child {
    border-bottom: none;
}

.arabic {
    font-size: calc(24px * var(--scale-arabic));
    direction: rtl;
    margin-bottom: 10px;
    font-family: 'Amiri', serif; /* Assuming a serif font helps */
}

.transliteration {
    font-size: calc(20px * var(--scale-latin));
    font-weight: bold;
    margin-bottom: 5px;
    font-family: serif;
    text-align: left;
}

.translation {
    font-size: calc(14px * var(--scale-norsk));
    color: #555;
    text-align: left;
}

#surah-checkboxes {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
    text-align: left;
}

#surah-checkboxes label {
    display: block;
    margin-bottom: 5px;
    cursor: pointer;
}

#player {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

#player select {
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    font-size: 1em;
}

#audioPlayer {
    width: 100%;
    margin-top: 20px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
#dua-checkboxes, #surah-checkboxes {
    text-align: left;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
}

.surah-entry {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.surah-entry:hover {
    background-color: #f0f8f8;
}

.surah-entry:last-child {
    border-bottom: none;
}

.surah-entry input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.surah-entry label {
    cursor: pointer;
    flex: 1;
    font-size: 1.1em;
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    #hamburger-btn {
        display: block !important;
    }

    #nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 10px;
    }

    #nav-links.show {
        display: flex;
    }

    nav a {
        display: block;
        font-size: 1.2em;
        margin: 5px auto;
        width: 80%;
    }

    h2 {
        font-size: 2em;
    }

    .flashcard {
        width: 100px;
        height: 100px;
        font-size: 3em;
    }

    .button, button {
        padding: 12px 24px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    nav {
        padding: 5px 0;
    }

    nav a {
        display: block;
        margin: 5px auto;
        width: 90%;
    }

    main {
        width: 95%;
        padding: 10px;
    }
}

/* Transcript Highlight */
.transcript-segment {
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 2px 4px;
    border-radius: 4px;
}

.transcript-segment:hover {
    background-color: #f0f0f0;
}

.transcript-segment.highlight {
    background-color: #ffd700;
    color: #333;
    font-weight: bold;
}

.sticky-transcript-container, .sticky-player-container {
    position: sticky;
    top: 60px; /* Offset for nav bar */
    z-index: 500;
    background-color: var(--white-bg); /* Use page background color */
    padding: 15px; 
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); /* Soft drop shadow to delineate from scrolling content below */
    border-bottom: 2px solid var(--accent-color);
    margin-bottom: 20px;
}

/* Tajweed Alquran Rules */
.tajweed-h { color: #AAAAAA !important; } /* hamza-wasl */
.tajweed-s { color: #AAAAAA !important; } /* silent */
.tajweed-l { color: #AAAAAA !important; } /* laam-shamsiyah */
.tajweed-n { color: #537FFF !important; } /* madda-normal */
.tajweed-p { color: #4050FF !important; } /* madda-permissible */
.tajweed-m { color: #000EBC !important; } /* madda-necesssary */
.tajweed-q { color: #DD0008 !important; } /* qalaqah */
.tajweed-o { color: #2144C1 !important; } /* madda-obligatory */
.tajweed-c { color: #D500B7 !important; } /* ikhafa-shafawi */
.tajweed-f { color: #9400A8 !important; } /* ikhafa */
.tajweed-w { color: #58B800 !important; } /* idgham-shafawi */
.tajweed-i { color: #26BFFD !important; } /* iqlab */
.tajweed-a { color: #169777 !important; } /* idgham-with-ghunnah */
.tajweed-u { color: #169200 !important; } /* idgham-without-ghunnah */
.tajweed-d { color: #A1A1A1 !important; } /* idgham-mutajanisayn */
.tajweed-g { color: #FF7E1E !important; } /* ghunnah */

/* Verses */
.verse {
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.verse.has-audio {
    cursor: pointer;
}

.verse.has-audio:hover {
    background-color: #f9f9f9;
}

.verse-highlight {
    background-color: #e6f7f5 !important;
    border-left: 4px solid #20B2AA !important;
    transition: all 0.3s ease-in-out !important;
    padding-left: 10px !important; /* Force padding so left border shows */
}
