/* ═══════════════════════════════════════════════════
   NOOR — new-features.css
   Ramadan Tracker · Daily Verse · Dua Generator · Mirath
   ═══════════════════════════════════════════════════ */

/* ═══ RAMADAN TRACKER ═══ */
.rm-countdown {
  background: linear-gradient(135deg, var(--emerald-800), var(--emerald-900));
  border-radius: var(--r-xl);
  padding: 48px 24px;
  text-align: center;
  color: white;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.rm-countdown::before {
  content: '';
  position: absolute;
  top: -30%; right: -20%;
  width: 60%; height: 160%;
  background: radial-gradient(circle, rgba(245,158,11,0.08), transparent 60%);
}
.rm-moon { font-size: 52px; margin-bottom: 12px; animation: rmFloat 3s ease-in-out infinite; }
@keyframes rmFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.rm-countdown-num { font-size: 80px; font-weight: 900; line-height: 1; position: relative; }
.rm-countdown-label { font-size: 16px; opacity: .8; margin-top: 8px; position: relative; letter-spacing: .05em; }

.rm-active-banner {
  background: linear-gradient(135deg, var(--emerald-700), var(--emerald-900));
  border-radius: var(--r-xl);
  padding: 36px 24px;
  text-align: center;
  color: white;
  margin-bottom: 20px;
}
.rm-active-icon { font-size: 44px; margin-bottom: 10px; }
.rm-active-text { font-size: 24px; font-weight: 700; margin-bottom: 16px; }
.rm-progress-wrap { max-width: 340px; margin: 0 auto; }
.rm-progress-bar { height: 8px; background: rgba(255,255,255,0.2); border-radius: 8px; overflow: hidden; }
.rm-progress-fill { height: 100%; background: var(--gold-400); border-radius: 8px; transition: width .5s var(--ease); }
.rm-progress-label { font-size: 13px; opacity: .75; margin-top: 6px; }

.rm-times-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.rm-time-card {
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 20px;
  text-align: center;
  transition: all .3s var(--ease);
}
.rm-time-card:hover { box-shadow: var(--shadow-md); }
.rm-time-card.suhoor { border-top: 3px solid var(--gold-400); }
.rm-time-card.iftar  { border-top: 3px solid var(--emerald-500); }
.rm-time-icon { font-size: 28px; margin-bottom: 6px; }
.rm-time-label { font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.rm-time-val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rm-loading { color: var(--text-3); font-size: 16px; }

.rm-section { background: var(--bg-el); border: 1px solid var(--border-1); border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px; }
.rm-section-title { font-size: 14px; font-weight: 700; color: var(--emerald-700); display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }

.rm-log-btns { display: flex; gap: 10px; margin-bottom: 14px; }
.rm-log-btn { flex: 1; padding: 12px; border: 2px solid var(--border-2); border-radius: var(--r-sm); background: var(--bg-sunk); font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .25s; }
.rm-log-btn.fasted.active-btn { background: var(--emerald-50); border-color: var(--emerald-500); color: var(--emerald-700); }
.rm-log-btn.not-fasted.active-btn { background: #FEF2F2; border-color: #DC2626; color: #DC2626; }

.rm-fasted-count { font-size: 14px; color: var(--text-2); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.rm-fasted-count i { color: var(--gold-500); }
.rm-fasted-count strong { color: var(--emerald-700); }

.rm-cal { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-day { display: flex; flex-direction: column; align-items: center; width: 44px; height: 52px; border-radius: var(--r-sm); border: 1px solid var(--border-1); background: var(--bg-sunk); cursor: default; padding: 4px 0; }
.rm-day.fasted { background: var(--emerald-50); border-color: var(--emerald-500); }
.rm-day.not-fasted { background: #FEF2F2; border-color: #DC2626; }
.rm-day-num { font-size: 11px; font-weight: 700; color: var(--text-2); }
.rm-day-icon { font-size: 14px; }

.rm-laylatul { background: linear-gradient(135deg, #1a0a3e, #2d1a6e); border-radius: var(--r-xl); padding: 32px; text-align: center; color: white; margin-bottom: 16px; }
.rm-laylatul-icon { font-size: 40px; margin-bottom: 10px; }
.rm-laylatul-text { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.rm-laylatul-desc { font-size: 14px; opacity: .8; line-height: 1.6; }

.rm-dua-section { background: var(--bg-el); border: 1px solid var(--border-1); border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px; }
.rm-dua-ar { font-family: var(--font-arabic); font-size: 22px; line-height: 1.8; text-align: center; color: var(--text-1); direction: rtl; margin-bottom: 8px; }
.rm-dua-trans { font-size: 13px; color: var(--text-2); font-style: italic; text-align: center; margin-bottom: 4px; }
.rm-dua-mean { font-size: 14px; color: var(--text-1); text-align: center; margin-bottom: 6px; line-height: 1.6; }
.rm-dua-src { font-size: 12px; color: var(--text-3); text-align: center; }

/* ═══ DAILY VERSE & HADITH ═══ */
.daily-date { text-align: center; font-size: 14px; color: var(--text-3); margin-bottom: 20px; font-weight: 500; }

.daily-card {
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: 28px;
  margin-bottom: 16px;
  transition: box-shadow .3s;
}
.daily-card:hover { box-shadow: var(--shadow-lg); }
.verse-card { border-top: 4px solid var(--emerald-500); }
.hadith-card { border-top: 4px solid var(--gold-400); }

.daily-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.daily-card-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--emerald-50); color: var(--emerald-700); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.hadith-ic { background: var(--gold-50); color: var(--gold-600); }
[data-theme="dark"] .daily-card-icon { background: rgba(5,150,105,0.1); }
[data-theme="dark"] .hadith-ic { background: rgba(245,158,11,0.1); }
.daily-card-label { font-size: 13px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; flex: 1; }
.daily-card-ref { font-size: 12px; color: var(--emerald-600); font-weight: 600; background: var(--emerald-50); padding: 3px 10px; border-radius: 20px; }
[data-theme="dark"] .daily-card-ref { background: rgba(5,150,105,0.1); }

.daily-arabic { font-family: var(--font-arabic); font-size: 26px; line-height: 2; text-align: center; color: var(--text-1); direction: rtl; margin-bottom: 14px; padding: 16px; background: var(--bg-sunk); border-radius: var(--r-md); }
.daily-translation { font-size: 15px; color: var(--text-2); line-height: 1.7; margin-bottom: 12px; font-style: italic; text-align: center; }
.daily-transliteration { font-size: 13px; color: var(--emerald-600); text-align: center; margin-bottom: 10px; font-style: italic; }
.daily-narrator { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 5px; margin-bottom: 12px; justify-content: center; }
.daily-narrator i { color: var(--gold-500); }

.daily-reflection { display: flex; gap: 10px; padding: 12px 14px; background: var(--gold-50); border-radius: var(--r-md); margin-bottom: 14px; font-size: 13px; color: var(--text-2); line-height: 1.6; }
[data-theme="dark"] .daily-reflection { background: rgba(245,158,11,0.05); }
.daily-reflection i { color: var(--gold-500); flex-shrink: 0; font-size: 16px; margin-top: 1px; }

.daily-actions { display: flex; gap: 8px; }
.daily-action-btn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px; border: 1px solid var(--border-1); border-radius: var(--r-sm); background: var(--bg-sunk); color: var(--text-2); cursor: pointer; font-family: var(--font); font-size: 13px; font-weight: 500; transition: all .2s; }
.daily-action-btn:hover { border-color: var(--emerald-500); color: var(--emerald-700); }

.daily-note { text-align: center; font-size: 12px; color: var(--text-3); display: flex; align-items: center; justify-content: center; gap: 5px; padding: 12px; }

/* ═══ DUA GENERATOR ═══ */
.dua-textarea {
  width: 100%;
  padding: 16px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--bg-el);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color .3s, box-shadow .3s;
  margin-bottom: 12px;
  display: block;
}
.dua-textarea:focus { outline: none; border-color: var(--emerald-500); box-shadow: 0 0 0 3px var(--primary-glow); }

.dua-generate-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--emerald-600), var(--emerald-700));
  color: white;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .25s var(--ease);
  box-shadow: 0 4px 16px rgba(5,150,105,0.25);
}
.dua-generate-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(5,150,105,0.35); }
.dua-generate-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.dua-cats { margin-top: 20px; }
.dua-cats-label { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 10px; }
.dua-cats-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.dua-cat-btn { padding: 8px 14px; border: 1px solid var(--border-1); border-radius: 20px; background: var(--bg-el); color: var(--text-2); cursor: pointer; font-family: var(--font); font-size: 13px; font-weight: 500; transition: all .2s; }
.dua-cat-btn:hover { border-color: var(--emerald-500); color: var(--emerald-700); background: var(--emerald-50); }

.dua-loading { display: flex; align-items: center; gap: 12px; padding: 20px; color: var(--text-3); font-size: 14px; }

.dua-result-card { background: var(--bg-el); border: 1px solid var(--border-1); border-radius: var(--r-xl); padding: 28px; margin-top: 16px; border-top: 4px solid var(--emerald-500); }
.dua-ar { font-family: var(--font-arabic); font-size: 28px; line-height: 2; text-align: center; color: var(--text-1); direction: rtl; background: var(--emerald-50); padding: 20px; border-radius: var(--r-md); margin-bottom: 16px; }
[data-theme="dark"] .dua-ar { background: rgba(5,150,105,0.06); }
.dua-trans, .dua-meaning, .dua-source { margin-bottom: 10px; font-size: 14px; color: var(--text-2); line-height: 1.7; }
.dua-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin-right: 6px; display: block; margin-bottom: 3px; }
.dua-source { display: flex; align-items: center; gap: 6px; color: var(--emerald-700); font-weight: 600; }
.dua-source i { font-size: 16px; }
.dua-explanation { margin-top: 14px; padding: 12px 14px; background: var(--gold-50); border-radius: var(--r-md); font-size: 13px; color: var(--text-2); line-height: 1.6; display: flex; gap: 8px; }
[data-theme="dark"] .dua-explanation { background: rgba(245,158,11,0.05); }
.dua-explanation i { color: var(--gold-500); flex-shrink: 0; }
.dua-result-actions { margin-top: 16px; }
.dua-disclaimer { font-size: 12px; color: var(--text-3); margin-top: 12px; display: flex; align-items: flex-start; gap: 6px; line-height: 1.5; }
.dua-disclaimer i { flex-shrink: 0; margin-top: 1px; }
.dua-raw { font-size: 14px; color: var(--text-2); line-height: 1.8; padding: 20px; background: var(--bg-el); border-radius: var(--r-md); border: 1px solid var(--border-1); }
.dua-error { color: #DC2626; display: flex; align-items: center; gap: 8px; padding: 16px; }

/* ═══ MIRATH CALCULATOR ═══ */
.mirath-form { background: var(--bg-el); border: 1px solid var(--border-1); border-radius: var(--r-lg); padding: 24px; margin-bottom: 16px; }
.mirath-heirs-label { font-size: 14px; font-weight: 700; color: var(--text-1); margin: 20px 0 12px; }
.mirath-heirs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.mirath-heir-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; padding: 10px 14px; border: 1px solid var(--border-1); border-radius: var(--r-sm); background: var(--bg-sunk); transition: all .2s; }
.mirath-heir-check:hover { border-color: var(--emerald-500); color: var(--emerald-700); }
.mirath-heir-check input { accent-color: var(--emerald-600); width: 16px; height: 16px; }
.mirath-heir-num { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--text-2); padding: 8px 14px; border: 1px solid var(--border-1); border-radius: var(--r-sm); background: var(--bg-sunk); }

