:root {
    --bg-grade-good: rgba(27, 94, 59, 0.1);
    --text-grade-good: #1b5e3b;
    --bg-grade-ok: rgba(212, 175, 55, 0.15);
    --text-grade-ok: #8a6d1a;
    --bg-grade-weak: rgba(139, 0, 0, 0.08);
    --text-grade-weak: #8b0000;
    --warning-bg: rgba(180, 140, 40, 0.12);
    --warning-text: #7a5c00;
    --warning-border: rgba(180, 140, 40, 0.35);
}

[data-bs-theme="dark"] {
    --bg-grade-good: rgba(127, 201, 160, 0.15);
    --text-grade-good: #7fc9a0;
    --bg-grade-ok: rgba(232, 199, 102, 0.18);
    --text-grade-ok: #e8c766;
    --bg-grade-weak: rgba(224, 100, 100, 0.15);
    --text-grade-weak: #e06464;
    --warning-bg: rgba(240, 198, 116, 0.1);
    --warning-text: #f0c674;
    --warning-border: rgba(240, 198, 116, 0.3);
}

.hadith-card {
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
    transition: box-shadow 0.4s ease;
}

.hadith-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    color: var(--emerald);
    border-color: var(--gold);
}

.hadith-number-badge {
    display: inline-block;
    background: var(--emerald);
    color: white;
    box-shadow: 0 2px 6px rgba(27, 94, 59, 0.25);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    text-align: center;
    line-height: 35px;
    font-size: 0.7rem;
    margin-bottom: 0.75rem;
}

.hadith-arabic {
    font-family: "Amiri Quran", "Scheherazade New", "Amiri", serif;
    font-size: 1.4rem;
    color: var(--emerald-light);
    line-height: 2.4;
    margin-bottom: 0.75rem;
    text-align: right;
    padding: 0.25rem 0;
    letter-spacing: 0.3px;
}

.hadith-english {
    color: var(--emerald-light);
    font-size: 0.92rem;
    line-height: 1.75;
    padding-top: 1rem;
    border-top: none;
    position: relative;
    margin-top: 0.5rem;
}

.hadith-english::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--gold);
}

.hadith-incomplete-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--warning-bg, #fff3cd);
    color: var(--warning-text, #856404);
    border: 1px solid var(--warning-border, #ffeeba);
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.hadith-incomplete-notice i {
    font-size: 1rem;
}

/* ════════════ GRADE BADGE (merged — sirf ek jagah define) ════════════ */
.grade-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    margin-top: 0.5rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.grade-sahih {
    background: var(--bg-grade-good);
    color: var(--text-grade-good);
}
.grade-hasan {
    background: var(--bg-grade-ok);
    color: var(--text-grade-ok);
}
.grade-daif {
    background: var(--bg-grade-weak);
    color: var(--text-grade-weak);
}
.grade-very-daif,
.grade-munkar,
.grade-shadh,
.grade-mawdu {
    background: var(--bg-grade-weak);
    color: var(--text-grade-weak);
    font-weight: 400;
}

.grade-mawdu {
    background: var(--bg-grade-weak);
    color: var(--text-grade-weak);
    font-weight: 400;
}
.hadith-disclaimer {
    font-size: 0.85rem;
    color: var(--emerald-light);
    opacity: 0.6;
    border-left: 2px solid var(--gold);
    padding-left: 10px;
    margin-top: 0.5rem;
}

.hadith-disclaimer a {
    color: var(--gold-dark);
    text-decoration: underline;
}

/* Collection Card — hover lift + icon */
.hadith-collection-card {
    background: var(--cream);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    height: 100%;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.hadith-collection-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.08);
}

.hadith-collection-card h5 {
    font-family: "Cinzel", serif;
    font-size: 1.05rem;
}

.hadith-count-badge {
    display: inline-block;
    background: rgba(27, 94, 59, 0.1);
    color: var(--emerald-light);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 12px;
    margin-top: 0.5rem;
}

/* Chapter row — gold number badge instead of plain text */
.chapter-number-badge {
    flex-shrink: 0;
    background: rgba(212, 175, 55, 0.12);
    color: var(--gold-dark);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    margin-top: 2px;
}

/* ════════════ ACTION BUTTONS (Bookmark/Copy/Share/Note) ════════════ */
.ayah-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--emerald-light);
    border-radius: 20px;
    padding: 4px 14px;
    padding-top: 0.5rem;
    font-size: 0.82rem;
    margin-right: 0.4rem;
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
    transition: all 0.15s ease;
    cursor: pointer;
}

