/* Citation Panel Styles & Exploration Panel Styles */

/* Citation Links in Response */
.citation-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    padding: 0 2px;
    border-radius: 3px;
}

.citation-link:hover {
    background-color: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.citation-link.highlighted {
    background-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Dark mode citation links */
.dark .citation-link {
    color: #60a5fa;
}

.dark .citation-link:hover {
    background-color: rgba(96, 165, 250, 0.1);
    color: #93bbfc;
}

.dark .citation-link.highlighted {
    background-color: rgba(96, 165, 250, 0.2);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

/* Citation Panel */
#citationPanel {
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

#citationPanel.panel-hidden {
    transform: translateX(100%);
    opacity: 0;
}

/* Ensure citation list doesn't overflow */
#citationList {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0; /* Important for flexbox overflow */
}

/* Fix main content area layout */
main > .flex-1.flex {
    min-height: 0; /* Allow flexbox children to shrink */
}

#chatMessages {
    min-width: 0; /* Allow chat messages to shrink */
}

/* Citation Cards */
.citation-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.citation-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.citation-card.active {
    border-color: #3b82f6;
    background-color: #eff6ff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.citation-card-unverified {
    border-color: #fbbf24;
    background-color: #fffbeb;
}

.dark .citation-card {
    background: #1f2937;
    border-color: #374151;
}

.dark .citation-card:hover {
    border-color: #60a5fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark .citation-card.active {
    border-color: #60a5fa;
    background-color: #1e293b;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.15);
}

/* Citation Number Badge */
.citation-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #3b82f6;
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 50%;
    flex-shrink: 0;
}

.dark .citation-number {
    background: #60a5fa;
    color: #1f2937;
}

/* Citation Text */
.citation-text {
    font-size: 15px;
    line-height: 1.6;
    color: #111827 !important;  /* Much darker - almost black */
    margin: 8px 0;
    font-style: italic;
    border-left: 3px solid #3b82f6;
    padding-left: 12px;
    font-weight: 500;  /* Slightly bolder for better readability */
}

.dark .citation-text {
    color: #f3f4f6 !important;  /* Light gray for dark mode */
    border-left-color: #60a5fa;
}

/* Citation Source */
.citation-source {
    font-size: 13px;
    color: #374151 !important;  /* Darker */
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.dark .citation-source {
    color: #d1d5db !important;
}

.citation-source-title {
    font-weight: 700;  /* Bolder */
    color: #111827 !important;  /* Much darker - almost black */
    font-size: 14px;  /* Slightly larger */
}

.dark .citation-source-title {
    color: #f9fafb !important;  /* Very light for dark mode */
}

/* Citation Confidence Score */
.citation-confidence {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 12px;
    background: #f3f4f6;
    color: #6b7280;
}

.dark .citation-confidence {
    background: #374151;
    color: #9ca3af;
}

.citation-confidence.high {
    background: #dcfce7;
    color: #16a34a;
}

.citation-confidence.medium {
    background: #fef3c7;
    color: #d97706;
}

.citation-confidence.low {
    background: #fee2e2;
    color: #dc2626;
}

.dark .citation-confidence.high {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.dark .citation-confidence.medium {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.dark .citation-confidence.low {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* Mobile Citation Drawer */
#mobileCitationDrawer {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobileCitationDrawer.open {
    transform: translateY(0);
}

/* Mobile Citation Button */
.mobile-citation-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 40;
}

.mobile-citation-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.mobile-citation-btn.has-citations {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* Citation Badge Count */
.citation-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Export Menu */
.export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    min-width: 180px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.export-menu.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dark .export-menu {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.export-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    color: #374151;
    font-size: 14px;
}

.export-option:hover {
    background: #f3f4f6;
}

.export-option:first-child {
    border-radius: 8px 8px 0 0;
}

.export-option:last-child {
    border-radius: 0 0 8px 8px;
}

.dark .export-option {
    color: #d1d5db;
}

.dark .export-option:hover {
    background: #374151;
}

/* Citation Hover Tooltip */
.citation-tooltip {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-width: 400px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.citation-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.dark .citation-tooltip {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Citation Stats */
#citationStats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-weight: 600;
    color: #111827;
}

.dark .stat-value {
    color: #f3f4f6;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    #citationPanel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 80%;
        max-width: 400px;
        z-index: 45;
        box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
    }
    
    .citation-panel-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 44;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }
    
    .citation-panel-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 640px) {
    .citation-card {
        padding: 10px;
    }

    .citation-text {
        font-size: 14px;
        padding-left: 8px;
    }

    .citation-source {
        font-size: 12px;
    }
}

/* Loading State */
.citation-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6b7280;
}

.citation-loading-spinner {
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.citation-empty {
    text-align: center;
    padding: 32px 16px;
    color: #9ca3af;
}

.citation-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    opacity: 0.5;
}

/* Theme Transitions */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* ========================================
   EXPLORATION PANEL STYLES
   ======================================== */

/* Exploration Panel */
#explorationPanel {
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

#explorationPanel.panel-hidden {
    transform: translateX(100%);
    opacity: 0;
}