.mirath-net { background: linear-gradient(135deg, var(--emerald-600), var(--emerald-800)); border-radius: var(--r-lg); padding: 24px; color: white; text-align: center; margin-bottom: 16px; }
.mirath-net-label { font-size: 12px; opacity: .8; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px; }
.mirath-net-val { font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mirath-net-sub { font-size: 12px; opacity: .65; margin-top: 4px; }

.mirath-table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--border-1); margin-bottom: 14px; }
.mirath-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mirath-table thead { background: var(--emerald-50); }
[data-theme="dark"] .mirath-table thead { background: rgba(5,150,105,0.08); }
.mirath-table th { padding: 12px 16px; text-align: start; font-size: 12px; font-weight: 700; color: var(--emerald-700); text-transform: uppercase; letter-spacing: .08em; }
.mirath-table td { padding: 12px 16px; border-top: 1px solid var(--border-1); color: var(--text-2); }
.mirath-table tr:hover td { background: var(--bg-sunk); }
.mirath-frac { background: var(--emerald-50); color: var(--emerald-700); padding: 2px 8px; border-radius: 20px; font-size: 13px; font-weight: 600; }
[data-theme="dark"] .mirath-frac { background: rgba(5,150,105,0.1); }
.mirath-ref { color: var(--text-3); font-size: 11px; }

.mirath-disclaimer { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; line-height: 1.5; padding: 12px 14px; background: var(--gold-50); border-radius: var(--r-sm); }
[data-theme="dark"] .mirath-disclaimer { background: rgba(245,158,11,0.05); }
.mirath-disclaimer i { flex-shrink: 0; color: var(--gold-500); }

