﻿/* 强制重置文章详情页所有样式 */
.article-detail-container,
.article-detail-container *,
.article-detail-container *::before,
.article-detail-container *::after {
    box-sizing: border-box !important;
    max-width: 100% !important;
}

.article-content img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 10px 0 !important;
    padding: 0 !important;
    border: none !important;
}

.article-content {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 5px !important;
}

    /* 确保不被其他样式覆盖 */
    .article-content img[style] {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }

/* 文章详情页样式 */
.article-detail {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.article-header {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.article-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
    line-height: 1.3;
    min-height: 60px; /* 确保标题区域最小高度 */
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    font-size: 0.9rem;
}

.article-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    min-height: 400px; /* 确保内容区域最小高度 */
}

    .article-content img {
        max-width: 100%;
        height: auto;
        border-radius: 4px;
        margin: 10px 0;
    }

/* 文章操作按钮区域 */
.article-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .action-btn:hover {
        background: #e9ecef;
        border-color: #adb5bd;
    }

    .action-btn.active {
        background: #007bff;
        color: white;
        border-color: #007bff;
    }

/* 评论区域样式 */
.comments-section {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

    .comments-section h3 {
        margin-bottom: 20px;
        color: #333;
        border-bottom: 2px solid #007bff;
        padding-bottom: 10px;
    }

.comment-list {
    margin-top: 20px;
}

/* 评论项 */
.comment-item {
    padding: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #fff;
    transition: all 0.3s ease;
}

    .comment-item:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        border-color: #dee2e6;
    }


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

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-content {
    color: #555;
    line-height: 1.6;
    padding: 10px 0;
    margin-left: 15px; /* 头像宽度 + 间距 */
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
}

/* 子评论 */
.comment-children {
    margin-top: 20px;
    padding-left: 65px; /* 与主评论对齐 */
}

.comment-child-item {
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 15px;
    background: #f8f9fa;
}

    .comment-child-item:last-child {
        margin-bottom: 0;
    }

    .comment-child-item .comment-header {
        /*padding-bottom: 8px;
        margin-bottom: 8px;*/
        margin-bottom: 10px;
    }

    .comment-child-item .comment-content {
        margin-left: 55px; /* 子评论头像宽度 + 间距 */
        border-top: 1px solid #e9ecef;
        padding-top: 10px;
        padding-left: 0;
    }

    .comment-child-item .comment-author-info {
        display: flex;
        flex-direction: column;
    }

    .comment-child-item .comment-author {
        font-weight: 500;
        margin-bottom: 3px;
    }

    .comment-child-item .comment-time {
        font-size: 0.85rem;
    }

/* 懒加载图片 */
.lazy-image {
    background-color: #f0f0f0;
    transition: opacity 0.3s;
    opacity: 0;
}

    .lazy-image.loaded {
        background-color: transparent;
        opacity: 1;
    }

/* 评论头部 */
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /*    margin-bottom: 10px;
    padding-bottom: 10px;*/
    border-bottom: 1px solid #f0f0f0;
}

