/* Enhanced Bibliography and Citation Styles */

/* Citation hover effects */
.citation {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px dotted #2563eb;
    transition: all 0.2s ease;
}

.citation:hover {
    color: #1d4ed8;
    border-bottom: 1px solid #1d4ed8;
    background-color: rgba(37, 99, 235, 0.1);
    padding: 1px 2px;
    border-radius: 3px;
}

/* Reference section styling */
#references {
    border-top: 2px solid #e5e7eb;
    margin-top: 3rem;
    padding-top: 2rem;
}

#references h1 {
    color: #374151;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #d1d5db;
    padding-bottom: 0.5rem;
}

/* Individual reference styling */
.csl-entry {
    margin-bottom: 1.2rem;
    line-height: 1.6;
    padding: 0.8rem;
    border-left: 3px solid #3b82f6;
    background-color: rgba(59, 130, 246, 0.02);
    border-radius: 0 4px 4px 0;
    transition: all 0.2s ease;
}

.csl-entry:hover {
    background-color: rgba(59, 130, 246, 0.05);
    border-left-color: #1d4ed8;
    transform: translateX(2px);
}

/* DOI and URL links in references */
.csl-entry a {
    color: #059669;
    text-decoration: none;
    font-weight: 500;
}

.csl-entry a:hover {
    color: #047857;
    text-decoration: underline;
}

/* Author names in references */
.csl-entry .author {
    font-weight: 600;
    color: #374151;
}

/* Journal names in references */
.csl-entry .container-title {
    font-style: italic;
    color: #6b7280;
}

/* Year styling */
.csl-entry .issued {
    font-weight: 500;
    color: #4b5563;
}

/* Margin citations */
.margin-citation {
    position: absolute;
    right: -200px;
    width: 180px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #6b7280;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Footnotes styling */
.footnotes {
    border-top: 1px solid #e5e7eb;
    margin-top: 2rem;
    padding-top: 1rem;
    font-size: 0.9rem;
}

.footnotes ol {
    padding-left: 1.5rem;
}

.footnotes li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Citation popup styling (for hover citations) */
.citation-popup {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.75rem;
    max-width: 300px;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Back-reference links */
.footnote-back {
    color: #6b7280;
    text-decoration: none;
    margin-left: 0.25rem;
}

.footnote-back:hover {
    color: #374151;
}

/* Table of contents with citations */
.toc-actions {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.toc-actions a {
    color: #6b7280;
    text-decoration: none;
    margin-right: 1rem;
}

.toc-actions a:hover {
    color: #374151;
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .margin-citation {
        position: static;
        right: auto;
        width: auto;
        margin: 0.5rem 0;
    }
    
    .citation-popup {
        max-width: 250px;
    }
}

/* Print styles */
@media print {
    .citation {
        color: black;
        border-bottom: none;
    }
    
    .csl-entry {
        border-left: none;
        background-color: transparent;
        padding: 0;
    }
    
    .margin-citation {
        display: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .citation {
        color: #60a5fa;
        border-bottom-color: #60a5fa;
    }
    
    .citation:hover {
        color: #93c5fd;
        border-bottom-color: #93c5fd;
        background-color: rgba(96, 165, 250, 0.1);
    }
    
    .csl-entry {
        background-color: rgba(96, 165, 250, 0.05);
        border-left-color: #60a5fa;
    }
    
    .csl-entry:hover {
        background-color: rgba(96, 165, 250, 0.1);
    }
    
    .citation-popup {
        background: #1f2937;
        border-color: #4b5563;
        color: #f9fafb;
    }
}
