/* ============================================================
   tafsir.css — صفحة تفسير القرآن
   ============================================================ */

.tafsir-app { padding-bottom: 140px; }

.tafsir-hero {
  background: linear-gradient(150deg, var(--green) 0%, #143C2E 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 26px 22px;
  margin: 4px 0 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.tafsir-hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}
.tafsir-badge {
  display: inline-block;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  margin-bottom: 12px;
  position: relative;
}
.tafsir-hero h2 {
  font-family: 'Amiri', serif;
  font-size: 26px;
  margin: 0 0 8px;
  position: relative;
}
.tafsir-hero p {
  color: rgba(255,255,255,.92);
  font-size: 14px;
  margin: 0;
  position: relative;
  line-height: 1.8;
}

.tafsir-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.tafsir-selector label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--green);
  flex: 0 0 auto;
}
.tafsir-selector select {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  text-align: right;
  padding: 4px 8px;
  border-radius: 8px;
}
.tafsir-selector select:focus { background: var(--green-light); }

.tafsir-surah-info {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 14px;
  text-align: center;
  border-top: 3px solid var(--gold);
  box-shadow: var(--shadow-sm);
}
.tafsir-surah-info h3 {
  font-family: 'Amiri', serif;
  font-size: 22px;
  color: var(--green);
  margin: 0 0 8px;
}
.tafsir-surah-info .info-meta {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-soft);
}

.tafsir-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gold-light);
  color: #5a4508;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 14px;
}
.tafsir-progress.done {
  background: var(--green-light);
  color: var(--green);
}

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

.tafsir-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  border-right: 4px solid var(--gold);
  padding: 16px 18px;
  transition: box-shadow .2s, transform .15s;
}
.tafsir-card:hover {
  transform: translateX(-2px);
  box-shadow: var(--shadow-md);
}

.tafsir-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}
.tafsir-ayah-num {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-light);
  color: var(--green);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
}
.tafsir-ayah-num .num {
  font-family: 'Amiri', serif;
  font-size: 16px;
  font-weight: 700;
}

.tafsir-card-actions { display: flex; gap: 6px; }
.tafsir-card-actions button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
  display: grid;
  place-items: center;
  transition: .18s;
  font-family: inherit;
}
.tafsir-card-actions button:hover {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
  transform: translateY(-2px);
}
.tafsir-card-actions .copy-btn:hover {
  background: var(--gold-light);
  border-color: var(--gold);
  color: #5a4508;
}

.tafsir-ayah {
  font-family: 'Amiri Quran', 'Amiri', serif;
  font-size: 20px;
  line-height: 2;
  color: var(--green);
  background: var(--cream-2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  text-align: right;
  position: relative;
}
.tafsir-ayah::before {
  content: '۝';
  color: var(--gold);
  opacity: .4;
  margin-left: 6px;
  font-size: 14px;
}

.tafsir-text {
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  line-height: 2;
  color: var(--ink);
  text-align: right;
}
.tafsir-text p { margin: 0 0 10px; }
.tafsir-text p:last-child { margin-bottom: 0; }

.tafsir-loading-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 0;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.tafsir-loading-inline .spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.tafsir-error {
  color: #c0392b;
  font-size: 13.5px;
  text-align: center;
  padding: 12px;
}

.surah-nav {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.sn-btn {
  flex: 1;
  padding: 12px 14px;
  background: var(--white);
  color: var(--green);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: .2s;
}
.sn-btn:hover:not(:disabled) {
  background: var(--green-light);
  border-color: var(--green);
}
.sn-btn:disabled { opacity: .4; cursor: not-allowed; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: tafsirSpin .8s linear infinite;
}
@keyframes tafsirSpin { to { transform: rotate(360deg); } }

body.dark .tafsir-selector {
  background: #1A241F;
  border-color: var(--line);
}
body.dark .tafsir-selector label { color: var(--gold); }
body.dark .tafsir-selector select { color: var(--ink); }
body.dark .tafsir-selector select:focus { background: rgba(201,162,39,.1); }
body.dark .tafsir-surah-info {
  background: #1A241F;
  border-top-color: var(--gold);
}
body.dark .tafsir-surah-info h3 { color: var(--gold); }
body.dark .tafsir-surah-info .info-meta { color: var(--ink-soft); }
body.dark .tafsir-progress {
  background: rgba(201,162,39,.15);
  color: var(--gold);
}
body.dark .tafsir-progress.done {
  background: rgba(31,78,61,.4);
  color: #b8d8c4;
}
body.dark .tafsir-card {
  background: #1A241F;
  border-right-color: var(--gold);
}
body.dark .tafsir-ayah {
  background: rgba(255,255,255,.04);
  color: var(--gold);
}
body.dark .tafsir-ayah-num {
  background: rgba(201,162,39,.15);
  color: var(--gold);
}
body.dark .tafsir-text { color: var(--ink); }
body.dark .tafsir-card-actions button {
  background: rgba(255,255,255,.05);
  border-color: var(--line);
  color: var(--ink-soft);
}
body.dark .tafsir-card-actions button:hover {
  background: rgba(201,162,39,.15);
  border-color: var(--gold);
  color: var(--gold);
}

@media (max-width: 359px) {
  .tafsir-hero { padding: 20px 16px; }
  .tafsir-hero h2 { font-size: 21px; }
  .tafsir-hero p { font-size: 13px; }
  .tafsir-card { padding: 12px 14px; }
  .tafsir-ayah { font-size: 18px; padding: 10px 12px; }
  .tafsir-text { font-size: 14px; }
  .tafsir-card-actions button { width: 28px; height: 28px; font-size: 12px; }
}

@media (min-width: 768px) {
  .tafsir-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }
}