/* =========================================================
   Short Lessons - Clean Final CSS
   ---------------------------------------------------------
   Goals:
   - No clipped lesson content
   - Long Arabic/English lessons scroll naturally
   - Mobile/tablet friendly
   - Language toggle works with .active-lang
   - Keeps lesson images, evidence blocks, tables, print,
     floating buttons, and shelves
========================================================= */

/* =========================
   1) Theme
========================= */

:root {
  --bg: #f5f5f3;
  --panel: #ffffff;
  --gold: #d4af37;
  --gold-dark: #8a6a16;
  --gold-soft: rgba(212, 175, 55, .15);
  --ink: #2c2c2c;
  --muted: #777777;
  --line: #eeeeee;
  --blue: #1f6fa5;
  --green: #0d8f4c;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .08);
}

/* =========================
   2) Base Reset
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

/* =========================
   3) Main App Layout
========================= */

.wrapper {
  display: flex;
  min-height: 100vh;
}

/* Left panel */
.sidebar {
  width: 300px;
  flex: 0 0 300px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Filters */
.filters {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filters select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 30px;
  border: 1px solid #dddddd;
  background: #ffffff;
  font-size: 13px;
  outline: none;
}

/* Lecture list */
.lecture-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lecture-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: .2s;
  border: 1px solid transparent;
  font-size: 13px;
}

.lecture-card:hover,
.lecture-card.active {
  background: var(--gold-soft);
}

.lecture-card.active {
  border-color: var(--gold);
}

.lecture-card img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.card-info {
  flex: 1;
  overflow: hidden;
}

.card-info h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-info p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

/* Right panel */
.content {
  flex: 1;
  min-width: 0;
  padding: 40px 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: visible;
}

.lecture-display {
  width: 90%;
  max-width: 1400px;
  min-width: 0;
}

/* Video */
.video-section {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.video-section video,
.video-section iframe {
  width: 100%;
  max-width: 800px;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* =========================
   4) Controls
========================= */

.language-toggle {
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle-btn,
.font-control-btn,
.print-lesson-btn,
.print-tables-btn,
.flyer-inline-btn {
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
  text-decoration: none;
}

.toggle-btn {
  padding: 8px 16px;
  border: 1px solid var(--gold);
  background: #ffffff;
  color: var(--gold);
}

.toggle-btn.active {
  background: var(--gold);
  color: #ffffff;
}

.font-control-btn {
  border: 1px solid var(--gold);
  background: #ffffff;
  color: var(--gold-dark);
  padding: 10px 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .10);
}

.font-control-btn:hover {
  background: var(--gold-soft);
  transform: translateY(-1px);
}

.font-size-label {
  min-width: 48px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.print-lesson-btn {
  border: none;
  background: var(--blue);
  color: #ffffff;
  padding: 10px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}

.print-lesson-btn:hover {
  background: #15547d;
  transform: translateY(-1px);
}

.flyer-inline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #14b866, var(--green));
  color: #ffffff !important;
  border: 1px solid var(--green);
  padding: 10px 16px;
}

.flyer-inline-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(20, 184, 102, .25);
}

#flyerContainer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================
   5) Lecture Content Area
   IMPORTANT:
   Language sections are NOT absolute.
   This prevents long lessons from being clipped.
========================= */

#lectureContentArea {
  --lesson-font-scale: 1;

  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  max-height: none;

  position: relative;
  overflow: visible;

  background: var(--panel);
  padding: 30px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  line-height: 1.8;
}

#lectureContentArea .lecture-content {
  width: 100%;
  min-width: 0;
}

/* Hide inactive language completely; show active language in normal flow */
#lectureContentArea .english,
#lectureContentArea .arabic {
  display: none;
  width: 100%;
  position: static;
  inset: auto;
  opacity: 1;
  pointer-events: auto;
  transition: none;
}

#lectureContentArea .english.active-lang,
#lectureContentArea .arabic.active-lang {
  display: block;
}

/* If a lesson file does not include active-lang, do not accidentally hide everything */
#lectureContentArea .lecture-content > .english:only-child,
#lectureContentArea .lecture-content > .arabic:only-child {
  display: block;
}

/* English */
#lectureContentArea .english {
  direction: ltr;
  text-align: left;
  font-size: calc(16px * var(--lesson-font-scale));
  line-height: 1.75;
}

#lectureContentArea .english h2 {
  font-size: calc(28px * var(--lesson-font-scale));
}

#lectureContentArea .english h3 {
  font-size: calc(22px * var(--lesson-font-scale));
}

