/* Modern Academic Research Portal Design */
:root {
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --secondary: #5f6368;
    --accent: #ea4335;
    --success: #1e8e3e;
    --background: #ffffff;
    --surface: #f8f9fa;
    --surface-hover: #f1f3f4;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-tertiary: #80868b;
    --border: #dadce0;
    --shadow-sm: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
    --shadow-md: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
    --shadow-lg: 0 2px 6px 2px rgba(60,64,67,.15), 0 8px 24px 4px rgba(60,64,67,.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body.dark {
    --primary: #8ab4f8;
    --primary-hover: #aecbfa;
    --secondary: #9aa0a6;
    --accent: #f28b82;
    --success: #81c995;
    --background: #202124;
    --surface: #292a2d;
    --surface-hover: #35363a;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-tertiary: #5f6368;
    --border: #3c4043;
}

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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Header */
.header {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.toggle-mode-wrapper {
    display: flex;
}

.toggle-mode {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.toggle-mode:hover {
    background: var(--surface-hover);
    color: var(--primary);
}

.description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Container */
.container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Featured Papers */
.featured-section {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.section-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--success);
    margin-bottom: 2px;
}

.section-heading h2 {
    font-size: 24px;
    line-height: 1.25;
    color: var(--text-primary);
}

.section-link,
.featured-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.section-link:hover,
.featured-link:hover {
    color: var(--primary-hover);
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.featured-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px;
    min-height: 210px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.featured-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.featured-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.featured-rank {
    color: var(--success);
}

.featured-card h3 {
    font-size: 17px;
    line-height: 1.35;
}

.featured-card h3 a,
.paper-title a {
    color: var(--primary);
    text-decoration: none;
}

.featured-card h3 a:hover,
.paper-title a:hover {
    color: var(--primary-hover);
}

.featured-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    flex: 1;
}

.featured-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: auto;
}

/* Stats Toolbar */
.ia-toolbar {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stats-strip {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    background: var(--background);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

/* Active Filters */
.active-filters {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.active-filters-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.active-filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.active-filters-empty {
    font-size: 14px;
    color: var(--text-tertiary);
    font-style: italic;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
}

.filter-chip button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.filter-chip button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.quick-clear {
    margin-top: 12px;
    padding: 8px 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-clear:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    color: var(--primary);
}

/* Filter Bar */
.filter-bar {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    padding: 10px 18px;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 24px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.1;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.filter-btn:hover::before {
    width: 200px;
    height: 200px;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.15);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.filter-btn.active:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Custom Select Dropdown */
.custom-select {
    position: relative;
    width: 100%;
    max-width: 300px;
}

.select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.select-trigger:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.1);
}

.select-trigger.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.select-trigger i {
    color: var(--text-tertiary);
    transition: transform 0.2s;
}

.select-trigger.active i {
    transform: rotate(180deg);
}

.select-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.select-dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.select-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    color: var(--text-primary);
}

.select-option:hover {
    background: var(--surface-hover);
    color: var(--primary);
}

.select-option.selected {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.select-option:first-child {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.select-option:last-child {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* Custom scrollbar for dropdown */
.select-dropdown::-webkit-scrollbar {
    width: 8px;
}

.select-dropdown::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.select-dropdown::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.select-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Search Box */
/* Search Box */
.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    background: var(--background);
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 400;
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.search-box input:hover {
    border-color: var(--primary);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.1);
    transform: translateY(-1px);
}

.search-box i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 16px;
    pointer-events: none;
    transition: color 0.2s;
}

.search-box input:focus + i,
.search-box input:hover + i {
    color: var(--primary);
}

/* Paper List */
.paper-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.paper-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.paper-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: translateY(-2px);
}

.paper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.paper-venue {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.llm-badge {
    padding: 4px 10px;
    background: #e8f5e9;
    border: 1px solid #4caf50;
    color: #2e7d32;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

body.dark .llm-badge {
    background: rgba(76, 175, 80, 0.2);
    border-color: #66bb6a;
    color: #81c784;
}

.paper-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.2s;
}

.paper-title:hover {
    color: var(--primary-hover);
}

.paper-authors {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.paper-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.paper-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    padding: 4px 10px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.paper-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.paper-link:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* Loader */
.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.empty-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.reset-button, .clear-all {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.reset-button:hover, .clear-all:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

/* Results Info */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
}

#resultsCount {
    font-weight: 600;
    color: var(--primary);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.row {
    display: flex;
    flex-direction: row;
}

.gap-8 {
    gap: 8px;
}

.align-center {
    align-items: center;
}

/* Group Filter Bar */
.group-filter-bar {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.group-filter-bar .filter-btn {
    padding: 8px 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        padding: 16px 12px;
    }

    .header {
        padding: 24px 20px;
    }

    .title {
        font-size: 24px;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .stats-strip {
        flex-direction: column;
    }

    .stat-card {
        min-width: 100%;
    }

    .paper-card {
        padding: 20px 16px;
    }

    .paper-title {
        font-size: 16px;
    }

    .filter-bar, .ia-toolbar {
        padding: 16px;
    }

    .featured-section {
        padding: 16px;
    }

    .section-heading {
        flex-direction: column;
        align-items: stretch;
    }

    .section-link {
        white-space: normal;
    }

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

    .featured-card {
        min-height: auto;
    }
}

/* Smooth Transitions */
* {
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
