:root {
    --reading-font-size: 1.15rem;
    --reading-font-family: 'Amiri', serif;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: #f7f5f0;
}

.app-toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(350px, calc(100vw - 2rem));
}

.app-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
    cursor: pointer;
    opacity: 1;
    transition: opacity 5s linear;
}

.app-toast .btn-close {
    flex-shrink: 0;
}

.app-toast.fade-out {
    opacity: 0;
}

[data-bs-theme="dark"] body {
    background-color: #12181f;
}

.verse-text, .reading-text {
    font-family: var(--reading-font-family);
    font-size: var(--reading-font-size);
    line-height: 2.4;
}

.verse {
    position: relative;
    padding: 0.15rem 0.4rem;
    border-radius: 0.3rem;
    cursor: pointer;
    transition: background-color .15s ease;
    /* يبعد الآية عن الشريط العلوي الثابت (sticky navbar) عند القفز إليها برابط #v{id} */
    scroll-margin-top: 96px;
}

.verse:hover {
    background-color: rgba(13, 110, 253, 0.08);
}

[data-bs-theme="dark"] .verse:hover {
    background-color: rgba(13, 110, 253, 0.18);
}

.verse-number {
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    font-size: 0.75rem;
    color: #0d6efd;
    vertical-align: super;
    margin-inline-end: 2px;
}

.verse.has-note {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-thickness: 2px;
    text-decoration-color: #fd7e14;
    text-underline-offset: 5px;
}

