/**
 * news-detail.css - 新闻详情页样式
 * 包含：文章头部、互动工具栏、正文、底部、相关推荐、深色模式
 */

/* ============================================================
   1. 文章主体容器
   ============================================================ */
.article-wrapper {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #eef2f6;
    box-shadow: 0 1px 4px rgba(0,0,0,0.02);
    overflow: hidden;
}

/* ============================================================
   2. 文章头部
   ============================================================ */
.article-header {
    padding: 30px 36px 20px;
    border-bottom: 1px solid #f0f2f5;
}
.article-header .article-category {
    display: inline-block;
    font-size: 13px;
    color: #4a6cf7;
    background: #f0f5ff;
    padding: 2px 14px;
    border-radius: 30px;
    margin-bottom: 12px;
    font-weight: 500;
}
.article-header h1 {
    font-size: 30px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.4;
    margin: 0 0 14px 0;
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
    font-size: 14px;
    color: #a0aec0;
}
.article-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.article-meta .meta-item i {
    font-size: 16px;
}
.article-meta .meta-divider {
    color: #e2e8f0;
}
.article-meta .meta-author {
    color: #4a6cf7;
    font-weight: 500;
}

/* ============================================================
   3. 互动工具栏
   ============================================================ */
.article-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 12px 36px;
    background: #f8fafc;
    border-bottom: 1px solid #f0f2f5;
}
.article-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.article-toolbar .toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}
.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: #718096;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.toolbar-btn:hover {
    background: #edf2f7;
    color: #4a6cf7;
}
.toolbar-btn i {
    font-size: 16px;
}
.toolbar-btn .badge {
    display: inline-block;
    background: #e2e8f0;
    color: #718096;
    font-size: 11px;
    padding: 0 8px;
    border-radius: 30px;
    line-height: 18px;
    min-width: 18px;
    text-align: center;
}
.toolbar-btn .badge.active {
    background: #4a6cf7;
    color: #fff;
}

/* ============================================================
   4. 分享下拉菜单
   ============================================================ */
.share-dropdown {
    position: relative;
    display: inline-block;
}
.share-dropdown .share-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 6px 0;
    min-width: 140px;
    z-index: 100;
}
.share-dropdown .share-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 13px;
    color: #4a5568;
    text-decoration: none;
    transition: background 0.15s;
}
.share-dropdown .share-menu a:hover {
    background: #f7fafc;
}
.share-dropdown .share-menu a i {
    font-size: 18px;
}
.share-dropdown:hover .share-menu {
    display: block;
}

/* ============================================================
   5. 文章正文
   ============================================================ */
.article-body {
    padding: 28px 36px 36px;
}
.article-body .article-content {
    font-size: 16px;
    color: #2d3748;
    line-height: 1.9;
}
.article-body .article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
}
.article-body .article-content iframe,
.article-body .article-content video {
    max-width: 100%;
    border-radius: 8px;
    margin: 12px 0;
}
.article-body .article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    display: block;
    overflow-x: auto;
}
.article-body .article-content table th,
.article-body .article-content table td {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
}
.article-body .article-content table th {
    background: #f7fafc;
    font-weight: 600;
}
.article-body .article-content blockquote {
    border-left: 4px solid #4a6cf7;
    padding: 10px 18px;
    margin: 12px 0;
    background: #f7fafc;
    border-radius: 0 8px 8px 0;
    color: #4a5568;
}
.article-body .article-content pre {
    background: #f7fafc;
    padding: 12px 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 14px;
}
.article-body .article-content code {
    background: #f7fafc;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
}

/* ============================================================
   6. 文章底部
   ============================================================ */