.mirath-quran { background: var(--bg-el); border: 1px solid var(--border-1); border-radius: var(--r-lg); padding: 20px; margin-top: 16px; border-left: 4px solid var(--emerald-500); }
[dir="rtl"] .mirath-quran { border-left: none; border-right: 4px solid var(--emerald-500); }
.mirath-quran-title { font-size: 13px; font-weight: 700; color: var(--emerald-700); display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.mirath-quran-ar { font-family: var(--font-arabic); font-size: 20px; line-height: 1.8; text-align: center; direction: rtl; margin-bottom: 8px; color: var(--text-1); }
.mirath-quran-ref { text-align: center; font-size: 12px; color: var(--gold-600); font-weight: 600; margin-bottom: 8px; }
.mirath-quran-en { font-size: 13px; color: var(--text-2); line-height: 1.6; font-style: italic; text-align: center; }

/* ═══ LANGUAGE SWITCHER (expanded) ═══ */
.lang-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px; }
.lang-btn { padding: 8px 6px; border-radius: var(--r-sm); border: 1px solid var(--border-1); background: var(--bg-sunk); color: var(--text-2); cursor: pointer; font-size: 12px; font-family: var(--font); font-weight: 500; transition: all .2s; text-align: center; }
.lang-btn:hover { border-color: var(--primary); color: var(--primary); }
.lang-btn.on { background: var(--primary); color: white; border-color: var(--primary); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 640px) {
  .rm-countdown-num { font-size: 60px; }
  .rm-times-row { grid-template-columns: 1fr 1fr; }
  .mirath-heirs-grid { grid-template-columns: 1fr 1fr; }
  .dua-cats-grid { gap: 6px; }
  .daily-arabic { font-size: 22px; }
  .dua-ar { font-size: 22px; }
}

/* ═══════════════════════════════════════════════════
   QURAN READER REDESIGN — quran.com-inspired + Noor theme
   ═══════════════════════════════════════════════════ */

/* ── Sticky header ── */
.qrn-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-sb);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.qrn-header::-webkit-scrollbar { display: none; }

.qrn-hbtn {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-1);
  background: var(--bg-sunk);
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  transition: all .2s;
}
.qrn-hbtn:hover { border-color: var(--primary); color: var(--primary); }

.qrn-hsel {
  padding: 8px 12px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  background: var(--bg-el);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 13px;
  flex: 1;
  max-width: 230px;
  min-width: 0;
}

.qrn-hsearch {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-sunk);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  flex-shrink: 0;
}
.qrn-hsearch i { color: var(--text-3); font-size: 15px; flex-shrink: 0; }
.qrn-hsearch input {
  border: none; background: transparent;
  color: var(--text-1); font-family: var(--font); font-size: 13px;
  width: 100px; outline: none;
}
.qrn-hsearch input::placeholder { color: var(--text-3); }

.qrn-modes {
  display: flex;
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.qrn-mode {
  padding: 8px 12px;
  border: none;
  background: var(--bg-sunk);
  color: var(--text-3);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  transition: all .2s;
  white-space: nowrap;
}
.qrn-mode.active { background: var(--emerald-600); color: white; }

.qrn-trans-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 12px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  background: var(--bg-el);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  transition: all .2s;
}
[dir="rtl"] .qrn-trans-btn { margin-left: 0; margin-right: auto; }
.qrn-trans-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Content wrapper ── */
.qrn-content {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* ── Surah banner ── */
.qrn-banner {
  background: linear-gradient(135deg, var(--emerald-700), var(--emerald-900));
  border-radius: var(--r-xl);
  padding: 36px 28px;
  color: white;
  text-align: center;
  margin: 24px 0 20px;
  position: relative;
  overflow: hidden;
}
.qrn-banner::before {
  content: '';
  position: absolute;
  top: -40%; right: -20%; width: 60%; height: 180%;
  background: radial-gradient(circle, rgba(245,158,11,0.07), transparent 60%);
}
.qrn-banner-ar {
  font-family: var(--font-arabic);
  font-size: 42px;
  margin-bottom: 6px;
  position: relative;
}
.qrn-banner-en {
  font-size: 14px;
  opacity: .75;
  margin-bottom: 12px;
  position: relative;
}
.qrn-banner-meta {
  display: flex; justify-content: center; gap: 20px;
  font-size: 13px; opacity: .7;
  position: relative;
}
.qrn-banner-meta span { display: flex; align-items: center; gap: 5px; }

/* ── Bismillah ── */
.qrn-bismillah {
  text-align: center;
  font-family: var(--font-arabic);
  font-size: 30px;
  color: var(--gold-500);
  padding: 20px 0;
}

/* ── Verse cards ── */
.qrn-verse {
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 10px;
  transition: box-shadow .3s;
}
.qrn-verse:hover { box-shadow: var(--shadow-md); }
.qrn-verse-top {
  display: flex;
  justify-content: flex-start; /* LTR: ref on left */
  margin-bottom: 16px;
}
[dir="rtl"] .qrn-verse-top { justify-content: flex-start; }
.qrn-verse-ref {
  background: var(--emerald-50);
  color: var(--emerald-700);
  font-size: 12px; font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}
[data-theme="dark"] .qrn-verse-ref { background: rgba(5,150,105,0.12); }

.qrn-arabic {
  font-family: var(--font-arabic);
  font-size: 26px;
  line-height: 2.2;
  text-align: right;
  direction: rtl;
  color: var(--text-1);
  margin-bottom: 14px;
}
.qrn-trans {
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.85;
  padding-top: 12px;
  border-top: 1px solid var(--border-1);
  margin-bottom: 14px;
}
.qrn-actions { display: flex; gap: 8px; }
.qrn-tafsir-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 16px;
  border: 1px solid var(--border-1);
  border-radius: 20px;
  background: var(--bg-sunk);
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
}
.qrn-tafsir-btn:hover { border-color: var(--emerald-500); color: var(--emerald-700); background: var(--emerald-50); }
[data-theme="dark"] .qrn-tafsir-btn:hover { background: rgba(5,150,105,0.08); }

/* ── Reading mode ── */
.qrn-reading-block {
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: 40px 36px;
  font-family: var(--font-arabic);
  font-size: 24px;
  line-height: 2.6;
  text-align: right;
  direction: rtl;
  color: var(--text-1);
  margin: 20px 0;
}
.qrn-vmarker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: var(--emerald-50);
  color: var(--emerald-700);
  font-family: var(--font);
  font-size: 11px; font-weight: 700;
  border-radius: 50%;
  margin: 0 4px;
  vertical-align: middle;
}
[data-theme="dark"] .qrn-vmarker { background: rgba(5,150,105,0.1); }
.qrn-reading-trans {
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: 28px 32px;
  font-size: 15px;
  color: var(--text-2);
  line-height: 2;
  margin-top: 16px;
}
.qrn-rt-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-3); margin-bottom: 14px; display: block;
}
.qrn-rt-verse { margin-right: 3px; }