/* Arabic */
#lectureContentArea .arabic {
  direction: rtl;
  text-align: right;
  font-family: "Amiri", "Scheherazade New", "Traditional Arabic", serif;
  font-size: calc(22px * var(--lesson-font-scale));
  line-height: 2.1;
  font-weight: 500;
}

#lectureContentArea h2 {
  margin-top: 0;
  color: var(--gold);
  line-height: 1.5;
}

#lectureContentArea h3 {
  color: var(--ink);
  line-height: 1.55;
}

#lectureContentArea p {
  margin: 18px 0;
}

#lectureContentArea .arabic h2 {
  font-size: calc(28px * var(--lesson-font-scale));
  line-height: 1.6;
}

#lectureContentArea .arabic h3 {
  font-size: calc(22px * var(--lesson-font-scale));
  margin-top: 30px;
  margin-bottom: 10px;
}

/* =========================
   6) Qur'an / Hadith Blocks
========================= */

.quran-block,
.hadith-block {
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 55, .35);
  border-left: 4px solid var(--gold);
  border-radius: 14px;
  padding: 18px;
  margin: 18px 0;
}

.arabic .quran-block,
.arabic .hadith-block,
[dir="rtl"] .quran-block,
[dir="rtl"] .hadith-block {
  border-left: 1px solid rgba(212, 175, 55, .35);
  border-right: 4px solid var(--gold);
}

.block-ar {
  direction: rtl;
  text-align: right;
  font-family: "Amiri", "Scheherazade New", "Traditional Arabic", serif;
  font-size: calc(24px * var(--lesson-font-scale));
  line-height: 2.2;
  font-weight: 600;
  margin-bottom: 10px;
}

.block-en {
  direction: ltr;
  text-align: left;
  font-size: calc(13px * var(--lesson-font-scale));
  color: var(--muted);
  line-height: 1.6;
}

/* =========================
   7) Lesson Image / Flyer Section
========================= */

.lesson-image-section {
  --lesson-image-section-width: 900px;
  --lesson-image-width: 650px;

  max-width: var(--lesson-image-section-width);
  margin: 34px auto;
  padding: 26px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(212, 175, 55, .16), transparent 34%),
    radial-gradient(circle at bottom left, rgba(44, 44, 44, .08), transparent 32%),
    linear-gradient(135deg, #fffdf6, #ffffff);
  border: 1px solid rgba(212, 175, 55, .35);
  box-shadow: 0 14px 35px rgba(0, 0, 0, .10);
  color: var(--ink);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.lesson-image-section::before,
.lesson-image-section::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  border: 2px solid rgba(212, 175, 55, .22);
  transform: rotate(45deg);
  border-radius: 28px;
  pointer-events: none;
}

.lesson-image-section::before {
  top: -92px;
  right: -92px;
}

.lesson-image-section::after {
  bottom: -92px;
  left: -92px;
}

.lesson-image-heading {
  position: relative;
  z-index: 2;
  display: inline-block;
  padding: 10px 24px;
  margin-bottom: 12px;
  background: var(--gold);
  color: #ffffff;
  border-radius: 999px;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
}

.lesson-image-subtitle {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 10px auto 24px;
  font-size: clamp(15px, 1.6vw, 17px);
  line-height: 1.9;
  color: #4b4b4b;
  font-weight: 600;
}

.lesson-image-frame {
  position: relative;
  z-index: 2;
  width: min(100%, var(--lesson-image-width));
  margin: 0 auto;
  padding: 14px;
  border-radius: 22px;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, var(--gold), #2c2c2c, var(--gold)) border-box;
  border: 3px solid transparent;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
}

.lesson-image-frame::before {
  content: attr(data-label);
  position: absolute;
  top: -16px;
  inset-inline-start: 28px;
  background: #fff8e8;
  color: #8a5a00;
  border: 1px solid #e7c26a;
  border-radius: 999px;
  padding: 5px 16px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(138, 90, 0, .12);
}

.lesson-image-frame:not([data-label])::before,
.lesson-image-frame[data-label=""]::before {
  display: none;
}

.lesson-image-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  background: #ffffff;
}

.lesson-image-note {
  position: relative;
  z-index: 2;
  max-width: 850px;
  margin: 22px auto 0;
  padding: 16px 18px;
  background: #fff8e8;
  border-left: 5px solid var(--gold);
  border-radius: 16px;
  color: #4b3410;
  font-size: clamp(15px, 1.6vw, 17px);
  font-weight: 700;
  line-height: 1.9;
}

.lesson-image-section[dir="rtl"] .lesson-image-note,
.arabic .lesson-image-note {
  border-left: none;
  border-right: 5px solid var(--gold);
}