.article-footer {
    padding: 16px 36px 30px;
    border-top: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.article-footer .footer-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.article-footer .footer-tags .tag-label {
    font-size: 13px;
    color: #a0aec0;
}
.article-footer .footer-tags .tag {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 30px;
    font-size: 12px;
    color: #4a6cf7;
    background: #f0f5ff;
    text-decoration: none;
    transition: all 0.2s;
}
.article-footer .footer-tags .tag:hover {
    background: #4a6cf7;
    color: #fff;
}
.article-footer .footer-source {
    font-size: 13px;
    color: #a0aec0;
}
.article-footer .footer-source strong {
    color: #4a5568;
}
.article-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.article-actions .btn-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 18px;
    border-radius: 8px;
    font-size: 14px;
    color: #718096;
    background: #f0f2f5;
    text-decoration: none;
    transition: all 0.2s;
}
.article-actions .btn-back:hover {
    background: #e2e8f0;
    color: #4a6cf7;
}

/* ============================================================
   7. 相关推荐
   ============================================================ */
.article-related {
    padding: 0 36px 30px;
}
.article-related .related-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.article-related .related-title i {
    color: #4a6cf7;
}
.article-related .related-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.article-related .related-item {
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #eef2f6;
    padding: 12px 16px;
    transition: all 0.25s ease;
}
.article-related .related-item:hover {
    border-color: #4a6cf7;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(74,108,247,0.06);
}
.article-related .related-item a {
    font-size: 14px;
    color: #1a202c;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}
.article-related .related-item a:hover {
    color: #4a6cf7;
}
.article-related .related-item .rel-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #a0aec0;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f0f2f5;
}

/* ============================================================
   8. 响应式
   ============================================================ */
@media (max-width: 768px) {
    .article-header {
        padding: 20px 18px 16px;
    }
    .article-header h1 {
        font-size: 22px;
    }
    .article-toolbar {
        padding: 10px 18px;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .article-toolbar .toolbar-right {
        margin-left: 0;
    }
    .article-body {
        padding: 16px 18px 20px;
    }
    .article-body .article-content {
        font-size: 15px;
    }
    .article-footer {
        padding: 12px 18px 20px;
        flex-direction: column;
        align-items: flex-start;
    }
    .article-related {
        padding: 0 18px 20px;
    }
    .article-related .related-list {
        grid-template-columns: 1fr;
    }
    .article-meta {
        font-size: 13px;
        gap: 8px 16px;
    }
    .article-meta .meta-divider {
        display: none;
    }
}
@media (max-width: 480px) {
    .article-header h1 {
        font-size: 19px;
    }
    .article-toolbar .toolbar-btn {
        font-size: 12px;
        padding: 3px 10px;
    }
    .article-body .article-content {
        font-size: 14px;
    }
}

/* ============================================================
   9. 深色模式
   ============================================================ */
body.dark-mode .article-wrapper {
    background: #16213e;
    border-color: #2a3a5a;
}
body.dark-mode .article-header {
    border-bottom-color: #2a2a4a;
}
body.dark-mode .article-header h1 {
    color: #e2e8f0;
}
body.dark-mode .article-toolbar {
    background: #1a2a4a;
    border-bottom-color: #2a2a4a;
}
body.dark-mode .toolbar-btn {
    color: #a0aec0;
}
body.dark-mode .toolbar-btn:hover {
    background: #2a3a5a;
    color: #6a8cff;
}
body.dark-mode .toolbar-btn .badge {
    background: #2a3a5a;
    color: #a0aec0;
}
body.dark-mode .toolbar-btn .badge.active {
    background: #4a6cf7;
    color: #fff;
}
body.dark-mode .share-dropdown .share-menu {
    background: #1a2a4a;
    border-color: #2a3a5a;
}
body.dark-mode .share-dropdown .share-menu a {
    color: #cbd5e0;
}
body.dark-mode .share-dropdown .share-menu a:hover {
    background: #2a3a5a;
}
body.dark-mode .article-body .article-content {
    color: #cbd5e0;
}
body.dark-mode .article-body .article-content blockquote {
    background: #1a2a4a;
    color: #a0aec0;
}
body.dark-mode .article-body .article-content pre,
body.dark-mode .article-body .article-content code {
    background: #1a2a4a;
}
body.dark-mode .article-footer {
    border-top-color: #2a2a4a;
}
body.dark-mode .article-footer .footer-tags .tag {
    background: #1a2a4a;
    color: #6a8cff;
}
body.dark-mode .article-footer .footer-tags .tag:hover {
    background: #4a6cf7;
    color: #fff;
}
body.dark-mode .article-related .related-item {
    background: #1a2a4a;
    border-color: #2a3a5a;
}
body.dark-mode .article-related .related-item:hover {
    background: #1e2a4a;
    border-color: #4a6cf7;
}
body.dark-mode .article-related .related-item a {
    color: #e2e8f0;
}
body.dark-mode .article-related .related-item a:hover {
    color: #6a8cff;
}
body.dark-mode .article-related .related-item .rel-meta {
    border-top-color: #2a2a4a;
    color: #888;
}
body.dark-mode .article-actions .btn-back {
    background: #2a2a4a;
    color: #a0aec0;
}
body.dark-mode .article-actions .btn-back:hover {
    background: #3a3a5a;
    color: #6a8cff;
}
body.dark-mode .article-meta .meta-divider {
    color: #3a3a5a;
}
/**
 * news-detail.css - 新闻详情页样式
 * 包含：布局、文章主体、侧边栏、随机推荐、热门工具、响应式、深色模式
 */

/* ============================================================
   1. 整体布局：宽屏居中
   ============================================================ */
.detail-wrapper {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   2. 布局：左侧内容 + 右侧侧边栏（比例 3:1）
   ============================================================ */
.detail-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    width: 100%;
}
.detail-main {
    flex: 0 0 72%;
    min-width: 0;
}
.detail-sidebar {
    flex: 0 0 28%;
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

/* ============================================================
   3. 文章主体
   ============================================================ */
.article-wrapper {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #eef2f6;
    box-shadow: 0 1px 4px rgba(0,0,0,0.02);
    overflow: hidden;
}

/* ============================================================
   4. 侧边栏卡片
   ============================================================ */
.sidebar-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #eef2f6;
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.02);
    overflow: hidden;
}
.sidebar-card .sidebar-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sidebar-card .sidebar-title i {
    color: #4a6cf7;
}

