﻿/* 用户中心样式 */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* 页面容器 - 使用 flex 布局 */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 页头 */
header {
    flex: 0 0 auto; /* 不伸缩，保持原始高度 */
}

/* 主要内容区域 */
.main-content {
    flex: 1 0 auto; /* 自动伸缩，占据剩余空间 */
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.content-row {
    flex: 1 0 auto;
    display: flex;
    gap: 20px;
}

/* 左侧导航菜单 */
.user-center-sidebar {
    width: 250px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    height: fit-content;
    flex: 0 0 auto; /* 不伸缩 */
}

/* 右侧内容区域 */
.user-center-main {
    flex: 1 1 auto; /* 占据剩余空间 */
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    min-height: 500px;
}

/* 页脚 */
footer {
    flex: 0 0 auto; /* 不伸缩，保持原始高度 */
    margin-top: auto;
}

/* 用户中心导航菜单样式 */
.user-nav-menu .nav-title {
    padding: 10px 15px;
    margin: 0;
    font-size: 1.1rem;
    border-bottom: 1px solid #dee2e6;
}

.user-nav-menu .nav-link {
    padding: 10px 15px;
    margin: 2px 0;
    border-radius: 4px;
    color: #495057;
    transition: all 0.3s;
    text-decoration: none;
    display: block;
}

    .user-nav-menu .nav-link:hover {
        background-color: #e9ecef;
        color: #0d6efd;
    }

    .user-nav-menu .nav-link.active {
        background-color: #0d6efd;
        color: white;
    }

    .user-nav-menu .nav-link i {
        margin-right: 8px;
        width: 20px;
        text-align: center;
    }

/* 个人信息页面样式 */
.profile-header {
    text-align: center;
    margin-bottom: 30px;
}

/* 头像上传容器 */
.avatar-upload-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-bottom: 15px;
}

/* 头像图片 */
.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #dee2e6;
    display: block;
}

/* 文件上传输入框 */
.avatar-upload-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

/* 上传覆盖层（悬停时显示） */
.avatar-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

/* 上传中状态 */
.profile-avatar.uploading {
    opacity: 0.6;
    filter: blur(1px);
}

    /* 加载动画（可选） */
    .profile-avatar.uploading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 20px;
        height: 20px;
        border: 2px solid #fff;
        border-top: 2px solid #007bff;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        transform: translate(-50%, -50%);
    }

/* 悬停时显示覆盖层 */
.avatar-upload-container:hover .avatar-upload-overlay {
    opacity: 1;
}

.avatar-upload-overlay i {
    font-size: 24px;
    margin-bottom: 5px;
}

.avatar-upload-overlay span {
    font-size: 12px;
    text-align: center;
}

.profile-form .form-group {
    margin-bottom: 20px;
}

.profile-form label {
    font-weight: 500;
    margin-bottom: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .content-row {
        flex-direction: column;
    }

    .user-center-sidebar {
        width: 100%;
        margin-bottom: 20px;
    }

    .user-center-main {
        margin-left: 0;
    }
}

/* 修复页脚浮空问题 */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-wrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1 0 auto;
}


/* 我的评论页面样式 */
.comments-list {
    margin-bottom: 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.my-comment {
        border-left: 4px solid #007bff;
    }

    .comment-item.reply-to-me {
        border-left: 4px solid #28a745;
    }

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.comment-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.comment-author {
    font-weight: bold;
    color: #333;
}

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

.comment-content {
    margin-bottom: 15px;
}

/* 评论头像样式 */
.comment-avatar {
    width: 24px;
    height: 24px;
    object-fit: cover;
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
}

.comment-author-info {
    display: flex;
    align-items: center;
}

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

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

.article-title {
    font-size: 1rem;
    margin-bottom: 10px;
}

    .article-title a {
        color: #007bff;
        font-weight: 500;
    }

        .article-title a:hover {
            color: #0056b3;
            text-decoration: underline;
        }

.comment-text {
    color: #555;
    line-height: 1.6;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

.comment-actions {
    display: flex;
    gap: 10px;
}

    .comment-actions .btn {
        font-size: 0.875rem;
        padding: 5px 10px;
    }

/* 工具栏样式优化 */
.toolbar {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

    .toolbar .btn-group {
        display: flex;
        flex-wrap: nowrap;
        gap: 2px;
        width: 100%;
    }

    .toolbar .btn {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
        padding: 8px 12px;
        font-size: 0.875rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        border-radius: 4px;
    }

        .toolbar .btn i {
            font-size: 0.8rem;
        }

        .toolbar .btn.active {
            font-weight: bold;
        }

    /* 搜索框优化 */
    .toolbar .form-control {
        padding: 8px 12px;
        font-size: 0.875rem;
    }

    .toolbar .btn-outline-secondary {
        padding: 8px 15px;
        font-size: 0.875rem;
    }

/* 修复搜索区域布局 */
.toolbar-search-form {
    width: 100%;
    gap: 10px;
}

    .toolbar-search-form .form-control {
        flex: 1;
        min-width: 150px;
        padding: 8px 12px;
        font-size: 0.875rem;
    }

    .toolbar-search-form .btn {
        white-space: nowrap;
        padding: 8px 15px;
        font-size: 0.875rem;
        min-width: 90px; /* 确保按钮最小宽度 */
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
    }

        .toolbar-search-form .btn i {
            font-size: 0.8rem;
        }

/* 分页样式 */
.pagination-container {
    margin-top: 30px;
}

.pagination {
    margin-bottom: 15px;
}

.pagination-info {
    font-size: 0.9rem;
}

/* 空状态样式 */
.empty-state {
    padding: 40px 20px;
}

    .empty-state i {
        opacity: 0.5;
    }

/* 响应式设计 */
@media (max-width: 768px) {
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .comment-actions {
        flex-wrap: wrap;
    }

    .toolbar .row {
        flex-direction: column;
        gap: 15px;
    }

    .toolbar .col-md-6 {
        width: 100%;
    }

    .toolbar .btn-group {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .toolbar .btn {
        flex: 1;
        min-width: 80px;
    }

    .toolbar-search-form {
        flex-direction: column;
        gap: 10px;
    }

        .toolbar-search-form .form-control {
            min-width: 0;
        }

        .toolbar-search-form .btn {
            width: 100%;
        }
}

@media (max-width: 576px) {
    .toolbar .btn {
        font-size: 0.8rem;
        padding: 6px 8px;
    }

        .toolbar .btn span {
            display: none; /* 在很小的屏幕上只显示图标 */
        }

        .toolbar .btn i {
            margin-right: 0;
        }

    .search-btn-text {
        display: none; /* 在很小的屏幕上只显示图标 */
    }

    .toolbar-search-form .btn {
        min-width: 40px;
        padding: 8px 12px;
    }

        .toolbar-search-form .btn i {
            margin-right: 0;
        }
}
