/* public/static/css/news.css */

.news-container {
    padding-bottom: 30px;
}

.news-header {
    background-color: #f8f9fa;
    padding: 20px 0;
    margin-bottom: 30px;
    width: 100%; /* 确保 header 是通栏 */
    box-sizing: border-box;
}

/* 确保 header 内部的 container 居中 */
.news-header > .container {
    max-width: 1140px; /* 同步 news-main 的宽度 */
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 15px;
    padding-right: 15px;
    width: 100%; /* 使 padding 生效 */
    box-sizing: border-box;
}

.news-header .page-title {
    font-size: 24px;
    margin-bottom: 5px;
}

.news-header .breadcrumb {
    font-size: 14px;
    color: #6c757d;
}

.news-header .breadcrumb a {
    color: #0d6efd;
    text-decoration: none;
}

.news-main, .news-detail-main {
    display: flex;
    gap: 30px; /* 边栏和内容区的间距 */
}

/* --- 侧边栏样式 --- */
.news-sidebar {
    width: 280px; /* 侧边栏宽度 */
    flex-shrink: 0;
}

.category-card, .hot-card, .related-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.category-list, .hot-list, .related-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li a {
    display: block;
    padding: 8px 0;
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.category-list li.active a, .category-list li a:hover {
    color: #0d6efd;
    font-weight: 500;
}

.hot-list li a {
    display: flex;
    align-items: center;
    padding: 8px 0;
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}
.hot-list li a:hover {
    color: #0d6efd;
}

.hot-rank {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    background-color: #eee;
    color: #666;
    font-size: 12px;
    margin-right: 10px;
    border-radius: 3px;
}
.hot-list li:nth-child(-n+3) .hot-rank {
    background-color: #ffc107;
    color: #fff;
}

.hot-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* --- 内容区样式 --- */
.news-content {
    flex-grow: 1;
    min-width: 0;
    box-sizing: border-box;
    /* 可以去掉内容区的背景色和内边距，让列表项直接在白色背景上 */
    background-color: #fff;
    /* padding: 20px; */
    /* border-radius: 8px; */
}

.news-filter {
    margin-bottom: 20px;
    padding: 0 15px; /* 如果内容区没内边距，给筛选标题加一点 */
}

.filter-title {
    font-size: 18px;
    font-weight: 600;
}

/* --- 新闻列表项 (使用新类名) --- */
.news-list2 { /* <--- 修改 */
    padding: 0;
    margin: 0;
    list-style: none;
}

.news-list2 .news-item2 { /* <--- 修改 */
    display: flex;
    align-items: flex-start;
    padding: 20px 5px;
    border-bottom: 1px solid #f0f0f0;
    gap: 20px;
    overflow: hidden;
    background-color: transparent;
    box-shadow: none;
    border-radius: 0;
    margin-bottom: 0;
    transition: background-color 0.2s ease;
}

.news-list2 .news-item2:hover { /* <--- 修改 */
    background-color: #fafafa;
}

.news-list2 .news-item2:last-child { /* <--- 修改 */
    border-bottom: none;
}

/* 子元素样式选择器也要相应修改，如果之前有嵌套的话 */
/* 例如 .news-list .news-item .news-image -> .news-list2 .news-item2 .news-image */
/* 但当前的 CSS 结构似乎没有这么深的嵌套，主要是修改顶级类 */

.news-item2 .news-image { /* <--- 修改 */
    width: 160px;
    height: 110px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
}

.news-item2 .news-image img { /* <--- 修改 */
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* 如果有图片悬停效果的选择器，也需要修改 */
/* .news-list2 .news-item2:hover .news-image img { ... } */

.news-item2 .news-info { /* <--- 修改 */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* news-info 内部的元素类名不变，所以它们的样式规则主体不用改 */
/* 但如果之前的选择器依赖了 .news-item，则需要调整 */
/* 例如，如果之前是 .news-item .news-title，现在不需要改，因为是 .news-item2 .news-title */
.news-item2 .news-title { /* <--- 修改 */
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
    color: #343a40;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.news-item2 .news-title a { color: inherit; text-decoration: none; transition: color 0.2s; }
.news-item2 .news-title a:hover { color: #007bff; }

.news-item2 .news-meta { /* <--- 修改 */
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    flex-shrink: 0;
}
.news-item2 .news-meta span { display: inline-flex; align-items: center; }
.news-item2 .news-meta .meta-view { display: inline-flex; }
.news-item2 .news-meta i { margin-right: 4px; font-size: 14px; color: #adb5bd; }

.news-item2 .news-intro { /* <--- 修改 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    color: #495057;
    line-height: 1.6;
    margin-bottom: 12px;
}

.news-item2 .read-more { /* <--- 修改 */
    margin-top: auto;
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    align-self: flex-start;
    flex-shrink: 0;
    padding: 3px 0;
    transition: color 0.2s;
}
.news-item2 .read-more:hover { color: #0056b3; }
.news-item2 .read-more i {
    display: inline-block;
    vertical-align: middle;
    margin-left: 3px;
    font-size: 13px;
    transition: transform 0.2s;
}
.news-item2 .read-more:hover i { transform: translateX(3px); }


/* --- 响应式调整 --- */
@media (max-width: 768px) {
     .news-main {
         /* 在小屏幕上，内容区和侧边栏堆叠 */
         flex-direction: column;
     }
     .news-sidebar {
         width: 100%; /* 侧边栏占满宽度 */
     }
     .news-list2 .news-item2 { /* <--- 修改 */
         flex-direction: column;
         align-items: stretch;
         padding-left: 10px;
         padding-right: 10px;
     }
     .news-item2 .news-image { /* <--- 修改 */
         width: 100%;
         height: 180px;
         margin-bottom: 15px;
     }
     .news-item2 .read-more { /* <--- 修改 */
         margin-top: 10px;
     }
 }

/* --- 分页样式 --- */
.pagination-container {
    margin-top: 40px;
    text-align: center;
}

/* ul.pagination 是 Bootstrap 分页的标准结构 */
ul.pagination { /* Target the ul directly */
    display: inline-flex;
    padding-left: 0;
    list-style: none;
    margin: 0;
}

ul.pagination > li { /* Target the li directly */
    margin: 0 3px; /* Adjust spacing between items */
}

/* Common styles for the links and spans inside li */
ul.pagination > li > a,
ul.pagination > li > span {
    display: inline-flex; /* Use flex for alignment */
    align-items: center;
    justify-content: center;
    min-width: 36px;   /* Button width */
    height: 36px;      /* Button height */
    padding: 0 10px;   /* Horizontal padding */
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;  /* Ensure text vertical alignment */
    color: #495057;    /* Default text color */
    background-color: #fff; /* Default background */
    border: 1px solid #dee2e6; /* Default border */
    border-radius: 4px;     /* Rounded corners */
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

/* Hover state for links */
ul.pagination > li > a:hover {
    z-index: 2;
    color: #0d6efd;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

/* Active state (targets the span inside li.active) */
ul.pagination > li.active > span {
    z-index: 3;
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}
/* Optional: If active state might contain an <a> tag */
ul.pagination > li.active > a {
     z-index: 3;
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
    pointer-events: none; /* Active link shouldn't be clickable */
}


/* Disabled state (targets the span inside li.disabled) */
ul.pagination > li.disabled > span {
    color: #adb5bd; /* Lighter text color for disabled */
    pointer-events: none;
    background-color: #f8f9fa; /* Slightly different background */
    border-color: #dee2e6;
}
/* Optional: If disabled state might contain an <a> tag */
ul.pagination > li.disabled > a {
     color: #adb5bd;
    pointer-events: none;
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

/* --- 空状态 --- */
.empty-placeholder {
    text-align: center;
    padding: 50px 0;
    color: #999;
}
.empty-placeholder img {
    max-width: 150px;
    margin-bottom: 15px;
}

/* --- 新闻详情页样式 --- */
.detail-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.article-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.article-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    
}

.article-title {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 15px;
    line-height: 1.4;
}

.article-meta {
    font-size: 14px;
    color: #999;
}
.article-meta .meta-item {
    margin-right: 20px;
}
.article-meta .meta-item i {
    margin-right: 5px;
}

.article-cover img, .article-video video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 25px;
}

.article-body {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
}
.article-body p {
    margin-bottom: 1.5em;
}
.article-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em auto;
    border-radius: 4px;
}

.article-tags {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 14px;
    color: #666;
}
.article-tags i {
    margin-right: 5px;
}
.article-tags a {
    display: inline-block;
    background-color: #f1f1f1;
    padding: 3px 10px;
    border-radius: 12px;
    color: #666;
    text-decoration: none;
    margin-left: 8px;
    transition: background-color 0.3s;
}
.article-tags a:hover {
    background-color: #ddd;
}

.article-navigation {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
}
.article-navigation span {
    color: #999;
}
.article-navigation a {
    color: #0d6efd;
    text-decoration: none;
}
.navigation-prev {
    margin-bottom: 10px;
}


/* --- 相关推荐 --- */
.related-item {
    display: flex;
    margin-bottom: 15px;
    gap: 15px;
}
.related-image {
    width: 80px; /* 图片宽度 */
    height: 60px; /* 图片高度 */
    flex-shrink: 0;
}
.related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}
.related-info {
    flex-grow: 1;
}
.related-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    /* 多行省略 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.related-title a {
    color: #333;
    text-decoration: none;
}
.related-title a:hover {
    color: #0d6efd;
}
.related-meta {
    font-size: 12px;
    color: #999;
}
.related-meta i {
    margin-right: 3px;
}
.empty-related {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 20px 0;
}

/* 响应式调整 */
@media (max-width: 992px) {
    .news-main, .news-detail-main {
        flex-direction: column;
    }
    .news-sidebar, .detail-sidebar {
        width: 100%;
    }
}

@media (max-width: 576px) {
     /* 在非常小的屏幕上，可能连 read-more 也要隐藏 */
    .news-item2 .read-more {
        display: none;
    }
     .news-item2 .news-title {
        /* 让标题占据几乎全部空间 */
     }
}

/* 强制确保 .container 的居中和最大宽度 */
/* 可以根据你的 Bootstrap 版本调整 max-width */
.container.news-main,
.container.news-detail-main {
    max-width: 1140px; /* 或者 960px, 1320px 等 */
    margin-left: auto !important; /* 强制居中 */
    margin-right: auto !important; /* 强制居中 */
    padding-left: 15px; /* 保留 Bootstrap 边距 */
    padding-right: 15px; /* 保留 Bootstrap 边距 */
    width: 100%; /* 确保宽度计算正确 */
    box-sizing: border-box; /* 避免 padding 影响总宽度 */
}

/* 确保 .news-main 是 flex 容器 */
.news-main {
    display: flex !important; /* 强制 flex */
    gap: 30px;
}

/* 确保侧边栏和内容区宽度正确 */
.news-sidebar {
    width: 280px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.news-content {
    flex-grow: 1;
    min-width: 0; /* 防止 flex 子项内容溢出 */
    box-sizing: border-box;
}

/* 重置可能冲突的全局样式 (谨慎使用) */
/*
.news-main div,
.news-sidebar div,
.news-content div {
    float: none;
    position: static;
    width: auto; // 取消可能存在的全局 width: 100%
}
*/

/* --- 确保 news-header 内部的 container 居中 --- */
.news-header > .container {
    /* 确保与 .container.news-main 使用相同的最大宽度 */
    max-width: 1140px; /* 根据你的 Bootstrap 版本或设计调整 */
    width: 100%; /* 必须设置，否则 max-width 不会生效 */
    padding-left: 15px; /* Bootstrap 默认 */
    padding-right: 15px; /* Bootstrap 默认 */
    margin-left: auto; /* 水平居中 */
    margin-right: auto; /* 水平居中 */
    box-sizing: border-box;
}

/* 可选：确保 news-header 本身是通栏 */
.news-header {
        width: 100%;
    box-sizing: border-box;
    /* 保留原有的 padding 和 background-color */
    background-color: #f8f9fa;
    padding: 20px 0;
    margin-bottom: 30px;
}

/* --- Detail Page Specific - Increased Specificity --- */

/* 应用到详情页的主容器 */
.news-detail-main {
    /* (这里的样式定义保持不变，只是用它做父选择器) */
    /* display: flex; gap: 30px; ... */
}

/* 内容区域 */
.news-detail-main .article-content { /* <--- 增加父选择器 */
    flex-grow: 1;
    min-width: 0;
    background-color: #fff;
    padding: 30px;
    border-radius: 6px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* 文章头部 */
.article-content .article-header { /* <--- 增加父选择器 */
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

/* 文章标题 */
.article-content .article-title { /* <--- 增加父选择器 */
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 15px;
    line-height: 1.4;
    color: #212529;
}

/* 文章元信息 */
.article-content .article-meta { /* <--- 增加父选择器 */
    font-size: 14px;
    color: #6c757d;
}
.article-content .article-meta .meta-item { /* <--- 增加父选择器 */
     margin-right: 20px; display: inline-flex; align-items: center;
}
.article-content .article-meta .meta-item i { /* <--- 增加父选择器 */
    margin-right: 5px; font-size: 15px;
}


/* 文章封面/视频 */
.article-content .article-cover img,
.article-content .article-video video { /* <--- 增加父选择器 */
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 25px 0;
    border: 1px solid #eee;
}

/* 文章正文 */
.article-content .article-body { /* <--- 增加父选择器 */
    font-size: 16px;
    line-height: 1.8;
    color: #343a40;
}
.article-content .article-body p { margin-bottom: 1.6em; }
.article-content .article-body img {
    max-width: 100%; height: auto; display: block; margin: 1.5em auto;
    border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}
.article-content .article-body h2 { font-size: 22px; margin: 1.5em 0 0.8em; font-weight: 600; }
.article-content .article-body h3 { font-size: 19px; margin: 1.2em 0 0.7em; font-weight: 600; }
.article-content .article-body ul, .article-content .article-body ol { margin-bottom: 1.5em; padding-left: 1.5em; }
.article-content .article-body li { margin-bottom: 0.5em; }

/* 文章标签 */
.article-content .article-tags { /* <--- 增加父选择器 */
    margin-top: 35px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 14px;
    color: #6c757d;
}
.article-content .article-tags i { margin-right: 8px; vertical-align: middle; }
.article-content .article-tags a {
    /* ... (样式保持不变) ... */
    display: inline-block; background-color: #e9ecef; padding: 4px 12px;
    border-radius: 4px; color: #495057; text-decoration: none;
    margin-left: 8px; transition: background-color 0.2s, color 0.2s;
    font-size: 13px;
}
.article-content .article-tags a:hover { background-color: #dee2e6; color: #212529; }

/* 文章导航 */
.article-content .article-navigation { /* <--- 增加父选择器 */
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid #f0f0f0;
}
.article-content .article-navigation span { color: #6c757d; }
.article-content .article-navigation a { color: #0d6efd; text-decoration: none; transition: color 0.2s; }
.article-content .article-navigation a:hover { color: #0a58ca; }
.article-content .navigation-prev { margin-bottom: 10px; }

/* 详情页侧边栏 */
.news-detail-main .detail-sidebar { /* <--- 增加父选择器 */
    width: 280px;
    flex-shrink: 0;
    box-sizing: border-box;
}
.detail-sidebar .sidebar-card { /* <--- 增加父选择器 */
    /* (继承通用 .sidebar-card 样式) */
}
.detail-sidebar .related-card { /* <--- 增加父选择器 */
     /* (可能不需要额外样式，已继承) */
}
.detail-sidebar .related-list { /* <--- 增加父选择器 */
    /* (样式保持不变) */
     list-style: none; padding: 0; margin: 0;
}
/* ... 对 related-item, related-image, related-info, related-title, related-meta 也加上 .detail-sidebar 前缀 ... */
.detail-sidebar .related-item { display: flex; margin-bottom: 15px; gap: 15px; }
.detail-sidebar .related-item:last-child { margin-bottom: 0; }
.detail-sidebar .related-image { width: 80px; height: 60px; flex-shrink: 0; border-radius: 4px; overflow: hidden; }
.detail-sidebar .related-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-sidebar .related-info { flex-grow: 1; min-width: 0; }
.detail-sidebar .related-title { font-size: 14px; font-weight: 500; margin-bottom: 6px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.detail-sidebar .related-title a { color: #343a40; text-decoration: none; transition: color 0.2s; }
.detail-sidebar .related-title a:hover { color: #0d6efd; }
.detail-sidebar .related-meta { font-size: 12px; color: #6c757d; }
.detail-sidebar .related-meta i { margin-right: 3px; vertical-align: middle; font-size: 13px; }
.detail-sidebar .empty-related { text-align: center; color: #999; font-size: 14px; padding: 20px 0;}

/* --- Related Jobs Card --- */
.related-job-card .related-job-list { list-style: none; padding: 0; margin: 0; }
.related-job-item {
    display: flex;
    justify-content: space-between; /* Title/Company on left, Salary on right */
    align-items: flex-start; /* Align items to top */
    padding: 12px 0; /* Vertical spacing */
    border-bottom: 1px dashed #eee; /* Dashed separator */
}
.related-job-item:last-child { border-bottom: none; }

.job-item-info {
    flex-grow: 1; /* Allow info to take space */
    margin-right: 10px; /* Space before salary */
    min-width: 0; /* Prevent overflow */
}

.job-item-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.job-item-title a { color: #343a40; text-decoration: none; transition: color 0.2s; }
.job-item-title a:hover { color: #0d6efd; }

.job-item-company {
    font-size: 12px;
    color: #6c757d;
}
.job-item-company a { color: inherit; text-decoration: none; }
.job-item-company a:hover { color: #0d6efd; text-decoration: underline; }
.job-item-city { margin-left: 8px; }


.job-item-salary {
    font-size: 14px;
    font-weight: 600;
    color: #fd7e14; /* Highlight salary */
    flex-shrink: 0; /* Prevent salary from shrinking */
    white-space: nowrap;
}

/* --- Related Companies Card --- */
.related-company-card .related-company-list { list-style: none; padding: 0; margin: 0; }
.related-company-item {
    display: flex;
    align-items: center; /* Center vertically */
    padding: 12px 0; /* Vertical spacing */
    border-bottom: 1px dashed #eee;
    gap: 12px; /* Space between logo and info */
}
.related-company-item:last-child { border-bottom: none; }

.company-item-logo {
    width: 45px; /* Logo size */
    height: 45px;
    flex-shrink: 0;
    border: 1px solid #f0f0f0; /* Subtle border for logo */
    border-radius: 4px;
    overflow: hidden; /* Ensure logo fits */
    display: flex; /* Center image inside */
    align-items: center;
    justify-content: center;
}
.company-item-logo img {
    max-width: 90%; /* Prevent image stretching */
    max-height: 90%;
    object-fit: contain; /* Contain logo within box */
}

.company-item-info {
    flex-grow: 1;
    min-width: 0; /* Prevent overflow */
}

.company-item-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.company-item-name a { color: #343a40; text-decoration: none; transition: color 0.2s; }
.company-item-name a:hover { color: #0d6efd; }

.company-item-city {
    font-size: 12px;
    color: #6c757d;
    margin: 0; /* Remove default p margin */
}


/* --- Responsive Adjustments (Ensure sidebar cards stack nicely) --- */
@media (max-width: 992px) {
    /* .news-main, .news-detail-main { flex-direction: column; } */ /* Already exists */
    /* .news-sidebar, .detail-sidebar { width: 100%; } */ /* Already exists */

    /* Optional: Add some bottom margin to the content when stacked */
     .article-content {
        margin-bottom: 30px;
     }
}

/* ... (Keep existing responsive rules and overrides) ... */