﻿body {
    padding-top: 70px;
}

:root {
    --hd-main: #1E5F74;
    --hd-accent: #FCDAB7;
    --hd-dark: #133B5C;
    --hd-radius: 14px;
    --hd-shadow: 0 4px 16px rgba(0,0,0,.08);
    --hd-shadow-lg: 0 10px 26px rgba(0,0,0,.13);
}

/* ===== الشريط الجانبي ===== */
.hadith-sidebar {
    background: #fff;
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-shadow);
    position: sticky;
    top: 180px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.hadith-sidebar-header {
    background: var(--hd-main);
    color: #fff;
    font-weight: 700;
    font-family: 'Noto Kufi Arabic', sans-serif;
    padding: 14px 18px;
    border-radius: var(--hd-radius) var(--hd-radius) 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chapter-btn {
    display: block;
    width: 100%;
    text-align: right;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid rgba(0,0,0,.06);
    background: none;
    font-family: 'Noto Kufi Arabic', sans-serif;
    cursor: pointer;
    transition: background .2s, padding-right .2s;
}

    .chapter-btn:last-child {
        border-bottom: none;
    }

    .chapter-btn:hover {
        background: rgba(30,95,116,.08);
        color: var(--hd-main);
        padding-right: 20px;
    }

    .chapter-btn.active {
        background: var(--hd-main);
        color: #fff;
    }

        .chapter-btn.active .chapter-count {
            color: rgba(255,255,255,.75) !important;
        }

        .chapter-btn.active .chapter-num-badge {
            background: rgba(255,255,255,.25);
            color: #fff;
        }

.chapter-num-badge {
    display: inline-block;
    background: rgba(30,95,116,.12);
    color: var(--hd-main);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: .75rem;
    line-height: 26px;
    text-align: center;
    margin-left: 8px;
    transition: background .2s, color .2s;
}

/* ===== ترويسة الباب ===== */
.hadith-chapter-heading {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    border-right: 4px solid var(--hd-accent);
}

    .hadith-chapter-heading h5 {
        margin: 0;
        color: var(--hd-main);
        font-weight: 700;
        font-family: 'Noto Kufi Arabic', sans-serif;
    }

/* ===== بطاقة الحديث ===== */
.hadith-card {
    background: #f8f9fa;
    border-radius: 16px;
    box-shadow: var(--hd-shadow);
    padding: 26px 28px;
    margin-bottom: 22px;
    border-right: 5px solid var(--hd-main);
    transition: transform .25s ease, box-shadow .25s ease;
}

    .hadith-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--hd-shadow-lg);
    }

.hadith-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.hadith-num-badge {
    background: var(--hd-main);
    color: #fff;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(30,95,116,.35);
}

.chapter-tag {
    background: rgba(30,95,116,.08);
    color: var(--hd-main);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: .82rem;
}

.hadith-text {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 1.35rem;
    line-height: 2.2;
    color: #1a1a1a;
    margin-bottom: 14px;
    text-align: justify;
}

/* تم تصغيره قليلاً بناءً على الطلب */
.hadith-matn {
    color: #1668dc;
    font-weight: 600;
    font-size: .9em;
}

.quran-text {
    color: #198754;
    font-weight: 600;
}

.hadith-source {
    background: rgba(30,95,116,.10);
    color: var(--hd-main);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: .88rem;
    font-weight: 600;
    display: inline-block;
}

.hadith-glossary {
    background: rgba(252,218,183,.2);
    border: 1px solid rgba(252,218,183,.7);
    border-radius: 10px;
    padding: 14px 18px;
}

.hadith-benefits {
    background: rgba(30,95,116,.05);
    border-radius: 10px;
    padding: 14px 18px;
}

.hadith-section-title {
    font-weight: 700;
    margin-bottom: 10px;
    font-size: .95rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--hd-dark);
}

.benefits-title {
    color: var(--hd-main);
}

.hadith-glossary ul,
.hadith-benefits ol {
    margin: 0;
    padding-right: 18px;
    padding-left: 0;
    font-size: .95rem;
    line-height: 1.8;
}

/* ===== البحث — إعادة تصميم ===== */
.hadith-search-wrap {
    background: #fff;
    border: 2px solid rgba(30,95,116,.15);
    border-radius: 16px;
    box-shadow: var(--hd-shadow);
    padding: 6px 6px 6px 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: border-color .2s, box-shadow .2s;
}

    .hadith-search-wrap:focus-within {
        border-color: var(--hd-main);
        box-shadow: 0 4px 18px rgba(30,95,116,.18);
    }

.hadith-search-icon {
    color: var(--hd-main);
    padding: 0 12px;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.hadith-search-input {
    border: none;
    background: transparent;
    font-family: 'Noto Kufi Arabic', sans-serif;
    font-size: 1rem;
    height: 44px;
    flex: 1;
    min-width: 0;
    padding: 0;
}

    .hadith-search-input:focus {
        outline: none;
        box-shadow: none;
    }

.hadith-search-btn {
    background: var(--hd-main);
    color: #fff;
    border: none;
    border-radius: 12px;
    height: 42px;
    padding: 0 22px;
    font-family: 'Noto Kufi Arabic', sans-serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    transition: background .2s, transform .15s;
}

    .hadith-search-btn:hover {
        background: var(--hd-dark);
        color: #fff;
        transform: translateY(-1px);
    }

    .hadith-search-btn:active {
        transform: translateY(0);
    }

.hadith-search-clear {
    background: none;
    border: none;
    color: #adb5bd;
    padding: 0 10px;
    font-size: 1rem;
    flex-shrink: 0;
}

    .hadith-search-clear:hover {
        color: var(--hd-main);
    }

.hadith-search-sticky {
    position: sticky;
    top: 70px;
    z-index: 1025;
    background: #eee;
    padding: 8px 0;
}

/* تمييز نتائج البحث */
mark.hadith-highlight {
    background: var(--hd-accent);
    color: var(--hd-dark);
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 700;
}

.btn-outline-hadiths {
    border: 1px solid var(--hd-main);
    color: var(--hd-main);
    font-family: 'Noto Kufi Arabic', sans-serif;
    background: none;
    transition: background .2s, color .2s;
}

    .btn-outline-hadiths:hover {
        background: var(--hd-main);
        color: #fff;
    }

.hadith-spinner {
    text-align: center;
    padding: 60px 0;
    color: var(--hd-main);
}

@media (max-width: 767.98px) {
    #sidebar-col {
        display: block;
        position: sticky;
        top: 146px; /* fixed navbar plus search box */
        z-index: 1020;
    }

    .hadith-sidebar {
        position: static;
        display: flex;
        flex-direction: row;
        align-items: stretch;
        width: 100%;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        scrollbar-width: thin;
    }

    .hadith-sidebar-header {
        display: none;
    }

    .chapter-btn {
        display: block;
        flex: 0 0 auto;
        width: auto;
        border-bottom: 0;
        padding: 10px 14px;
    }

        .chapter-btn .chapter-count {
            display: none !important;
        }

    .hadith-card {
        padding: 18px 16px;
    }

    .hadith-text {
        font-size: 1.15rem;
        line-height: 2;
    }
}