/* 评论用户信息 */
.comment-user-info {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

/* 评论头像 */
.comment-avatar {
    width: 50px;
    height: 50px;
    object-fit: cover;
    background-color: #f0f0f0;
    transition: opacity 0.3s;
    opacity: 0;
}

    .comment-avatar.loaded {
        background-color: transparent;
        opacity: 1;
    }

/* 子评论头像 */
.comment-child-item .comment-avatar {
    width: 40px;
    height: 40px;
}

/* 评论作者详情 */
.comment-author-details {
    flex: 1;
}

.comment-author-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.comment-author {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.reply-btn {
    font-size: 0.8rem;
    padding: 4px 8px;
    align-self: center;
    white-space: nowrap;
}


.comment-time {
    color: #666;
    font-size: 0.9rem;
}

.comment-text {
    color: #333;
    line-height: 1.6;
}

/* 评论表单 */
.comment-form {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

    .comment-form h4 {
        margin-bottom: 15px;
        color: #333;
    }

    .comment-form textarea {
        width: 100%;
        min-height: 100px;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        resize: vertical;
        margin-bottom: 10px;
        box-sizing: border-box;
    }

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.comment-form button {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

    .comment-form button:hover {
        background: #0056b3;
    }

/* 登录提示 */
.login-prompt {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 30px;
}

    .login-prompt a {
        color: #007bff;
        text-decoration: none;
    }

        .login-prompt a:hover {
            text-decoration: underline;
        }

/* 侧边栏样式（如果有的话） */
.sidebar {
    margin-top: 30px;
}

.sidebar-widget {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

    .sidebar-list li {
        padding: 8px 0;
        border-bottom: 1px solid #eee;
    }

        .sidebar-list li:last-child {
            border-bottom: none;
        }

    .sidebar-list a {
        color: #333;
        text-decoration: none;
        transition: color 0.3s ease;
    }

        .sidebar-list a:hover {
            color: #007bff;
        }


/* 图集模态框样式 */
#imageGalleryModal {
    background-color: rgba(0, 0, 0, 0.9);
}

    #imageGalleryModal .modal-content {
        background-color: transparent;
        border: none;
        border-radius: 0;
        height: 100vh;
        margin: 0;
        max-width: 100%;
    }

    #imageGalleryModal .modal-header {
        border: none;
        padding: 1rem 1.5rem;
        background-color: rgba(0, 0, 0, 0.5);
        color: white;
        border-radius: 0;
    }

.gallery-info {
    display: flex;
    flex-direction: column;
}

.gallery-counter {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.gallery-title {
    font-size: 1rem;
    opacity: 0.8;
}

#imageGalleryModal .btn-close {
    filter: invert(1);
}

#imageGalleryModal .modal-body {
    padding: 0;
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.gallery-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-navigation {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.nav-btn {
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

    .nav-btn:hover:not(:disabled) {
        background-color: rgba(255, 255, 255, 0.3);
        transform: scale(1.1);
    }

    .nav-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.nav-prev {
    margin-right: 20px;
}

.nav-next {
    margin-left: 20px;
}

.gallery-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    max-width: calc(100% - 140px);
    height: 100%;
}

.gallery-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: none;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.gallery-thumbnails {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    max-height: 120px;
    overflow-x: auto;
    background-color: rgba(0, 0, 0, 0.3);
}

.thumbnail-item {
    width: 80px;
    height: 60px;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

    .thumbnail-item:hover {
        border-color: rgba(255, 255, 255, 0.5);
        transform: scale(1.05);
    }

    .thumbnail-item.active {
        border-color: #007bff;
    }

    .thumbnail-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

/* 文章内容中的图片 */
.article-content-content img {
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 4px;
}

    .article-content-content img:hover {
        transform: scale(1.02);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

/* 响应式设计 */
@media (max-width: 768px) {
    .article-detail {
        padding: 10px;
    }

    .article-title {
        font-size: 1.5rem;
        min-height: 50px;
    }

    .article-content {
        padding: 15px;
    }

    .article-meta {
        gap: 10px;
        font-size: 0.8rem;
    }

    .comment-item {
        flex-direction: column;
    }

    .comment-avatar {
        align-self: flex-start;
    }


    .comment-form {
        padding: 15px;
    }

    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .comment-children {
        padding-left: 15px;
    }

    .comment-form-actions {
        flex-direction: column;
    }

        .comment-form-actions .btn {
            width: 100%;
        }

    .comments-section {
        padding: 20px 15px;
    }

    .comment-form {
        padding: 15px;
    }

    .comment-avatar {
        width: 40px;
        height: 40px;
    }

    .comment-child-item .comment-avatar {
        width: 35px;
        height: 35px;
    }

    .comment-content {
        margin-left: 55px;
    }

    .comment-children {
        padding-left: 55px;
    }

    .comment-child-item .comment-content {
        margin-left: 50px;
    }

    .comment-form-actions {
        flex-direction: column;
    }

        .comment-form-actions .btn {
            width: 100%;
        }

    .gallery-navigation {
        flex-direction: column;
        gap: 20px;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }

    .nav-prev {
        left: 10px;
        margin-right: 0;
    }

    .nav-next {
        right: 10px;
        margin-left: 0;
    }

    .gallery-image-container {
        max-width: 100%;
        padding: 0 60px;
    }

    .gallery-thumbnails {
        max-height: 80px;
        padding: 10px;
    }

    .thumbnail-item {
        width: 60px;
        height: 45px;
    }

    #imageGalleryModal .modal-header {
        padding: 0.5rem 1rem;
    }

    .gallery-counter {
        font-size: 1rem;
    }

    .gallery-title {
        font-size: 0.8rem;
    }


    /* 移动端布局 */

        .comment-header {
            display: flex;
            justify-content: space-between; /* 左右分开 */
            align-items: center; /* 垂直居中 */
        }

        .avatar-container {
            flex: 0 0 auto; /* 固定宽度 */
        }

        .comment-author-info {
            flex: 0 0 auto; /* 固定宽度 */
            text-align: right; /* 右对齐 */
        }

        .comment-content {
            width: 100%; /* 占满整行 */
            margin-top: 8px; /* 与上方间距 */
        }
    
}

/* 确保内容区域不会因为内容少而被压缩 */
.article-content-content {
    min-height: 300px; /* 设置内容最小高度 */
    line-height: 1.8;
}

    /* 确保空内容也有适当显示 */
    .article-content-content:empty::before {
        content: "暂无内容";
        color: #999;
        font-style: italic;
    }


/* 在小屏幕上将时间和作者分为两行 */
@media (max-width: 576px) {
/*    .comment-author-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }*/

    .comment-header {
        flex-direction: column;
        gap: 10px;
    }

    .comment-user-info {
        width: 100%;
    }

    .comment-content {
        margin-left: 0;
        margin-top: 15px;
    }

    .comment-children {
        padding-left: 0;
    }

    .comment-child-item .comment-content {
        margin-left: 0;
        margin-top: 10px;
    }

    .thumbnail-item {
        width: 50px;
        height: 38px;
    }

    .gallery-image {
        max-height: 70vh;
    }

    /* 移动端布局 */

    .comment-header {
        display: flex;
        justify-content: space-between; /* 左右分开 */
        align-items: center; /* 垂直居中 */
    }

    .avatar-container {
        flex: 0 0 auto; /* 固定宽度 */
    }

    .comment-author-info {
        flex: 0 0 auto; /* 固定宽度 */
        text-align: right; /* 右对齐 */
    }

    .comment-content {
        width: 100%; /* 占满整行 */
        margin-top: 8px; /* 与上方间距 */
    }
}

/* 文章详情页图片终极处理方案 */
.article-content img {
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    display: block !important;
    margin: 10px 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: both !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
    box-sizing: border-box !important;
}

/* 强制容器样式 */
.article-content {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 10px !important;
}

    /* 重置可能影响的父元素 */
    .article-content p,
    .article-content div,
    .article-content span {
        max-width: 100% !important;
        overflow-x: hidden !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
