* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --primary-color: #3b82f6;
    --secondary-color: #1d4ed8;
    --accent-color: #60a5fa;
    --bg-color: #0b1120;
    --card-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 12px -1px rgba(0, 0, 0, 0.6);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 14px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header - More Compact */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.logo {
    height: 2.5rem;
    width: auto;
    display: block;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0;
}

.subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
}

.subtitle a {
    color: white;
    text-decoration: underline;
}

.subtitle a:hover {
    opacity: 0.8;
}

/* Main Content */
main {
    padding: 1rem 0;
}

/* Controls - Compact */
.controls {
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: 6px;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.search-box {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-input-wrapper {
    flex: 1;
    min-width: 260px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 50%;
    transition: all 0.15s ease;
}

.search-clear-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
}

.search-abstract-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    font-weight: 500;
}

.search-abstract-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--primary-color);
}

.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 120px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.year-select {
    flex: 0 0 100px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.reset-btn {
    padding: 0.5rem 1rem;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: var(--text-primary);
}

.sort-select {
    flex: 0 0 210px;
    font-weight: 600;
    border-color: #cbd5e1;
    color: var(--text-primary);
    background-color: #f8fafc;
}

.download-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background: var(--secondary-color);
}

.ris-download-btn {
    background: #0284c7;
}

.ris-download-btn:hover {
    background: #0369a1;
}

/* Active Filter Chips Bar */
.active-filters-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.6rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border-color);
}

.active-filters-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex: 1;
}

.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.73rem;
    font-weight: 500;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    cursor: pointer;
    transition: all 0.15s ease;
}

.active-filter-chip:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.active-filter-chip.chip-data {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

.active-filter-chip.chip-data:hover {
    background: #bae6fd;
    border-color: #7dd3fc;
}

.active-filter-chip.chip-site {
    background: #f3e8ff;
    color: #7e22ce;
    border-color: #e9d5ff;
}

.active-filter-chip.chip-site:hover {
    background: #e9d5ff;
    border-color: #d8b4fe;
}

.active-filter-chip.chip-status {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
}

.active-filter-chip.chip-status:hover {
    background: #fde68a;
    border-color: #fcd34d;
}

.active-filter-chip.chip-author {
    background: #eef2ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

.active-filter-chip.chip-author:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}

.chip-prefix {
    opacity: 0.8;
}

.chip-value {
    font-weight: 600;
}

.chip-remove {
    margin-left: 0.15rem;
    font-size: 0.7rem;
    opacity: 0.75;
}

.active-filter-chip:hover .chip-remove {
    opacity: 1;
}

.copy-filter-link-btn {
    margin-left: auto;
    padding: 0.22rem 0.6rem;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.73rem;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary-color);
    border: 1px solid rgba(37, 99, 235, 0.25);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.copy-filter-link-btn:hover {
    background: rgba(37, 99, 235, 0.16);
    border-color: rgba(37, 99, 235, 0.45);
}

.copy-filter-link-btn.copied {
    background: #16a34a;
    color: #ffffff;
    border-color: #15803d;
}

/* Statistics - Compact */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}

.stat-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Publications List - Very Compact */
.publications-list {
    display: grid;
    gap: 0.5rem;
}

.publication-card {
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: 6px;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    border-left: 3px solid var(--primary-color);
}

.publication-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.pub-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.pub-authors {
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    line-height: 1.45;
}