/* ── Translation Sidebar ── */
.qrn-trans-sidebar {
  position: fixed;
  top: 0; bottom: 0;
  right: -380px;
  width: 340px;
  background: var(--bg-el);
  border-left: 1px solid var(--border-1);
  z-index: 800;
  display: flex; flex-direction: column;
  transition: right .4s var(--ease);
  box-shadow: var(--shadow-xl);
}
[dir="rtl"] .qrn-trans-sidebar {
  right: auto; left: -380px;
  border-left: none; border-right: 1px solid var(--border-1);
  transition: left .4s var(--ease);
}
.qrn-trans-sidebar.open { right: 0; }
[dir="rtl"] .qrn-trans-sidebar.open { right: auto; left: 0; }
.qrn-ts-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-1);
  font-size: 15px; font-weight: 700;
  flex-shrink: 0;
}
.qrn-ts-header button {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-1);
  background: var(--bg-sunk);
  color: var(--text-2);
  cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.qrn-ts-header button:hover { border-color: var(--primary); color: var(--primary); }
.qrn-ts-list { flex: 1; overflow-y: auto; padding: 12px; }
.qrn-ts-group { margin-bottom: 14px; }
.qrn-ts-glabel {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-3);
  padding: 4px 10px; margin-bottom: 4px;
}
.qrn-trans-item {
  padding: 10px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px; color: var(--text-2);
  transition: all .2s;
  display: flex; align-items: center;
}
.qrn-trans-item:hover { background: var(--bg-sunk); color: var(--primary); }
.qrn-trans-item.active { background: var(--emerald-50); color: var(--emerald-700); font-weight: 600; }
[data-theme="dark"] .qrn-trans-item.active { background: rgba(5,150,105,0.1); }

/* ── Tafsir Modal ── */
.qrn-taf-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 900;
  display: none;
  align-items: flex-end; /* bottom sheet on mobile */
  justify-content: center;
  padding: 20px;
}
@media (min-width: 641px) {
  .qrn-taf-overlay { align-items: center; }
}

.qrn-taf-modal {
  background: var(--bg-el);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 740px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: mIn .35s var(--ease);
}

/* Modal header */
.qrn-taf-mhead {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}
.qrn-taf-nav {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
}
[dir="rtl"] .qrn-taf-nav { margin-left: 0; margin-right: auto; }
.qrn-taf-navbtn {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-1);
  background: var(--bg-sunk);
  color: var(--text-2);
  cursor: pointer; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.qrn-taf-navbtn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.qrn-taf-navbtn:disabled { opacity: .35; cursor: not-allowed; }
.qrn-taf-ref {
  font-size: 14px; font-weight: 700;
  color: var(--emerald-700);
  min-width: 52px; text-align: center;
  background: var(--emerald-50);
  padding: 4px 10px; border-radius: 20px;
}
[data-theme="dark"] .qrn-taf-ref { background: rgba(5,150,105,0.1); }
.qrn-taf-closebtn {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-1);
  background: var(--bg-sunk);
  color: var(--text-2);
  cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.qrn-taf-closebtn:hover { background: #FEF2F2; color: #DC2626; border-color: #DC2626; }

/* Verse in modal */
.qrn-taf-verse {
  font-family: var(--font-arabic);
  font-size: 22px;
  line-height: 2;
  text-align: right;
  direction: rtl;
  padding: 18px 20px;
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
  color: var(--text-1);
}

/* Tafsir edition tabs */
.qrn-taf-tabs {
  display: flex; gap: 6px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.qrn-taf-tabs::-webkit-scrollbar { display: none; }
.qrn-taf-tab {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-1);
  background: var(--bg-sunk);
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: all .2s;
  font-family: var(--font-arabic);
}
.qrn-taf-tab:hover { border-color: var(--emerald-400); color: var(--emerald-700); }
.qrn-taf-tab.active { background: var(--emerald-600); color: white; border-color: var(--emerald-600); }

/* Tafsir text area */
.qrn-taf-text {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.qrn-taf-body {
  font-size: 15px;
  line-height: 2;
  color: var(--text-2);
}
.qrn-taf-body[dir="rtl"] {
  font-family: var(--font-arabic);
  font-size: 17px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .qrn-header { padding: 8px 12px; }
  .qrn-hsel { max-width: 120px; font-size: 12px; }
  .qrn-hsearch input { width: 60px; }
  .qrn-mode span { display: none; }
  .qrn-trans-btn span { display: none; }
  .qrn-reading-block { font-size: 20px; padding: 20px; }
  .qrn-arabic { font-size: 22px; }
  .qrn-trans-sidebar { width: 100%; right: -110%; }
  .qrn-trans-sidebar.open { right: 0; }
  .qrn-taf-modal { border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; }
  .qrn-taf-overlay { padding: 0; }
  .qrn-content { padding: 0 12px 60px; }
}

/* ═══════════════════════════════════════════════════
   TAFSIR MODAL — Bigger + scroll-to-top fix
   ═══════════════════════════════════════════════════ */

/* Bigger modal — override previous values */
.qrn-taf-modal {
  max-width: 900px !important;
  max-height: 92vh !important;
  width: 96% !important;
}
.qrn-taf-body {
  font-size: 17px !important;
  line-height: 2.2 !important;
}
.qrn-taf-body[dir="rtl"] {
  font-size: 19px !important;
  font-family: var(--font-arabic) !important;
}
.qrn-taf-text {
  padding: 24px 28px !important;
}
.qrn-taf-verse {
  font-size: 24px !important;
  line-height: 2.2 !important;
  padding: 22px 28px !important;
}
/* Prevent body scroll when modal open — handled in JS */
body.modal-open { overflow: hidden !important; }

/* ═══════════════════════════════════════════════════
   DHIKR PAGE — Complete redesign with accordion
   ═══════════════════════════════════════════════════ */

.dh-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.dh-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-1);
  border-radius: 24px;
  background: var(--bg-el);
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  white-space: nowrap;
}
.dh-filter i { font-size: 15px; }
.dh-filter:hover { border-color: var(--emerald-400); color: var(--emerald-700); background: var(--emerald-50); }
.dh-filter.active { background: var(--emerald-600); color: white; border-color: var(--emerald-600); }
[data-theme="dark"] .dh-filter:hover { background: rgba(5,150,105,0.1); }
[data-theme="dark"] .dh-filter.active { background: var(--emerald-700); }

.dh-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Dhikr Card ── */
.dhn-card {
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: 24px;
  transition: box-shadow .3s;
}
.dhn-card:hover { box-shadow: var(--shadow-md); }

.dhn-arabic {
  font-family: var(--font-arabic);
  font-size: 24px;
  line-height: 2.2;
  text-align: right;
  direction: rtl;
  color: var(--text-1);
  padding: 16px 20px;
  background: var(--emerald-50);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  border-right: 4px solid var(--emerald-500);
}
[data-theme="dark"] .dhn-arabic { background: rgba(5,150,105,0.06); }
[dir="rtl"] .dhn-arabic { border-right: none; border-left: 4px solid var(--emerald-500); }