.lesson-image-small {
  --lesson-image-section-width: 650px;
  --lesson-image-width: 420px;
}

.lesson-image-medium {
  --lesson-image-section-width: 760px;
  --lesson-image-width: 520px;
}

.lesson-image-large {
  --lesson-image-section-width: 900px;
  --lesson-image-width: 650px;
}

.lesson-image-full {
  --lesson-image-section-width: 1100px;
  --lesson-image-width: 100%;
}

/* =========================
   8) Reusable Lesson Tables
========================= */

.lesson-table-wrap {
  max-width: 1100px;
  margin: 30px auto;
  padding: 22px;
  background: linear-gradient(135deg, #fffdf6, #ffffff);
  border: 1px solid rgba(212, 175, 55, .35);
  border-radius: 18px;
  color: var(--ink);
  line-height: 1.8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
}

.lesson-table-wrap h2,
.lesson-table-wrap h3 {
  margin: 0 0 12px;
  color: var(--gold);
  font-weight: 800;
  line-height: 1.35;
}

.lesson-table-wrap h2 {
  font-size: clamp(22px, 3vw, 28px);
}

.lesson-table-wrap h3 {
  font-size: clamp(19px, 2.4vw, 23px);
}

.lesson-table-wrap p {
  margin: 8px 0;
  font-size: clamp(15px, 1.8vw, 17px);
}

.lesson-table-intro,
.lesson-table-note {
  border-left: 6px solid var(--gold);
  border-radius: 14px;
}

.lesson-table-intro {
  background: var(--gold-soft);
  padding: 18px 20px;
  margin-bottom: 22px;
}

.lesson-table-note {
  margin-top: 22px;
  padding: 18px 20px;
  background: #fff8e8;
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 700;
  color: #4b3410;
  line-height: 1.8;
}

.arabic .lesson-table-intro,
.arabic .lesson-table-note,
.lesson-table-wrap[dir="rtl"] .lesson-table-intro,
.lesson-table-wrap[dir="rtl"] .lesson-table-note {
  border-left: none;
  border-right: 6px solid var(--gold);
}

.lesson-table-main-question {
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 800;
  color: #7a5a10;
  margin: 8px 0;
  line-height: 1.45;
}

.lesson-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
}

.lesson-table th {
  background: var(--gold);
  color: #ffffff;
  padding: 12px 10px;
  font-size: clamp(12px, 1.35vw, 16px);
  text-align: inherit;
  vertical-align: top;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.lesson-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(212, 175, 55, .25);
  font-size: clamp(12px, 1.25vw, 15.5px);
  vertical-align: top;
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: normal;
}

.lesson-table tr:nth-child(even) td {
  background: #fffaf0;
}

.lesson-table tr:last-child td {
  border-bottom: none;
}

.lesson-table .num {
  text-align: center;
  font-weight: 800;
  color: #9a741c;
  font-size: clamp(13px, 1.4vw, 18px);
}

.lesson-table .topic,
.lesson-table .title,
.lesson-table .name {
  font-weight: 800;
  color: #6f5315;
}

.lesson-table .verse-ref,
.lesson-table .source-ref {
  font-weight: 800;
  color: #8a5a00;
  white-space: normal;
}

.lesson-table .ayah,
.lesson-table .arabic-text {
  direction: rtl;
  text-align: right;
  color: #14532d;
  font-family: "Amiri", "Scheherazade New", "Traditional Arabic", serif;
  font-weight: 700;
  line-height: 1.9;
  font-size: clamp(15px, 1.5vw, 18px);
}

.lesson-table .meaning,
.lesson-table .description,
.lesson-table .lesson {
  color: #263238;
}

/* Optional column systems */
.lesson-table-4_wide th:nth-child(1),
.lesson-table-4_wide td:nth-child(1) { width: 25%; }

.lesson-table-4_wide th:nth-child(2),
.lesson-table-4_wide td:nth-child(2) { width: 25%; }

.lesson-table-4_wide th:nth-child(3),
.lesson-table-4_wide td:nth-child(3) { width: 25%; }

.lesson-table-4_wide th:nth-child(4),
.lesson-table-4_wide td:nth-child(4) { width: 25%; }

.lesson-table-4 th:nth-child(1),
.lesson-table-4 td:nth-child(1) { width: 7%; }

.lesson-table-4 th:nth-child(2),
.lesson-table-4 td:nth-child(2) { width: 23%; }

.lesson-table-4 th:nth-child(3),
.lesson-table-4 td:nth-child(3) { width: 25%; }

