/* =========================================================================
   BIBLE POPUP (ALKITAB POPUP) STYLESHEET
   Supports Light Mode, Dark Mode, Responsive Layouts, and Bulma UI
   ========================================================================= */

/* Interactive verse trigger badges & inline text */
.bible-ref-badge {
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    user-select: none;
    vertical-align: middle;
}

.bible-ref-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 209, 178, 0.25) !important;
    filter: brightness(0.95);
}

.bible-verse-inline {
    cursor: pointer;
    text-decoration: underline dotted 1.5px #00d1b2;
    text-underline-offset: 3px;
    color: inherit;
    font-weight: 600;
    transition: all 0.15s ease;
    border-radius: 3px;
    padding: 0 2px;
}

.bible-verse-inline:hover {
    background-color: rgba(0, 209, 178, 0.15);
    color: #0c1e21;
    text-decoration: underline solid 1.5px #00d1b2;
}

[data-theme="dark"] .bible-verse-inline:hover,
body.dark .bible-verse-inline:hover,
.dark-mode .bible-verse-inline:hover {
    background-color: rgba(0, 209, 178, 0.25);
    color: #5eead4;
}

/* Floating Popup Container */
#bible-popup-card {
    position: fixed;
    z-index: 999999;
    width: 440px;
    max-width: calc(100vw - 24px);
    background: #ffffff;
    color: #1e293b;
    border-radius: 12px;
    box-shadow: 0 20px 35px -8px rgba(0, 0, 0, 0.22), 0 8px 16px -4px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.96) translateY(6px);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
                visibility 0.2s;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    overflow: hidden;
}

#bible-popup-card.is-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Header */
.bpop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, #0c1e21 0%, #1c3b40 100%);
    color: #ffffff;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.bpop-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.925rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bpop-header-title i {
    color: #2dd4bf;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.bpop-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.bpop-badge-version {
    font-size: 0.675rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

.bpop-btn-action {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
}

.bpop-btn-action:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

/* Body / Content */
.bpop-body {
    padding: 14px 16px;
    max-height: 320px;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.65;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.bpop-body::-webkit-scrollbar {
    width: 5px;
}
.bpop-body::-webkit-scrollbar-track {
    background: transparent;
}
.bpop-body::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

/* Section / Passage */
.bpop-passage {
    margin-bottom: 12px;
}
.bpop-passage:last-child {
    margin-bottom: 0;
}

.bpop-passage-header {
    font-size: 0.775rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #0f766e;
    background: #f0fdfa;
    border-left: 3px solid #0d9488;
    padding: 4px 8px;
    margin: 8px 0 10px 0;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bpop-pericope-title {
    font-size: 0.85rem;
    font-weight: 700;
    font-style: italic;
    color: #475569;
    margin: 6px 0 8px 0;
    padding-bottom: 2px;
}

/* Verse Item */
.bpop-verse-item {
    margin-bottom: 8px;
    text-align: justify;
}
.bpop-verse-item:last-child {
    margin-bottom: 0;
}

.bpop-verse-num {
    font-weight: 800;
    font-size: 0.75rem;
    color: #0d9488;
    margin-right: 5px;
    vertical-align: baseline;
    display: inline-block;
}

.bpop-verse-text {
    color: #334155;
}

/* Loading & Empty States */
.bpop-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    gap: 10px;
    color: #64748b;
    font-size: 0.875rem;
}

.bpop-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(13, 148, 136, 0.2);
    border-top-color: #0d9488;
    border-radius: 50%;
    animation: bpop-spin 0.8s linear infinite;
}

@keyframes bpop-spin {
    to { transform: rotate(360deg); }
}

.bpop-empty {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.875rem;
}

/* Footer / Toast */
.bpop-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    font-size: 0.725rem;
    color: #64748b;
}

.bpop-footer a {
    color: #0d9488;
    text-decoration: none;
    font-weight: 600;
}
.bpop-footer a:hover {
    text-decoration: underline;
}

/* Dark Mode Overrides */
[data-theme="dark"] #bible-popup-card,
body.dark #bible-popup-card,
.dark-mode #bible-popup-card {
    background: #1e293b;
    color: #f1f5f9;
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .bpop-body,
body.dark .bpop-body,
.dark-mode .bpop-body {
    scrollbar-color: #475569 transparent;
}
[data-theme="dark"] .bpop-body::-webkit-scrollbar-thumb,
body.dark .bpop-body::-webkit-scrollbar-thumb,
.dark-mode .bpop-body::-webkit-scrollbar-thumb {
    background-color: #475569;
}

[data-theme="dark"] .bpop-verse-text,
body.dark .bpop-verse-text,
.dark-mode .bpop-verse-text {
    color: #e2e8f0;
}

[data-theme="dark"] .bpop-verse-num,
body.dark .bpop-verse-num,
.dark-mode .bpop-verse-num {
    color: #2dd4bf;
}

[data-theme="dark"] .bpop-pericope-title,
body.dark .bpop-pericope-title,
.dark-mode .bpop-pericope-title {
    color: #94a3b8;
}

[data-theme="dark"] .bpop-passage-header,
body.dark .bpop-passage-header,
.dark-mode .bpop-passage-header {
    background: #0f2d33;
    color: #2dd4bf;
    border-left-color: #14b8a6;
}

[data-theme="dark"] .bpop-footer,
body.dark .bpop-footer,
.dark-mode .bpop-footer {
    background: #0f172a;
    border-top-color: #334155;
    color: #94a3b8;
}

/* Toast Notice inside popup */
.bpop-copy-notice {
    font-size: 0.725rem;
    color: #10b981;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.bpop-copy-notice.is-active {
    opacity: 1;
}

@media screen and (max-width: 480px) {
    #bible-popup-card {
        width: calc(100vw - 20px) !important;
        left: 10px !important;
    }
}
