/* Hadith library: browse, search, read and learn. Uses the site's own surfaces and green. */

.hd-hero { background: linear-gradient(135deg, #0f6d52 0%, #0a4a39 100%); color: #fff; border-radius: 0 0 2rem 2rem; }
.hd-hero h1, .hd-hero .hd-hero-sub { color: #fff; }
.hd-hero .hd-hero-sub { opacity: .88; max-width: 44rem; margin-inline: auto; }
.hd-hero .breadcrumb-item, .hd-hero .breadcrumb-item a, .hd-hero .breadcrumb-item.active { color: rgba(255, 255, 255, .85); }
.hd-hero .breadcrumb-item + .breadcrumb-item::before { color: rgba(255, 255, 255, .6); }

.hd-search { max-width: 640px; }
.hd-search input { min-width: 0; }

.hd-quick { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.hd-quick a { padding: .3rem .85rem; border-radius: 999px; font-size: .8125rem; font-weight: 500; color: #fff; background: rgba(255, 255, 255, .14); text-decoration: none; }
.hd-quick a:hover { background: rgba(255, 255, 255, .26); color: #fff; }

/* Topic tiles */
.hd-topic { display: flex; gap: .875rem; align-items: flex-start; height: 100%; padding: 1.125rem; border-radius: 1rem; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.hd-topic:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(15, 109, 82, .12); border-color: #9fd3c1 !important; }
.hd-topic-icon { flex: 0 0 auto; width: 2.75rem; height: 2.75rem; border-radius: .75rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; background: #eaf7f2; color: #0f6d52; }
.hd-topic.is-blue .hd-topic-icon { background: #e8f0fe; color: #1a56c4; }
.hd-topic.is-purple .hd-topic-icon { background: #f1eafd; color: #6b3fc4; }
.hd-topic.is-orange .hd-topic-icon { background: #fff1e0; color: #b45f06; }
.hd-topic.is-teal .hd-topic-icon { background: #e1f6f6; color: #0b7a7a; }
.hd-topic.is-red .hd-topic-icon { background: #fdeaea; color: #b3261e; }
.hd-topic-title { font-weight: 600; font-size: .9375rem; margin-bottom: .125rem; }
.hd-topic-arabic { font-family: "Amiri Quran", "Noto Naskh Arabic", serif; font-size: 1rem; opacity: .75; }
.hd-topic-count { font-size: .75rem; }

/* Book cards */
.hd-book { display: block; height: 100%; padding: 1.375rem; border-radius: 1.125rem; text-decoration: none; position: relative; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
.hd-book:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(15, 109, 82, .12); }
.hd-book-arabic { font-family: "Amiri Quran", "Noto Naskh Arabic", serif; font-size: 1.375rem; color: #0f6d52; line-height: 1.6; }
.hd-book.is-empty { opacity: .62; }

/* Filter rail */
.hd-filter-title { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; margin-bottom: .5rem; }
.hd-filter-list { list-style: none; margin: 0 0 1.25rem; padding: 0; max-height: 19rem; overflow-y: auto; }
.hd-filter-list a { display: flex; justify-content: space-between; gap: .5rem; padding: .375rem .625rem; border-radius: .5rem; font-size: .875rem; text-decoration: none; color: inherit; }
.hd-filter-list a:hover { background: #eaf7f2; color: #0f6d52; }
.hd-filter-list a.active { background: #0f6d52; color: #fff; font-weight: 600; }
.hd-filter-list a.active small { color: rgba(255, 255, 255, .8) !important; }

.hd-active-filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.hd-active-filters a { display: inline-flex; align-items: center; gap: .375rem; padding: .25rem .625rem; border-radius: 999px; font-size: .8125rem; background: #eaf7f2; color: #0f6d52; text-decoration: none; }
.hd-active-filters a:hover { background: #d3efe5; }

/* Hadith card in a list */
.hd-card { border-radius: 1.125rem; padding: 1.375rem; margin-bottom: 1rem; transition: box-shadow .18s ease, border-color .18s ease; }
.hd-card:hover { box-shadow: 0 8px 24px rgba(15, 109, 82, .1); border-color: #9fd3c1 !important; }
.hd-number { flex: 0 0 auto; min-width: 2.75rem; height: 2.75rem; padding: 0 .5rem; border-radius: .75rem; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: #eaf7f2; color: #0f6d52; }
.hd-card-title { font-size: 1.0625rem; font-weight: 600; margin: 0; }
.hd-card-title a { color: inherit; text-decoration: none; }
.hd-card-title a:hover { color: #0f6d52; }
.hd-excerpt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hd-source { font-size: .8125rem; }
.hd-tag { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 500; background: #f1f3f5; color: #495057; text-decoration: none; }
.hd-tag:hover { background: #eaf7f2; color: #0f6d52; }
.hd-grade { font-size: .75rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: #eaf7f2; color: #0f6d52; }
.hd-grade.is-hasan { background: #fff4db; color: #8a5a00; }
.hd-grade.is-daif { background: #fdeaea; color: #b3261e; }
.hd-stage { font-size: .75rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: #e8f0fe; color: #1a56c4; }
.hd-stage.is-memorised { background: #0f6d52; color: #fff; }

/* The reading page */
.hd-reader { border-radius: 1.25rem; padding: 2rem; }
.hd-arabic { font-family: "Amiri Quran", "Noto Naskh Arabic", "Scheherazade New", serif; font-size: var(--hd-arabic-size, 1.75rem); line-height: 2.3; text-align: right; direction: rtl; color: #14342b; }
.hd-translation { font-size: var(--hd-english-size, 1.0625rem); line-height: 1.85; }
.hd-translation a { font-weight: 600; white-space: nowrap; }
.hd-divider { border: 0; height: 1px; background: linear-gradient(90deg, transparent, #c9a24a, transparent); margin: 1.75rem 0; opacity: .6; }

/* English / Arabic / Both: one switch, remembered between visits. */
.hd-view { display: inline-flex; padding: .25rem; border-radius: .75rem; background: #eef2f1; gap: .25rem; }
.hd-view button { border: 0; background: transparent; padding: .375rem .875rem; border-radius: .5625rem; font-size: .875rem; font-weight: 600; color: #5c6f69; }
.hd-view button[aria-pressed="true"] { background: #fff; color: #0f6d52; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
[data-hd-view="english"] .hd-only-arabic, [data-hd-view="arabic"] .hd-only-english { display: none; }

.hd-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hd-tool { border: 1px solid #dfe5e3; background: transparent; border-radius: .625rem; padding: .375rem .625rem; font-size: .875rem; color: inherit; line-height: 1.2; }
.hd-tool:hover { border-color: #0f6d52; color: #0f6d52; }
.hd-tool.is-on { background: #0f6d52; border-color: #0f6d52; color: #fff; }

.hd-reference { border-left: 4px solid #c9a24a; border-radius: .75rem; padding: 1rem 1.25rem; background: #fdf8ec; color: #4a3a12; }
.hd-reference dt { font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; opacity: .75; }
.hd-reference dd { margin-bottom: .625rem; font-weight: 500; }
.hd-reference dd:last-child { margin-bottom: 0; }

/* Learning stages */
.hd-stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.hd-stage-btn { border: 1.5px solid #dfe5e3; background: transparent; border-radius: .875rem; padding: .75rem .5rem; text-align: center; color: inherit; transition: border-color .15s ease, background-color .15s ease; }
.hd-stage-btn i { display: block; font-size: 1.25rem; margin-bottom: .25rem; color: #8a9893; }
.hd-stage-btn span { font-size: .8125rem; font-weight: 600; }
.hd-stage-btn:hover { border-color: #0f6d52; }
.hd-stage-btn.is-done { border-color: #0f6d52; background: #eaf7f2; }
.hd-stage-btn.is-done i { color: #0f6d52; }
.hd-stage-btn.is-current { background: #0f6d52; border-color: #0f6d52; color: #fff; }
.hd-stage-btn.is-current i { color: #fff; }

.hd-pager { display: flex; justify-content: space-between; gap: 1rem; }
.hd-pager a { flex: 1 1 0; min-width: 0; padding: 1rem 1.25rem; border-radius: 1rem; text-decoration: none; color: inherit; }
.hd-pager a:hover { border-color: #0f6d52 !important; }
.hd-pager small { display: block; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.hd-pager strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hd-progress { height: .5rem; border-radius: 999px; background: #e6ecea; overflow: hidden; }
.hd-progress span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #0f6d52, #2fae8d); }

.hd-stat { border-radius: 1rem; padding: 1rem 1.125rem; height: 100%; }
.hd-stat-value { font-size: 1.625rem; font-weight: 700; line-height: 1.1; color: #0f6d52; }

.hd-toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); padding: .75rem 1.25rem; border-radius: .75rem; background: #14342b; color: #fff; font-size: .9375rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 1080; max-width: calc(100vw - 2rem); }
.hd-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.hd-toast.is-error { background: #8c1d18; }

/* Hadith shown inside a course lesson */
.hadith-lesson-arabic { font-family: "Amiri Quran", "Noto Naskh Arabic", serif; font-size: 1.625rem; line-height: 2.2; text-align: right; }
.hadith-lesson-translation { border-left: 4px solid #0f6d52; padding: .25rem 0 .25rem 1rem; margin: 1rem 0; font-size: 1.0625rem; line-height: 1.8; }
.hadith-lesson-verse { border-radius: .75rem; padding: 1rem 1.25rem; margin: .75rem 0; background: #fdf8ec; }
.hadith-lesson-verse .hadith-lesson-arabic { font-size: 1.375rem; margin-bottom: .5rem; }

@media (max-width: 575.98px) {
    .hd-reader { padding: 1.25rem; }
    .hd-arabic { font-size: var(--hd-arabic-size, 1.5rem); line-height: 2.1; }
    .hd-pager { flex-direction: column; }
    .hd-stages { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .hd-topic, .hd-book, .hd-card, .hd-toast { transition: none; }
    .hd-topic:hover, .hd-book:hover { transform: none; }
}

@media print {
    .hd-tools, .hd-view, .hd-pager, .hd-learn, header, footer, nav { display: none !important; }
    [data-hd-view] .hd-only-arabic, [data-hd-view] .hd-only-english { display: block !important; }
}
