/* Insights页面专用样式 */

.insights-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 200px);
}

/* 页面标题区域 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
}

.title-section {
    flex: 1;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 1.1rem;
    color: #64748b;
    margin: 0;
}

.controls-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 语言切换按钮 */
.language-toggle {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.language-toggle:hover {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* 搜索和过滤区域 */
.search-filters {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
}

/* 搜索框 */
.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 12px 50px 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #fafafa;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.search-btn:hover {
    color: #3b82f6;
    background: #f1f5f9;
}

/* 过滤器 */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.filter-select, .sort-select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.filter-option {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-option:hover {
    background: #f1f5f9;
    border-color: #3b82f6;
}

.filter-option.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.tags-filter {
    max-height: 120px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.tags-filter.expanded {
    max-height: none;
}

.show-more-btn {
    margin-top: 8px;
    padding: 4px 12px;
    border: 1px solid #3b82f6;
    border-radius: 15px;
    background: white;
    color: #3b82f6;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.show-more-btn:hover {
    background: #3b82f6;
    color: white;
}

.filter-select:focus, .sort-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.clear-filters {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    height: fit-content;
}

.clear-filters:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* 结果信息 */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 0 4px;
}

.results-count {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-label {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

/* 文章网格 */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

/* 文章卡片 */
.article-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #e2e8f0;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.article-card:hover::before {
    opacity: 1;
}

.article-header {
    margin-bottom: 16px;
}

.article-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.article-source {
    font-size: 0.875rem;
    color: #3b82f6;
    font-weight: 500;
    background: #eff6ff;
    padding: 4px 8px;
    border-radius: 4px;
}

.article-date {
    font-size: 0.8rem;
    color: #64748b;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.tag {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #e2e8f0;
}

.article-summary {
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
}

.article-quote {
    background: #f8fafc;
    border-left: 3px solid #3b82f6;
    padding: 12px 16px;
    margin: 16px 0;
    font-style: italic;
    color: #374151;
    border-radius: 0 6px 6px 0;
}

.article-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.read-more {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.read-more:hover {
    color: #2563eb;
    gap: 8px;
}

.expand-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 0.875rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background: #f1f5f9;
    color: #374151;
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f1f5f9;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.loading-text {
    color: #64748b;
    font-size: 1rem;
}

/* 无结果状态 */
.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.no-results-title {
    font-size: 1.5rem;
    color: #374151;
    margin-bottom: 8px;
}

.no-results-text {
    color: #64748b;
    font-size: 1rem;
}

/* 双语支持样式 */
.lang-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-toggle:hover {
    border-color: #3b82f6;
}

.lang-option {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.lang-option.active {
    background: #3b82f6;
    color: white;
}

/* 语言特定内容显示/隐藏 */
.lang-content {
    display: block;
}

.lang-content[data-lang="en"] {
    display: none;
}

.lang-content[data-lang="zh"] {
    display: block;
}

body.lang-en .lang-content[data-lang="en"] {
    display: block;
}

body.lang-en .lang-content[data-lang="zh"] {
    display: none;
}

/* 错误状态样式 */
.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-text {
    margin-bottom: 20px;
    color: #64748b;
}

.retry-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.retry-btn:hover {
    background: #2563eb;
}

/* 双语支持 - 默认显示中文 */
body:not(.lang-en) .title-en,
body:not(.lang-en) .subtitle-en,
body:not(.lang-en) .lang-en,
body:not(.lang-en) .label-en,
body:not(.lang-en) .option-en,
body:not(.lang-en) .clear-en,
body:not(.lang-en) .sort-en,
body:not(.lang-en) .sort-option-en,
body:not(.lang-en) .loading-en,
body:not(.lang-en) .no-results-en,
body:not(.lang-en) .no-results-desc-en {
    display: none;
}

/* 英文模式 */
body.lang-en .title-zh,
body.lang-en .subtitle-zh,
body.lang-en .lang-zh,
body.lang-en .label-zh,
body.lang-en .option-zh,
body.lang-en .clear-zh,
body.lang-en .sort-zh,
body.lang-en .sort-option-zh,
body.lang-en .loading-zh,
body.lang-en .no-results-zh,
body.lang-en .no-results-desc-zh {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .insights-container {
        padding: 16px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .search-filters {
        padding: 20px;
    }
    
    .filters {
        flex-direction: column;
        gap: 12px;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .results-info {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .article-card {
        padding: 20px;
    }
    
    .article-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.75rem;
    }
    
    .search-filters {
        padding: 16px;
    }
    
    .article-card {
        padding: 16px;
    }
    
    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* 性能优化 */
.article-card {
    will-change: transform;
    contain: layout style paint;
}

.article-card:hover {
    transform: translateY(-2px);
}

/* 加载优化 */
.articles-grid {
    contain: layout;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 减少重绘 */
.loading-spinner {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 优化字体渲染 */
body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}