/* ألوان التظليل */
.hl-warning   { background-color: #fff3cd; }
.hl-success   { background-color: #d1e7dd; }
.hl-info      { background-color: #cff4fc; }
.hl-danger    { background-color: #f8d7da; }
.hl-primary   { background-color: #cfe2ff; }
.hl-secondary { background-color: #e2e3e5; }

[data-bs-theme="dark"] .hl-warning   { background-color: #5c4a15; }
[data-bs-theme="dark"] .hl-success   { background-color: #234a37; }
[data-bs-theme="dark"] .hl-info      { background-color: #1c4a54; }
[data-bs-theme="dark"] .hl-danger    { background-color: #5a2530; }
[data-bs-theme="dark"] .hl-primary   { background-color: #253a5c; }
[data-bs-theme="dark"] .hl-secondary { background-color: #3a3d40; }

/* وميض الآية المستهدَفة القادمة من نتائج البحث أو رابط مباشر */
@keyframes verse-flash-anim {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(255, 193, 7, 0.55); }
}

.verse-flash {
    animation: verse-flash-anim 0.9s ease-in-out 5;
    border-radius: 0.3rem;
}

/* صفحة حول البرنامج: بطاقات التواصل */
.contact-link {
    transition: border-color .15s ease, background-color .15s ease;
}

.contact-link:hover {
    border-color: var(--bs-primary) !important;
    background-color: rgba(13, 110, 253, 0.06);
}

.contact-icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* صفحة حول البرنامج: سجل التحديثات */
.changelog-timeline {
    position: relative;
    padding-inline-start: 1.5rem;
    border-inline-start: 2px solid var(--bs-border-color);
}

.changelog-entry {
    position: relative;
    padding-bottom: 1.75rem;
}

.changelog-entry:last-child {
    padding-bottom: 0;
}

.changelog-dot {
    position: absolute;
    inset-inline-start: -1.94rem;
    top: 0.3rem;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    background-color: var(--bs-primary);
    border: 3px solid var(--bs-body-bg);
    box-shadow: 0 0 0 2px var(--bs-primary);
}

.highlight-picker {
    position: absolute;
    z-index: 1030;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
    padding: 0.5rem;
    display: none;
}

[data-bs-theme="dark"] .highlight-picker {
    background: #212529;
    border-color: #495057;
}

.highlight-picker.show {
    display: flex;
    gap: 0.35rem;
}

.color-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #fff;
    outline: 1px solid #dee2e6;
    cursor: pointer;
}

.color-dot:hover {
    outline: 2px solid #333;
}

.color-dot.none {
    background: repeating-linear-gradient(45deg, #fff, #fff 3px, #dc3545 3px, #dc3545 4px);
}

.picker-divider {
    width: 1px;
    align-self: stretch;
    background: #dee2e6;
}

[data-bs-theme="dark"] .picker-divider {
    background: #495057;
}

.picker-copy {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #495057;
    cursor: pointer;
    font-size: 0.75rem;
}

.picker-copy:hover {
    outline: 2px solid #333;
}

.picker-copy.copied {
    color: #198754;
    border-color: #198754;
}

[data-bs-theme="dark"] .picker-copy {
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme="dark"] .picker-copy:hover {
    outline: 2px solid #dee2e6;
}

.picker-note {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #fd7e14;
    cursor: pointer;
    font-size: 0.75rem;
}

.picker-note:hover {
    outline: 2px solid #333;
}

[data-bs-theme="dark"] .picker-note {
    border-color: #495057;
}

[data-bs-theme="dark"] .picker-note:hover {
    outline: 2px solid #dee2e6;
}

.note-popover {
    position: absolute;
    z-index: 1030;
    width: min(280px, calc(100vw - 2rem));
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
    padding: 0.6rem;
    display: none;
}

[data-bs-theme="dark"] .note-popover {
    background: #212529;
    border-color: #495057;
}

.note-popover.show {
    display: block;
}

.note-popover textarea {
    resize: vertical;
    font-family: 'Cairo', sans-serif;
}

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

.picker-share {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #0d6efd;
    cursor: pointer;
    font-size: 0.75rem;
}

.picker-share:hover {
    outline: 2px solid #333;
}

[data-bs-theme="dark"] .picker-share {
    border-color: #495057;
}

[data-bs-theme="dark"] .picker-share:hover {
    outline: 2px solid #dee2e6;
}

.share-popover {
    position: absolute;
    z-index: 1030;
    width: max-content;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    gap: 0.4rem;
}

[data-bs-theme="dark"] .share-popover {
    background: #212529;
    border-color: #495057;
}

.share-popover.show {
    display: flex;
}

.share-popover .btn {
    white-space: nowrap;
    text-align: right;
}

.bg-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    max-width: 260px;
}

.bg-swatch {
    width: 44px;
    height: 44px;
    border-radius: 0.4rem;
    border: 2px solid transparent;
    outline: 1px solid #dee2e6;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.8rem;
    padding: 0;
}

.bg-swatch.active {
    border-color: #0d6efd;
}

[data-bs-theme="dark"] .bg-swatch {
    outline-color: #495057;
}

.text-color-row {
    display: flex;
    gap: 0.4rem;
}

.text-color-row .color-dot.active {
    outline: 2px solid #0d6efd;
}

#imagePreviewImg {
    max-height: 70vh;
    max-width: 100%;
}

.book-card {
    transition: transform .15s ease, box-shadow .15s ease;
}
.book-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.1);
}

[data-bs-theme="dark"] .book-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.4);
}

@media print {
    nav, footer, .no-print {
        display: none !important;
    }
    body {
        background: #fff !important;
    }
}

.deutero-badge {
    font-size: 0.65rem;
}

.day-status-done { color: #198754; }
.day-status-late  { color: #dc3545; }
.day-status-today { color: #0d6efd; }

#bookScopeSelect optgroup {
    color: #0d6efd;
}
#bookScopeSelect option {
    color: #212529;
}

[data-bs-theme="dark"] #bookScopeSelect optgroup {
    color: #ffc107;
}
[data-bs-theme="dark"] #bookScopeSelect option {
    color: #fff;
}

/* في الثيمة الغامقة: نستبدل لون primary بلون warning في كل عناصر الموقع */
[data-bs-theme="dark"] {
    --bs-primary: #ffc107;
    --bs-primary-rgb: 255, 193, 7;
    --bs-primary-text-emphasis: #ffda6a;
    --bs-primary-bg-subtle: #332701;
    --bs-primary-border-subtle: #997404;
}

[data-bs-theme="dark"] .btn-primary {
    --bs-btn-color: #000;
    --bs-btn-bg: #ffc107;
    --bs-btn-border-color: #ffc107;
    --bs-btn-hover-color: #000;
    --bs-btn-hover-bg: #ffca2c;
    --bs-btn-hover-border-color: #ffc720;
    --bs-btn-focus-shadow-rgb: 217, 164, 6;
    --bs-btn-active-color: #000;
    --bs-btn-active-bg: #ffcd39;
    --bs-btn-active-border-color: #ffc720;
    --bs-btn-disabled-color: #000;
    --bs-btn-disabled-bg: #ffc107;
    --bs-btn-disabled-border-color: #ffc107;
}

[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: #ffc107;
    --bs-btn-border-color: #ffc107;
    --bs-btn-hover-color: #000;
    --bs-btn-hover-bg: #ffc107;
    --bs-btn-hover-border-color: #ffc107;
    --bs-btn-focus-shadow-rgb: 255, 193, 7;
    --bs-btn-active-color: #000;
    --bs-btn-active-bg: #ffc107;
    --bs-btn-active-border-color: #ffc107;
    --bs-btn-disabled-color: #ffc107;
    --bs-btn-disabled-border-color: #ffc107;
}

[data-bs-theme="dark"] .nav-pills {
    --bs-nav-pills-link-active-color: #000;
    --bs-nav-pills-link-active-bg: #ffc107;
}

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: #ffc107;
    border-color: #ffc107;
}

[data-bs-theme="dark"] .text-bg-primary,
[data-bs-theme="dark"] .badge.bg-primary,
[data-bs-theme="dark"] .bg-primary.text-white {
    color: #000 !important;
}

[data-bs-theme="dark"] .day-status-today {
    color: #ffc107;
}

#testamentTabs .nav-link {
    border: 1px solid transparent;
}

#testamentTabs .nav-link:not(.active) {
    color: #0d6efd;
    border-color: #0d6efd;
}

[data-bs-theme="dark"] #testamentTabs .nav-link:not(.active) {
    color: #ffc107;
    border-color: #ffc107;
}