.dhn-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.dhn-count, .dhn-src {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}
.dhn-count i { color: var(--emerald-500); }
.dhn-src i   { color: var(--gold-500); }

/* ── Accordion sections ── */
.dhn-section {
  border-top: 1px solid var(--border-1);
}
.dhn-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 12px 4px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  text-align: start;
  transition: color .2s;
}
.dhn-toggle:hover { color: var(--emerald-700); }
.dhn-toggle.open  { color: var(--emerald-700); }
.dhn-toggle i:first-child { font-size: 16px; color: var(--emerald-600); }
.dhn-chev {
  margin-left: auto;
  font-size: 18px;
  transition: transform .25s var(--ease);
  color: var(--text-3);
}
[dir="rtl"] .dhn-chev { margin-left: 0; margin-right: auto; }

.dhn-body {
  padding: 4px 4px 16px;
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.85;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

.dhn-trans-text {
  font-style: italic;
  color: var(--emerald-700);
  font-size: 14px;
  line-height: 1.7;
}

.dhn-virtue {
  background: var(--gold-50);
  border-radius: var(--r-md);
  padding: 12px 16px !important;
  color: var(--text-1);
  border-left: 3px solid var(--gold-400);
}
[data-theme="dark"] .dhn-virtue { background: rgba(245,158,11,0.05); }
[dir="rtl"] .dhn-virtue { border-left: none; border-right: 3px solid var(--gold-400); }

.dhn-explanation {
  background: var(--bg-sunk);
  border-radius: var(--r-md);
  padding: 14px 16px !important;
  color: var(--text-2);
}

/* Responsive */
@media (max-width: 640px) {
  .dhn-arabic { font-size: 20px; padding: 12px 14px; }
  .dh-filter span { display: none; }
  .dhn-card { padding: 16px; }
  .qrn-taf-modal { width: 100% !important; max-height: 94vh !important; border-radius: var(--r-xl) var(--r-xl) 0 0 !important; }
}

/* ═══════════════════════════════════════════════════
   TAFSIR OVERLAY — class-based open/close (v4 fix)
   Uses .open class instead of display:flex
   so it's ALWAYS centered in the viewport regardless of scroll
   ═══════════════════════════════════════════════════ */

/* Base state: hidden */
.qrn-taf-overlay {
  display: none;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,0.6);
  z-index: 9999 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px;
}
/* Open state */
.qrn-taf-overlay.open {
  display: flex !important;
}
/* Prevent page scroll when modal is open */
body.qr-modal-open {
  overflow: hidden !important;
}

/* Modal sizing — override previous values */
.qrn-taf-modal {
  width: 96% !important;
  max-width: 860px !important;
  max-height: 88vh !important;
  border-radius: var(--r-xl) !important;
  display: flex !important;
  flex-direction: column !important;
  background: var(--bg-el) !important;
  box-shadow: 0 32px 80px rgba(0,0,0,0.4) !important;
  overflow: hidden !important;
  animation: tafIn .25s var(--ease) !important;
}
@keyframes tafIn {
  from { opacity:0; transform:scale(0.95) translateY(12px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}

/* Bigger tafsir text */
.qrn-taf-text {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 24px 28px !important;
  overscroll-behavior: contain;
}
.qrn-taf-body {
  font-size: 16px !important;
  line-height: 2 !important;
  color: var(--text-2) !important;
}
.qrn-taf-body[dir="rtl"] {
  font-family: var(--font-arabic) !important;
  font-size: 20px !important;
  line-height: 2.3 !important;
  text-align: right !important;
}
.qrn-taf-verse {
  font-size: 24px !important;
  line-height: 2.2 !important;
  padding: 20px 28px !important;
}

@media (max-width: 640px) {
  .qrn-taf-modal {
    width: 100% !important;
    max-height: 90vh !important;
    border-radius: var(--r-xl) var(--r-xl) 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }
  .qrn-taf-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
}

/* ═══════════════════════════════════════════════════
   TAFSIR PORTAL MODAL ANIMATIONS (v6)
   The modal is appended to document.body at runtime.
   These keyframes animate the portal fade in/out.
   ═══════════════════════════════════════════════════ */
@keyframes qrTafFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes qrTafFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
/* Modal panel slides up on open */
#noorTafsirPortal .qrn-taf-modal {
  animation: qrTafSlideIn .25s var(--ease);
}
@keyframes qrTafSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
/* Override any old overlay styles that might conflict */
#noorTafsirPortal {
  /* All styles are inline — this is just a safety fallback */
  transform: none !important;
}

/* ═══════════════════════════════════════════════════
   VIDEO LIBRARY PAGE — Noor Design System
   ═══════════════════════════════════════════════════ */

/* ── Portal animations ── */
@keyframes vidFadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes vidFadeOut { from { opacity:1; } to { opacity:0; } }

/* ── Last Watched Banner ── */
.vid-last-watched {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(135deg, var(--emerald-700), var(--emerald-900));
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
  cursor: pointer;
  transition: opacity .2s;
  color: white;
  flex-wrap: wrap;
}
.vid-last-watched:hover { opacity: .92; }
.vid-lw-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.vid-lw-left img {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.2);
}
.vid-lw-label {
  font-size: 11px;
  opacity: .75;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.vid-lw-label span { opacity: .65; }
.vid-lw-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}
.vid-lw-speaker { font-size: 12px; opacity: .7; margin-top: 2px; }
.vid-lw-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.12);
  color: white;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.vid-lw-btn:hover { background: rgba(255,255,255,.22); }

/* ── Search bar ── */
.vid-search-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.vid-search-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-el);
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 10px 14px;
  transition: border-color .25s, box-shadow .25s;
}
.vid-search-bar:focus-within {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.vid-search-bar > i { font-size: 18px; color: var(--text-3); flex-shrink: 0; }
.vid-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--text-1);
  outline: none;
}
.vid-search-bar input::placeholder { color: var(--text-3); }
.vid-search-clear {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-sunk);
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: all .2s;
}
.vid-search-clear:hover { background: var(--border-2); color: var(--text-1); }
.vid-total-count {
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  font-weight: 500;
}

/* ── Category filter ── */
.vid-cats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 4px;
}
.vid-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 24px;
  border: 1px solid var(--border-1);
  background: var(--bg-el);
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  transition: all .22s var(--ease);
  white-space: nowrap;
}
.vid-cat-btn i { font-size: 15px; }
.vid-cat-btn:hover {
  border-color: var(--emerald-400);
  color: var(--emerald-700);
  background: var(--emerald-50);
}
[data-theme="dark"] .vid-cat-btn:hover { background: rgba(5,150,105,.1); }
.vid-cat-btn.active {
  background: linear-gradient(135deg, var(--emerald-600), var(--emerald-700));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(5,150,105,.28);
}