.lesson-table-4 th:nth-child(4),
.lesson-table-4 td:nth-child(4) { width: 45%; }

.lesson-table-5_wide th:nth-child(1),
.lesson-table-5_wide td:nth-child(1) { width: 20%; }

.lesson-table-5_wide th:nth-child(2),
.lesson-table-5_wide td:nth-child(2) { width: 20%; }

.lesson-table-5_wide th:nth-child(3),
.lesson-table-5_wide td:nth-child(3) { width: 20%; }

.lesson-table-5_wide th:nth-child(4),
.lesson-table-5_wide td:nth-child(4) { width: 20%; }

.lesson-table-5_wide th:nth-child(5),
.lesson-table-5_wide td:nth-child(5) { width: 20%; }


.lesson-table-5 th:nth-child(1),
.lesson-table-5 td:nth-child(1) { width: 6%; }

.lesson-table-5 th:nth-child(2),
.lesson-table-5 td:nth-child(2) { width: 20%; }

.lesson-table-5 th:nth-child(3),
.lesson-table-5 td:nth-child(3) { width: 13%; }

.lesson-table-5 th:nth-child(4),
.lesson-table-5 td:nth-child(4) { width: 25%; }

.lesson-table-5 th:nth-child(5),
.lesson-table-5 td:nth-child(5) { width: 36%; }

/* Old visual tables */
.visual-table {
  margin: 28px 0;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f8fbff, #eef6ff);
  border: 1px solid #d6e8f8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
}

.visual-table h3 {
  margin: 0 0 14px;
  color: #1f5f8b;
  font-size: 1.2rem;
}

.visual-table table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 14px;
  background: #ffffff;
}

.visual-table th {
  background: #3a8bcd;
  color: #ffffff;
  padding: 12px 14px;
  text-align: inherit;
  font-weight: 700;
}

.visual-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e8eef5;
  color: #243447;
  line-height: 1.7;
}

.visual-table tr:last-child td {
  border-bottom: none;
}

.visual-table tr:nth-child(even) td {
  background: #f7fbff;
}

.arabic .lesson-table-wrap,
.arabic .visual-table {
  direction: rtl;
  text-align: right;
}

.english .lesson-table-wrap,
.english .visual-table {
  direction: ltr;
  text-align: left;
}

/* Comparison Table */
.comparison-table {
  margin: 40px 0;
}

.comparison-table table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 16px;
  overflow: hidden;
}

.comparison-table th {
  padding: 16px;
  font-size: 18px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.comparison-table td {
  padding: 18px;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.comparison-table td:first-child {
  background: rgba(255, 70, 70, .05);
}

.comparison-table td:last-child {
  background: rgba(60, 180, 100, .05);
}

.comparison-table p {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.6;
}

.comparison-table .quran-block {
  margin: 0;
}

.rtl table {
  direction: rtl;
}

.rtl th,
.rtl td {
  text-align: right;
}

/* =========================
   9) Floating Buttons and Shelves
========================= */

#askBtn,
#libraryBtn {
  position: fixed;
  bottom: 25px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
  transition: .3s;
}

#askBtn {
  right: 25px;
  background: var(--gold);
  font-size: 30px;
  z-index: 9999;
}

#libraryBtn {
  right: 100px;
  background: #2c2c2c;
  font-size: 26px;
  z-index: 9999;
}

#askBtn:hover,
#libraryBtn:hover {
  transform: scale(1.1);
}

/* Question shelf */
#questionShelf,
#qaShelf {
  position: fixed;
  top: 0;
  right: -460px;
  height: 100%;
  background: #ffffff;
  box-shadow: -5px 0 20px rgba(0, 0, 0, .1);
  transition: .4s ease;
  display: flex;
  flex-direction: column;
}

#questionShelf {
  width: 380px;
  z-index: 9998;
}

#qaShelf {
  width: 420px;
  z-index: 9997;
}

#questionShelf.open,
#qaShelf.open {
  right: 0;
}

.shelf-header,
.qa-header {
  background: #f5f5f5;
  padding: 15px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #dddddd;
}