/* Exploration Content */
#explorationContent {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

/* Scripture Reference Cards */
.scripture-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #a855f7;
    border-radius: 6px;
    padding: 10px 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.scripture-card:hover {
    border-left-color: #9333ea;
    background-color: #faf5ff;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.1);
}

.dark .scripture-card {
    background: #1f2937 !important;
    border-color: #4b5563 !important;
    border-left-color: #a855f7 !important;
}

.dark .scripture-card:hover {
    background-color: #374151 !important;
    border-left-color: #c084fc !important;
}

.scripture-reference {
    font-weight: 600;
    color: #7c3aed;
    font-size: 13px;
}

.dark .scripture-reference {
    color: #e9d5ff !important;
    font-weight: 700;
}

.scripture-preview {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    font-style: italic;
}

.dark .scripture-preview {
    color: #d1d5db !important;
}

/* Topic Tags */
.topic-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topic-tag:hover {
    background: #dcfce7;
    border-color: #4ade80;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.15);
}

.dark .topic-tag {
    background: rgba(34, 197, 94, 0.2) !important;
    border-color: #4ade80 !important;
    color: #bbf7d0 !important;
    font-weight: 600;
}

.dark .topic-tag:hover {
    background: rgba(34, 197, 94, 0.35) !important;
    border-color: #86efac !important;
}

/* Related Sermon Cards */
.related-sermon-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.related-sermon-card:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.dark .related-sermon-card {
    background: #1f2937 !important;
    border-color: #4b5563 !important;
}

.dark .related-sermon-card:hover {
    border-color: #60a5fa !important;
    background-color: #374151 !important;
}

.sermon-title {
    font-weight: 600;
    color: #111827;
    font-size: 13px;
    margin-bottom: 4px;
}

.dark .sermon-title {
    color: #f9fafb !important;
    font-weight: 700;
}

.sermon-meta {
    font-size: 11px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dark .sermon-meta {
    color: #d1d5db !important;
}

.relevance-score {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    background: #dbeafe;
    color: #1e40af;
}

.dark .relevance-score {
    background: rgba(59, 130, 246, 0.25) !important;
    color: #bfdbfe !important;
    font-weight: 700;
}

/* Follow-up Question Cards */
.followup-card {
    background: white;
    border: 1px solid #fbbf24;
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
    padding: 10px 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.followup-card:hover {
    border-color: #f59e0b;
    background-color: #fffbeb;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.dark .followup-card {
    background: #1f2937 !important;
    border-color: #92400e !important;
    border-left-color: #fbbf24 !important;
}

.dark .followup-card:hover {
    background-color: #374151 !important;
    border-color: #fbbf24 !important;
}

.followup-question {
    font-size: 13px;
    color: #111827;
    font-weight: 500;
    line-height: 1.4;
}

.dark .followup-question {
    color: #f9fafb !important;
    font-weight: 600;
}

.followup-icon {
    width: 16px;
    height: 16px;
    color: #f59e0b;
}

.dark .followup-icon {
    color: #fbbf24 !important;
}

/* Loading States */
.exploration-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: #6b7280;
    font-size: 12px;
}

.dark .exploration-loading {
    color: #d1d5db !important;
}

.exploration-spinner {
    animation: spin 1s linear infinite;
    margin-right: 8px;
    width: 16px;
    height: 16px;
}

/* Empty State */
#explorationEmptyState {
    text-align: center;
    padding: 24px 16px;
}

/* Responsive */
@media (max-width: 1024px) {
    #explorationPanel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 85%;
        max-width: 400px;
        z-index: 45;
        box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
    }
}
