/* Theologian Graph Modal Styles */
.theologian-graph-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
}
.theologian-graph-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.theologian-graph-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}
.theologian-graph-container {
    position: relative;
    width: 90vw;
    height: 85vh;
    max-width: 1400px;
    background: #f7f7f8;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}
[data-theme="dark"] .theologian-graph-container {
    background: #1a1a1a;
}
.theologian-graph-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2;
}
[data-theme="dark"] .theologian-graph-header {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(26, 26, 26, 0.9);
}
.theologian-graph-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    font-family: 'Crimson Text', Georgia, serif;
}
[data-theme="dark"] .theologian-graph-title {
    color: #f0f0f8;
}
.theologian-graph-title svg {
    color: #6b5b95;
}
[data-theme="dark"] .theologian-graph-title svg {
    color: #a0c7ff;
}
.theologian-graph-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.theologian-graph-zoom-btn,
.theologian-graph-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: rgba(107, 91, 149, 0.1);
    color: #6b5b95;
    cursor: pointer;
    transition: all 0.15s ease;
}
.theologian-graph-zoom-btn:hover,
.theologian-graph-close-btn:hover {
    background: #6b5b95;
    color: white;
}
[data-theme="dark"] .theologian-graph-zoom-btn,
[data-theme="dark"] .theologian-graph-close-btn {
    background: rgba(160, 199, 255, 0.1);
    color: #a0c7ff;
}
[data-theme="dark"] .theologian-graph-zoom-btn:hover,
[data-theme="dark"] .theologian-graph-close-btn:hover {
    background: #a0c7ff;
    color: #1a1a1a;
}
.theologian-graph-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}
.theologian-graph-svg {
    width: 100%;
    height: 100%;
    display: none;
}
.theologian-graph-loading,
.theologian-graph-empty {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #6b5b95;
}
[data-theme="dark"] .theologian-graph-loading,
[data-theme="dark"] .theologian-graph-empty {
    color: #a0c7ff;
}
.theologian-graph-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 2;
}
[data-theme="dark"] .theologian-graph-legend {
    background: rgba(26, 26, 26, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
}
.theologian-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #555;
}
[data-theme="dark"] .theologian-legend-item {
    color: #a8a8b8;
}
.theologian-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.theologian-dot { background: #6b5b95; }
[data-theme="dark"] .theologian-dot { background: #a0c7ff; }
.work-dot { background: #9b59b6; }
[data-theme="dark"] .work-dot { background: #ce93d8; }
.commentary-dot { background: #9585c4; }
[data-theme="dark"] .commentary-dot { background: #bab4d4; }

/* Legacy theologian graph spinner - keeping for specialized inline use */
.theologian-graph-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(107, 91, 149, 0.2);
    border-top-color: #6b5b95;
    border-radius: 50%;
    animation: theologian-spin 0.8s linear infinite;
}
[data-theme="dark"] .theologian-graph-spinner {
    border-color: rgba(160, 199, 255, 0.2);
    border-top-color: #a0c7ff;
}
@keyframes theologian-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Graph link and node hover styles */
.graph-link {
    transition: opacity 0.15s ease;
}
.graph-link.dimmed {
    opacity: 0.08;
}
.graph-node {
    transition: opacity 0.15s ease;
}
.graph-node.dimmed {
    opacity: 0.15;
}
.node-label {
    fill: #333;
    font-size: 11px;
    pointer-events: none;
}
[data-theme="dark"] .node-label {
    fill: #e0e0e8;
}
/* Commentary Panel — full-height right-side drawer */
.theologian-commentary-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 420px;
    max-width: 50vw;
    background: white;
    border-radius: 0;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.12);
    z-index: 10002;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transform: translateX(110%);
    transition: transform 0.3s cubic-bezier(.4, 0, .2, 1);
}
.theologian-commentary-panel.open {
    transform: translateX(0);
}
[data-theme="dark"] .theologian-commentary-panel {
    background: #2a2a2a;
}
.theologian-commentary-close {
    position: sticky;
    top: 0;
    z-index: 2;
    width: 32px;
    height: 32px;
    margin-left: auto;
    margin-right: 18px;
    margin-top: 14px;
    margin-bottom: 4px;
    flex-shrink: 0;
    border-radius: 50%;
    border: none;
    background: rgba(107, 91, 149, 0.1);
    color: #6b5b95;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.theologian-commentary-close:hover {
    background: #6b5b95;
    color: white;
}
[data-theme="dark"] .theologian-commentary-close {
    background: rgba(160, 199, 255, 0.12);
    color: #a0c7ff;
}
[data-theme="dark"] .theologian-commentary-close:hover {
    background: #a0c7ff;
    color: #1a1a1a;
}
.commentary-verse-ref {
    font-size: 1.6rem;
    font-weight: 700;
    color: #6b5b95;
    padding: 0 28px 16px;
    margin: 0;
    font-family: 'Crimson Text', Georgia, serif;
    border-bottom: 1px solid rgba(107, 91, 149, 0.15);
}
[data-theme="dark"] .commentary-verse-ref {
    color: #a0c7ff;
    border-color: rgba(160, 199, 255, 0.15);
}
/* Scripture expand button — minimal, clean */
.scripture-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(107, 91, 149, 0.18);
    border-radius: 6px;
    color: #6b5b95;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    margin: 14px 28px 4px;
}
.scripture-toggle:hover {
    background: rgba(107, 91, 149, 0.06);
    border-color: rgba(107, 91, 149, 0.3);
}
.scripture-toggle .arrow {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
    opacity: 0.6;
}
.scripture-toggle.expanded .arrow {
    transform: rotate(180deg);
}
[data-theme="dark"] .scripture-toggle {
    background: transparent;
    border-color: rgba(160, 199, 255, 0.18);
    color: #a0c7ff;
}
[data-theme="dark"] .scripture-toggle:hover {
    background: rgba(160, 199, 255, 0.06);
}
.scripture-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: rgba(107, 91, 149, 0.05);
    border-radius: 8px;
    margin: 0 28px;
}
.scripture-content.expanded {
    max-height: 400px;
    padding: 14px;
    margin-bottom: 16px;
    overflow-y: auto;
}
[data-theme="dark"] .scripture-content {
    background: rgba(160, 199, 255, 0.05);
}
.scripture-text {
    color: #333;
    line-height: 1.75;
    font-size: 0.95rem;
}
[data-theme="dark"] .scripture-text {
    color: #d8d8e8;
}
.scripture-text .verse-num {
    font-weight: 600;
    color: #6b5b95;
    font-size: 0.8rem;
    vertical-align: super;
    margin-right: 2px;
}
[data-theme="dark"] .scripture-text .verse-num {
    color: #a0c7ff;
}
.scripture-loading {
    color: #888;
    font-style: italic;
    font-size: 0.9rem;
}
/* Commentary section with clear label */
.commentary-section {
    padding: 20px 28px 28px;
}
[data-theme="dark"] .commentary-section {
    border-color: rgba(160, 199, 255, 0.15);
}
.commentary-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b5b95;
    margin-bottom: 12px;
    padding-top: 16px;
    border-top: 1px solid rgba(107, 91, 149, 0.12);
}
[data-theme="dark"] .commentary-section-label {
    color: #a0c7ff;
}
/* Commentary content - clean minimal style */
.commentary-body {
    color: #333;
    line-height: 1.85;
    font-size: 1.05rem;
}
[data-theme="dark"] .commentary-body {
    color: #e0e0e8;
}
.commentary-citation {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .commentary-citation {
    color: #888898;
}
.commentary-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #6b5b95;
    padding: 20px 0;
}