.shelf-body,
.qa-body {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qa-body {
  overflow-y: auto;
  gap: 14px;
}

.shelf-body input,
.shelf-body textarea {
  padding: 10px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  font-size: 14px;
  width: 100%;
}

.shelf-body textarea {
  resize: none;
  height: 120px;
}

.shelf-body button {
  background: var(--gold);
  color: #ffffff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

#questionStatus {
  font-size: 13px;
  min-height: 20px;
}

.qa-item {
  background: #fafafa;
  border-radius: 10px;
  padding: 12px;
  border-left: 4px solid var(--gold);
}

.qa-question {
  font-weight: 600;
  margin-bottom: 6px;
}

.qa-answer {
  font-size: 14px;
  color: #555555;
}

.qa-unanswered {
  color: #999999;
  font-style: italic;
}

/* =========================
   10) Responsive Layout
========================= */

@media (max-width: 900px) {
  .wrapper {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: 42vh;
    position: relative;
    top: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .lecture-list {
    max-height: 30vh;
  }

  .content {
    display: block;
    width: 100%;
    padding: 20px 10px 100px;
  }

  .lecture-display {
    width: 100%;
    max-width: none;
  }

  .video-section {
    margin-bottom: 20px;
  }

  #lectureContentArea {
    padding: 18px;
    border-radius: 14px;
  }

  #lectureContentArea .arabic {
    font-size: calc(19px * var(--lesson-font-scale));
    line-height: 2;
  }

  #lectureContentArea .arabic h2 {
    font-size: calc(24px * var(--lesson-font-scale));
  }

  #lectureContentArea .arabic h3 {
    font-size: calc(20px * var(--lesson-font-scale));
  }

  .block-ar {
    font-size: calc(21px * var(--lesson-font-scale));
    line-height: 2.1;
  }

  .block-en {
    font-size: calc(13px * var(--lesson-font-scale));
  }

  .quran-block,
  .hadith-block {
    padding: 14px;
    margin: 14px 0;
  }

  .language-toggle {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    padding: 10px 0;
  }

  #questionShelf,
  #qaShelf {
    width: min(92vw, 420px);
  }
}

@media (max-width: 760px) {
  .lesson-image-section {
    padding: 18px 12px;
    margin: 24px auto;
    border-radius: 18px;
  }

  .lesson-image-heading {
    padding: 8px 18px;
  }

  .lesson-image-frame {
    padding: 8px;
    border-radius: 16px;
  }

  .lesson-image-frame::before {
    inset-inline-start: 16px;
    font-size: 12px;
    top: -14px;
  }

  .lesson-image-frame img {
    border-radius: 12px;
  }

  .lesson-image-note {
    padding: 14px;
  }
}

@media (max-width: 700px) {
  .visual-table {
    padding: 12px;
    overflow-x: auto;
  }

  .visual-table table {
    min-width: 520px;
  }

  .visual-table th,
  .visual-table td {
    padding: 10px;
    font-size: .95rem;
  }
}

/* Mobile: turn reusable tables into stacked cards */
@media (max-width: 850px) {
  .lesson-table-wrap {
    padding: 14px;
    margin: 18px auto;
  }

  .lesson-table-intro,
  .lesson-table-note {
    padding: 15px;
  }

  .lesson-table,
  .lesson-table thead,
  .lesson-table tbody,
  .lesson-table th,
  .lesson-table td,
  .lesson-table tr {
    display: block;
    width: 100%;
  }

  .lesson-table {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }

  .lesson-table thead {
    display: none;
  }

  .lesson-table tr {
    margin-bottom: 16px;
    border: 1px solid rgba(212, 175, 55, .35);
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .05);
  }

  .lesson-table tr:nth-child(even) td {
    background: #ffffff;
  }

  .lesson-table td {
    border-bottom: 1px solid rgba(212, 175, 55, .25);
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.7;
  }

  .lesson-table td:last-child {
    border-bottom: none;
  }

  .lesson-table td::before {
    content: attr(data-label);
    display: block;
    font-weight: 800;
    color: #9a741c;
    margin-bottom: 4px;
    font-size: 13px;
    line-height: 1.4;
  }

  .lesson-table .num {
    text-align: inherit;
    font-size: 16px;
  }

  .lesson-table .ayah,
  .lesson-table .arabic-text {
    font-size: 17px;
    line-height: 2;
  }
}

@media (max-width: 600px) {
  .content {
    padding: 12px 6px 110px;
  }

  #lectureContentArea {
    padding: 14px;
    border-radius: 12px;
  }

  #lectureContentArea .arabic {
    font-size: calc(18px * var(--lesson-font-scale));
    line-height: 1.95;
  }

  #lectureContentArea .english {
    font-size: calc(15px * var(--lesson-font-scale));
    line-height: 1.7;
  }

  .toggle-btn,
  .font-control-btn,
  .print-lesson-btn,
  .flyer-inline-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  #askBtn,
  #libraryBtn {
    width: 54px;
    height: 54px;
    bottom: 18px;
  }

  #askBtn {
    right: 18px;
  }

  #libraryBtn {
    right: 84px;
  }
}

/* =========================
   11) Print
========================= */

