/* 番茄小说数据分析平台 - 主样式表 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0 2rem 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 导航栏 */
.nav-bar {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 2rem;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.nav-link {
    display: inline-block;
    padding: 1rem 2rem;
    color: #666;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
}

.nav-link:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    border-bottom-color: #667eea;
}

.nav-link.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.08);
}

/* Tab内容区域 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 统计卡片 */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.stat-card h3 {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: #666;
    font-size: 0.9rem;
}

/* 区块 */
.section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 0.5rem;
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* 排名徽章 */
.ranking {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    background: #667eea;
    color: white;
    font-weight: bold;
}

.ranking.top3 {
    background: #f59e0b;
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 20px;
    font-size: 0.85rem;
}

.status-serializing {
    background: #d1fae5;
    color: #065f46;
}

/* 功能特性 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.feature-item {
    padding: 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.3s;
}

.feature-item:hover {
    border-color: #667eea;
    background: #f9fafb;
}

.feature-item h3 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.feature-item p {
    color: #666;
    font-size: 0.95rem;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 0.9rem;
    background: white;
    margin-top: 2rem;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #999;
}

/* 响应式 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .container {
        padding: 1rem;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }

    .filter-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .filter-group {
        width: 100%;
    }

    .category-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ==================== 新增样式 ==================== */

/* 筛选栏 */
.filter-bar {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* 分类Tab */
.category-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-button {
    padding: 0.5rem 1.25rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    white-space: nowrap;
    color: #666;
}

.tab-button:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    color: #667eea;
}

.tab-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 筛选下拉框 */
.filter-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 2rem;
    background-color: white;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 搜索框 */
.search-box input {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 0.9rem;
    width: 250px;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    width: 300px;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 热力色 */
.heat-low {
    color: #6b7280;
    font-weight: 500;
}

.heat-medium {
    color: #667eea;
    font-weight: 600;
}

.heat-high {
    color: #f59e0b;
    font-weight: 700;
}

/* 表格行可点击 */
.book-row {
    cursor: pointer;
    transition: background 0.2s;
}

.book-row:hover {
    background: #f9fafb;
}

/* 详情面板 */
.detail-panel {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.detail-panel.open {
    right: 0;
}

.detail-panel-content {
    padding: 2rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.detail-header h3 {
    font-size: 1.5rem;
    color: #333;
    line-height: 1.4;
    padding-right: 2rem;
}

.close-button {
    background: none;
    border: none;
    font-size: 2rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    line-height: 1;
    transition: color 0.3s;
}

.close-button:hover {
    color: #333;
}

.detail-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 详情数据卡片 */
.detail-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.detail-stat {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-stat .label {
    font-size: 0.85rem;
    color: #6b7280;
}

.detail-stat .value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

/* 详情区块 */
.detail-section h4 {
    font-size: 1rem;
    color: #555;
    margin-bottom: 0.75rem;
}

.detail-section p,
.detail-desc {
    color: #666;
    line-height: 1.8;
}

.author-sign {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.9rem;
    margin-top: 0.25rem !important;
}

/* 标签容器 */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-item {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
}

/* 平台标签（番茄官方标签） */
.tag-platform {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 500;
}

/* 提取标签（程序从简介提取） */
.tag-extracted {
    background: #fef3c7;
    color: #92400e;
}

/* 关键词高亮 */
.keyword-highlight {
    background: #fef3c7;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* 相似书籍 */
.similar-books {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.similar-book-item {
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.similar-book-item:hover {
    background: #e5e7eb;
}

.similar-book-item strong {
    color: #333;
}

.similarity-score {
    background: #dbeafe;
    color: #1e40af;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.similar-book-item p {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* 操作按钮 */
.detail-actions {
    margin-top: 1rem;
}

.action-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.action-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.action-button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #9ca3af;
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: #9ca3af;
}

.error {
    text-align: center;
    padding: 3rem;
    color: #ef4444;
}

/* ==================== 按钮统一样式 ==================== */

/* 所有按钮的基础样式 */
button {
    font-family: inherit;
    border: none;
    outline: none;
}

button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

/* ==================== 收藏夹样式 ==================== */

/* 收藏夹按钮 */
.favorites-toggle {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}

.favorites-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

.favorites-toggle:active {
    transform: translateY(0);
}

/* 收藏夹区域 */
.favorites-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

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

/* 收藏按钮（详情面板） */
.action-button.favorited {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

/* 取消收藏按钮 */
.remove-favorite-btn {
    padding: 0.25rem 0.75rem;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.remove-favorite-btn:hover {
    background: #fecaca;
}

/* ==================== 趋势分析页样式 ==================== */

/* 导航链接 */
.nav-links {
    margin-top: 1rem;
}

.nav-links a {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-links a:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

/* 词云容器 */
.wordcloud-container {
    width: 100%;
    height: 400px;
    position: relative;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hint {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

/* 洞察卡片 */
.insights-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.insight-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.insight-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.insight-card p {
    font-size: 1rem;
    line-height: 1.6;
}

.insight-card strong {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

/* ==================== 对比工具页样式 ==================== */

/* 对比选择区域 */
.compare-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .compare-selection {
        grid-template-columns: 1fr;
    }
}

/* 搜索区域 */
.search-area-wrapper {
    position: relative;
}

.search-area {
    width: 100%;
}

#bookSearchInput {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    box-sizing: border-box;
}

#bookSearchInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 搜索结果 */
.search-results {
    position: absolute;
    left: 0;
    width: 100%;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    box-sizing: border-box;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f3f4f6;
}

.search-result-item:hover {
    background: #f9fafb;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item strong {
    display: block;
    color: #333;
}

.search-result-item span {
    color: #6b7280;
    font-size: 0.9rem;
}

.search-result-item small {
    color: #9ca3af;
    font-size: 0.85rem;
}

/* 已选书籍 */
.selected-books h4 {
    margin-bottom: 1rem;
    color: #555;
}

.selected-books-list {
    min-height: 100px;
}

.selected-book-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.selected-book-item strong {
    color: #333;
}

.selected-book-item span {
    color: #6b7280;
    font-size: 0.9rem;
}

.remove-btn {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: #fecaca;
}

/* 对比按钮区域 */
.section .action-button {
    margin: 0 0.5rem 0 0;
}

/* 对比结果 */
.compare-result {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 对比表格 */
.compare-table-container {
    overflow-x: auto;
    margin-bottom: 2rem;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
}

.compare-table th,
.compare-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.compare-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #555;
}

.compare-table tbody tr:hover {
    background: #f9fafb;
}

/* 图表容器 */
.compare-charts {
    margin: 2rem 0;
}

.chart-container {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-container h4 {
    margin-bottom: 1rem;
    color: #555;
}

/* 分析结论 */
.compare-analysis {
    margin-top: 2rem;
}

.analysis-card {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
}

.analysis-card h4 {
    margin-bottom: 1rem;
}

.analysis-card p {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.analysis-card strong {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.no-result {
    padding: 1rem;
    text-align: center;
    color: #9ca3af;
}

/* 单选按钮组样式 */
.radio-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    transition: all 0.2s ease;
    user-select: none;
}

.radio-label:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.radio-label input[type="radio"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.radio-label input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

.radio-label:has(input[type="radio"]:checked) {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

/* 筛选摘要 */
.filter-summary {
    background: rgba(102, 126, 234, 0.1);
    border-left: 4px solid #667eea;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    font-size: 0.95rem;
}

.filter-summary span {
    font-weight: 600;
    color: #667eea;
}