/* ── Video grid ── */
.vid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ── Video card ── */
.vid-card {
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.vid-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}
.vid-card:hover .vid-play-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.vid-card:hover .vid-thumb { filter: brightness(.75); }

/* Thumbnail wrapper */
.vid-thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-sunk);
}
.vid-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter .3s;
  display: block;
}

/* Play button overlay */
.vid-play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.85);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(5,150,105,.9);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  opacity: 0;
  transition: opacity .25s, transform .25s var(--spring);
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
}

/* Duration badge */
.vid-duration {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,.75);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  letter-spacing: .02em;
}
[dir="rtl"] .vid-duration { right: auto; left: 8px; }

/* Card info section */
.vid-info {
  padding: 14px;
}
.vid-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--emerald-600);
  background: var(--emerald-50);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}
[data-theme="dark"] .vid-cat-badge { background: rgba(5,150,105,.1); }
.vid-cat-badge i { font-size: 12px; }
.vid-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-1);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vid-speaker {
  font-size: 12.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.vid-speaker i { font-size: 13px; color: var(--gold-500); }

/* ── Empty state ── */
.vid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
}
.vid-empty i { font-size: 48px; display: block; margin-bottom: 14px; opacity: .4; }
.vid-empty p { font-size: 15px; }

/* ── Video Modal (portal on body) ── */
#noorVideoPortal .vid-modal {
  background: var(--bg-el);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 860px;
  overflow: hidden;
  animation: vidSlideIn .25s var(--ease);
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes vidSlideIn {
  from { opacity:0; transform: scale(.94) translateY(14px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}

/* Modal header */
.vid-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-el);
  position: sticky;
  top: 0;
  z-index: 10;
}
.vid-modal-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.vid-modal-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--emerald-600);
  background: var(--emerald-50);
  padding: 4px 12px;
  border-radius: 20px;
}
[data-theme="dark"] .vid-modal-cat { background: rgba(5,150,105,.1); }
.vid-modal-speaker {
  font-size: 13px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.vid-modal-close {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-1);
  background: var(--bg-sunk);
  color: var(--text-2);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.vid-modal-close:hover { background: #FEF2F2; color: #DC2626; border-color: #DC2626; }

/* Responsive 16:9 iframe */
.vid-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}
.vid-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Video title below player */
.vid-modal-title {
  padding: 16px 20px 12px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-1);
  border-bottom: 1px solid var(--border-1);
}

/* Related videos */
.vid-related {
  padding: 16px 20px 20px;
}
.vid-related-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.vid-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.vid-related-card {
  position: relative;
  cursor: pointer;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border-1);
  transition: all .25s;
  background: var(--bg-sunk);
}
.vid-related-card:hover { transform: scale(1.03); box-shadow: var(--shadow-md); }
.vid-related-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transition: filter .25s;
}
.vid-related-card:hover img { filter: brightness(.75); }
.vid-related-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-60%);
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(5,150,105,.88);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0;
  transition: opacity .2s, transform .2s;
}
.vid-related-card:hover .vid-related-play {
  opacity: 1;
  transform: translate(-50%,-50%);
}
.vid-related-title {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  padding: 6px 8px 8px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .vid-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .vid-last-watched { padding: 12px 14px; }
  .vid-lw-title { max-width: 200px; }
  .vid-modal { border-radius: var(--r-xl) var(--r-xl) 0 0 !important; }
  #noorVideoPortal {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  #noorVideoPortal .vid-modal {
    max-height: 95vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .vid-related-grid { grid-template-columns: repeat(2, 1fr); }
  .vid-cat-btn span { display: none; }
  .vid-cat-btn { padding: 9px 12px; }
  .vid-cats { gap: 6px; }
}
@media (max-width: 480px) {
  .vid-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .vid-title { font-size: 12.5px; }
  .vid-cat-badge { font-size: 10px; }
  .vid-last-watched { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════
   PLAYLIST SYSTEM — Noor Design System
   ═══════════════════════════════════════════════════ */

/* ── Video section labels in grid ── */
.vid-section-label {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: 4px;
}
.vid-section-label i { font-size: 16px; color: var(--emerald-600); }
.vid-section-count {
  background: var(--bg-sunk);
  color: var(--text-3);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 4px;
}

/* ── Playlist card ── */
.pl-card {
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  position: relative;
}
.pl-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-xl); }
.pl-card:hover .pl-card-overlay { opacity: 1; }
.pl-card:hover .vid-thumb { filter: brightness(.7); }

/* Stacked thumbnail effect */
.pl-card-thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: visible;
}
.pl-card-stack-1,
.pl-card-stack-2 {
  position: absolute;
  left: 8px; right: -4px; bottom: -4px;
  height: 100%;
  border-radius: var(--r-md);
  background: var(--border-2);
  z-index: -1;
}
.pl-card-stack-2 {
  left: 16px; right: -8px; bottom: -8px;
  background: var(--border-1);
  z-index: -2;
}
.pl-card-thumb-wrap .vid-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
  transition: filter .3s;
  position: relative;
  z-index: 1;
}

/* Overlay */
.pl-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .3s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 14px;
  z-index: 2;
}
.pl-card-count {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(0,0,0,.75);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}
[dir="rtl"] .pl-card-count { right: auto; left: 10px; }
.pl-card-play-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--emerald-600);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  transition: transform .2s var(--spring);
}
.pl-card:hover .pl-card-play-btn { transform: scale(1.1); }

/* ═══════════════════════════════════════════════════
   PLAYLIST MODAL — Desktop: side-by-side
                    Mobile: stacked
   ═══════════════════════════════════════════════════ */

#noorPlaylistPortal .pl-modal {
  background: var(--bg-el);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: vidSlideIn .25s var(--ease);
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
}

/* Header */
.pl-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-el);
  flex-shrink: 0;
}
.pl-head-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.pl-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 560px;
}

/* Body: player + sidebar */
.pl-modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Player panel */
.pl-player-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border-1);
}
[dir="rtl"] .pl-player-panel { border-right: none; border-left: 1px solid var(--border-1); }

.pl-now-playing {
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-sunk);
}
.pl-now-label {
  font-size: 11px;
  color: var(--emerald-600);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.pl-now-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Prev/Next controls */
.pl-controls {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border-1);
  background: var(--bg-el);
}
.pl-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-1);
  background: var(--bg-sunk);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.pl-ctrl-btn:hover:not(:disabled) { border-color: var(--emerald-500); color: var(--emerald-700); }
.pl-ctrl-btn:disabled { opacity: .35; cursor: not-allowed; }
.pl-ctrl-btn.primary {
  background: linear-gradient(135deg, var(--emerald-600), var(--emerald-700));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(5,150,105,.25);
}
.pl-ctrl-btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(5,150,105,.35); }