@media print {
  @page {
    size: auto;
  }

  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html,
  body {
    width: auto !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  body {
    padding: 0 !important;
    font-size: 10.5pt !important;
    line-height: 1.45 !important;
    position: static !important;
  }

  .wrapper,
  .content,
  .lecture-display,
  #lectureContentArea,
  .lecture-content,
  .english,
  .arabic {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    position: static !important;
    inset: auto !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  .sidebar,
  .filters,
  .lecture-list,
  .video-section,
  video,
  iframe,
  .language-toggle,
  .print-lesson-btn,
  .print-tables-btn,
  .font-control-btn,
  .font-size-label,
  #askBtn,
  #questionShelf,
  #qaShelf,
  #libraryBtn,
  #shareBtn,
  #flyerContainer,
  #bookBtn {
    display: none !important;
  }

  .content,
  .lecture-display,
  #lectureContentArea {
    padding: 0 !important;
  }

  #lectureContentArea {
    background: #ffffff !important;
    color: #000000 !important;
    border-radius: 0 !important;
    border: none !important;
  }

  #lectureContentArea .english,
  #lectureContentArea .arabic {
    opacity: 1 !important;
    pointer-events: auto !important;
    transition: none !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding-left: .35in !important;
    padding-right: .35in !important;
  }

  #lectureContentArea .english:not(.active-lang),
  #lectureContentArea .arabic:not(.active-lang) {
    display: none !important;
  }

  h1,
  h2,
  h3 {
    color: #000000 !important;
    page-break-after: avoid;
    break-after: avoid;
  }

  h2 {
    font-size: 20pt !important;
    margin-top: 0 !important;
  }

  h3 {
    font-size: 16pt !important;
    margin-top: 22px !important;
  }

  p {
    color: #000000 !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  #lectureContentArea .arabic {
    direction: rtl !important;
    text-align: right !important;
    font-size: calc(17pt * var(--lesson-font-scale)) !important;
    line-height: 2 !important;
    font-family: "Amiri", "Scheherazade New", "Traditional Arabic", serif !important;
    padding-right: .45in !important;
    padding-left: .3in !important;
  }

  #lectureContentArea .english {
    font-size: calc(11pt * var(--lesson-font-scale)) !important;
    line-height: 1.55 !important;
  }

  .quran-block,
  .hadith-block {
    border: 1px solid #999999 !important;
    border-right: 4px solid #777777 !important;
    border-left: 4px solid #777777 !important;
    background: #f7f7f7 !important;
    color: #000000 !important;
    padding: 12px 16px !important;
    margin: 18px 0 !important;
    border-radius: 8px !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .block-ar,
  .block-en {
    color: #000000 !important;
    background: transparent !important;
  }

  .block-ar {
    direction: rtl !important;
    text-align: right !important;
    font-size: calc(15pt * var(--lesson-font-scale)) !important;
    line-height: 1.9 !important;
  }

  .block-en {
    direction: ltr !important;
    text-align: left !important;
    font-size: calc(12pt * var(--lesson-font-scale)) !important;
    line-height: 1.6 !important;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: auto !important;
  }

  tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  th,
  td,
  .lesson-table th,
  .lesson-table td {
    border: 1px solid #999999 !important;
    color: #000000 !important;
    background: #ffffff !important;
    padding: 8px !important;
  }

  .lesson-table-wrap,
  .visual-table,
  .comparison-table {
    background: #ffffff !important;
    border: none !important;
    padding: 0 !important;
    margin: 18px 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
  }

  .lesson-table,
  .visual-table table {
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: collapse !important;
    table-layout: auto !important;
  }

  .lesson-table td::before {
    content: none !important;
  }

  .lesson-image-section {
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 18px 0 !important;
    max-width: none !important;
  }

  .lesson-image-section::before,
  .lesson-image-section::after,
  .lesson-image-frame::before {
    display: none !important;
  }

  .lesson-image-heading,
  .lesson-image-subtitle,
  .lesson-image-note {
    color: #000000 !important;
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
  }

  .lesson-image-frame {
    width: 100% !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  .lesson-image-frame img {
    max-width: 100% !important;
    border-radius: 0 !important;
  }

  a {
    color: #000000 !important;
    text-decoration: none !important;
  }
}

.print-tables-btn {
  border: none;
  background: #f28c28;
  color: #ffffff;
  padding: 10px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}

.print-tables-btn:hover {
  background: #d97706;
  transform: translateY(-1px);
}


/* =========================================================
   QuranLectures.com - Standalone Home / Player Refresh
========================================================= */
:root {
  --ql-bg: #f7f4ea;
  --ql-deep: #17372d;
  --ql-deeper: #0e241e;
  --ql-cream: #fffaf0;
  --ql-gold: #d4af37;
  --ql-gold-2: #f0d978;
  --ql-mint: #dff3ea;
  --ql-card: rgba(255, 255, 255, .88);
}

body {
  background:
    radial-gradient(circle at top left, rgba(212, 175, 55, .25), transparent 32rem),
    radial-gradient(circle at top right, rgba(23, 55, 45, .18), transparent 30rem),
    linear-gradient(180deg, #fffaf0 0%, #f7f4ea 45%, #f5f5f3 100%);
}

.site-hero {
  background:
    linear-gradient(135deg, rgba(14, 36, 30, .96), rgba(23, 55, 45, .92)),
    radial-gradient(circle at 20% 15%, rgba(212, 175, 55, .55), transparent 24rem);
  color: #fff;
  padding: 18px clamp(18px, 4vw, 56px) 52px;
  position: relative;
  overflow: hidden;
}

.site-hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -140px;
  bottom: -220px;
  border: 2px solid rgba(240, 217, 120, .28);
  border-radius: 90px;
  transform: rotate(45deg);
}

.topbar,
.hero-inner,
.scholar-strip,
.wrapper {
  position: relative;
  z-index: 2;
}

.topbar {
  max-width: 1440px;
  margin: 0 auto 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--ql-gold), var(--ql-gold-2));
  color: var(--ql-deeper);
  font-family: "Amiri", "Traditional Arabic", serif;
  font-size: 30px;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
}

