/* Lesson specific styles */
.lesson-header {
    background: linear-gradient(135deg, #60A5FA, #3B82F6);
    color: white;
}
.lesson-header h1, .lesson-header i, .lesson-header .subject-badge {
    color: white;
}
.lesson-header .subject-badge {
    background: rgba(255, 255, 255, 0.2);
}
.back-btn-header {
    color: white;
    font-size: 1.5rem;
    text-decoration: none;
    transition: transform 0.2s;
}
.back-btn-header:hover {
    transform: scale(1.1);
}

.tabs-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}
.tab-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 30px;
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Tajawal', sans-serif;
}
.tab-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.tab-btn.active {
    background: var(--grammar-color);
    color: white;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}
.tab-content.active-tab {
    display: block;
}

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

.lesson-card-large, .exercise-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.lesson-title, .exercise-title {
    font-family: 'Changa', sans-serif;
    color: var(--grammar-color);
    font-size: 2rem;
    margin-bottom: 25px;
    text-align: center;
    border-bottom: 3px dashed #E5E7EB;
    padding-bottom: 15px;
}

.info-box {
    background: #EFF6FF;
    border-right: 5px solid var(--grammar-color);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}
.definition-box h3 {
    color: var(--grammar-color);
    margin-bottom: 10px;
}

.qa-box {
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
}
.question {
    font-weight: bold;
    font-size: 1.2rem;
    color: #1E293B;
    margin-bottom: 10px;
}
.q-mark { color: #EF4444; margin-left: 5px; }
.answer {
    font-size: 1.1rem;
    color: #334155;
}
.a-mark { color: #10B981; margin-left: 5px; font-weight: bold; }

.equation-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
    align-items: center;
}
.equation {
    background: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid #E2E8F0;
}
.equation small {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: normal;
}
.equation .result {
    color: var(--grammar-color);
    font-size: 1.8rem;
}

.highlight-text {
    text-align: center;
    background: #FEF3C7;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
}
.final-sentence {
    color: #D97706;
    font-size: 2.5rem;
    margin: 15px 0;
    font-family: 'Changa', sans-serif;
}

.alphabet-table-container {
    overflow-x: auto;
}
.alphabet-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    margin-top: 20px;
}
.alphabet-table th {
    background: var(--grammar-color);
    color: white;
    padding: 15px;
    border: 1px solid #BFDBFE;
}
.alphabet-table td {
    padding: 12px;
    border: 1px solid #E5E7EB;
    font-size: 1.2rem;
}
.alphabet-table tr:nth-child(even) {
    background-color: #F8FAFC;
}
.alphabet-table td:nth-child(2), .alphabet-table td:nth-child(5) {
    font-weight: bold;
    color: var(--grammar-color);
    font-size: 1.5rem;
}

/* Exercises */
.exercise-instruction {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
}
.word-list {
    color: var(--primary-color);
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
}
.exercise-note {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 20px;
}
.example-note {
    background: #F0FDF4;
    padding: 15px;
    border-radius: 10px;
    border-right: 4px solid #22C55E;
    margin-top: 20px;
}

