/* public/stylesheets/news.css */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    /* 确保body不会溢出 */
    overflow-x: hidden;
    width: 100%;
}

.container {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
    align-items: flex-start;
    /* 确保容器不会溢出 */
    width: 100%;
}

.news-content {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    /* 确保内容区域不会溢出 */
    box-sizing: border-box;
}

.sidebar {
    width: 300px;
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
    /* 确保侧边栏不会溢出 */
    box-sizing: border-box;
}

/* 面包屑导航样式 */
.breadcrumb {
    width: 100%;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
    padding: 10px 0;
    /* 确保面包屑不会溢出 */
    box-sizing: border-box;
}

.breadcrumb a {
    color: #1a2980;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: red;
    text-decoration: underline;
}

.breadcrumb span:last-child {
    color: #333;
    font-weight: 500;
}

.content-wrapper {
    display: flex;
    width: 100%;
    gap: 20px;
    /* 确保内容包装器不会溢出 */
    box-sizing: border-box;
}

.news-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #1a2980;
    line-height: 1.4;
    /* 确保标题不会溢出 */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.news-meta {
    color: red;
    font-size: 14px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    font-weight: 900;
}

.news-content-text {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.8;
    /* 确保内容文本不会溢出 */
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
}

.news-content-text p {
    margin-bottom: 15px;
    text-indent: 2em;
    /* 确保段落不会溢出 */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.news-images {
    margin: 20px 0;
    border-top: 1px solid #eee;
    padding-top: 20px;
    /* 确保图片区域不会溢出 */
    width: 100%;
}

.news-image-container {
    margin: 10px 0;
    text-align: center;
    /* 确保图片容器不会溢出 */
    width: 100%;
}

.news-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    /* 确保图片不会溢出 */
    display: block;
    margin: 0 auto;
}

.news-image:hover {
    transform: scale(1.02);
}

.related-section {
    margin-bottom: 20px;
    /* 确保相关区域不会溢出 */
    width: 100%;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #1a2980;
    border-bottom: 2px solid #1a2980;
    padding-bottom: 5px;
    /* 确保标题不会溢出 */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.stock-list,
.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    /* 确保列表不会溢出 */
    width: 100%;
}

.stock-item,
.category-item {
    background: #f1f3f5;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    /* 确保项目不会溢出 */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.category-item a {
    color: #1a2980;
    text-decoration: none;
}

.category-item a:hover {
    text-decoration: underline;
}

/* 修改source-info样式，宽度自适应内容 */
.source-info {
    display: inline-block;
    background: #f1f3f5;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    margin-top: 20px;
    /* 确保来源信息不会溢出 */
    max-width: 100%;
    box-sizing: border-box;
}

.source-info a {
    color: #1a2980;
    text-decoration: none;
    font-weight: 500;
    /* 确保链接不会溢出 */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.source-info a:hover {
    text-decoration: underline;
}

.stock-data-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    /* 确保股票数据项不会溢出 */
    width: 100%;
    box-sizing: border-box;
}

.stock-data-item:last-child {
    border-bottom: none;
}

.stock-name {
    font-weight: bold;
    /* 确保股票名称不会溢出 */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 70%;
}

.stock-name a {
    color: #1a2980;
    text-decoration: none;
}

.stock-name a:hover {
    color: red;
    text-decoration: underline;
}

.index-data-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    /* 确保指数数据项不会溢出 */
    width: 100%;
    box-sizing: border-box;
}

.index-data-item:last-child {
    border-bottom: none;
}

.index-name {
    font-weight: bold;
    /* 确保指数名称不会溢出 */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 70%;
}

.index-name a {
    color: #1a2980;
    text-decoration: none;
}

.index-name a:hover {
    color: red;
    text-decoration: underline;
}

.index-value {
    color: #666;
}

/* 响应式设计 - 修复移动端布局 */
@media (max-width: 768px) {
    body {
        /* 确保移动端body不会溢出 */
        overflow-x: hidden;
        width: 100%;
    }
    
    .container {
        padding: 10px;
        width: 100%;
        max-width: 100%;
        /* 确保移动端容器不会溢出 */
        box-sizing: border-box;
    }

    .content-wrapper {
        flex-direction: column;
        width: 100%;
        gap: 15px;
    }

    .sidebar {
        width: 100%;
        position: static;
        margin-top: 0;
        /* 确保移动端侧边栏不会溢出 */
        box-sizing: border-box;
    }
    
    .news-content {
        padding: 15px;
        /* 确保移动端新闻内容不会溢出 */
        box-sizing: border-box;
    }
    
    .news-title {
        font-size: 20px;
        padding: 0 5px;
    }
    
    .news-content-text {
        font-size: 15px;
        padding: 0 5px;
    }
    
    .news-content-text p {
        text-indent: 1.5em;
    }
    
    .section-title {
        font-size: 16px;
        padding: 0 5px;
    }
    
    .stock-list,
    .category-list {
        gap: 8px;
        padding: 0 5px;
    }
    
    .stock-item,
    .category-item {
        font-size: 13px;
        padding: 4px 8px;
    }
    
    .breadcrumb {
        font-size: 13px;
        padding: 0 5px;
    }
    
    .news-meta {
        padding: 0 5px 10px 5px;
    }
    
    .news-images {
        padding: 15px 5px 0 5px;
    }
}

/* 针对小屏幕手机的额外优化 */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .news-content {
        padding: 12px;
    }
    
    .news-title {
        font-size: 18px;
    }
    
    .news-content-text {
        font-size: 14px;
    }
    
    .news-content-text p {
        text-indent: 1em;
        margin-bottom: 12px;
    }
    
    .section-title {
        font-size: 15px;
    }
    
    .stock-item,
    .category-item {
        font-size: 12px;
        padding: 3px 6px;
    }
    
    .breadcrumb {
        font-size: 12px;
    }
    
    .source-info {
        font-size: 13px;
        padding: 6px 12px;
    }
}

.error-message {
    background: #ffe6e6;
    border: 1px solid #ffcccc;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
    color: #cc0000;
    /* 确保错误消息不会溢出 */
    width: 100%;
    box-sizing: border-box;
}

.no-data {
    color: #888;
    font-style: italic;
    padding: 10px 0;
    text-align: center;
    /* 确保无数据提示不会溢出 */
    width: 100%;
}

.action-button {
    padding: 8px 16px;
    background-color: #1a2980;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    /* 确保按钮不会溢出 */
    max-width: 100%;
    box-sizing: border-box;
}

.action-button:hover {
    background-color: red;
}

/* 分享按钮样式 */
.share-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    /* 确保分享按钮不会溢出 */
    flex-wrap: wrap;
    width: 100%;
}

.share-button {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #ddd;
    background: #f9f9f9;
    transition: all 0.3s;
    /* 确保分享按钮不会溢出 */
    box-sizing: border-box;
}

.share-button:hover {
    background: #eee;
}

.share-wechat {
    color: #2aae67;
}

.share-weibo {
    color: #e6162d;
}

.share-qq {
    color: #12b7f5;
}

/* 表格响应式处理 */
.news-content-text table {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto;
    display: block;
}

.news-content-text td,
.news-content-text th {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* 防止长单词和URL溢出 */
.news-content-text {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

.news-content-text a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}