/* ───────────── Digital Mufti Knowledge Center ───────────── */
:root {
  --primary: #16A34A;
  --primary-light: #22C55E;
  --primary-dark: #15803D;
  --gold: #FBBF24;
  --gold-dark: #D97706;
  --bg: #F0FDF4;
  --bg-card: #FFFFFF;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --glass-bg: rgba(255,255,255,0.75);
  --glass-border: rgba(255,255,255,0.3);
}

.knowledge-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* ─── Header ─── */
.knowledge-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}
.knowledge-header-content {
  display: flex;
  align-items: center;
  gap: 14px;
}
.knowledge-icon {
  font-size: 2.2rem;
  line-height: 1;
}
.knowledge-header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
}
.knowledge-subtitle {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ─── Search Bar ─── */
.knowledge-search-bar {
  display: flex;
  gap: 8px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  padding: 4px;
  box-shadow: var(--shadow);
}
.knowledge-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 18px;
  font-size: 0.95rem;
  outline: none;
  color: var(--text);
}
.knowledge-search-bar input::placeholder { color: var(--text-muted); }
.btn-search {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 100px;
  width: 44px;
  cursor: pointer;
  font-size: 1.1rem;
}

/* ─── Continue Card ─── */
.quran-continue-row, .hadith-continue-row {
  margin-bottom: 20px;
}
.continue-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  transition: transform 0.2s;
  border-radius: var(--radius);
}
.continue-card:hover { transform: translateY(-2px); }
.continue-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.continue-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.continue-ref {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ─── Glass Card ─── */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ─── Surah Grid ─── */
.surah-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.surah-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.25s ease;
  box-shadow: var(--shadow);
}
.surah-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(22, 163, 74, 0.15);
  border-color: var(--primary-light);
}
.surah-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.surah-info { flex: 1; min-width: 0; }
.surah-name-arabic {
  font-family: 'Amiri', 'Noto Naskh Arabic', serif;
  font-size: 1.15rem;
  color: var(--primary-dark);
  direction: rtl;
}
.surah-name-english {
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 2px;
}
.surah-name-urdu {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.surah-meta {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.75rem;
  align-items: center;
}
.surah-revelation {
  padding: 2px 10px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.surah-revelation.meccan { background: #FEF3C7; color: #92400E; }
.surah-revelation.medinan { background: #DBEAFE; color: #1E40AF; }
.surah-ayah-count { color: var(--text-muted); }

/* ─── Surah Page ─── */
.surah-header {
  margin-bottom: 20px;
}
.btn-back {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 12px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.btn-back:hover { opacity: 1; }
.surah-header-info { text-align: center; padding: 16px 0; }
.surah-header-arabic {
  font-family: 'Amiri', 'Noto Naskh Arabic', serif;
  font-size: 2.5rem;
  color: var(--primary-dark);
  direction: rtl;
  margin-bottom: 6px;
}
.surah-header-english {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--text);
}
.surah-header-urdu {
  font-size: 1.1rem;
  color: var(--text);
  margin-top: 2px;
}
.surah-header-meta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.bismillah {
  text-align: center;
  font-family: 'Amiri', 'Noto Naskh Arabic', serif;
  font-size: 2rem;
  color: var(--primary);
  padding: 20px 0;
  direction: rtl;
  opacity: 0.7;
}

/* ─── Ayah Cards ─── */
.ayahs-list { display: flex; flex-direction: column; gap: 16px; }
.ayah-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  position: relative;
}
.ayah-card:hover { border-color: var(--primary-light); }
.ayah-arabic {
  font-family: 'Amiri', 'Noto Naskh Arabic', serif;
  font-size: 2rem;
  line-height: 2;
  color: #1a1a2e;
  direction: rtl;
  text-align: right;
  padding-right: 40px;
  margin-bottom: 10px;
}
.ayah-number-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}
.ayah-translation {
  font-size: 1.15rem;
  line-height: 1.7;
  padding: 4px 0;
  color: var(--text);
}
.ayah-urdu {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-size: 1.25rem;
  color: var(--text);
  direction: rtl;
}
.ayah-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ayah-btn, .hadith-btn {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}
.ayah-btn:hover, .hadith-btn:hover {
  border-color: var(--primary);
  background: var(--bg);
}
.ayah-btn-explain, .hadith-btn-explain {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-color: var(--primary);
}
.ayah-btn-explain:hover, .hadith-btn-explain:hover {
  background: var(--primary-dark);
  color: #fff;
}
.ayah-btn.disabled, .hadith-btn.disabled, .btn-premium {
  opacity: 0.4;
  cursor: not-allowed;
  position: relative;
}

/* ─── Books Grid (Hadith) ─── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.book-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.25s ease;
  box-shadow: var(--shadow);
}
.book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(22, 163, 74, 0.12);
  border-color: var(--primary-light);
}
.book-icon { font-size: 2rem; }
.book-name { font-weight: 700; font-size: 0.95rem; }
.book-count { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }

/* ─── Chapters List ─── */
.chapters-list { display: flex; flex-direction: column; gap: 10px; }
.chapter-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.chapter-card:hover {
  transform: translateX(4px);
  border-color: var(--primary-light);
}
.chapter-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.chapter-info { flex: 1; }
.chapter-title { font-weight: 600; font-size: 0.9rem; }
.chapter-count { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.chapter-arrow { color: var(--text-muted); font-size: 1.2rem; }

/* ─── Hadith Cards ─── */
.hadiths-list { display: flex; flex-direction: column; gap: 16px; }
.hadith-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.hadith-card:hover { border-color: #3B82F6; }
.hadith-narrator {
  font-size: 1rem;
  color: var(--primary-dark);
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bg);
}
.hadith-arabic {
  font-family: 'Amiri', 'Noto Naskh Arabic', serif;
  font-size: 1.8rem;
  line-height: 2;
  color: #1a1a2e;
  direction: rtl;
  text-align: right;
  margin-bottom: 10px;
}
.hadith-translation {
  font-size: 1.15rem;
  line-height: 1.7;
  padding: 4px 0;
  color: var(--text);
}
.hadith-urdu {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-size: 1.25rem;
  direction: rtl;
  color: var(--text);
}
.hadith-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.hadith-ref {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
}
.hadith-collection { font-weight: 700; color: #3B82F6; }
.hadith-number { color: var(--text-muted); }
.hadith-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.grade-badge {
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
}
.grade-sahih { background: #DCFCE7; color: #166534; }
.grade-hasan { background: #FEF9C3; color: #854D0E; }
.grade-daif { background: #FEE2E2; color: #991B1B; }
.grade-other { background: #F3F4F6; color: #4B5563; }

/* ─── Unified Search ─── */
.unified-search-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.unified-search-box input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 100px;
  font-size: 1rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.unified-search-box input:focus { border-color: var(--primary); }
.search-filters {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.filter-chip {
  padding: 6px 16px;
  border-radius: 100px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.search-submit-btn {
  align-self: center;
  padding: 10px 32px;
  border-radius: 100px;
}
.search-results { display: flex; flex-direction: column; gap: 16px; }
.search-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 12px 0 8px;
  color: var(--text);
}
.search-result-card {
  display: block;
  padding: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.search-result-card:hover { transform: translateX(4px); border-color: var(--primary-light); }
.search-result-card.quran-result { border-left: 4px solid var(--primary); }
.search-result-card.hadith-result { border-left: 4px solid #3B82F6; }
.search-arabic {
  font-family: 'Amiri', 'Noto Naskh Arabic', serif;
  font-size: 1.2rem;
  direction: rtl;
  text-align: right;
  margin-bottom: 6px;
  color: var(--primary-dark);
}
.search-english {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 6px;
}
.search-ref {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.search-loading, .search-empty, .search-error {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.search-empty { font-size: 1.1rem; }

/* ─── Modal / Bottom Sheet ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-bottom-sheet {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px 24px 32px;
  animation: slideUp 0.3s ease;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.12);
}
.modal-handle {
  width: 40px;
  height: 4px;
  background: #ddd;
  border-radius: 4px;
  margin: 0 auto 16px;
}
.modal-loading, .modal-error {
  text-align: center;
  padding: 30px;
  font-size: 1rem;
  color: var(--text-muted);
}
.explain-reference {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-dark);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--bg);
}
.explain-section { margin-bottom: 16px; }
.explain-section h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}
.explain-section p, .explain-section li {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #374151;
  margin: 0;
}
.explain-section ul { margin: 4px 0 0; padding-left: 20px; }
.explain-section li { margin-bottom: 4px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .knowledge-container { padding: 16px 12px 80px; }
  .surah-grid, .books-grid { grid-template-columns: 1fr; }
  .ayah-arabic { font-size: 1.7rem; padding-right: 36px; }
  .hadith-arabic { font-size: 1.5rem; }
  .surah-header-arabic { font-size: 2rem; }
}