/* ── SIDEBAR ── */
.pl-sidebar {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-sunk);
  overflow: hidden;
}
.pl-sidebar-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-el);
  flex-shrink: 0;
}
.pl-sidebar-header i { font-size: 16px; color: var(--emerald-600); }
.pl-sidebar-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}
[dir="rtl"] .pl-sidebar-count { margin-left: 0; margin-right: auto; }

.pl-sidebar-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
.pl-sidebar-list::-webkit-scrollbar { width: 4px; }
.pl-sidebar-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* Sidebar items */
.pl-sidebar-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-1);
  transition: background .18s;
  align-items: flex-start;
}
.pl-sidebar-item:hover { background: var(--bg-el); }
.pl-sidebar-item.active {
  background: var(--emerald-50);
  border-left: 3px solid var(--emerald-500);
}
[data-theme="dark"] .pl-sidebar-item.active { background: rgba(5,150,105,.08); }
[dir="rtl"] .pl-sidebar-item.active { border-left: none; border-right: 3px solid var(--emerald-500); }

.pl-sidebar-thumb-wrap {
  position: relative;
  width: 80px;
  min-width: 80px;
  aspect-ratio: 16/9;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-sunk);
}
.pl-sidebar-thumb-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.pl-sidebar-play {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: 0;
  transition: opacity .2s;
}
.pl-sidebar-item:hover .pl-sidebar-play { opacity: 1; }
.pl-sidebar-item.active .pl-sidebar-play { opacity: 0; }

/* Playing animation (bars) */
.pl-sidebar-playing-anim {
  position: absolute;
  inset: 0;
  background: rgba(5,150,105,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.pl-sidebar-playing-anim span {
  width: 3px;
  background: white;
  border-radius: 2px;
  animation: plBarAnim .9s ease-in-out infinite;
}
.pl-sidebar-playing-anim span:nth-child(1) { height: 10px; animation-delay: 0s;   }
.pl-sidebar-playing-anim span:nth-child(2) { height: 16px; animation-delay: .15s; }
.pl-sidebar-playing-anim span:nth-child(3) { height: 8px;  animation-delay: .3s;  }
@keyframes plBarAnim {
  0%,100% { transform: scaleY(.5); }
  50%      { transform: scaleY(1); }
}

.pl-sidebar-info { flex: 1; min-width: 0; }
.pl-sidebar-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 3px;
}
.pl-sidebar-item.active .pl-sidebar-num { color: var(--emerald-600); }
.pl-sidebar-vtitle {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.pl-sidebar-item.active .pl-sidebar-vtitle { color: var(--emerald-700); }
[data-theme="dark"] .pl-sidebar-item.active .pl-sidebar-vtitle { color: var(--emerald-400); }
.pl-sidebar-dur {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 3px;
}
.pl-sidebar-dur i { font-size: 12px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  /* Playlist modal: stacked layout */
  #noorPlaylistPortal {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  #noorPlaylistPortal .pl-modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .pl-modal-body { flex-direction: column; }
  .pl-player-panel { border-right: none; border-bottom: 1px solid var(--border-1); }
  [dir="rtl"] .pl-player-panel { border-left: none; border-bottom: 1px solid var(--border-1); }
  .pl-sidebar { width: 100%; max-height: 250px; }
  .pl-sidebar-list { max-height: 200px; display: flex; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .pl-sidebar-list::-webkit-scrollbar { height: 4px; }
  .pl-sidebar-item { flex-direction: column; width: 120px; min-width: 120px; border-bottom: none; border-right: 1px solid var(--border-1); padding: 10px; }
  [dir="rtl"] .pl-sidebar-item { border-right: none; border-left: 1px solid var(--border-1); }
  .pl-sidebar-item.active { border-left: none; border-bottom: 3px solid var(--emerald-500); }
  [dir="rtl"] .pl-sidebar-item.active { border-right: none; border-bottom: 3px solid var(--emerald-500); }
  .pl-sidebar-thumb-wrap { width: 100%; min-width: unset; }
  .pl-modal-title { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pl-controls { padding: 8px 12px; gap: 8px; }
  .pl-ctrl-btn { padding: 8px 14px; font-size: 12px; }
}

@media (max-width: 480px) {
  .vid-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pl-sidebar { max-height: 220px; }
  .pl-sidebar-item { width: 100px; min-width: 100px; }
}

/* ═══════════════════════════════════════════════════
   LESSONS SYSTEM — Noor Design System
   Completely separate from video/playlist CSS.
   All selectors prefixed with .ls- to avoid conflicts.
   ═══════════════════════════════════════════════════ */

/* ── Category filter ── */
.ls-cats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.ls-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 24px;
  border: 1px solid var(--border-1);
  background: var(--bg-el);
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  transition: all .22s var(--ease);
  white-space: nowrap;
}
.ls-cat-btn i { font-size: 15px; }
.ls-cat-btn:hover { border-color: var(--gold-400); color: var(--gold-600); background: var(--gold-50); }
[data-theme="dark"] .ls-cat-btn:hover { background: rgba(245,158,11,.08); }
.ls-cat-btn.active {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(245,158,11,.3);
}

/* ── Grid header ── */
.ls-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ls-total-count {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}

/* ── Lessons grid ── */
.ls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ─────────────────────────────────────────
   COMPONENT: LessonCard
   Feels like a course card — distinct from
   the thumbnail-heavy video card design.
───────────────────────────────────────── */
.ls-card {
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.ls-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--gold-300);
}

/* Thumbnail area */
.ls-card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-sunk);
  flex-shrink: 0;
}
.ls-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s var(--ease);
}
.ls-card:hover .ls-card-thumb img { transform: scale(1.04); }
.ls-card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--emerald-800), var(--emerald-900));
  color: rgba(255,255,255,.3);
  font-size: 48px;
}
.ls-card-count-badge {
  position: absolute;
  bottom: 10px; right: 10px;
  background: rgba(0,0,0,.75);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
}
[dir="rtl"] .ls-card-count-badge { right: auto; left: 10px; }

/* Card body — course-style layout */
.ls-card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }

.ls-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ls-card-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold-600);
  background: var(--gold-50);
  padding: 3px 10px;
  border-radius: 20px;
}
[data-theme="dark"] .ls-card-cat { background: rgba(245,158,11,.1); }
.ls-level {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--lc, var(--emerald-600));
  background: color-mix(in srgb, var(--lc, var(--emerald-600)) 12%, transparent);
  padding: 2px 8px;
  border-radius: 20px;
}
.ls-card-lang { font-size: 14px; }

.ls-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.4;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ls-card-speaker {
  font-size: 13px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
}
.ls-card-speaker i { color: var(--gold-500); }
.ls-card-desc {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.55;
  margin: 0 0 12px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card footer */
.ls-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-1);
  margin-top: auto;
}
.ls-card-episodes {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}
.ls-card-episodes i { color: var(--emerald-600); }
.ls-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-600);
  transition: gap .2s;
}
.ls-card:hover .ls-start-btn { gap: 8px; }
.ls-start-btn i { font-size: 14px; }

