/* IslamDashboard.com - Quran Connected Skeleton */

:root {
  --bg: #f5efe2;
  --bg2: #efe3cf;
  --card: #fffaf0;
  --card2: #ffffff;
  --ink: #191712;
  --muted: #70675b;
  --green: #1f6048;
  --green-dark: #143d2f;
  --gold: #b8872f;
  --gold-soft: rgba(184, 135, 47, 0.15);
  --border: rgba(109, 80, 31, 0.18);
  --shadow: 0 18px 45px rgba(43, 31, 16, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(184, 135, 47, 0.2), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(31, 96, 72, 0.18), transparent 34%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  min-height: 100vh;
}

html[dir="rtl"] body {
  font-family: Tahoma, Arial, sans-serif;
}

button, select, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1220px, 94%);
  margin: 0 auto;
  padding: 18px 0 60px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: white;
  font-size: 1.45rem;
  box-shadow: 0 10px 24px rgba(31, 96, 72, 0.22);
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; }
.brand small { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-action, .lang-toggle, .primary-btn, .soft-btn, .mini-btn, .drawer-close, .card-open-btn {
  border: 0;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.header-action:hover, .lang-toggle:hover, .primary-btn:hover, .soft-btn:hover, .mini-btn:hover, .drawer-close:hover, .card-open-btn:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.header-action, .lang-toggle {
  border-radius: 999px;
  padding: 10px 13px;
  color: var(--green);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  font-weight: 700;
}

.lang-toggle { color: white; background: var(--green); }

.hero-panel {
  margin-top: 8px;
  padding: 22px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(20, 61, 47, 0.98), rgba(31, 96, 72, 0.96));
  color: white;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "۞";
  position: absolute;
  right: 18px;
  top: -24px;
  font-size: 9rem;
  opacity: 0.07;
  line-height: 1;
}

html[dir="rtl"] .hero-panel::after { right: auto; left: 18px; }

.hero-copy { position: relative; z-index: 2; }

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.72);
  font-weight: 700;
}

html[dir="rtl"] .eyebrow { letter-spacing: 0; }
.eyebrow.dark { color: var(--gold); }

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 4.5rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  max-width: 800px;
}

html[dir="rtl"] .hero-copy h1 {
  letter-spacing: 0;
  line-height: 1.25;
}

.hero-copy p:last-child {
  max-width: 780px;
  color: rgba(255,255,255,0.84);
  line-height: 1.8;
  font-size: 1.02rem;
}

.selector-card {
  position: relative;
  z-index: 2;
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
}

.selector-card label { display: grid; gap: 7px; }
.selector-card label span { color: rgba(255,255,255,0.8); font-size: 0.9rem; font-weight: 700; }

.selector-card select {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 14px;
  border-radius: var(--radius-md);
  background: white;
  color: var(--ink);
}

.primary-btn {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  color: white;
  background: var(--gold);
  font-weight: 800;
}

.ayah-card {
  margin-top: 18px;
  padding: 20px;
  border-radius: var(--radius-xl);
  background: rgba(255,250,240,0.97);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.ayah-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ayah-meta, .tag-row, .quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.pill, .tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid rgba(184, 135, 47, 0.18);
  background: var(--gold-soft);
  color: #6f4b13;
  font-size: 0.88rem;
  font-weight: 700;
}

.ayah-ar {
  margin: 18px 0 14px;
  text-align: right;
  font-size: clamp(1.85rem, 8vw, 4.2rem);
  line-height: 1.95;
  color: #133728;
}

.ayah-en {
  max-width: 920px;
  color: var(--muted);
  line-height: 1.85;
  font-size: 1.08rem;
}

html[dir="rtl"] .ayah-en { text-align: right; }

.tag-row { margin-top: 18px; }

.tag {
  background: rgba(31, 96, 72, 0.09);
  color: var(--green);
  border-color: rgba(31, 96, 72, 0.15);
}

.quick-actions { margin-top: 18px; }

.soft-btn, .mini-btn {
  border-radius: 999px;
  padding: 10px 13px;
  background: white;
  color: var(--green);
  border: 1px solid var(--border);
  font-weight: 800;
}

