/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.5;
    padding: 10px;
}

a {
    color: #ff4d4f;
    text-decoration: none;
    word-break: break-all;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 新闻容器样式 */
.news-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: relative;
    padding: 0;
}

/* 固定定位样式 */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: white;
    z-index: 2001; /* 提高z-index，确保fixed-header及其子元素（包括提示框）显示在news-container上方 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    width: 100%;
}

.news-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.news-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #262626;
    margin-bottom: 8px;
}

.refresh-btn {
    background-color: transparent;
    color: #999;
    border: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: content-box;
    line-height: 1;
}

.refresh-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}

.refresh-btn:hover {
    background-color: rgba(255, 77, 79, 0.1);
    color: #ff4d4f;
}

.refresh-btn:active {
}

.refresh-btn.loading {
}

.news-stats {
    font-size: 14px;
    color: #52c41a;
    background-color: #f6ffed;
    border: 1px solid #b7eb8f;
    border-radius: 4px;
    padding: 6px 12px;
    display: inline-block;
}

/* 新闻标签页样式 */
.news-tabs {
    background-color: #fafafa;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    white-space: nowrap;
}

/* 隐藏滚动条 */
.news-tabs::-webkit-scrollbar {
    display: none;
}

/* 禁止tab按钮换行 */
.news-tab {
    flex-shrink: 0;
}

/* 内容区域样式 */
.content-wrapper {
    margin-top: 118px; /* 减小margin-top，缩小与固定标题的距离 */
    padding: 0;
}

.news-tab-content {
    margin-top: 0;
}

.news-tab {
    flex: 1 1 0;
    padding: 6px 16px 4px; /* 减小下padding，更紧凑 */
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px; /* 减小字体大小 */
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    position: relative;
    text-align: center;
}

.news-tab.active {
    color: #ff4d4f;
    background-color: white;
}

.news-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #ff4d4f;
}

.news-tab:hover {
    color: #ff4d4f;
    background-color: rgba(255, 77, 79, 0.05);
}

/* 小字体统计信息样式 */
.news-stats-small {
    font-size: 11px;
    color: #999;
    font-weight: normal;
    margin-left: 6px;
    white-space: nowrap;
    display: inline-block;
}

/* 统计信息容器样式 */
.stats-container {
    display: inline-flex;
    align-items: center;
    width: auto;
    flex-shrink: 1;
}

/* 问号图标样式 */
.stats-tooltip-container {
    position: relative;
    margin-left: 4px;
    display: inline-block;
}

.stats-question {
    font-size: 10px;
    color: #999;
    background-color: #f0f0f0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    transition: all 0.3s ease;
    font-weight: bold;
}

.stats-question:hover {
    background-color: rgba(255, 77, 79, 0.1);
    color: #ff4d4f;
}

/* 提示框样式 */
.stats-tooltip {
    position: fixed;
    background-color: white;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px;
    width: 200px;
    z-index: 2000; /* 设置更高的z-index，确保显示在所有内容上方 */
    display: none;
    pointer-events: auto;
    transform: translateX(-50%);
    margin-top: 4px;
}

/* 提示框显示 */
.stats-tooltip-container:hover .stats-tooltip {
    display: block;
}

/* 提示框内容样式 */
.tooltip-content {
    font-size: 12px;
    color: #333;
}

.tooltip-content p {
    margin: 4px 0;
    line-height: 1.4;
}

.tooltip-label {
    color: #ff4d4f;
    font-weight: bold;
}

/* 提示框箭头 */
.stats-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid white;
}

.stats-tooltip::after {
    content: '';
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid #e8e8e8;
    z-index: -1;
}

/* 新闻内容区域 */
.news-tab-content {
    min-height: 400px;
    padding: 0;
    margin-top: 0;
}

.news-tab-pane {
    display: none;
    padding: 0;
}

.news-tab-pane.active {
    display: block;
    padding: 0;
}

/* 新闻列表样式 */
.news-list {
    padding: 0 8px; /* 进一步减小左右padding */
    margin-top: 0;
}

/* 中国相关内容样式 */
.china-content .china-title,
.china-content .china-detail {
    color: #ff4d4f;
}

/* 新闻项样式 - 参考同花顺7X24小时快讯 */
.news-item {
    display: flex;
    padding: 8px 12px 8px 16px; /* 调整左侧padding */
    border-bottom: 0.5px solid #f0f0f0; /* 减小边框宽度 */
    transition: all 0.2s ease;
    background-color: white;
    position: relative;
}

/* 时间线样式 */
.news-item::before {
    content: '';
    position: absolute;
    left: 8px; /* 调整时间线位置 */
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e8e8e8;
    z-index: 1;
}

/* 第一个新闻项的时间线不显示顶部部分 */
.news-item:first-child::before {
    top: 20px; /* 从第一个时间点开始 */
}

/* 最后一个新闻项的时间线不显示底部部分 */
.news-item:last-child::before {
    bottom: 20px; /* 到最后一个时间点结束 */
}

.news-item:hover {
    background-color: #fafafa;
}

.news-item:last-child {
    border-bottom: none;
}