.author-pill {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0.04rem 0.2rem;
    margin: 0 -0.1rem;
    border-radius: 3px;
    font: inherit;
    color: inherit;
    line-height: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.author-pill:hover {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.author-pill.active {
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
    padding: 0.04rem 0.35rem;
    margin: 0 0.05rem;
    text-decoration: none;
}

.author-pill.active:hover {
    background: var(--secondary-color);
    color: #ffffff;
}

.author-pill:focus-visible,
.tag-interactive:focus-visible,
.active-filter-chip:focus-visible,
.copy-filter-link-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

.pub-venue {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.pub-meta {
    color: var(--text-secondary);
    font-weight: normal;
}

.pub-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.tag {
    background: #dbeafe;
    color: var(--primary-color);
    border: 1px solid #bfdbfe;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.3;
    cursor: help;
}

.tag-interactive {
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.tag-interactive:hover {
    background: #bfdbfe;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.tag-interactive.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #1d4ed8;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}

.tag-data {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

.tag-data.tag-interactive:hover {
    background: #bae6fd;
    border-color: #7dd3fc;
}

.tag-data.tag-interactive.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0369a1;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.35);
}

.tag-site {
    background: #f3e8ff;
    color: #7e22ce;
    border-color: #e9d5ff;
}

.tag-site.tag-interactive:hover {
    background: #e9d5ff;
    border-color: #d8b4fe;
}

.tag-site.tag-interactive.active {
    background: #7e22ce;
    color: #ffffff;
    border-color: #6b21a8;
    box-shadow: 0 1px 3px rgba(126, 34, 206, 0.35);
}

.tag-dataset {
    background: #ccfbf1;
    color: #0f766e;
    border: 1px solid #99f6e4;
    text-decoration: none;
}

.tag-dataset.tag-interactive:hover {
    background: #99f6e4;
    border-color: #5eead4;
}

.tag-dataset.tag-interactive.active {
    background: #0f766e;
    color: #ffffff;
    border-color: #115e59;
    box-shadow: 0 1px 3px rgba(15, 118, 110, 0.35);
}

.tag-preprint {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.tag-preprint.tag-interactive:hover {
    background: #fde68a;
    border-color: #fcd34d;
}

.tag-preprint.tag-interactive.active {
    background: #d97706;
    color: #ffffff;
    border-color: #b45309;
    box-shadow: 0 1px 3px rgba(217, 119, 6, 0.35);
}

.tag-thesis {
    background: #e0e7ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

.tag-thesis.tag-interactive:hover {
    background: #c7d2fe;
    border-color: #a5b4fc;
}

.tag-thesis.tag-interactive.active {
    background: #4338ca;
    color: #ffffff;
    border-color: #3730a3;
    box-shadow: 0 1px 3px rgba(67, 56, 202, 0.35);
}

.pub-footer {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pub-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pub-link:hover {
    background: var(--secondary-color);
}

.share-btn {
    background: #0284c7;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.share-btn:hover {
    background: #0369a1;
}

.share-btn.copied {
    background: #16a34a !important;
}

.cite-btn {
    background: #0f766e;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.cite-btn:hover,
.cite-btn.active {
    background: #115e59;
}

.cited-by-btn {
    background: #d97706;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.cited-by-btn:hover,
.cited-by-btn.active {
}

.citation-container {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.citation-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.citation-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 280px;
    overflow-y: auto;
}

.citation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.65rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.citation-item:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: translateX(2px);
}

.citation-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.78rem;
    line-height: 1.35;
}

.citation-link-title {
    font-weight: 600;
    color: var(--primary-color);
}

.citation-meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.jump-arrow {
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: color 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.citation-item:hover .jump-arrow {
    color: var(--primary-color);
    transform: translateX(2px);
}

.publication-card.pub-highlight {
    border-left: 4px solid var(--primary-color);
    animation: pubHighlightPulse 2.5s ease-out;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35), var(--shadow-lg);
}

@keyframes pubHighlightPulse {
    0% {
        background-color: #dbeafe;
        box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.5), var(--shadow-lg);
    }
    70% {
        background-color: #eff6ff;
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35), var(--shadow-lg);
    }
    100% {
        background-color: var(--card-bg);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35), var(--shadow-lg);
    }
}

.bibtex-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bibtex-btn:hover,
.bibtex-btn.active {
    background: var(--text-primary);
}

.bibtex-container {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.code-container-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.45rem;
    margin-bottom: 0.55rem;
    border-bottom: 1px solid var(--border-color);
}

.code-format-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.code-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.code-action-btn {
    padding: 0.2rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 500;
    background: #e2e8f0;
    color: var(--text-primary);
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.code-action-btn:hover {
    background: #cbd5e1;
}

.inline-download-link {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.25);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.inline-download-link:hover {
    background: rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.4);
    text-decoration: none;
}

.abstract-container {
    background: #f8fafc;
}

.abstract-text {
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.55;
    margin: 0;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.bibtex-text {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary);
}

/* Pagination - Compact */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--card-bg);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.page-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: var(--secondary-color);
}

.page-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.page-info {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Footer - Compact */
footer {
    background: #1e293b;
    color: white;
    padding: 1rem 0;
    margin-top: 2rem;
    text-align: center;
    font-size: 0.8rem;
}

[data-theme="dark"] footer {
    background: #0f172a;
    border-top: 1px solid var(--border-color);
    color: #cbd5e1;
}

footer p {
    margin-bottom: 0.25rem;
    opacity: 0.9;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .filters {
        flex-direction: column;
    }

    .filter-select {
        width: 100%;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .pub-title {
        font-size: 0.9rem;
    }
}

/* Site Header Navigation Buttons */
.header-nav {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-btn {
    display: inline-block;
    padding: 0.45rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.nav-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    border-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.nav-divider {
    display: inline-block;
    width: 1px;
    height: 1.5rem;
    background: rgba(255, 255, 255, 0.35);
    margin: 0 0.25rem;
}

.nav-btn-dataset {
    background: rgba(20, 184, 166, 0.22);
    border-color: rgba(153, 246, 228, 0.45);
}

.nav-btn-dataset:hover {
    background: rgba(20, 184, 166, 0.38);
    border-color: rgba(153, 246, 228, 0.75);
}

.nav-btn-dataset.active {
    background: #ccfbf1;
    color: #0f766e;
    border-color: #99f6e4;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    user-select: none;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.5);
}

.theme-toggle-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.theme-toggle-text {
    font-size: 0.825rem;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.analytics-content {
    margin-top: 1rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.chart-container {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.chart-container h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.chart-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.chart-header-row h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.chart-replay-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.chart-step-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    background: #f1f5f9;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chart-step-btn:hover:not(:disabled) {
    background: #e2e8f0;
    border-color: var(--primary-color);
}

.chart-step-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chart-replay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 1.75rem;
    padding: 0 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    background: #f1f5f9;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.chart-replay-btn:hover {
    background: #e2e8f0;
    border-color: var(--primary-color);
}

.chart-replay-btn.playing {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.chart-replay-btn.paused {
    background: #dbeafe;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="dark"] .chart-replay-btn {
    background: #0f172a;
    color: #60a5fa;
    border-color: var(--border-color);
}

[data-theme="dark"] .chart-replay-btn:hover {
    background: #334155;
}

[data-theme="dark"] .chart-replay-btn.playing {
    background: var(--primary-color);
    color: white;
}

[data-theme="dark"] .chart-replay-btn.paused {
    background: rgba(59, 130, 246, 0.22);
    color: #93c5fd;
    border-color: #60a5fa;
}

[data-theme="dark"] .chart-step-btn {
    background: #0f172a;
    color: #60a5fa;
    border-color: var(--border-color);
}

[data-theme="dark"] .chart-step-btn:hover:not(:disabled) {
    background: #334155;
    border-color: #60a5fa;
}

.full-width-chart {
    grid-column: 1 / -1;
    margin-top: 1.5rem;
    overflow-x: auto;
}

.sites-chart-wrapper {
    min-width: 800px;
    height: 500px;
}

.chart-container canvas {
    max-height: 400px;
    width: 100% !important;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        padding: 1rem;
    }
    
    .chart-container h2 {
        font-size: 1rem;
    }
}

/* ==========================================================================
   Citation Network Graph Styles
   ========================================================================== */
.graph-main {
    max-width: 1560px;
    padding: 1rem 16px;
}

.graph-toolbar {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn-group {
    display: inline-flex;
    background: #f1f5f9;
    padding: 2px;
    border-radius: 6px;
    gap: 2px;
}

.pill-btn {
    border: none;
    background: transparent;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pill-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.6);
}

.pill-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.year-range-inputs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.toolbar-select {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    color: var(--text-primary);
}

/* Graph Search */
.graph-search-wrapper {
    position: relative;
    width: 220px;
}

.graph-search-input {
    width: 100%;
    padding: 0.38rem 1.8rem 0.38rem 0.65rem;
    font-size: 0.82rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.graph-search-input:focus {
    background: white;
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.clear-search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
}

.graph-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result-item {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s ease;
}

.search-result-item:hover {
    background: #f8fafc;
}

.search-result-item:last-child {
    border-bottom: none;
}

.result-key {
    font-size: 0.8rem;
    color: var(--primary-color);
}

.result-title {
    font-size: 0.75rem;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 2px 0;
}

.result-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.action-btn {
    border: 1px solid var(--border-color);
    background: white;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.clear-btn {
    color: #dc2626;
    border-color: #fecaca;
    background: #fff5f5;
}

.clear-btn:hover {
    background: #fee2e2;
}

/* Workspace Layout */
.graph-workspace {
    display: flex;
    gap: 1rem;
    height: calc(100vh - 210px);
    min-height: 640px;
}

.graph-canvas-container {
    flex: 1;
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.network-canvas {
    width: 100%;
    height: 100%;
}

/* HUD Overlay */
.canvas-hud {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 8px;
    pointer-events: none;
    z-index: 10;
}

.hud-badge {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-primary);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stabilizing-badge {
    color: #d97706;
    background: rgba(254, 243, 199, 0.9);
    border-color: #fde68a;
}

.active-hud {
    color: #ea580c;
    background: rgba(255, 247, 237, 0.95);
    border-color: #fed7aa;
}

/* Floating Zoom Controls */
.canvas-controls {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.15s ease;
}

.zoom-btn:hover {
    background: #f8fafc;
    color: var(--primary-color);
}

/* Graph Sidebar Inspector */
.graph-sidebar {
    width: 380px;
    flex-shrink: 0;
    overflow-y: auto;
    max-height: 100%;
}

.sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.sidebar-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.key-badge {
    background: #eff6ff;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #dbeafe;
}

.year-badge {
    background: #f1f5f9;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.close-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.close-sidebar-btn:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

.sidebar-authors {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.sidebar-venue {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.sidebar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.sidebar-link-btn {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    background: #f1f5f9;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: all 0.15s ease;
}

.sidebar-link-btn:hover {
    background: #e2e8f0;
}

.primary-link {
    background: #eff6ff;
    color: var(--primary-color);
    border-color: #bfdbfe;
}

.primary-link:hover {
    background: #dbeafe;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid #f1f5f9;
    margin: 1rem 0;
}

.citation-group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.outgoing-dot {
    background: #ea580c;
}

.incoming-dot {
    background: #2563eb;
}

.empty-citations {
    font-size: 0.75rem;
    color: #94a3b8;
    font-style: italic;
    padding: 0.25rem 0;
}

.sidebar-citation-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 200px;
    overflow-y: auto;
}

.sidebar-citation-item {
    padding: 0.5rem 0.6rem;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.15s ease;
}

.sidebar-citation-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateX(2px);
}

.item-header {
    font-size: 0.78rem;
    color: var(--primary-color);
}

.item-year {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-left: 4px;
}

.item-sub {
    font-size: 0.7rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
    margin-top: 1px;
}

.jump-indicator {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: 6px;
}

/* Overview Sidebar State */
.overview-card .overview-heading {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.overview-instructions {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 1rem;
}

.legend-box {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.legend-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2563eb;
    display: inline-block;
}

.legend-line {
    width: 16px;
    height: 2px;
    display: inline-block;
}

.incoming-line {
    background: #2563eb;
}

.outgoing-line {
    background: #ea580c;
}

.top-papers-section h4 {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.top-papers-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.top-paper-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.45rem 0.6rem;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.top-paper-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.top-paper-badge {
    background: #eff6ff;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

.top-paper-info {
    flex: 1;
    overflow: hidden;
}

.top-paper-key {
    font-size: 0.78rem;
    color: var(--text-primary);
}

.top-paper-title {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .graph-workspace {
        flex-direction: column;
        height: auto;
    }

    .graph-canvas-container {
        height: 520px;
    }

    .graph-sidebar {
        width: 100%;
    }
}

/* Vis.js Custom Tooltip Popup */
div.vis-tooltip {
    position: absolute;
    visibility: hidden;
    padding: 8px 12px !important;
    background-color: #ffffff !important;
    color: #1e293b !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
    max-width: 320px !important;
    white-space: normal !important;
    pointer-events: none !important;
    z-index: 10000 !important;
    line-height: 1.35 !important;
}

.network-tooltip .tooltip-header {
    font-size: 12px;
    margin-bottom: 3px;
}

.network-tooltip .tooltip-header strong {
    color: #2563eb;
}

.network-tooltip .tooltip-year {
    color: #64748b;
    font-size: 11px;
}

.network-tooltip .tooltip-title {
    font-size: 11.5px;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.35;
    margin-bottom: 4px;
}

.network-tooltip .tooltip-author {
    font-size: 10.5px;
    color: #64748b;
    margin-bottom: 4px;
    line-height: 1.3;
}

.network-tooltip .tooltip-meta {
    font-size: 11px;
    color: #64748b;
    border-top: 1px solid #f1f5f9;
    padding-top: 3px;
    margin-top: 2px;
}

.network-tooltip .tooltip-meta strong {
    color: #0f172a;
}

.network-tooltip .tooltip-site {
    color: #2563eb;
    font-weight: 600;
}

/* ==========================================================================
   Dark Mode Component Styles
   ========================================================================== */
[data-theme="dark"] header {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
}

[data-theme="dark"] .search-input {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .filter-select {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .filter-select option {
    background: var(--card-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .sort-select {
    background-color: #1e293b;
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .citation-container,
[data-theme="dark"] .bibtex-container {
    background: #0f172a !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .code-container-header {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .code-format-label {
    color: var(--text-secondary);
}

[data-theme="dark"] .code-action-btn {
    background: #334155;
    color: var(--text-primary);
    border-color: #475569;
}

[data-theme="dark"] .code-action-btn:hover {
    background: #475569;
}

[data-theme="dark"] .inline-download-link {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.35);
}

[data-theme="dark"] .inline-download-link:hover {
    background: rgba(96, 165, 250, 0.25);
    border-color: rgba(96, 165, 250, 0.5);
}

[data-theme="dark"] .abstract-container {
    background: #0f172a !important;
}

[data-theme="dark"] .citation-item {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .citation-item:hover {
    background: #334155;
}

[data-theme="dark"] .bibtex-text {
    color: #cbd5e1;
}

[data-theme="dark"] .author-pill:hover {
    background: rgba(96, 165, 250, 0.18);
    color: #93c5fd;
}

[data-theme="dark"] .author-pill.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.45);
}

[data-theme="dark"] .author-pill.active:hover {
    background: #1d4ed8;
    color: #ffffff;
}

[data-theme="dark"] .active-filter-chip {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .active-filter-chip:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(96, 165, 250, 0.55);
}

[data-theme="dark"] .active-filter-chip.chip-data {
    background: rgba(14, 165, 233, 0.18);
    color: #7dd3fc;
    border-color: rgba(14, 165, 233, 0.35);
}

[data-theme="dark"] .active-filter-chip.chip-data:hover {
    background: rgba(14, 165, 233, 0.3);
    border-color: rgba(125, 211, 252, 0.55);
}

[data-theme="dark"] .active-filter-chip.chip-site {
    background: rgba(168, 85, 247, 0.18);
    color: #d8b4fe;
    border-color: rgba(168, 85, 247, 0.35);
}

[data-theme="dark"] .active-filter-chip.chip-site:hover {
    background: rgba(168, 85, 247, 0.3);
    border-color: rgba(216, 180, 254, 0.55);
}

[data-theme="dark"] .active-filter-chip.chip-status {
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .active-filter-chip.chip-status:hover {
    background: rgba(245, 158, 11, 0.3);
    border-color: rgba(252, 211, 77, 0.55);
}

[data-theme="dark"] .active-filter-chip.chip-author {
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
    border-color: rgba(99, 102, 241, 0.4);
}

[data-theme="dark"] .active-filter-chip.chip-author:hover {
    background: rgba(99, 102, 241, 0.32);
    border-color: rgba(165, 180, 252, 0.6);
}

[data-theme="dark"] .copy-filter-link-btn {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.14);
    border-color: rgba(96, 165, 250, 0.35);
}

[data-theme="dark"] .copy-filter-link-btn:hover {
    background: rgba(96, 165, 250, 0.25);
    border-color: rgba(96, 165, 250, 0.55);
}

[data-theme="dark"] .copy-filter-link-btn.copied {
    background: #16a34a;
    color: #ffffff;
    border-color: #15803d;
}

[data-theme="dark"] .tag {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .tag.tag-interactive:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(96, 165, 250, 0.55);
}

[data-theme="dark"] .tag.tag-interactive.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #60a5fa;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.4);
}

[data-theme="dark"] .tag-data {
    background: rgba(14, 165, 233, 0.18);
    color: #7dd3fc;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

[data-theme="dark"] .tag-data.tag-interactive:hover {
    background: rgba(14, 165, 233, 0.3);
    border-color: rgba(125, 211, 252, 0.55);
}

[data-theme="dark"] .tag-data.tag-interactive.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

[data-theme="dark"] .tag-site {
    background: rgba(168, 85, 247, 0.18);
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

[data-theme="dark"] .tag-site.tag-interactive:hover {
    background: rgba(168, 85, 247, 0.3);
    border-color: rgba(216, 180, 254, 0.55);
}

[data-theme="dark"] .tag-site.tag-interactive.active {
    background: #7e22ce;
    color: #ffffff;
    border-color: #c084fc;
    box-shadow: 0 0 0 1px rgba(192, 132, 252, 0.4);
}

[data-theme="dark"] .tag-dataset {
    background: rgba(20, 184, 166, 0.18);
    color: #5eead4;
    border: 1px solid rgba(20, 184, 166, 0.32);
    text-decoration: none;
}

[data-theme="dark"] .tag-dataset.tag-interactive:hover {
    background: rgba(20, 184, 166, 0.3);
    border-color: rgba(94, 234, 212, 0.55);
}

[data-theme="dark"] .tag-dataset.tag-interactive.active {
    background: #0f766e;
    color: #ffffff;
    border-color: #2dd4bf;
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.4);
}

[data-theme="dark"] .tag-preprint {
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .tag-preprint.tag-interactive:hover {
    background: rgba(245, 158, 11, 0.3);
    border-color: rgba(252, 211, 77, 0.55);
}

[data-theme="dark"] .tag-preprint.tag-interactive.active {
    background: #d97706;
    color: #ffffff;
    border-color: #fbbf24;
}

[data-theme="dark"] .tag-thesis {
    background: rgba(99, 102, 241, 0.18);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .tag-thesis.tag-interactive:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: rgba(165, 180, 252, 0.55);
}

[data-theme="dark"] .tag-thesis.tag-interactive.active {
    background: #4f46e5;
    color: #ffffff;
    border-color: #818cf8;
}

[data-theme="dark"] .btn-group {
    background: #0f172a;
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .pill-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .pill-btn.active {
    background: var(--card-bg);
    color: var(--accent-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .toolbar-select {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .graph-search-input {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .graph-search-input:focus {
    background: #0f172a;
}

[data-theme="dark"] .graph-search-dropdown {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .search-result-item {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .search-result-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .action-btn {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .action-btn:hover {
    background: #334155;
}

[data-theme="dark"] .clear-btn {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.3);
    color: #f87171;
}

[data-theme="dark"] .graph-canvas-container {
    background: #0b1120;
    border-color: var(--border-color);
}

[data-theme="dark"] .hud-badge {
    background: rgba(15, 23, 42, 0.85);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .zoom-btn {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .zoom-btn:hover {
    background: #334155;
}

[data-theme="dark"] .key-badge {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

[data-theme="dark"] .year-badge {
    background: #334155;
    border-color: #475569;
    color: #cbd5e1;
}

[data-theme="dark"] .close-sidebar-btn:hover {
    background: #334155;
}

[data-theme="dark"] .sidebar-venue {
    color: #94a3b8;
}

[data-theme="dark"] .sidebar-link-btn {
    background: #1e293b;
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .sidebar-link-btn:hover {
    background: #334155;
}

[data-theme="dark"] .primary-link {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .primary-link:hover {
    background: rgba(59, 130, 246, 0.28);
}

[data-theme="dark"] .sidebar-divider {
    border-top-color: var(--border-color);
}

[data-theme="dark"] .sidebar-citation-item,
[data-theme="dark"] .legend-box,
[data-theme="dark"] .top-paper-item {
    background: #0f172a;
    border-color: var(--border-color);
}

[data-theme="dark"] .sidebar-citation-item:hover,
[data-theme="dark"] .top-paper-item:hover {
    background: #334155;
    border-color: #475569;
}

[data-theme="dark"] .legend-box strong {
    color: var(--text-primary);
}

[data-theme="dark"] .top-paper-badge {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

[data-theme="dark"] .stat-card {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .nav-btn.active {
    background: var(--card-bg);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

[data-theme="dark"] .nav-btn-dataset.active {
    background: #0f766e;
    color: #ffffff;
    border-color: #5eead4;
}

[data-theme="dark"] .network-tooltip {
    background: rgba(15, 23, 42, 0.95);
    border-color: #334155;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .network-tooltip .tooltip-title {
    color: #f8fafc;
}

[data-theme="dark"] .network-tooltip .tooltip-author {
    color: #94a3b8;
}

[data-theme="dark"] .network-tooltip .tooltip-meta {
    color: #94a3b8;
    border-top-color: #334155;
}

[data-theme="dark"] .network-tooltip .tooltip-meta strong {
    color: #f1f5f9;
}

[data-theme="dark"] .network-tooltip .tooltip-site {
    color: #60a5fa;
}

/* ==========================================================================
   Inter-Site Collaboration Matrix & Modal
   ========================================================================== */
.collab-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.collab-header-bar h2 {
    margin-bottom: 0.25rem !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

.section-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.collab-controls {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.collab-control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.matrix-sort-select {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
}

.collab-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.collab-stat-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.collab-stat-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.collab-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-color);
}

.collab-stat-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.matrix-wrapper {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    overflow: hidden;
}

.matrix-scroll-container {
    overflow: auto;
    max-height: 800px;
    padding: 0.75rem;
}

.collab-matrix-table {
    border-collapse: separate;
    border-spacing: 2px;
    margin: 0 auto;
    user-select: none;
}

.matrix-corner-cell {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 10;
    background: var(--card-bg);
    min-width: 82px;
    height: 75px;
    padding: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    border-right: 2px solid var(--border-color);
}

.matrix-axis-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.matrix-col-header {
    position: sticky;
    top: 0;
    z-index: 8;
    background: var(--card-bg);
    height: 75px;
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    vertical-align: bottom;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border-color);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.col-label-rot {
    display: inline-block;
    transform: rotate(-55deg);
    transform-origin: bottom left;
    white-space: nowrap;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 20px;
    margin-left: 12px;
}

.matrix-row-header {
    position: sticky;
    left: 0;
    z-index: 7;
    background: var(--card-bg);
    text-align: right;
    padding: 0 8px 0 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    border-right: 2px solid var(--border-color);
    height: 32px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.header-highlighted {
    background-color: rgba(37, 99, 235, 0.12) !important;
    color: var(--primary-color) !important;
}

.matrix-cell {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    padding: 0;
    text-align: center;
    vertical-align: middle;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: default;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.matrix-cell.has-papers,
.matrix-cell.diagonal-cell {
    cursor: pointer;
}

.matrix-cell:hover {
    transform: scale(1.18);
    z-index: 6;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    filter: brightness(1.08);
}

.cell-crosshair {
    outline: 1px dashed rgba(37, 99, 235, 0.45);
}

/* Heatmap Levels - Light Mode */
.matrix-cell.level-0 {
    background: #f8fafc;
    color: #cbd5e1;
}

.matrix-cell.level-1 {
    background: #dbeafe;
    color: #1e40af;
}

.matrix-cell.level-2 {
    background: #93c5fd;
    color: #1e3a8a;
}

.matrix-cell.level-3 {
    background: #3b82f6;
    color: #ffffff;
}

.matrix-cell.level-4 {
    background: #1d4ed8;
    color: #ffffff;
}

.matrix-cell.diagonal-cell {
    background: #e2e8f0;
    color: #475569;
    font-style: italic;
    font-weight: 700;
    border: 1px solid #cbd5e1;
}

.cell-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.matrix-footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.matrix-legend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.legend-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.legend-scale {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-cell {
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 3px;
    display: inline-block;
}

.legend-scale .level-0 {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid var(--border-color);
}

.legend-scale .level-1 {
    background: #dbeafe;
    color: #1e40af;
}

.legend-scale .level-2 {
    background: #93c5fd;
    color: #1e3a8a;
}

.legend-scale .level-3 {
    background: #3b82f6;
    color: #ffffff;
}

.legend-scale .level-4 {
    background: #1d4ed8;
    color: #ffffff;
}

.legend-diagonal {
    background: #e2e8f0;
    color: #475569;
    font-style: italic;
    border: 1px solid #cbd5e1;
    margin-left: 0.5rem;
}

.matrix-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Modal Dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
    animation: fadeIn 0.15s ease-out;
}

.modal-card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    max-width: 780px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    animation: slideUp 0.2s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.modal-close-btn:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-pub-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.modal-pub-title a {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    line-height: 1.4;
}

.modal-pub-title a:hover {
    text-decoration: underline;
}

.modal-pub-author {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.modal-pub-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.modal-action-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
}

.modal-action-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
}

.modal-action-link:hover {
    text-decoration: underline;
}

.modal-action-note {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.modal-btn {
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.modal-btn:hover {
    background: var(--secondary-color);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   Dark Mode Collaboration Matrix & Modal Overrides
   ========================================================================== */
[data-theme="dark"] .collab-stat-item {
    background: #0f172a;
    border-color: var(--border-color);
}

[data-theme="dark"] .matrix-sort-select {
    background: #1e293b;
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .matrix-wrapper {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .matrix-corner-cell,
[data-theme="dark"] .matrix-col-header,
[data-theme="dark"] .matrix-row-header {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .col-label-rot {
    color: var(--text-primary);
}

[data-theme="dark"] .header-highlighted {
    background-color: rgba(59, 130, 246, 0.25) !important;
    color: #60a5fa !important;
}

[data-theme="dark"] .matrix-cell.level-0 {
    background: #0f172a;
    color: #334155;
}

[data-theme="dark"] .matrix-cell.level-1 {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

[data-theme="dark"] .matrix-cell.level-2 {
    background: rgba(59, 130, 246, 0.45);
    color: #bfdbfe;
}

[data-theme="dark"] .matrix-cell.level-3 {
    background: rgba(37, 99, 235, 0.7);
    color: #ffffff;
}

[data-theme="dark"] .matrix-cell.level-4 {
    background: #2563eb;
    color: #ffffff;
}

[data-theme="dark"] .matrix-cell.diagonal-cell {
    background: #334155;
    color: #cbd5e1;
    border-color: #475569;
}

[data-theme="dark"] .legend-scale .level-0 {
    background: #0f172a;
    color: #94a3b8;
    border-color: var(--border-color);
}

[data-theme="dark"] .legend-scale .level-1 {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

[data-theme="dark"] .legend-scale .level-2 {
    background: rgba(59, 130, 246, 0.45);
    color: #bfdbfe;
}

[data-theme="dark"] .legend-scale .level-3 {
    background: rgba(37, 99, 235, 0.7);
    color: #ffffff;
}

[data-theme="dark"] .legend-scale .level-4 {
    background: #2563eb;
    color: #ffffff;
}

[data-theme="dark"] .legend-diagonal {
    background: #334155;
    color: #cbd5e1;
    border-color: #475569;
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.75);
}

[data-theme="dark"] .modal-card {
    background: #1e293b;
    border-color: var(--border-color);
}

[data-theme="dark"] .modal-pub-item {
    background: #0f172a;
    border-color: var(--border-color);
}

[data-theme="dark"] .modal-pub-title a {
    color: #60a5fa;
}

[data-theme="dark"] .modal-footer {
    background: #0f172a;
    border-color: var(--border-color);
}

[data-theme="dark"] .modal-close-btn:hover {
    background: #334155;
}

/* ==========================================================================
   Sites Map Page Styles
   ========================================================================== */
.map-toolbar {
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
}

.map-playback-group {
    gap: 0.35rem;
}

.map-play-btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: background 0.15s ease;
}

.map-play-btn:hover {
    background: var(--secondary-color);
}

.map-play-btn.playing {
    background: #ea580c;
}

.map-play-btn.playing:hover {
    background: #c2410c;
}

.map-step-btn,
.map-reset-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.65rem;
    min-height: 1.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.map-step-btn:hover:not(:disabled),
.map-reset-view-btn:hover {
    background: #e2e8f0;
}

.map-step-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.map-slider-group {
    flex: 1 1 240px;
    min-width: 220px;
}

.map-year-badge {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 3rem;
}

.map-year-slider {
    flex: 1;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.map-year-bounds {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.map-toggles {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.map-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.map-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.dvrk-map-canvas {
    width: 100%;
    height: 540px;
    z-index: 1;
}

.map-legend-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.map-legend-items {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.map-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
    border: 1.5px solid transparent;
}

.map-dot-zero {
    background: #dc2626;
    border-color: #991b1b;
}

[data-theme="dark"] .map-dot-zero {
    background: #f87171;
    border-color: #fca5a5;
}

.map-dot-pop {
    background: rgba(56, 189, 248, 0.3);
    border-color: #38bdf8;
}

.map-gradient-legend {
    gap: 0.45rem;
}

.map-gradient-bar {
    width: 110px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    background: linear-gradient(90deg, hsl(220, 84%, 52%) 0%, hsl(180, 80%, 47%) 50%, hsl(140, 76%, 42%) 100%);
    border: 1px solid var(--border-color);
}

.map-scale-label {
    font-weight: 600;
    color: var(--text-primary);
}

.map-pulse-wrapper {
    pointer-events: none;
}

.map-pulse-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: mapPulse 1.05s ease-out 1 forwards;
    box-sizing: border-box;
}

.map-pulse-ring.pulse-paper {
    border: 2px solid #38bdf8;
}

.map-pulse-ring.pulse-joined {
    border: 2px solid #60a5fa;
}

.map-pulse-ring.pulse-joined-pop {
    border: 2.5px solid #38bdf8;
    background: rgba(56, 189, 248, 0.24);
    animation: mapJoinPop 1.05s cubic-bezier(0.22, 1, 0.36, 1) 1 forwards;
}

@keyframes mapJoinPop {
    0% {
        transform: scale(0.3);
        opacity: 1;
    }
    45% {
        transform: scale(1.8);
        opacity: 0.9;
    }
    100% {
        transform: scale(2.15);
        opacity: 0;
    }
}

.map-site-chip.is-joined-this-year {
    box-shadow: 0 0 0 1.5px rgba(16, 185, 129, 0.55);
}

@keyframes mapPulse {
    0% {
        transform: scale(0.75);
        opacity: 0.9;
    }
    100% {
        transform: scale(1.55);
        opacity: 0;
    }
}

.map-tooltip-box {
    font-size: 0.8rem;
    line-height: 1.35;
}

.tooltip-delta {
    color: #ea580c;
    font-weight: 600;
}

.map-leaderboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.map-leaderboard-card h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.map-site-search {
    width: 260px;
}

.map-site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.65rem;
}

.map-site-chip {
    text-align: left;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.map-site-chip:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.map-site-chip.has-new-in-year {
    border-left: 3px solid #ea580c;
}

.map-site-chip.is-joined-only {
    opacity: 0.78;
    border-left: 3px solid #10b981;
}

.map-site-chip-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.map-site-code {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-color);
}

.map-site-count {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: #e2e8f0;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
}

.map-site-chip-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-site-chip-meta {
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.map-site-delta {
    color: #ea580c;
    font-weight: 600;
}

.modal-scope-tag {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.modal-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

[data-theme="dark"] .map-step-btn,
[data-theme="dark"] .map-reset-view-btn {
    background: #0f172a;
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .map-step-btn:hover:not(:disabled),
[data-theme="dark"] .map-reset-view-btn:hover {
    background: #334155;
}

[data-theme="dark"] .map-toolbar .btn-group {
    background: #0f172a;
}

[data-theme="dark"] .map-toolbar .pill-btn.active {
    background: #1e293b;
    color: #60a5fa;
}

[data-theme="dark"] .map-toolbar .toolbar-select,
[data-theme="dark"] .map-site-search {
    background: #0f172a;
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .map-site-chip {
    background: #0f172a;
}

[data-theme="dark"] .map-site-count {
    background: #334155;
    color: #f8fafc;
}

[data-theme="dark"] .dvrk-map-canvas {
    background: #0f172a;
}

.dvrk-map-canvas .leaflet-tile-pane {
    filter: grayscale(25%) contrast(0.95) brightness(1.02);
}

[data-theme="dark"] .dvrk-map-canvas .leaflet-tile-pane {
    filter: invert(100%) hue-rotate(180deg) brightness(92%) contrast(90%) saturate(0.65);
}

@media (max-width: 768px) {
    .dvrk-map-canvas {
        height: 400px;
    }
    .map-site-search {
        width: 100%;
    }
}

/* ==========================================================================
   Analytics Top-4 Charts Site Filter Bar
   ========================================================================== */
.analytics-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    margin-top: 1.25rem;
    padding: 0.85rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.chart-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.chart-mode-subtitle {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.sites-year-select {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.analytics-filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.analytics-filter-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.analytics-site-select {
    max-width: 360px;
    font-weight: 500;
}

.analytics-clear-btn {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    background: #f1f5f9;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.analytics-clear-btn:hover {
    background: #e2e8f0;
    border-color: var(--primary-color);
}

.analytics-filter-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.analytics-site-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.analytics-site-link:hover {
    text-decoration: underline;
}

[data-theme="dark"] .analytics-clear-btn {
    background: #0f172a;
    color: #60a5fa;
}

[data-theme="dark"] .analytics-clear-btn:hover {
    background: #334155;
}

@media (max-width: 768px) {
    .analytics-site-select {
        max-width: 100%;
        width: 100%;
    }
}