/* Empty state */
.ls-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
}
.ls-empty i { font-size: 48px; display: block; margin-bottom: 14px; opacity: .4; }

/* ─────────────────────────────────────────
   COMPONENT: LessonViewer
   Full-page viewer — replaces the grid.
   Desktop: player left, sidebar right.
   Mobile: player top, sidebar bottom.
───────────────────────────────────────── */
.ls-viewer { display: flex; flex-direction: column; }

/* Viewer header / breadcrumb */
.ls-viewer-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.ls-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-1);
  background: var(--bg-el);
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  transition: all .2s;
  flex-shrink: 0;
}
.ls-back-btn:hover { border-color: var(--primary); color: var(--primary); }
.ls-viewer-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.ls-viewer-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold-600);
  background: var(--gold-50);
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .ls-viewer-cat { background: rgba(245,158,11,.1); }
.ls-viewer-series-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ls-viewer-speaker {
  font-size: 13px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: auto;
}
[dir="rtl"] .ls-viewer-speaker { margin-left: 0; margin-right: auto; }
.ls-viewer-speaker i { color: var(--gold-500); }

/* Viewer body: two-column layout */
.ls-viewer-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* ── PLAYER PANEL ── */
.ls-player-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  overflow: hidden;
}

/* 16:9 responsive iframe wrapper */
.ls-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}
.ls-player-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Now playing */
.ls-now-playing {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-sunk);
}
.ls-now-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold-600);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ls-now-label i { font-size: 14px; }
.ls-now-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.4;
  margin-bottom: 4px;
}
.ls-now-dur {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Controls bar */
.ls-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
}
.ls-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-1);
  background: var(--bg-sunk);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.ls-ctrl-btn:hover:not(:disabled) { border-color: var(--gold-400); color: var(--gold-600); }
.ls-ctrl-btn:disabled { opacity: .3; cursor: not-allowed; }
.ls-ctrl-btn.primary {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(245,158,11,.28);
}
.ls-ctrl-btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(245,158,11,.4); }

/* Progress dots */
.ls-progress-dots {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 5px;
  overflow: hidden;
  padding: 0 4px;
}
.ls-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-2);
  flex-shrink: 0;
  transition: background .2s, transform .2s;
}
.ls-dot.done   { background: var(--gold-300); }
.ls-dot.active { background: var(--gold-500); transform: scale(1.4); }

/* ─────────────────────────────────────────
   COMPONENT: LessonSidebar
───────────────────────────────────────── */
.ls-sidebar {
  width: 320px;
  flex-shrink: 0;
  background: var(--bg-el);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  max-height: 600px;
  overflow: hidden;
  position: sticky;
  top: 80px;
}
.ls-sidebar-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}
.ls-sidebar-header i { font-size: 16px; color: var(--gold-500); }
.ls-sidebar-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}
[dir="rtl"] .ls-sidebar-count { margin-left: 0; margin-right: auto; }

.ls-sidebar-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
.ls-sidebar-list::-webkit-scrollbar { width: 4px; }
.ls-sidebar-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* Episode items */
.ls-ep-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-1);
  transition: background .18s;
  align-items: flex-start;
}
.ls-ep-item:hover { background: var(--bg-sunk); }
.ls-ep-item.active {
  background: var(--gold-50);
  border-left: 3px solid var(--gold-500);
}
[data-theme="dark"] .ls-ep-item.active { background: rgba(245,158,11,.07); }
[dir="rtl"] .ls-ep-item.active { border-left: none; border-right: 3px solid var(--gold-500); }

.ls-ep-thumb-wrap {
  position: relative;
  width: 80px;
  min-width: 80px;
  aspect-ratio: 16/9;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-sunk);
}
.ls-ep-thumb-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Play icon overlay */
.ls-ep-play-icon {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.42);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  opacity: 0;
  transition: opacity .2s;
}
.ls-ep-item:hover .ls-ep-play-icon { opacity: 1; }
.ls-ep-item.active .ls-ep-play-icon { opacity: 0; }

/* Playing bars animation */
.ls-ep-playing {
  position: absolute;
  inset: 0;
  background: rgba(245,158,11,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.ls-ep-playing span {
  width: 3px;
  background: white;
  border-radius: 2px;
  animation: lsBarAnim .9s ease-in-out infinite;
}
.ls-ep-playing span:nth-child(1) { height: 10px; animation-delay: 0s;   }
.ls-ep-playing span:nth-child(2) { height: 16px; animation-delay: .15s; }
.ls-ep-playing span:nth-child(3) { height: 8px;  animation-delay: .3s;  }
@keyframes lsBarAnim {
  0%,100% { transform: scaleY(.5); }
  50%      { transform: scaleY(1); }
}

.ls-ep-info { flex: 1; min-width: 0; }
.ls-ep-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 3px;
}
.ls-ep-item.active .ls-ep-num { color: var(--gold-600); }
.ls-ep-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.ls-ep-item.active .ls-ep-title { color: var(--gold-700); }
[data-theme="dark"] .ls-ep-item.active .ls-ep-title { color: var(--gold-400); }
.ls-ep-dur {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .ls-viewer-body { flex-direction: column; }
  .ls-sidebar {
    width: 100%;
    max-height: 300px;
    position: static;
  }
  .ls-sidebar-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: unset;
    padding-bottom: 4px;
  }
  .ls-sidebar-list::-webkit-scrollbar { height: 4px; }
  .ls-ep-item {
    flex-direction: column;
    width: 130px;
    min-width: 130px;
    border-bottom: none;
    border-right: 1px solid var(--border-1);
    padding: 10px;
    flex-shrink: 0;
  }
  [dir="rtl"] .ls-ep-item { border-right: none; border-left: 1px solid var(--border-1); }
  .ls-ep-item.active { border-left: none; border-top: 3px solid var(--gold-500); background: var(--gold-50); }
  [dir="rtl"] .ls-ep-item.active { border-right: none; border-top: 3px solid var(--gold-500); }
  .ls-ep-thumb-wrap { width: 100%; min-width: unset; }
  .ls-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .ls-grid { grid-template-columns: 1fr; gap: 12px; }
  .ls-viewer-head { gap: 10px; padding: 10px 0 14px; }
  .ls-viewer-breadcrumb { display: none; }
  .ls-controls { padding: 10px 14px; gap: 8px; }
  .ls-ctrl-btn { padding: 8px 14px; font-size: 12px; }
  .ls-progress-dots { gap: 4px; }
  .ls-dot { width: 6px; height: 6px; }
  .ls-cat-btn span { display: none; }
  .ls-cat-btn { padding: 9px 12px; }
}
