:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #333333;
    --border-color: #dee2e6;
    --hover-color: #f1f3f5;
    --link-color: #3498db;
    --link-hover: #2980b9;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

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

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.site-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    padding: 0.3rem;
    background: rgba(255, 255, 255, 1.0);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.site-logo-link:hover {
    background: rgba(255, 255, 255, 0.582);
    transform: translateY(-1px);
    text-decoration: none;
}

.site-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    display: block;
}

.header-intro {
    flex: 1;
    min-width: 260px;
}

.github-link {
    color: white;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.github-link:hover {
    opacity: 0.75;
    color: white;
    text-decoration: none;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

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

section {
    background: var(--card-background);
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.8rem;
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.intro ul {
    list-style-position: inside;
    margin: 1rem 0;
    padding-left: 1rem;
}

.intro li {
    margin: 0.5rem 0;
}

.note {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

/* Search Section */
.search-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

#searchInput {
    flex: 1;
    min-width: 300px;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: border-color 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

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

.btn-export {
    padding: 0.75rem 1.5rem;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    font-weight: 600;
}

.btn-export:hover {
    background-color: #229954;
}

.stats {
    padding: 0.75rem;
    background-color: var(--hover-color);
    border-radius: 4px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-hint {
    flex-shrink: 0;
    font-weight: normal;
}

/* Table Section */
.table-container {
    overflow-x: auto;
    overflow-y: auto;
    margin-top: 1rem;
    max-height: 600px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    /* Improve horizontal scrolling */
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-color) var(--hover-color);
}

.table-container::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--hover-color);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--link-hover);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background-color: white;
}

thead {
    position: sticky;
    top: 0;
    background-color: var(--primary-color);
    color: white;
    z-index: 10;
}

/* Filter row sticky below header */
#filterRow {
    position: sticky;
    top: 48px; /* Adjust based on header height */
    background-color: #f8f9fa;
    z-index: 9;
}

th {
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.1);
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.6rem;
}

th.sortable::after {
    content: '↕';
    position: absolute;
    right: 0.5rem;
    opacity: 0.45;
    font-size: 0.85rem;
}

th.sortable.sort-active::after {
    opacity: 1;
}

th.sortable.sort-asc::after {
    content: '▲';
}

th.sortable.sort-desc::after {
    content: '▼';
}

th:last-child {
    border-right: none;
}

/* Sticky first column */
th:first-child,
td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background-color: var(--card-background);
    box-shadow: 2px 0 5px rgba(0,0,0,0.15);
    font-weight: 600;
}

thead th:first-child {
    background-color: var(--primary-color);
    z-index: 15;
}

#filterRow td:first-child {
    background-color: #f8f9fa;
    z-index: 5;
}

tbody tr:hover td:first-child {
    background-color: #e3f2fd;
}

tbody tr:nth-child(even) td:first-child {
    background-color: #fafafa;
}

tbody tr:nth-child(even):hover td:first-child {
    background-color: #e3f2fd;
}

/* Column visibility */
.column-hidden {
    display: none;
}

.filter-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.85rem;
    background-color: white;
}

.filter-input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

#filterRow {
    background-color: #f8f9fa;
}

#filterRow td {
    padding: 0.5rem;
    border-right: 1px solid var(--border-color);
}

#filterRow td:last-child {
    border-right: none;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: #e3f2fd;
}

tbody tr:nth-child(even) {
    background-color: #fafafa;
}

tbody tr:nth-child(even):hover {
    background-color: #e3f2fd;
}

td {
    padding: 0.75rem;
    vertical-align: top;
    border-right: 1px solid var(--border-color);
}

td:last-child {
    border-right: none;
}

/* Links and Buttons */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.btn-link {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background-color: var(--secondary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 0.2rem;
    transition: background-color 0.3s;
    text-decoration: none;
}

.btn-link:hover {
    background-color: var(--link-hover);
    text-decoration: none;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    margin-top: 2rem;
}

footer a {
    color: #85c1e9;
}

footer a:hover {
    color: white;
}

.disclaimer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    section {
        padding: 1.5rem;
    }
    
    .search-controls {
        flex-direction: column;
    }
    
    #searchInput {
        min-width: 100%;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
    
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* Column Toggles */
.column-toggles {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--hover-color);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.column-toggles h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.column-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem;
}

.column-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.column-checkbox label {
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
}

/* Citation Box */
.citation-box {
    background-color: #f8f9fa;
    border-left: 4px solid var(--secondary-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.citation-box h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.citation-box pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0;
}

.citation-box code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Contact Section */
.contact p {
    margin: 0.5rem 0;
}
