/* 全局样式 */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
}

/* 加载动画 */
.loader {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-bottom-color: #1E40AF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 淡入动画 */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

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

/* 卡片悬停效果 */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* 文本截断 */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* 首页特定样式 */
.search-container {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    z-index: 40;
}

.search-container.hidden {
    transform: translateY(-100%);
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
    border-bottom: none;
}

.tags-container {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    transition: top 0.3s ease;
    z-index: 30;
}

.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 4px 0;
}

.filter-tab {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    white-space: nowrap;
    background-color: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-tab:hover {
    background-color: #e2e8f0;
    border-color: #cbd5e1;
}

.filter-tab.active {
    background-color: #1E40AF;
    color: white;
    border-color: #1E40AF;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2);
}

/* 响应式设计优化 */
@media (max-width: 768px) {
    .search-container {
        top: 56px;
    }
    
    .tags-container {
        top: 116px;
    }
    
    .tags-container.scrolled-up {
        top: 56px;
    }
    
    .filter-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 8px 0;
    }
    
    .filter-tab {
        flex-shrink: 0;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 修复移动端按钮点击区域 */
    .gradient-btn {
        padding: 14px 20px;
        width: 100%;
        font-size: 14px;
    }
    
    .modern-input {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .modern-tab {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .pagination-btn {
        width: 36px;
        height: 36px;
    }
}

/* 无障碍支持 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 焦点样式 */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #1E40AF;
    outline-offset: 2px;
}

/* 选择文本样式 */
::selection {
    background-color: rgba(30, 64, 175, 0.2);
    color: inherit;
}

/* 确保底部导航不被内容遮挡 */
.main-container {
    padding-bottom: 4rem;
}