.ayah-btn:hover {
    background: rgba(27, 94, 59, 0.06);
    border-color: var(--emerald);
}

.ayah-btn.bookmarked,
.ayah-btn.has-note {
    background: var(--emerald);
    color: white;
    border-color: var(--emerald);
}

/* ════════════ NOTE BANNER ════════════ */
.note-banner {
    display: none;
    margin-top: 0.75rem;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    padding: 1rem;
}

.note-banner.open {
    display: block;
}

.note-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    color: var(--emerald);
    font-size: 0.9rem;
}

.note-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--emerald-light);
    cursor: pointer;
    line-height: 1;
}

.note-title-input,
.note-content-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
    margin-bottom: 0.6rem;
    background: var(--cream);
    color: var(--emerald-light);
}

.note-content-input {
    resize: vertical;
    line-height: 1.6;
}

.note-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.note-save-btn {
    background: var(--emerald);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 0.82rem;
    cursor: pointer;
}

.note-delete-btn {
    background: transparent;
    border: 1px solid #8b0000;
    color: #8b0000;
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 0.82rem;
    cursor: pointer;
}

/* ════════════ FLASH TOAST ════════════ */
.flash-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--emerald);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.88rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: flashIn 0.25s ease;
}

.flash-warning {
    background: #8a6d1a;
}
.flash-error {
    background: #8b0000;
}

@keyframes flashIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ════════════ CHAPTERS LIST PAGE ════════════ */
.hadith-chapter-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1.1rem;
    margin-bottom: 0.6rem;
    text-decoration: none;
    color: var(--emerald-light);
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.hadith-chapter-row:hover {
    background: rgba(212, 175, 55, 0.06);
    border-color: var(--gold);
    color: var(--emerald-light);
}

.hadith-chapter-title {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}

.hadith-grade-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--emerald-light);
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.15s ease;
}

.hadith-grade-btn:hover {
    background: rgba(27, 94, 59, 0.06);
    border-color: var(--emerald);
    color: var(--emerald);
}

.chapter-range-badge {
    font-size: 0.7rem;
    color: var(--emerald-light);
    white-space: nowrap;
    font-style: italic;
}

[data-bs-theme="dark"] .chapter-range-badge {
    opacity: 0.65; /* dark mode mein thoda zyada, warna bahut fade lagega */
}

/* ════════════ BREADCRUMB ════════════ */
.hadith-breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: var(--emerald-light);
}

.hadith-breadcrumb a {
    color: var(--gold-dark);
    text-decoration: none;
    transition: color 0.15s ease;
}

.hadith-breadcrumb a:hover {
    color: var(--emerald);
    text-decoration: underline;
}

.hadith-breadcrumb .breadcrumb-separator {
    color: var(--border);
    margin: 0 0.4rem;
}

.hadith-breadcrumb .breadcrumb-current {
    color: var(--emerald-light);
    opacity: 0.7;
}

/* ════════════ EMPTY STATE ════════════ */
.hadith-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--cream);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--emerald-light);
}

.hadith-empty-icon {
    font-size: 2.2rem;
    color: var(--gold);
    margin-bottom: 0.75rem;
    display: block;
}

.hadith-empty-title {
    font-family: "Cinzel", serif;
    color: var(--emerald);
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}

.hadith-empty-text {
    font-size: 0.88rem;
    opacity: 0.75;
    max-width: 360px;
    margin: 0 auto;
}

/* ════════════ GRADE LEGEND — final version ════════════
   Desktop: horizontal strip, full width, top pe (sidebar nahi ab)
   Mobile:  vertical stack, top pe
════════════════════════════════════════════════════ */
.hadith-grade-legend {
    width: 100%;
    background: rgba(0, 100, 0, 0.04);
    border-left: 3px solid var(--emerald);
    border-radius: 6px;
    padding: 14px 16px;
}

[data-bs-theme="dark"] .hadith-grade-legend {
    background: rgba(16, 185, 129, 0.08);
    border-left-color: var(--emerald);
}

.hadith-grade-legend > p {
    font-size: 0.72rem !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--emerald);
    font-weight: 600;
}

/* Desktop default: row + wrap (horizontal) */
.grade-legend-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.grade-legend-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 220px;
}

