
.hadith-page { max-width: 1100px; margin: 0 auto; padding: 0 12px 24px; font-family: 'Outfit', system-ui, -apple-system, sans-serif; }
.hadith-page .page-breadcrumbs { display: none !important; }

.hadith-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
@media (min-width: 900px) {
    .hadith-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .hadith-grid { grid-template-columns: 1fr; gap: 12px; }
}

.hadith-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.hadith-modal.active { display: flex; }
.hadith-modal-content {
    background: #fff;
    width: min(1100px, 100%);
    max-height: min(90vh, 900px);
    overflow: auto;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    padding: 20px 20px 16px;
    border: 1px solid #e2e8f0;
}
.hadith-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.hadith-modal-header h2 { margin: 0; font-size: 1.15rem; color: #0f172a; font-weight: 700; }
.hadith-modal-close {
    border: none;
    background: #f1f5f9;
    color: #475569;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}
.hadith-modal-close:hover { background: #e2e8f0; color: #0f172a; }

.hadith-search-bar { margin-bottom: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hadith-search-bar input { flex: 1; min-width: 200px; padding: 10px 16px; border: 1.5px solid #e2e8f0; border-radius: 10px; font-size: 14px; transition: 0.25s; }
.hadith-search-bar input:focus { outline: none; border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15); }
.hadith-search-bar label { font-size: 0.9rem; font-weight: 600; color: #475569; }

.hadith-daily { 
    background: #fff; 
    border-radius: 18px; 
    padding: 24px; 
    border: 1px solid #e2e8f0; 
    margin-bottom: 24px; 
    border-left: 5px solid #0284c7; 
    box-shadow: 0 4px 18px rgba(0,0,0,0.03); 
}
.hadith-daily h3 { margin: 0 0 12px 0; font-size: 1rem; color: #0284c7; font-weight: 800; display: flex; align-items: center; gap: 10px; text-transform: uppercase; letter-spacing: 0.8px; }
.hadith-daily .content { font-size: 1.05rem; line-height: 1.65; color: #334155; font-weight: 500; font-style: italic; }
.hadith-daily .content.ar { direction: rtl; text-align: right; font-style: normal; font-family: 'Amiri', serif; font-size: 1.3rem; margin-bottom: 12px; line-height: 1.9; color: #064e3b; }
.hadith-daily .ref { margin-top: 10px; font-size: 12px; color: #94a3b8; font-weight: 700; }
.hadith-daily .loading { color: #94a3b8; font-style: italic; }

.hadith-card { 
    background: #fff; 
    border-radius: 16px; 
    padding: 16px; 
    border: 1px solid #e2e8f0; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.02); 
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1); 
    cursor: pointer; 
}
.hadith-card:hover { 
    border-color: #cbd5e1; 
    box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.08); 
    transform: translateY(-3px); 
}
.hadith-card-top { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.hadith-card-titles { flex: 1; min-width: 0; }
.hadith-cover {
    width: 68px;
    height: 102px;
    flex-shrink: 0;
    border-radius: 5px;
    display: block;
}
.hadith-card h2 { margin: 0; font-size: 0.98rem; color: #1e3a5f; font-weight: 700; line-height: 1.35; padding-top: 2px; }
.hadith-compiler-tribute { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.hadith-compiler-ar {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 0.88rem;
    color: #475569;
    line-height: 1.3;
    direction: rtl;
    text-align: right;
}
.hadith-compiler-meta { font-size: 0.72rem; color: #94a3b8; font-weight: 600; line-height: 1.35; }

.hadith-compiler-panel {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.85rem;
    line-height: 1.45;
}
.hadith-compiler-panel .hcp-ar {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 1rem;
    direction: rtl;
    text-align: right;
    opacity: 0.95;
    margin-bottom: 4px;
}
.hadith-compiler-panel .hcp-meta { opacity: 0.8; font-weight: 600; font-size: 0.8rem; margin-bottom: 6px; }
.hadith-compiler-panel .hcp-bio { opacity: 0.88; font-weight: 500; }
.hadith-card p { margin: 0; font-size: 0.95rem; color: #64748b; line-height: 1.5; }
.hadith-card a { display: inline-flex; align-items: center; gap: 8px; margin-top: 15px; font-size: 0.9rem; color: #3b7cb5; text-decoration: none; font-weight: 700; }
.hadith-card a:hover { color: #1e3a5f; }

.hadith-footer { margin-top: 40px; padding: 20px; background: #f8fafc; border-radius: 15px; border: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; }
.hadith-link { color: #3b7cb5; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }

.hadith-collections-main { margin-top: 28px; }
.hadith-collections-heading {
    margin: 0 0 16px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e3a5f;
    display: flex;
    align-items: center;
    gap: 10px;
}
.hadith-collections-heading i { color: #3b7cb5; }

.hadith-view-intro {
    margin: 0 0 18px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #f0f7ff 0%, #f8fafc 100%);
    border: 1px solid #bfdbfe;
    border-left: 4px solid #3b7cb5;
    border-radius: 12px;
}
.hadith-view-intro h3 { margin: 0 0 8px; font-size: 1.05rem; color: #1e3a5f; }
.hadith-view-intro p { margin: 0; font-size: 0.92rem; color: #475569; line-height: 1.55; }
.hadith-view-intro[hidden] { display: none !important; }

.hadith-concordance-panel {
    margin-top: 18px;
    padding: 14px 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 12px;
}
.hadith-concordance-panel[hidden] { display: none !important; }
.hadith-concordance-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #0369a1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.hadith-concordance-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sitta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #94a3b8;
}
.sitta-badge.found {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
    cursor: pointer;
}
.sitta-badge.found:hover { background: #bbf7d0; }
.sitta-badge.current {
    box-shadow: 0 0 0 2px #3b7cb5;
}
.sitta-badge.checking {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}
.hadith-concordance-note {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.45;
}
.hadith-mishkat-sources {
    margin-top: 12px;
    padding: 10px 12px;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #6b21a8;
}
.hadith-mishkat-sources strong { color: #581c87; }
.jami-topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.jami-topic-card {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e3a5f;
    transition: 0.2s;
}
.jami-topic-card:hover { border-color: #3b7cb5; background: #f0f7ff; }
.jami-topic-books { font-size: 0.72rem; color: #64748b; font-weight: 600; margin-top: 4px; }
.jami-topic-results h3 { margin: 0 0 12px; color: #1e3a5f; font-size: 1rem; }
.jami-book-block { margin-bottom: 16px; padding: 12px; background: #f8fafc; border-radius: 10px; border: 1px solid #e2e8f0; }
.jami-book-block h4 { margin: 0 0 8px; font-size: 0.9rem; color: #3b7cb5; }
.jami-hadith-link {
    display: block;
    padding: 8px 10px;
    margin-top: 6px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.82rem;
    color: #334155;
    text-decoration: none;
    cursor: pointer;
}
.jami-hadith-link:hover { border-color: #3b7cb5; color: #1e3a5f; }

.hadith-library-welcome {
    text-align: center;
    padding: 28px 20px;
    color: #64748b;
    font-size: 1rem;
    line-height: 1.6;
}
.hadith-library-welcome i { display: block; font-size: 2rem; color: #3b7cb5; margin-bottom: 12px; opacity: 0.85; }

#hadithOverview { transition: opacity 0.3s ease; }

/* Reader view (when a collection is open) */
.hadith-reader-wrap { display: none; margin-bottom: 24px; }
.hadith-reader-wrap.active { display: block; }
.hadith-reader-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: #fff;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(30,58,95,0.2);
}
.reader-row-header { display: flex; justify-content: center; border-bottom: 1px solid rgba(255,255,255,0.12); padding-bottom: 8px; margin-bottom: 4px; }
.reader-row-header h1 { margin: 0; font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; gap: 10px; font-family: 'Amiri', serif; }
.reader-row-top { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    flex-wrap: nowrap; 
    width: 100%; 
    overflow-x: auto; /* Allow horizontal scroll if literally impossible to fit */
    scrollbar-width: none; /* Hide scrollbar for clean look */
}
.reader-row-top::-webkit-scrollbar { display: none; }
.reader-row-top > div { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.reader-row-desc { font-size: 0.9rem; opacity: 0.85; line-height: 1.4; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 8px; font-weight: 500; }
.hadith-grid-btn { 
    display: inline-flex; align-items: center; justify-content: center; 
    width: 36px; height: 36px; border-radius: 8px; 
    background: rgba(255,255,255,0.2); color: #fff; 
    text-decoration: none; font-size: 1.1rem; flex-shrink: 0;
    transition: 0.2s;
}
.hadith-grid-btn:hover { background: rgba(255,255,255,0.35); color: #fff; }
.hadith-reader-bar label { font-size: 0.8rem; opacity: 0.8; white-space: nowrap; }
.hadith-reader-bar select {
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    flex-shrink: 0;
}
.hadith-reader-bar select option { background: #1e3a5f; color: #fff; }
.hadith-reader-nav { display: flex; align-items: center; gap: 8px; }
.hadith-reader-nav input[type="number"] {
    width: 70px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
}
.hadith-reader-nav button {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
}
.hadith-reader-nav button:hover { background: rgba(255,255,255,0.35); }
.hadith-reader-content {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px 28px;
    min-height: 120px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.hadith-reader-content .hr-ar {
    direction: rtl;
    text-align: right;
    font-family: 'Amiri', serif;
    font-size: 1.25rem;
    line-height: 1.9;
    color: #0f172a;
    margin-bottom: 16px;
}
.hadith-reader-content .hr-trans {
    font-size: 1rem;
    line-height: 1.7;
    color: #334155;
    margin-bottom: 12px;
}
.hadith-reader-content .hr-ref { font-size: 0.8rem; color: #94a3b8; font-weight: 700; }
.hadith-reader-content .hr-loading { color: #94a3b8; font-style: italic; }
.hr-audio-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 16px 0 12px 0; padding: 12px 0; border-top: 1px solid #e2e8f0; }
.hr-audio-bar .hr-audio-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px;
    border: 1px solid #cbd5e1; background: #f8fafc; color: #334155; font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.hr-audio-bar .hr-audio-btn:hover { background: #e2e8f0; border-color: #94a3b8; }
.hr-audio-bar .hr-audio-btn i { color: #3b7cb5; }

    .hadith-modal-close:hover { background: #cbd5e1; transform: rotate(90deg); }

/* Topic Explorer Styles */
.topic-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 20px; }
.topic-card { 
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 15px; 
    cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 10px;
}
.topic-card:hover { border-color: #3b7cb5; background: #f0f7ff; transform: translateY(-2px); }
.topic-card i { color: #3b7cb5; font-size: 1.1rem; }
.topic-card span { font-size: 0.95rem; font-weight: 600; color: #1e3a5f; }

/* Explanation Panel */
.explanation-panel { 
    margin-top: 20px; padding: 20px; background: #f8fafc; border-radius: 16px; 
    border-left: 4px solid #0ea5e9; display: none; 
}
.explanation-panel.active { display: block; }
.exp-section { margin-bottom: 20px; }
.exp-title { font-size: 0.9rem; font-weight: 800; color: #0369a1; text-transform: uppercase; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.exp-content { font-size: 1rem; line-height: 1.6; color: #334155; }
.exp-grading { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-weight: 700; font-size: 0.85rem; margin-bottom: 15px; }
.grade-authentic { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.grade-weak { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