/* ============================================================
   5. 随机文章列表
   ============================================================ */
.random-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.random-list .random-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #f5f7fa;
}
.random-list .random-item:last-child {
    border-bottom: none;
}
.random-list .random-item img {
    width: 56px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: #f5f7fa;
}
.random-list .random-item .random-title {
    font-size: 13px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    flex: 1;
}
.random-list .random-item .random-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}
.random-list .random-item .random-title a:hover {
    color: #4a6cf7;
}
.random-list .random-item .random-date {
    font-size: 11px;
    color: #a0aec0;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ============================================================
   6. 热门工具网格
   ============================================================ */
.hot-tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.hot-tools-grid .tool-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #eef2f6;
    transition: all 0.2s;
    text-decoration: none;
    overflow: hidden;
    min-width: 0;
}
.hot-tools-grid .tool-item:hover {
    border-color: #4a6cf7;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(74,108,247,0.06);
}
.hot-tools-grid .tool-item img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
}
.hot-tools-grid .tool-item .tool-name {
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.hot-tools-grid .tool-item .tool-click {
    font-size: 11px;
    color: #a0aec0;
    flex-shrink: 0;
    padding-left: 4px;
}

/* ============================================================
   7. 响应式适配
   ============================================================ */
@media (max-width: 992px) {
    .detail-layout {
        flex-direction: column;
    }
    .detail-main {
        flex: 1 1 100%;
    }
    .detail-sidebar {
        flex: 1 1 100%;
        position: static;
        width: 100%;
    }
    .hot-tools-grid {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 768px) {
    .detail-wrapper {
        padding: 0 12px;
    }
    .detail-layout {
        gap: 16px;
    }
    .sidebar-card {
        padding: 14px 16px;
    }
    .random-list .random-item img {
        width: 44px;
        height: 36px;
    }
    .hot-tools-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .hot-tools-grid .tool-item {
        padding: 6px 8px;
    }
    .hot-tools-grid .tool-item .tool-name {
        font-size: 12px;
    }
}

/* ============================================================
   8. 深色模式
   ============================================================ */
body.dark-mode .article-wrapper {
    background: #16213e;
    border-color: #2a3a5a;
}
body.dark-mode .sidebar-card {
    background: #16213e;
    border-color: #2a3a5a;
}
body.dark-mode .sidebar-card .sidebar-title {
    color: #e2e8f0;
    border-bottom-color: #2a2a4a;
}
body.dark-mode .random-list .random-item {
    border-bottom-color: #2a2a4a;
}
body.dark-mode .random-list .random-item .random-title a {
    color: #d0d0d0;
}
body.dark-mode .random-list .random-item .random-title a:hover {
    color: #6a8cff;
}
body.dark-mode .hot-tools-grid .tool-item {
    background: #1a2a4a;
    border-color: #2a3a5a;
}
body.dark-mode .hot-tools-grid .tool-item:hover {
    border-color: #4a6cf7;
    background: #1e2a4a;
}
body.dark-mode .hot-tools-grid .tool-item .tool-name {
    color: #d0d0d0;
}
body.dark-mode .hot-tools-grid .tool-item .tool-click {
    color: #888;
}
body.dark-mode .dh-content {
    background: transparent;
}
/* ===== 手机端正文内容优化 ===== */
@media (max-width: 768px) {
    /* 正文容器 */
    .article-body {
        padding: 12px 16px !important;
    }

    /* 正文内容 */
    .article-content {
        font-size: 15px !important;
        line-height: 1.8 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
    }

    /* 正文中的图片自适应 */
    .article-content img {
        max-width: 100% !important;
        height: auto !important;
        display: block !important;
        margin: 8px 0 !important;
        border-radius: 6px !important;
    }

    /* 正文中的视频/iframe 自适应 */
    .article-content iframe,
    .article-content video {
        max-width: 100% !important;
        height: auto !important;
        min-height: 180px !important;
        border-radius: 6px !important;
    }

    /* 正文中的表格自适应 */
    .article-content table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        font-size: 13px !important;
    }

    /* 正文中的代码块 */
    .article-content pre {
        font-size: 13px !important;
        padding: 10px 12px !important;
        overflow-x: auto !important;
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
    }

    /* 正文中的列表 */
    .article-content ul,
    .article-content ol {
        padding-left: 20px !important;
    }

    /* 正文中的块引用 */
    .article-content blockquote {
        font-size: 14px !important;
        padding: 8px 14px !important;
    }
    /* ===== 分享下拉菜单 - 点击切换 ===== */
.share-dropdown {
    position: relative;
    display: inline-block;
}

.share-toggle {
    cursor: pointer;
    user-select: none;
}

.share-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 6px 0;
    min-width: 140px;
    z-index: 999;
}

.share-menu.open {
    display: block;
}

.share-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 13px;
    color: #4a5568;
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}

.share-menu a:hover {
    background: #f7fafc;
}

.share-menu a i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* 深色模式适配 */
body.dark-mode .share-menu {
    background: #1a2a4a;
    border-color: #2a3a5a;
}
body.dark-mode .share-menu a {
    color: #cbd5e0;
}
body.dark-mode .share-menu a:hover {
    background: #2a3a5a;
}
/* ===== 分享下拉菜单 - 纯点击切换，无 hover 干扰 ===== */
.share-dropdown {
    position: relative;
    display: inline-block;
}

.share-toggle {
    cursor: pointer;
    user-select: none;
}

.share-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 6px 0;
    min-width: 140px;
    z-index: 9999;
}

.share-menu.open {
    display: block !important;
}

.share-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 13px;
    color: #4a5568;
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
    white-space: nowrap;
}

.share-menu a:hover {
    background: #f7fafc;
}

.share-menu a i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* 深色模式适配 */
body.dark-mode .share-menu {
    background: #1a2a4a;
    border-color: #2a3a5a;
}
body.dark-mode .share-menu a {
    color: #cbd5e0;
}
body.dark-mode .share-menu a:hover {
    background: #2a3a5a;
}