/* Main Styles for Allah Intelligence */
@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #1e5f74;
    --secondary-color: #4ba3c3;
    --accent-color: #f0c929;
    --text-color: #333;
    --light-color: #f4f4f4;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --bg-color: #f8f9fa;
    --header-bg: #1a3a6c;
    --header-text: #fff;
    --card-bg: #fff;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --btn-primary-bg: #1a3a6c;
    --btn-primary-text: #fff;
    --btn-secondary-bg: #e9ecef;
    --btn-secondary-text: #333;
    --btn-accent-bg: #28a745;
    --btn-accent-text: #fff;
    --border-color: #dee2e6;
    --input-bg: #fff;
    --input-text: #333;
    --toggle-bg: #ccc;
    --toggle-active: #1a3a6c;
    --section-title: #1a3a6c;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #f0f0f0;
    --header-bg: #1a1a2e;
    --header-text: #f0f0f0;
    --card-bg: #1e1e30;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --btn-primary-bg: #3a506b;
    --btn-primary-text: #fff;
    --btn-secondary-bg: #2c2c44;
    --btn-secondary-text: #f0f0f0;
    --btn-accent-bg: #2d6a4f;
    --btn-accent-text: #fff;
    --border-color: #3a3a5a;
    --input-bg: #2c2c44;
    --input-text: #f0f0f0;
    --toggle-bg: #444;
    --toggle-active: #4a6fa5;
    --section-title: #6a8ec8;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    font-family: 'Arial', sans-serif;
    overflow-x: hidden;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 5px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    header h2 {
        font-size: 1rem;
    }
}

/* Collapsible settings panel */
.settings-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.settings-toggle:hover {
    background-color: #388E3C;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background-color: #f8f8f8;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 999;
    overflow-y: auto;
    padding: 60px 10px 20px;
}

.settings-panel.active {
    right: 0;
}

.settings-panel h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.settings-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

[data-theme="dark"] .settings-panel {
    background-color: #333;
    box-shadow: -2px 0 5px rgba(0,0,0,0.3);
}

[data-theme="dark"] .settings-close {
    color: #ddd;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--header-bg);
    color: var(--header-text);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

header h2 {
    font-size: 1.2rem;
    font-weight: 400;
}

.mode-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-switch-wrapper {
    display: flex;
    align-items: center;
    position: absolute;
    top: 20px;
    right: 20px;
}

.theme-switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 50px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: var(--toggle-bg);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    background-color: white;
    bottom: 4px;
    content: "";
    height: 16px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 16px;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--toggle-active);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.theme-switch-wrapper .theme-label {
    margin-left: 10px;
    font-size: 14px;
}

.mode-btn {
    padding: 10px 20px;
    margin: 0 10px;
    background-color: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 0 5px;
}

.mode-btn:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mode-btn.active {
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}

.mode-btn.accent-btn {
    background-color: var(--btn-accent-bg);
    color: var(--btn-accent-text);
}

.mode-btn.accent-btn:hover {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.main-content {
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 20px;
    margin-bottom: 20px;
    gap: 25px;
    position: relative;
}

.quran-display {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--card-shadow);
    position: relative;
    margin-bottom: 20px;
}

.arabic-text {
    font-family: 'Amiri', serif;
    font-size: 2.5rem;
    line-height: 1.8;
    direction: rtl;
    margin-bottom: 15px;
    color: var(--primary-color);
    text-align: center;
    padding: 15px;
    background-color: #f9f7e8;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

[data-theme="dark"] .arabic-text, [data-theme="dark"] .quiz-question.arabic-text {
    background-color: #2c2c44;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.transliteration {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.translation {
    font-size: 1rem;
    font-style: italic;
    color: #666;
}

.interaction-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.interaction-row {
    width: 100%;
    margin-bottom: 15px;
}

.interaction-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    width: 100%;
}