.brand strong {
  display: block;
  font-size: clamp(20px, 2vw, 28px);
  letter-spacing: .2px;
}

.brand small {
  display: block;
  color: rgba(255,255,255,.74);
  margin-top: 2px;
}

.browse-toggle,
.primary-action,
.secondary-action,
.clear-filters,
.close-browse {
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: .2s ease;
}

.browse-toggle {
  display: none;
  padding: 12px 18px;
  background: #fff;
  color: var(--ql-deep);
}

.hero-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
  gap: 34px;
  align-items: end;
}

.eyebrow,
.section-label,
.active-topic {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 900;
}

.eyebrow {
  padding: 8px 12px;
  border: 1px solid rgba(240, 217, 120, .38);
  border-radius: 999px;
  color: var(--ql-gold-2);
  background: rgba(255,255,255,.08);
}

.hero-copy h1 {
  max-width: 950px;
  margin: 18px 0 18px;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 1.04;
  letter-spacing: -1.8px;
}

.hero-copy p {
  max-width: 790px;
  margin: 0;
  color: rgba(255,255,255,.82);
  font-size: clamp(16px, 1.45vw, 21px);
  line-height: 1.75;
}

.hero-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-action,
.secondary-action {
  padding: 13px 20px;
}

.primary-action {
  background: linear-gradient(135deg, var(--ql-gold), var(--ql-gold-2));
  color: var(--ql-deeper);
  box-shadow: 0 14px 30px rgba(0,0,0,.24);
}

.secondary-action {
  color: #fff;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.20);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hero-stats div {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(10px);
}

.hero-stats strong {
  display: block;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1;
  color: var(--ql-gold-2);
}

.hero-stats span {
  display: block;
  margin-top: 8px;
  color: rgba(255,255,255,.76);
  font-weight: 700;
}

.scholar-strip {
  max-width: 1440px;
  margin: -26px auto 18px;
  padding: 18px;
  border-radius: 26px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 18px 40px rgba(0,0,0,.10);
  backdrop-filter: blur(14px);
}

.section-label {
  color: var(--gold-dark);
  margin-bottom: 10px;
}

.chip-row,
.topic-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-chip {
  border: 1px solid rgba(23, 55, 45, .16);
  background: #fff;
  color: var(--ql-deep);
  border-radius: 999px;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
  transition: .18s ease;
}

.nav-chip:hover,
.nav-chip.active {
  background: var(--ql-deep);
  color: #fff;
  border-color: var(--ql-deep);
  transform: translateY(-1px);
}

.wrapper {
  max-width: 1440px;
  margin: 0 auto;
  min-height: auto;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 22px;
  padding: 0 18px 60px;
}

.sidebar {
  width: auto;
  flex: none;
  height: calc(100vh - 24px);
  top: 12px;
  border: 1px solid rgba(23, 55, 45, .10);
  border-radius: 26px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 42px rgba(23, 55, 45, .10);
}