/* ==========================================
   FULL SOURCE READER OVERLAY
   Bible-reader style for reading primary sources
   ========================================== */

.tg-reader-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10010;
}
.tg-reader-overlay.open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.tg-reader-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
}
.tg-reader-container {
    position: relative;
    width: 90vw;
    max-width: 800px;
    height: 90vh;
    background: #fefefe;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    animation: tg-reader-entrance 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}
[data-theme="dark"] .tg-reader-container {
    background: #1e1e2e;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
@keyframes tg-reader-entrance {
    from { transform: scale(0.95) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.tg-reader-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid rgba(107, 91, 149, 0.12);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}
[data-theme="dark"] .tg-reader-header {
    background: rgba(30, 30, 46, 0.95);
    border-color: rgba(160, 199, 255, 0.1);
}
.tg-reader-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    font-family: 'Crimson Text', Georgia, serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    padding-right: 16px;
}
[data-theme="dark"] .tg-reader-title {
    color: #f0f0f8;
}
.tg-reader-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(107, 91, 149, 0.1);
    color: #6b5b95;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.tg-reader-close:hover {
    background: #6b5b95;
    color: white;
}
[data-theme="dark"] .tg-reader-close {
    background: rgba(160, 199, 255, 0.1);
    color: #a0c7ff;
}
[data-theme="dark"] .tg-reader-close:hover {
    background: #a0c7ff;
    color: #1a1a2e;
}
.tg-reader-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    position: relative;
}
.tg-reader-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 2.5rem 2rem 4rem;
    font-family: 'Crimson Text', Georgia, 'Times New Roman', serif;
    font-size: 1.12rem;
    line-height: 1.85;
    color: #2a2a3e;
}
[data-theme="dark"] .tg-reader-content {
    color: #d8d8e8;
}
.tg-reader-content p {
    margin: 0 0 1.2em;
    text-align: justify;
    hyphens: auto;
}
.tg-reader-content h1,
.tg-reader-content h2,
.tg-reader-content h3 {
    font-family: 'Crimson Text', Georgia, serif;
    color: #1a1a2e;
    margin: 2em 0 0.8em;
    line-height: 1.3;
}
[data-theme="dark"] .tg-reader-content h1,
[data-theme="dark"] .tg-reader-content h2,
[data-theme="dark"] .tg-reader-content h3 {
    color: #f0f0f8;
}
.tg-reader-content h1 { font-size: 1.8rem; }
.tg-reader-content h2 { font-size: 1.4rem; border-bottom: 1px solid rgba(107, 91, 149, 0.15); padding-bottom: 0.4em; }
.tg-reader-content h3 { font-size: 1.2rem; }