.grade-legend-item p {
    font-size: 0.76rem;
    line-height: 1.15; /* 1.3 se kam — lines aapas mein tight ho jayengi */
    margin: 0;
    color: var(--bs-body-color);
}
/* Collections layout (list area only — legend ab isme nahi hai) */
.hadith-layout {
    display: flex;
    gap: 1.5rem;
    align-items: start;
}

/* Mobile: legend vertical stack */
@media (max-width: 768px) {
    .grade-legend-grid {
        flex-direction: column;
    }

    .grade-legend-item {
        min-width: 100%;
    }
}

/* ================================================
           TASBIH LOADING STATE
        ================================================ */
.tasbih-loader {
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.6rem 0;
}

.tasbih-loader.active {
    display: flex;
}

.bead {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gold-dark);
    opacity: 0.25;
    animation: beadPulse 1.2s ease-in-out infinite;
}

.bead:nth-child(1) {
    animation-delay: 0s;
}

.bead:nth-child(2) {
    animation-delay: 0.15s;
}

.bead:nth-child(3) {
    animation-delay: 0.3s;
}

.bead:nth-child(4) {
    animation-delay: 0.45s;
}

.bead:nth-child(5) {
    animation-delay: 0.6s;
}

.bead:nth-child(6) {
    animation-delay: 0.75s;
}

.bead:nth-child(7) {
    animation-delay: 0.9s;
}

@keyframes beadPulse {
    0%,
    100% {
        opacity: 0.2;
        transform: scale(0.85);
    }

    50% {
        opacity: 1;
        transform: scale(1.15);
        background: var(--gold);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bead {
        animation: none;
        opacity: 0.6;
    }
}

.highlight-flash {
    animation: flashBg 3s ease-out;
}

@keyframes flashBg {
    0% {
        background-color: rgba(212, 175, 55, 0.35);
    }
    100% {
        background-color: transparent;
    }
}

[data-bs-theme="dark"] .highlight-flash {
    animation: flashBgDark 3s ease-out;
}

@keyframes flashBgDark {
    0% {
        background-color: rgba(232, 199, 102, 0.3);
    }
    100% {
        background-color: transparent;
    }
}

.hadith-actions {
    margin-top: 0.85rem; /* grade badge se thoda gap badhaya */
}

/* purana .hadith-nav-link ka naam badal do isko */
.hadith-view-in-chapter-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(27, 94, 59, 0.06);
    border-color: var(--emerald);
    color: var(--emerald);
    font-size: 0.8rem;
    font-weight: 500;
}

.hadith-view-in-chapter-btn:hover {
    background: var(--emerald);
    color: white;
    border-color: var(--emerald);
}

[data-bs-theme="dark"] .hadith-view-in-chapter-btn {
    background: rgba(127, 201, 160, 0.1);
    border-color: var(--emerald-light);
    color: var(--emerald-light);
}

[data-bs-theme="dark"] .hadith-view-in-chapter-btn:hover {
    background: var(--emerald-light);
    color: #1a1a1a;
}
/* ════════════ PROGRESS RING (Index page — collection card) ════════════ */
.hadith-progress-ring {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: conic-gradient(
        var(--gold) calc(var(--pct) * 1%),
        var(--border) 0deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative; /* 👈 dusre block se merge kiya */
}

.hadith-progress-ring::before {
    content: "";
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--cream);
}

/* ════════════ MARK AS READ BUTTON ════════════ */
.js-mark-read {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.js-mark-read::before {
    content: "○";
    font-size: 0.85rem;
}

.js-mark-read.bookmarked::before {
    content: "✓";
}

.hadith-progress-label {
    font-size: 0.72rem;
    color: var(--emerald-light);
    opacity: 0.65;
    margin-top: 2px;
    letter-spacing: 0.2px;
}

[data-bs-theme="dark"] .hadith-progress-label {
    opacity: 0.75; /* dark mode mein thoda zyada opacity — kam contrast na lage */
}

.review-flag {
    display: inline-block;
    font-size: 0.72rem;
    color: var(--gold-dark);
    background: rgba(201, 150, 58, 0.12);
    border: 1px solid rgba(201, 150, 58, 0.3);
    padding: 2px 10px;
    border-radius: 12px;
    margin-left: 6px;
}

[data-bs-theme="dark"] .review-flag {
    color: #e8c766;
    background: rgba(232, 199, 102, 0.12);
    border-color: rgba(232, 199, 102, 0.3);
}

.hadith-chapter-row {
    align-items: flex-start;
}

.hadith-chapter-title {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    flex: 1;
    min-width: 0;
}

.chapter-number-badge {
    flex-shrink: 0;
    margin-top: 2px;
}

.chapter-title-text {
    line-height: 1.25;
}

.chapter-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    white-space: nowrap;
    margin-top: 2px;
}
.hadith-complete-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(27, 94, 59, 0.08);
    color: var(--emerald);
    border: 1px solid var(--emerald);
    border-radius: 24px;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

