/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1574FF;
    --primary-hover: #0d5fd6;
    --primary-light: #e6f1ff;
    --secondary-color: #f8f9fa;
    --text-color: #333;
    --text-light: #666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 20px rgba(21, 116, 255, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fafbfc;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0d5fd6 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
}

header h1 {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 600;
}

.header-text {
    flex: 1;
    min-width: 200px;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.95;
    margin-bottom: 0.25rem;
}

.update-time {
    font-size: 0.85rem;
    opacity: 0.85;
}

/* 导航和筛选 */
nav {
    background: white;
    padding: 1.5rem 20px;
    margin: 1.5rem auto;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.filter-section {
    margin-bottom: 1rem;
}

.filter-group {
    margin-bottom: 1.25rem;
}

.filter-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.filter-label {
    display: inline-block;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.manage-categories-btn {
    padding: 0.4rem 0.8rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    font-weight: 500;
}

.manage-categories-btn:hover {
    background: var(--primary-color);
    color: white;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-btn:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(21, 116, 255, 0.3);
}

.search-box {
    margin-top: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
    background: #fff;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(21, 116, 255, 0.1);
}

/* 主内容区域 */
main {
    margin-top: 0;
    padding-bottom: 2rem;
}

#papers-container {
    margin-top: 1rem;
}

/* 结果信息栏 */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--secondary-color);
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 1rem;
}

#resultsCount {
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 500;
}

.export-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.export-btn {
    padding: 0.6rem 1.2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.export-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.select-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.select-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* 论文卡片 */
.paper-card {
    position: relative;
    background: white;
    padding: 1.5rem;
    padding-top: 2.5rem;
    padding-left: 4rem;
    margin-bottom: 1.25rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border: 1px solid #f0f0f0;
}

.paper-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

/* 复选框样式 */
.paper-select {
    position: absolute;
    left: 1.2rem;
    top: 1.5rem;
}

.paper-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.paper-content {
    flex: 1;
}

/* Venue 徽章 */
.venue-badge {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    margin-left: 0.5rem;
    max-width: 600px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
}

.badge-neurips {
    background: #6B46C1;
    color: white;
}

.badge-cvpr, .badge-iccv, .badge-eccv {
    background: #E53E3E;
    color: white;
}

.badge-icml, .badge-iclr {
    background: #3182CE;
    color: white;
}

.badge-acl, .badge-emnlp, .badge-naacl {
    background: #38A169;
    color: white;
}

.badge-aaai, .badge-ijcai {
    background: #D69E2E;
    color: white;
}

.badge-published {
    background: #4A5568;
    color: white;
}

.preprint {
    background: #f5f5f5;
    color: #757575;
}

.paper-title {
    font-size: 1.25rem;
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.paper-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.paper-title a:hover {
    color: var(--primary-color);
}

.paper-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    color: var(--text-light);
    align-items: center;
}

.meta-item {
    display: inline-flex;
    align-items: center;
}

.paper-authors {
    margin-bottom: 0.8rem;
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
}

.paper-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.paper-abstract {
    margin-bottom: 1rem;
}

.paper-abstract details summary {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 500;
    user-select: none;
    padding: 0.5rem 0;
}

.paper-abstract details[open] summary {
    margin-bottom: 0.5rem;
}

.paper-abstract p {
    color: var(--text-light);
    line-height: 1.8;
    text-align: justify;
}

.paper-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-link {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-block;
}

.btn-link:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-code {
    background: #28a745;
}

.btn-code:hover {
    background: #218838;
}

.btn-project {
    background: #17a2b8;
}

.btn-project:hover {
    background: #138496;
}

/* 底部 */
footer {
    background: #1a1a1a;
    color: #e0e0e0;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.3s;
}

footer a:hover {
    opacity: 0.8;
}

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

/* 加载指示器 */
.loading-indicator {
    text-align: center;
    padding: 2rem;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 500;
}

.loading-indicator::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideUp 0.3s;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--secondary-color);
}

.modal-header h2 {
    font-size: 1.3rem;
    color: var(--text-color);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 100px);
}

.add-category-section {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.category-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.category-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(21, 116, 255, 0.1);
}

.add-category-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}

.add-category-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.custom-categories-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.custom-category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--secondary-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.custom-category-item span {
    font-weight: 500;
    color: var(--text-color);
}

.delete-category-btn {
    padding: 0.4rem 0.8rem;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.delete-category-btn:hover {
    background: #cc0000;
    transform: translateY(-1px);
}

.empty-message {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-style: italic;
}

.modal-hint {
    background: var(--primary-light);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
}

.modal-hint p {
    margin: 0;
    color: var(--text-color);
    font-size: 0.9rem;
}

.category-info {
    width: 100%;
}

.category-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.category-name-row strong {
    color: var(--text-color);
    font-size: 1rem;
}

.category-keywords {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.category-keywords label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.keywords-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.keywords-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(21, 116, 255, 0.1);
}

.save-keywords-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
    align-self: flex-start;
}

.save-keywords-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.keywords-hint {
    margin-top: 0.25rem;
}

.keywords-hint small {
    color: var(--text-light);
    font-size: 0.8rem;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .category-name-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .delete-category-btn {
        width: 100%;
    }
    
    .category-keywords {
        gap: 0.75rem;
    }
    
    .save-keywords-btn {
        width: 100%;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    header {
        padding: 1rem 0;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .logo-section {
        width: 100%;
    }

    .site-logo {
        width: 40px;
        height: 40px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .update-time {
        font-size: 0.8rem;
    }

    nav {
        padding: 1rem 16px;
        margin: 1rem auto;
        border-radius: 10px;
    }

    .filter-group {
        margin-bottom: 1rem;
    }

    .filter-label-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .filters {
        gap: 0.4rem;
    }

    .filter-btn {
        padding: 0.45rem 0.85rem;
        font-size: 0.85rem;
    }

    .results-info {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .export-controls {
        width: 100%;
        justify-content: stretch;
    }

    .select-btn, .export-btn {
        flex: 1;
        min-width: 0;
    }

    .paper-card {
        padding: 1.25rem;
        padding-top: 2.25rem;
        padding-left: 3.5rem;
        margin-bottom: 1rem;
    }

    .paper-select {
        left: 1rem;
        top: 1.25rem;
    }

    .paper-title {
        font-size: 1.1rem;
    }

    .paper-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .paper-links {
        flex-direction: column;
    }

    .btn-link {
        width: 100%;
        text-align: center;
    }

    .modal-content {
        max-width: 100%;
        margin: 1rem;
        max-height: 90vh;
    }

    .modal-header {
        padding: 1.25rem;
    }

    .modal-body {
        padding: 1.25rem;
    }

    .add-category-section {
        flex-direction: column;
    }

    .add-category-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3rem;
    }

    .site-logo {
        width: 36px;
        height: 36px;
    }

    .filter-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .paper-card {
        padding: 1rem;
        padding-top: 2rem;
        padding-left: 3rem;
    }

    .paper-title {
        font-size: 1rem;
    }
}
