/* 全局样式 */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-color);
}

/* 导航栏 */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

/* 搜索区域 */
.search-section {
    padding: 40px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0 0 20px 20px;
    margin-top: 56px !important;
}

.search-box h1 {
    color: white;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.search-suggestions {
    background: white;
    border-radius: var(--border-radius);
    padding: 10px;
    box-shadow: var(--box-shadow);
    display: none;
}

.search-suggestions.show {
    display: block;
}

.search-suggestions .suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.search-suggestions .suggestion-item:hover {
    background-color: var(--light-color);
}

/* 分类导航 */
.category-nav {
    position: sticky;
    top: 56px;
    z-index: 999;
    background: white;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-tabs .nav-pills .nav-link {
    margin: 0 5px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.category-tabs .nav-pills .nav-link.active {
    background-color: var(--primary-color);
}

.category-tabs .nav-pills .nav-link:hover {
    transform: translateY(-2px);
}

/* 链接展示区域 */
.links-section {
    padding: 30px 0;
    min-height: 500px;
}

.category-section {
    margin-bottom: 40px;
}

.category-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary-color);
    color: var(--dark-color);
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.link-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.link-card.pinned {
    border: 2px solid var(--warning-color);
    position: relative;
}

.link-card.pinned::before {
    content: '\f08d';
    font-family: 'FontAwesome';
    font-weight: 900;
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--warning-color);
    font-size: 1.2rem;
}

.link-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    border-radius: 8px;
    object-fit: cover;
}

.link-icon.fa-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.5rem;
}

.link-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--dark-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.link-description {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 40px;
}

.link-stats {
    font-size: 0.75rem;
    color: var(--secondary-color);
    margin-top: auto;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* 页脚 */
.footer {
    background-color: var(--light-color) !important;
    border-top: 1px solid #dee2e6;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: var(--transition);
}

.back-to-top.show {
    display: flex;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* 公告弹窗 */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
}

.modal-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

#announcementContent {
    font-size: 1rem;
    line-height: 1.8;
    white-space: pre-line;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .search-section {
        padding: 30px 0;
    }

    .search-box h1 {
        font-size: 1.5rem;
    }

    .category-tabs .nav-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
    }

    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .link-card {
        padding: 15px;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 576px) {
    .links-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .link-card {
        padding: 12px;
    }

    .link-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .link-title {
        font-size: 0.9rem;
    }

    .link-description {
        font-size: 0.8rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.link-card {
    animation: fadeIn 0.5s ease;
}

/* 高亮搜索结果 */
.highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

/* A+ 首页视觉升级 */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #7c3aed;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --shadow-card: 0 12px 28px rgba(15, 23, 42, 0.07);
}

body {
    background: linear-gradient(180deg, #f8fbff 0%, #f8fafc 46%, #ffffff 100%);
    color: var(--ink);
}

.research-hero {
    position: relative;
    overflow: hidden;
    padding: 86px 0 56px;
    background:
        radial-gradient(circle at 16% 18%, rgba(96, 165, 250, 0.32), transparent 30%),
        radial-gradient(circle at 84% 10%, rgba(168, 85, 247, 0.24), transparent 28%),
        linear-gradient(135deg, #f8fbff 0%, #eef6ff 54%, #f7f3ff 100%);
}

.hero-glow { position: absolute; width: 240px; height: 240px; border-radius: 50%; filter: blur(48px); opacity: 0.36; }
.hero-glow-left { left: -90px; bottom: -120px; background: #60a5fa; }
.hero-glow-right { top: -120px; right: -90px; background: #a855f7; }

.hero-content { position: relative; z-index: 1; max-width: 900px; text-align: center; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
}

.research-hero h1 { margin: 18px 0 12px; font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 900; letter-spacing: -0.05em; }
.hero-subtitle { max-width: 680px; margin: 0 auto 28px; color: var(--muted); font-size: 1.08rem; }

.hero-search {
    display: flex;
    align-items: center;
    max-width: 720px;
    margin: 0 auto;
    padding: 6px 8px 6px 18px;
    background: var(--surface);
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 999px;
    box-shadow: 0 20px 45px rgba(30, 64, 175, 0.16);
}

.hero-search .form-control { border: 0; box-shadow: none; }
.search-icon { color: var(--primary); }
.search-suggestions { max-width: 720px; margin: 12px auto 0; text-align: left; }

.site-stats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.stat-pill { display: inline-flex; align-items: baseline; gap: 6px; padding: 9px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(226, 232, 240, 0.9); color: var(--muted); }
.stat-pill strong { color: var(--primary-dark); }

.category-section { margin: 28px 0; }
.category-list { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.category-list .category-item, .category-pill { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: #475569; transition: all 0.18s ease; }
.category-list .category-item.active, .category-pill.active { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-color: transparent; box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22); }

.links-main { min-height: 500px; padding-bottom: 30px; }
.link-card { height: 100%; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-card); transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.link-card:hover { transform: translateY(-4px); border-color: rgba(37, 99, 235, 0.28); box-shadow: 0 18px 38px rgba(15, 23, 42, 0.11); }
.link-icon-wrapper { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 10px; border-radius: 16px; background: #f8fafc; border: 1px solid var(--line); }
.link-icon { width: 30px; height: 30px; margin-bottom: 0; object-fit: contain; }
.link-icon-placeholder { color: var(--primary); font-size: 1.2rem; }
.empty-state { width: 100%; padding: 58px 20px; text-align: center; color: var(--muted); }

@media (max-width: 768px) {
    .research-hero { padding: 64px 0 42px; }
    .hero-search { border-radius: 22px; }
}