[data-bs-theme="dark"] .hadith-complete-banner {
    background: rgba(127, 201, 160, 0.1);
    color: var(--emerald-light);
    border-color: var(--emerald-light);
}
/* Complete row — poora emerald fill */
.chapter-complete {
    background: var(--emerald) !important;
    border-color: var(--emerald) !important;
}

.chapter-complete .chapter-title-text,
.chapter-complete .chapter-range-badge,
.chapter-complete .chapter-number-badge {
    color: white !important;
}

.chapter-complete .chapter-number-badge {
    background: rgba(255, 255, 255, 0.2);
}

.chapter-complete-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.chapter-complete .hadith-count-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Ring ke andar percentage number */

.ring-label {
    position: absolute;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--emerald);
}

[data-bs-theme="dark"] .ring-label {
    color: var(--emerald-light);
}
.chapter-progress-text {
    font-size: 0.72rem;
    color: var(--emerald-light);
    opacity: 0.7;
}
@media (max-width: 576px) {
    .hadith-chapter-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .hadith-chapter-title {
        width: 100%;
    }

    .chapter-meta {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        padding-left: calc(
            28px + 0.6rem
        ); /* number-badge width + gap ke barabar, taaki text ke saath align ho */
    }

    .chapter-complete-badge {
        font-size: 0.75rem;
    }

    .chapter-range-badge {
        font-size: 0.68rem;
    }
}

.chapter-title-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chapter-range-subtitle {
    font-size: 0.72rem;
    color: var(--emerald-light);
    opacity: 0.8;
    font-style: italic;
}

.range-symbol {
    color: var(--gold);
    opacity: 0.8;
    font-style: normal;
    margin-right: 2px;
}

[data-bs-theme="dark"] .chapter-range-subtitle {
    opacity: 0.7;
}

/* Complete state mein bhi subtitle white ho */
.chapter-complete .chapter-range-subtitle {
    color: rgba(255, 255, 255, 0.75);
    opacity: 1;
}

.chapter-complete .range-symbol {
    color: rgba(255, 255, 255, 0.9);
}
.hadith-page-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 576px) {
    .hadith-page-header-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .hadith-resume-btn,
    .hadith-complete-banner {
        width: 100%;
        justify-content: center;
    }
}

a.hadith-back-btn {
    color: var(--emerald-light) !important;
    text-decoration: none !important;
}

a.hadith-back-btn:hover {
    color: var(--gold) !important;
}
a.hadith-resume-btn {
    color: var(--emerald-light) !important;
    text-decoration: none !important;
}

a.hadith-resume-btn:hover {
    color: var(--gold) !important;
}

.hadith-info-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--emerald-light);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hadith-info-btn:hover {
    background: rgba(27, 94, 59, 0.06);
}

.hadith-glossary-box {
    background: rgba(212, 175, 55, 0.05);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.hadith-glossary-box p {
    font-size: 0.85rem;
    color: var(--emerald-light);
    margin-bottom: 0.6rem;
}

.hadith-glossary-box p:last-child {
    margin-bottom: 0;
}
.hadith-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.hadith-header-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hadith-arabic-zone {
    background: rgba(212, 175, 55, 0.04);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

[data-bs-theme="dark"] .hadith-arabic-zone {
    background: rgba(232, 199, 102, 0.04);
}

.hadith-divider {
    height: 1px;
    background: var(--border);
    margin: 1rem 0;
    position: relative;
}

.hadith-divider::after {
    content: "۝";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--cream);
    color: var(--gold);
    padding: 0 10px;
    font-size: 0.9rem;
}

.hadith-reference-line {
    font-size: 0.72rem;
    color: var(--emerald-light);
    opacity: 0.8;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}