.sidebar-head {
  padding: 20px 18px 8px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-head h2 {
  margin: 0;
  color: var(--ql-deep);
  font-size: 24px;
}

.close-browse {
  display: none;
  width: 36px;
  height: 36px;
  background: #f2ead7;
  color: var(--ql-deep);
}

.filters {
  padding: 12px 18px;
}

.search-input,
.filters select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(23, 55, 45, .14);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

.search-input:focus,
.filters select:focus {
  border-color: var(--ql-gold);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, .14);
}

.clear-filters {
  padding: 11px 14px;
  background: var(--ql-mint);
  color: var(--ql-deep);
}

.topic-chip-row {
  padding: 0 18px 12px;
}

.topic-chip-row .nav-chip {
  font-size: 12px;
  padding: 7px 10px;
}

.list-meta {
  padding: 8px 18px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.list-meta strong {
  color: var(--ql-deep);
}

.lecture-list {
  padding: 0 12px 16px;
  gap: 9px;
}

.lecture-card {
  gap: 12px;
  padding: 11px;
  border-radius: 18px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(23, 55, 45, .08);
}

.lecture-card:hover,
.lecture-card.active {
  background: #fff9e9;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(23, 55, 45, .08);
}

.lecture-card.active {
  border-color: var(--ql-gold);
}

.lecture-card img {
  width: 58px;
  height: 58px;
  border-radius: 16px;
}

.card-info h4 {
  font-size: 14px;
  white-space: normal;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-info p {
  margin-top: 4px;
  font-size: 12px;
}

.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.card-meta-row span,
.active-badges span {
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef8f2;
  color: var(--ql-deep);
  font-size: 11px;
  font-weight: 800;
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  background: #fff8e8;
  color: var(--ql-deep);
  display: grid;
  gap: 4px;
}

.content {
  padding: 0;
  display: block;
}

.lecture-display {
  width: 100%;
  max-width: none;
}

.active-lecture-banner,
.controls-card,
#lectureContentArea {
  border: 1px solid rgba(23, 55, 45, .10);
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 36px rgba(23, 55, 45, .09);
}

.active-lecture-banner {
  border-radius: 26px;
  padding: 22px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.active-topic {
  color: var(--gold-dark);
}

.active-lecture-banner h2 {
  margin: 8px 0 6px;
  color: var(--ql-deep);
  font-size: clamp(24px, 3vw, 40px);
  line-height: 1.15;
}

.active-lecture-banner p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.active-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.video-section {
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(23,55,45,.92), rgba(14,36,30,.98));
  box-shadow: 0 20px 44px rgba(14, 36, 30, .18);
}

.video-section video,
.video-section iframe {
  max-width: 1000px;
  border-radius: 22px;
  background: #000;
  box-shadow: 0 12px 32px rgba(0,0,0,.26);
}

.controls-card {
  position: sticky;
  top: 12px;
  z-index: 50;
  margin: 0 0 18px;
  padding: 14px;
  border-radius: 22px;
}

#lectureContentArea {
  padding: clamp(20px, 3vw, 36px);
  border-radius: 26px;
  height: auto !important;
}

.print-tables-btn {
  border: none;
  background: var(--ql-deep);
  color: #fff;
  padding: 10px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}

.print-tables-btn:hover {
  background: var(--ql-deeper);
  transform: translateY(-1px);
}

@media (max-width: 1100px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .wrapper {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .browse-toggle,
  .close-browse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand small {
    display: none;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scholar-strip {
    margin: -24px 12px 16px;
  }

  .wrapper {
    display: block;
    padding: 0 12px 48px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 -100%;
    width: min(90vw, 390px);
    height: 100vh;
    z-index: 99999;
    top: 0;
    border-radius: 0 24px 24px 0;
    transition: .28s ease;
  }

  body.sidebar-open .sidebar {
    left: 0;
  }

  body.sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99990;
  }

  .content {
    width: 100%;
  }

  .active-lecture-banner {
    display: block;
  }

  .active-badges {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .controls-card {
    position: static;
  }
}

@media (max-width: 620px) {
  .site-hero {
    padding: 14px 16px 42px;
  }

  .topbar {
    margin-bottom: 28px;
  }

  .hero-copy h1 {
    letter-spacing: -1px;
  }

  .hero-actions a,
  .browse-toggle {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .hero-stats {
    grid-template-columns: 1fr 1fr;
  }

  .video-section {
    padding: 10px;
    border-radius: 20px;
  }

  .language-toggle {
    gap: 7px;
  }

  .toggle-btn,
  .font-control-btn,
  .print-lesson-btn,
  .print-tables-btn,
  .flyer-inline-btn {
    font-size: 12px;
    padding: 8px 10px;
  }
}