/* 时间样式 */
.news-time {
    width: 80px;
    font-size: 12px;
    color: #999;
    padding-left: 12px;
    padding-right: 8px;
    text-align: right;
    flex-shrink: 0;
    line-height: 18px;
    position: relative;
    z-index: 2;
}

/* 时间点样式 - 与时间线重合 */
.news-time::before {
    content: '';
    position: absolute;
    left: -9px; /* 调整left值，使时间点与时间线重合 */
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #e8e8e8;
    z-index: 3;
}

/* 中国相关内容的时间点使用红色 */
.china-content .news-time::before {
    background-color: #ff4d4f;
}

/* 内容样式 */
.news-content {
    flex: 1;
    min-width: 0;
}

.news-title {
    font-size: 14px;
    font-weight: 600;
    color: #262626;
    margin-bottom: 2px;
    line-height: 18px;
}

.news-detail {
    font-size: 13px;
    color: #666;
    line-height: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 操作按钮样式 */
.news-actions {
    margin-left: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.news-share-btn {
    background-color: transparent;
    color: #999;
    border: none;
    padding: 2px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
}

.news-share-btn:hover {
    background-color: #fff2f0;
    color: #ff4d4f;
    transform: scale(1.1);
}

/* 原文链接文字样式 */
.original-link {
    font-size: 12px;
    color: #1890ff;
    text-decoration: none;
    margin-right: 8px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.original-link:hover {
    text-decoration: underline;
    background-color: rgba(24, 144, 255, 0.1);
}

/* 分享弹框样式 */
.share-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.share-modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.close-btn {
    color: #999;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #333;
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8e8e8;
}

.share-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #262626;
    margin: 0;
}

/* 分享卡片样式 - 参考同花顺设计 */
.share-card {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    min-height: 200px;
    overflow: hidden;
}

/* 彭博社快讯标题 - 大字体居中，优化样式 */
.share-card-header {
    text-align: center;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #ff4d4f 0%, #ff7875 100%);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 8px rgba(255, 77, 79, 0.2);
}

.share-card-logo {
    font-size: 32px;
    font-weight: 800;
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
}

/* 时间信息 - 位于标题下方 */
.share-card-time {
    font-size: 16px;
    color: #999;
    margin-bottom: 20px;
    text-align: left;
}

/* 新闻正文样式 */
.share-card-content {
    font-size: 18px;
    line-height: 1.7;
    color: #262626;
}

.share-title {
    font-size: 18px;
    font-weight: 600;
    color: #262626;
    margin-bottom: 16px;
    line-height: 1.5;
    margin-top: 0;
}

.share-detail {
    font-size: 16px;
    color: #595959;
    line-height: 1.6;
    margin-bottom: 0;
}

/* 分享卡片和Canvas容器样式 - 用于实现图片覆盖效果 */
.share-card-container {
    position: relative;
    margin-bottom: 20px;
    height: auto;
    min-height: 200px;
}

/* 隐藏HTML分享卡片，只用于生成图片 - 使用left: -9999px确保html2canvas能正常渲染 */
.share-card {
    position: absolute;
    top: 0;
    left: -9999px;
    width: 100%;
    height: auto;
    visibility: visible;
    opacity: 1;
    pointer-events: none;
    z-index: -1;
}

/* Canvas样式 - 居中显示，覆盖原有卡片 */
#shareCanvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 下载按钮样式 */
.download-container {
    text-align: center;
    margin-top: 20px;
}

.download-btn {
    background-color: #ff4d4f;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background-color: #ff7875;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
}

/* 加载状态样式 - 恢复为文字提示 */
.loading {
    text-align: center;
    padding: 20px;
    font-size: 14px;
    color: #999;
    margin: 0;
}

/* 分页控件样式 */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background-color: white;
    border-top: 1px solid #e8e8e8;
}

.pagination-btn {
    background-color: #f0f2f5;
    color: #666;
    border: 1px solid #d9d9d9;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    margin: 0 8px;
}

.pagination-btn:hover {
    background-color: #ff4d4f;
    color: white;
    border-color: #ff4d4f;
}

.current-page {
    font-size: 14px;
    color: #666;
}

/* 返回顶部按钮样式 */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(255, 77, 79, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: rgba(255, 77, 79, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 77, 79, 0.2);
}

.back-to-top:active {
    transform: translateY(0);
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        padding: 6px;
    }
    
    .news-header {
        padding: 12px 16px;
    }
    
    .news-header h1 {
        font-size: 20px;
    }
    
    .news-tab {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .news-list {
        padding: 8px;
    }
    
    .news-item {
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .news-time {
        width: auto;
        padding-right: 0;
        margin-bottom: 6px;
        text-align: left;
    }
    
    .news-actions {
        margin-left: 0;
        margin-top: 8px;
        align-self: flex-end;
    }
    
    .share-modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 16px;
    }
    
    .pagination-container {
        padding: 12px 8px;
    }
    
    .pagination-btn {
        padding: 4px 12px;
        font-size: 13px;
        margin: 0 4px;
    }
    
    .current-page {
        font-size: 13px;
    }
}