.tg-reader-content q,
.tg-reader-content blockquote {
    font-style: italic;
    color: #6b5b95;
}
[data-theme="dark"] .tg-reader-content q,
[data-theme="dark"] .tg-reader-content blockquote {
    color: #b4a8d4;
}

/* Loading & empty states */
.tg-reader-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    height: 100%;
    min-height: 300px;
    color: #6b5b95;
    font-size: 0.95rem;
}
[data-theme="dark"] .tg-reader-loading {
    color: #a0c7ff;
}
.tg-reader-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 100%;
    min-height: 300px;
    text-align: center;
    padding: 2rem;
    color: #6b5b95;
}
[data-theme="dark"] .tg-reader-empty {
    color: #a0c7ff;
}
.tg-reader-empty h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}
.tg-reader-empty p {
    margin: 0;
    font-size: 0.95rem;
    color: #888;
    line-height: 1.6;
}
[data-theme="dark"] .tg-reader-empty p {
    color: #888898;
}

/* Scroll to top button */
.tg-reader-scroll-top {
    position: sticky;
    bottom: 20px;
    float: right;
    margin-right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #6b5b95;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(107, 91, 149, 0.3);
    transition: all 0.2s ease;
    opacity: 0.8;
}
.tg-reader-scroll-top:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(107, 91, 149, 0.4);
}
[data-theme="dark"] .tg-reader-scroll-top {
    background: #a0c7ff;
    color: #1a1a2e;
    box-shadow: 0 4px 12px rgba(160, 199, 255, 0.3);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .tg-reader-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    .tg-reader-content {
        padding: 1.5rem 1.2rem 3rem;
        font-size: 1.05rem;
    }
    .tg-reader-title {
        font-size: 1.1rem;
    }
}