.dashboard-heading { margin: 30px 0 14px; }

.dashboard-heading h2 {
  margin: 0;
  font-size: 1.65rem;
  color: #1e332a;
}

.dashboard-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.knowledge-card {
  min-height: 168px;
  padding: 17px;
  border-radius: var(--radius-lg);
  background: var(--card2);
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(43, 31, 16, 0.08);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.knowledge-card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  right: -54px;
  bottom: -62px;
  background: rgba(184, 135, 47, 0.08);
}

html[dir="rtl"] .knowledge-card::after { right: auto; left: -54px; }

.knowledge-card-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.card-icon {
  width: 50px;
  height: 50px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: rgba(31, 96, 72, 0.1);
  color: var(--green);
  font-size: 1.5rem;
}

.knowledge-card h3 {
  margin: 0;
  color: #17382a;
  font-size: 1.12rem;
}

.card-count {
  display: inline-flex;
  width: max-content;
  margin-top: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--gold-soft);
  color: #765119;
  font-size: 0.8rem;
  font-weight: 800;
}

.card-preview {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  flex: 1;
}

.card-open-btn {
  position: relative;
  z-index: 2;
  width: max-content;
  border-radius: 999px;
  padding: 10px 14px;
  color: white;
  background: var(--green);
  font-weight: 800;
}

.status-panel {
  margin-top: 22px;
  padding: 15px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.6);
  border: 1px dashed var(--border);
  color: var(--muted);
  line-height: 1.6;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(16, 17, 15, 0.48);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.knowledge-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 88vh;
  z-index: 60;
  border-radius: 26px 26px 0 0;
  background: #fffaf0;
  border: 1px solid rgba(120, 92, 38, 0.2);
  box-shadow: 0 -22px 70px rgba(0,0,0,0.25);
  transform: translateY(105%);
  transition: transform 0.26s ease;
  display: flex;
  flex-direction: column;
}

.knowledge-drawer.open { transform: translateY(0); }

.drawer-grip {
  width: 54px;
  height: 5px;
  border-radius: 999px;
  background: rgba(120, 92, 38, 0.28);
  margin: 10px auto 0;
}

.drawer-header {
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(120, 92, 38, 0.16);
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: white;
}

.drawer-eyebrow {
  margin: 0;
  opacity: 0.74;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 800;
}

html[dir="rtl"] .drawer-eyebrow { letter-spacing: 0; }

.drawer-header h2 {
  margin: 5px 0 0;
  font-size: 1.45rem;
  line-height: 1.2;
}

.drawer-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  color: white;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  flex: 0 0 auto;
}

.drawer-ayah {
  max-height: 135px;
  overflow-y: auto;
  padding: 14px 18px;
  background: #f6ecd7;
  border-bottom: 1px solid rgba(120, 92, 38, 0.16);
  color: #17382a;
  font-size: 1.15rem;
  line-height: 1.9;
  text-align: right;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.drawer-tabs {
  position: sticky;
  top: -18px;
  z-index: 5;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 10px;
  background: #fffaf0;
}

.drawer-tab {
  border: 1px solid rgba(120, 92, 38, 0.22);
  background: white;
  color: var(--green);
  padding: 10px 13px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

.drawer-tab.active { background: var(--green); color: white; }

.drawer-box {
  margin-bottom: 13px;
  padding: 16px;
  border-radius: 18px;
  background: white;
  border: 1px solid rgba(120, 92, 38, 0.15);
  box-shadow: 0 8px 20px rgba(43, 31, 16, 0.05);
}

.drawer-box h3 {
  margin: 0 0 9px;
  color: var(--green);
  font-size: 1.08rem;
}

.drawer-box p {
  margin: 0;
  color: #443c32;
  line-height: 1.85;
}

.rtl { direction: rtl; text-align: right; font-size: 1.06rem; }

.drawer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.video-placeholder, .audio-row {
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
}

.video-placeholder {
  min-height: 150px;
  display: grid;
  align-content: center;
  gap: 8px;
  color: white;
  background: linear-gradient(135deg, #1e1a16, #3c2f20);
}

.audio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #faf7ef;
  border: 1px solid rgba(120, 92, 38, 0.13);
}

.audio-row strong { color: var(--green); }

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 17, 15, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.search-overlay.open { opacity: 1; pointer-events: auto; }

.search-box {
  width: min(650px, 100%);
  padding: 22px;
  border-radius: var(--radius-xl);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--border);
  outline: 0;
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 1rem;
}

.search-box p {
  color: var(--muted);
  line-height: 1.6;
}

.search-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--green);
}