.section-title {
    font-size: 1.2rem;
    color: var(--section-title);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.button-row {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.control-btn, .record-btn, .play-recording-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media (max-width: 480px) {
    .control-btn, .record-btn, .play-recording-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}

.record-btn {
    background-color: #dc3545;
    color: white;
}

[data-theme="dark"] .record-btn {
    background-color: #a52834;
}

.record-btn:hover {
    background-color: #e0b92a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.play-recording-btn {
    background-color: #17a2b8;
    color: white;
}

[data-theme="dark"] .play-recording-btn {
    background-color: #0f7a8a;
}

.play-recording-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.play-recording-btn:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.record-btn.recording {
    background-color: var(--error-color);
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
}

.results-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    height: 100%;
}

.recognition-text {
    font-family: 'Amiri', serif;
    font-size: 1.2rem;
    line-height: 1.5;
    min-height: 80px;
    color: var(--text-color);
    word-wrap: break-word;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-top: 10px;
    flex-grow: 1;
}

.recognition-text.arabic {
    direction: rtl;
}

.score-display {
    text-align: center;
    margin: 15px 0;
}

#scoreValue {
    font-size: 3.5rem;
    font-weight: bold;
    color: var(--primary-color);
    background-color: white;
    width: 100px;
    height: 100px;
    line-height: 100px;
    border-radius: 50%;
    margin: 0 auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.feedback {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    width: 100%;
    min-height: 60px;
    margin-top: 15px;
    font-size: 0.95rem;
}

.feedback.success {
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.feedback.warning {
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid var(--warning-color);
    color: var(--warning-color);
}

.feedback.error {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.settings-panel {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
}

.quiz-container {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.quiz-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.quiz-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 10px;
}

.quiz-instructions {
    font-size: 1rem;
    color: #666;
    text-align: center;
    margin-bottom: 20px;
}

.quiz-verse {
    font-family: 'Amiri', serif;
    font-size: 2rem;
    line-height: 1.8;
    direction: rtl;
    margin-bottom: 15px;
    color: var(--primary-color);
    text-align: center;
    padding: 15px;
    background-color: #f9f7e8;
    border-radius: 10px;
    width: 100%;
}

[data-theme="dark"] .quiz-verse {
    background-color: #2c2c44;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.quiz-transliteration {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--secondary-color);
    text-align: center;
}

.quiz-translation {
    font-size: 1rem;
    font-style: italic;
    color: #666;
    text-align: center;
    margin-bottom: 20px;
}

.quiz-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.fill-blanks-text {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    line-height: 2;
    direction: rtl;
    color: var(--primary-color);
    text-align: center;
    padding: 20px;
    background-color: #f9f7e8;
    border-radius: 10px;
    margin-bottom: 20px;
}

[data-theme="dark"] .fill-blanks-text {
    background-color: #2c2c44;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.blank-input {
    font-family: 'Amiri', serif;
    font-size: 1.5rem;
    width: 150px;
    padding: 5px 10px;
    border: 2px solid var(--secondary-color);
    border-radius: 5px;
    text-align: center;
    margin: 0 5px;
    background-color: white;
}

.blank-input.correct {
    border-color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.1);
}

.blank-input.incorrect {
    border-color: var(--error-color);
    background-color: rgba(220, 53, 69, 0.1);
}

.quiz-option {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-option:hover {
    background-color: #f0f0f0;
}

[data-theme="dark"] .quiz-option {
    background-color: #2c2c44;
    color: var(--text-color);
}

[data-theme="dark"] .quiz-option:hover {
    background-color: #3a3a5a;
}

.quiz-option input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.2);
}

.quiz-option label {
    flex: 1;
    cursor: pointer;
}

.quiz-option label.correct {
    color: var(--success-color);
    font-weight: bold;
}

.quiz-option label.incorrect {
    color: var(--error-color);
    text-decoration: line-through;
}

.quiz-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.quiz-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.quiz-score {
    text-align: center;
}

.quiz-score h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.score-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
}

.correct-answer {
    text-align: center;
    padding: 15px;
    background-color: #f9f7e8;
    border-radius: 10px;
    width: 100%;
}

[data-theme="dark"] .correct-answer {
    background-color: #2c2c44;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.correct-answer h4 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.quiz-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.quiz-btn {
    background-color: var(--accent-color);
    color: var(--text-color);
}

.quiz-btn:hover {
    background-color: #e0b81f;
}

.quiz-setting {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.small-btn {
    padding: 8px 16px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.toggle-box {
    position: absolute;
    background-color: #caa3a3;
    padding: 5px 5px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    font-family: sans-serif;
    font-size: 14px;
    z-index: 1000;
}

.bottom-right {
    bottom: 20px;
    right: 25px;
}

.bottom-right-transliteration {
    bottom: 60px;
    right: 20px;
}

.toggle-translation-box input[type="checkbox"] {
    margin-right: 8px;
}

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

.settings-panel h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.setting {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

@media (max-width: 480px) {
    .setting {
        flex-direction: column;
        align-items: flex-start;
    }
}

.setting label {
    font-weight: 500;
    min-width: 120px;
}

@media (max-width: 480px) {
    .setting label {
        display: block;
        margin-bottom: 5px;
    }
}

.setting select, .setting input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.setting button {
    padding: 10px 15px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 5px;
}

footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .arabic-text {
        font-size: 2rem;
    }
    
    .control-btn, .mode-btn, .record-btn, .play-recording-btn {
        padding: 10px 20px;
        font-size: 0.95rem;
        min-width: 130px;
    }
    
    #scoreValue {
        font-size: 3rem;
        width: 90px;
        height: 90px;
        line-height: 90px;
    }
    
    .results-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }
    
    header h2 {
        font-size: 1rem;
    }
    
    .arabic-text {
        font-size: 1.8rem;
    }
    
    .mode-selector {
        flex-direction: column;
        align-items: center;
    }
    
    .mode-btn {
        margin: 5px 0;
        width: 100%;
    }
    
    .button-row {
        flex-direction: column;
        width: 100%;
    }
    
    .control-btn, .record-btn, .play-recording-btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    #scoreValue {
        font-size: 2.5rem;
        width: 80px;
        height: 80px;
        line-height: 80px;
    }
}