.table-exercise {
    display: flex;
    justify-content: center;
    gap: 0;
    border: 2px solid #374151;
    border-radius: 10px;
    overflow: hidden;
    max-width: 400px;
    margin: 0 auto;
}
.table-exercise .column {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.table-exercise .header {
    background: #F3F4F6;
    font-weight: bold;
    padding: 15px;
    text-align: center;
    border-bottom: 2px solid #374151;
}
.table-exercise .words-col { border-left: 2px solid #374151; }
.cell {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #D1D5DB;
    font-size: 1.2rem;
    font-weight: bold;
}
.cell:last-child { border-bottom: none; }
.cell input {
    width: 60px;
    text-align: center;
    font-size: 1.2rem;
    padding: 5px;
    border: 2px solid #9CA3AF;
    border-radius: 5px;
}

/* Match Words Exercise */
.match-words {
    position: relative;
    display: flex;
    justify-content: space-between;
    max-width: 500px;
    margin: 40px auto;
}
.words-column {
    display: flex;
    flex-direction: column;
    gap: 30px;
    z-index: 2;
}
.word-node {
    background: white;
    border: 2px solid var(--grammar-color);
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.2s;
    user-select: none;
}
.word-node.selected {
    background: var(--grammar-color);
    color: white;
    transform: scale(1.05);
}
.word-node.matched {
    background: #10B981;
    border-color: #059669;
    color: white;
    cursor: default;
}
#lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}
line {
    stroke: #9CA3AF;
    stroke-width: 3;
    stroke-linecap: round;
}
line.matched-line {
    stroke: #10B981;
    stroke-width: 4;
}

/* Exercise 3 */
.t3-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    border: 2px solid #374151;
}
.t3-table th, .t3-table td {
    border: 1px solid #374151;
    padding: 15px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}
.t3-table th { background: #F3F4F6; }
.t3-table input {
    width: 90%;
    padding: 10px;
    font-size: 1.1rem;
    text-align: center;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
}
.correct-input { border-color: #10B981 !important; background: #F0FDF4; }
.wrong-input { border-color: #EF4444 !important; background: #FEF2F2; }

.btn {
    display: block;
    margin: 20px auto 0;
    padding: 12px 30px;
    font-size: 1.2rem;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-weight: bold;
    transition: all 0.2s;
}
.check-btn {
    background: var(--grammar-color);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
/* Lesson 2 specific styles */
.controls-list {
    list-style: none;
    margin-top: 10px;
    padding-right: 20px;
}
.controls-list li {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 5px;
}

.control-section {
    margin-top: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.control-head {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--grammar-color);
    margin-bottom: 15px;
    font-family: 'Changa', sans-serif;
}
.badge {
    background: var(--grammar-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}
.example-item {
    background: #F8FAFC;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}
.old { color: #94A3B8; text-decoration: line-through; }
.new { color: var(--grammar-color); font-weight: bold; }

.example-bubbles {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}
.bubble {
    background: #F1F5F9;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1.2rem;
}

.highlight-box {
    background: #FEF3C7;
    padding: 15px;
    border-radius: 10px;
    border-right: 5px solid #F59E0B;
    margin: 15px 0;
}

.word-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}
.word-cloud span {
    background: #E0F2FE;
    padding: 5px 15px;
    border-radius: 15px;
    font-weight: bold;
}

/* Exercise Grids */
.interactive-grid, .madda-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}
.exercise-item-box {
    background: #F8FAFC;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    border: 2px solid transparent;
}
.exercise-item-box input {
    width: 100%;
    text-align: center;
    padding: 8px;
    border: 2px solid #CBD5E1;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 1.1rem;
}

.wasl-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}
.wasl-row {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #F1F5F9;
    padding: 10px 20px;
    border-radius: 10px;
}
.wasl-row input {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #CBD5E1;
    font-family: 'Tajawal', sans-serif;
    text-align: center;
}

.vowel-exercise {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.vowel-item {
    background: #F8FAFC;
    padding: 20px;
    border-radius: 15px;
}
.vowel-word {
    font-size: 1.8rem;
    margin-bottom: 15px;
    text-align: center;
}
.vowel-options {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.vowel-opt {
    padding: 10px 20px;
    border: 2px solid #CBD5E1;
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    transition: all 0.2s;
    font-size: 1.5rem;
}
.vowel-opt.selected {
    background: var(--grammar-color);
    color: white;
    border-color: var(--grammar-color);
}
.vowel-opt.correct { background: #10B981; color: white; border-color: #10B981; }
.vowel-opt.wrong { background: #EF4444; color: white; border-color: #EF4444; }

/* SPA View Management */
.view-section {
    animation: fadeIn 0.4s ease-out;
}

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

/* Animations */
.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Ensure lesson-viewer header is consistent */
.lesson-viewer .section-header {
    margin-bottom: 20px;
}
/* Reading Lesson Styles */
.reading-content-box {
    background: #FFFBEB;
    border: 3px solid #FCD34D;
    border-radius: 20px;
    margin: 30px 0;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(251, 191, 36, 0.1);
}

.reading-header {
    background: #FBBF24;
    color: #92400E;
    padding: 12px 25px;
    font-weight: 800;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.audio-btn {
    background: #92400E;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.2s;
}

.audio-btn:hover {
    background: #78350F;
    transform: scale(1.05);
}

.audio-btn.playing {
    background: #EF4444;
}


.reading-text-body {
    padding: 30px;
    font-size: 1.8rem;
    line-height: 2;
    text-align: center;
    color: #451A03;
    font-family: 'Tajawal', sans-serif;
    white-space: pre-line;
}

.reading-text-body strong {
    color: #B45309;
}

.reading-text-body .verse {
    font-family: 'Changa', sans-serif;
    font-size: 2rem;
    color: #065F46;
    background: #ECFDF5;
    padding: 20px;
    border-radius: 15px;
    display: block;
    margin: 15px 0;
    border: 1px solid #A7F3D0;
}

.reading-text-body .source {
    font-size: 1rem;
    color: #92400E;
    margin-top: 10px;
    font-style: italic;
}

/* Poem Styles */
.poem-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    background: #FFF7ED;
    border-radius: 15px;
    border: 2px solid #FED7AA;
}

.poem-row {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    padding: 10px 0;
    border-bottom: 1px dashed #FDBA74;
}

.poem-row:last-child {
    border-bottom: none;
}

.poem-row span {
    flex: 1;
    font-size: 1.6rem;
    color: #9A3412;
    font-weight: bold;
}

.poem-row span:first-child {
    text-align: right;
}

.poem-row span:last-child {
    text-align: left;
}

.clickable-sentence {
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 2px 4px;
    display: inline;
}

.clickable-sentence:hover {
    background-color: rgba(251, 191, 36, 0.2);
    text-decoration: underline decoration-style dotted;
    color: #92400E;
}

.clickable-sentence.speaking-now {
    background-color: #FCD34D;
    color: #92400E;
    box-shadow: 0 2px 10px rgba(251, 191, 36, 0.3);
    font-weight: bold;
    transform: scale(1.02);
}