html[dir="rtl"] .search-close { right: auto; left: 14px; }

@media (min-width: 760px) {
  .app-shell { padding-top: 24px; }
  .hero-panel { padding: 30px; }

  .selector-card {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
  }

  .card-grid { grid-template-columns: repeat(2, 1fr); }

  .dashboard-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
  }

  .dashboard-heading p { max-width: 520px; }

  .knowledge-drawer {
    top: 0;
    left: auto;
    right: 0;
    bottom: auto;
    width: min(760px, 92vw);
    height: 100vh;
    border-radius: 0;
    transform: translateX(105%);
  }

  html[dir="rtl"] .knowledge-drawer {
    right: auto;
    left: 0;
    transform: translateX(-105%);
  }

  .knowledge-drawer.open,
  html[dir="rtl"] .knowledge-drawer.open {
    transform: translateX(0);
  }

  .drawer-grip { display: none; }
  .drawer-header { padding: 22px; }
  .drawer-content { padding: 22px; }
  .drawer-tabs { top: -22px; }
  .drawer-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1040px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .ayah-card { padding: 28px; }
}

@media (max-width: 480px) {
  .brand small { display: none; }

  .header-action, .lang-toggle {
    padding: 9px 10px;
    font-size: 0.9rem;
  }
}

/* Tafsir Library Drawer */
.tafsir-drawer-shell {
  display: grid;
  gap: 12px;
}

.tafsir-help-box {
  background: #fbf5e8;
}

.tafsir-group-row,
.tafsir-source-row {
  position: static;
  top: auto;
  padding-bottom: 0;
  margin-bottom: 4px;
}

.tafsir-source-row {
  border-bottom: 1px solid rgba(120, 92, 38, 0.13);
  padding-bottom: 12px;
}

.tafsir-group-tab,
.tafsir-source-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tafsir-source-tab {
  font-size: 0.93rem;
}

.tafsir-source-content {
  min-height: 180px;
}

.tafsir-result-box {
  font-size: calc(1.06rem * var(--reader-scale, 1));
}

.tafsir-result-text {
  line-height: 2;
  color: #332d25;
}

.tafsir-result-text p,
.tafsir-result-text .sharawi-paragraph,
.tafsir-result-text .tafsir-text,
.tafsir-result-text .quran-tafsir {
  line-height: 2;
}

.inline-ayah,
.ayah-text {
  color: #12553d;
  font-weight: 800;
  background: rgba(31, 96, 72, 0.08);
  border-radius: 9px;
  padding: 1px 5px;
}

.hadith {
  color: #7a4f11;
  font-weight: 800;
}

.term,
.ayah-ref {
  color: #7a4f11;
  font-weight: 700;
}

.tafsir-empty,
.tafsir-loading-box,
.tafsir-error-box {
  color: var(--muted);
}

.tafsir-error-box {
  border-color: rgba(150, 50, 30, 0.25);
  background: #fff5f1;
}

.sharawi-tafsir {
  display: grid;
  gap: 12px;
}

.sharawi-paragraph {
  margin: 0;
  padding: 14px;
  border-radius: 15px;
  background: #fbf7ee;
  border: 1px solid rgba(120, 92, 38, 0.12);
}

/* Translation Drawer Hookup */
.translation-drawer-shell {
  display: grid;
  gap: 14px;
}

.translation-help-box p {
  line-height: 1.85;
}

.translation-selector-box {
  padding: 16px;
  border-radius: 18px;
  background: white;
  border: 1px solid rgba(120, 92, 38, 0.15);
  box-shadow: 0 8px 20px rgba(43, 31, 16, 0.05);
}

.translation-selector-box label {
  display: grid;
  gap: 8px;
}

.translation-selector-box label span {
  color: var(--green);
  font-weight: 900;
}

.translation-selector-box select {
  width: 100%;
  border: 1px solid rgba(120, 92, 38, 0.22);
  outline: 0;
  padding: 13px 14px;
  border-radius: 15px;
  background: #fffaf0;
  color: var(--ink);
}

.translation-result-box {
  min-height: 150px;
}

.translation-card {
  position: relative;
  overflow: hidden;
}

.translation-card::after {
  content: "🌍";
  position: absolute;
  right: 18px;
  bottom: -18px;
  font-size: 4.5rem;
  opacity: 0.06;
  line-height: 1;
}

html[dir="rtl"] .translation-card::after {
  right: auto;
  left: 18px;
}

.translation-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.translation-language-pill,
.translation-file-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.84rem;
  font-weight: 900;
}

.translation-language-pill {
  background: rgba(31, 96, 72, 0.1);
  border: 1px solid rgba(31, 96, 72, 0.18);
  color: var(--green);
}

.translation-file-pill {
  background: var(--gold-soft);
  border: 1px solid rgba(184, 135, 47, 0.2);
  color: #765119;
}

.translation-text {
  color: #30291f;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.95;
  position: relative;
  z-index: 2;
}

.translation-save-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.translation-card.rtl {
  direction: rtl;
  text-align: right;
  font-family: Tahoma, Arial, sans-serif;
}

.translation-loading-box p {
  color: var(--muted);
}

/* ------------------------------
   Video Tafsir Drawer
-------------------------------- */
.video-tab-shell {
  display: grid;
  gap: 16px;
}

.video-tab-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-radius: 22px;
  color: white;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  box-shadow: 0 12px 26px rgba(31, 96, 72, 0.18);
}

.video-tab-intro h2 {
  margin: 0 0 7px;
  font-size: 1.28rem;
}

.video-tab-intro p {
  margin: 0;
  color: rgba(255,255,255,0.82);
  line-height: 1.7;
}

.video-tab-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.22);
  font-size: 1.8rem;
  flex: 0 0 auto;
}

.video-media-section {
  display: grid;
  gap: 12px;
}

.video-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(184, 135, 47, 0.12);
  border: 1px solid rgba(184, 135, 47, 0.18);
}

.video-section-heading h3 {
  margin: 0;
  color: var(--green);
}

.video-section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.video-section-count {
  min-width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--green);
  font-weight: 900;
}

.video-card-list {
  display: grid;
  gap: 12px;
}

.lecture-media-card {
  padding: 15px;
  border-radius: 20px;
  background: white;
  border: 1px solid rgba(120, 92, 38, 0.15);
  box-shadow: 0 8px 20px rgba(43, 31, 16, 0.06);
  border-inline-start: 6px solid var(--media-accent, var(--green));
}

.lecture-media-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 11px;
}

.lecture-media-top img {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  object-fit: cover;
  background: #f2eadc;
  border: 1px solid rgba(120, 92, 38, 0.16);
}

.lecture-media-top h4 {
  margin: 0;
  color: #17382a;
  font-size: 1.04rem;
}

.lecture-media-top p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.lecture-media-filename {
  width: max-content;
  max-width: 100%;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #765119;
  background: var(--gold-soft);
  font-size: 0.82rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.lecture-media-player {
  width: 100%;
  display: block;
  border-radius: 14px;
  margin-top: 8px;
}

video.lecture-media-player {
  max-height: 260px;
  background: #111;
}

.lecture-media-link {
  display: inline-flex;
  margin-top: 11px;
  color: var(--green);
  font-weight: 900;
  text-decoration: none;
}

.media-empty-state {
  padding: 26px 18px;
  border-radius: 22px;
  text-align: center;
  background: white;
  border: 1px dashed rgba(120, 92, 38, 0.24);
}

.media-empty-state div {
  font-size: 2rem;
}

.media-empty-state h3 {
  margin: 10px 0 7px;
  color: var(--green);
}

.media-empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
