﻿/* ========================================
   博客系统 - 绿色主题样式
   适用于文章列表页和详情页
   ======================================== */

/* ===== CSS变量 - 绿色主题 ===== */
:root {
    --primary-green: #2E7D32;
    --primary-light: #43A047;
    --primary-lighter: #66BB6A;
    --primary-dark: #1B5E20;
    --primary-bg: #E8F5E9;
    --primary-gradient: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #43A047 100%);
    --primary-shadow: rgba(46, 125, 50, 0.3);
    --primary-hover: #1B5E20;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a4a;
    --border-light: #e8f5e9;
    --card-radius: 12px;
    --card-shadow: 0 4px 20px rgba(46, 125, 50, 0.08);
    --card-hover-shadow: 0 8px 30px rgba(46, 125, 50, 0.12);
    --transition-speed: 0.3s;
}

/* ===== 全局重置 ===== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0 8px;
    font-size: 14px;
    background: #f5f7f5;
}

/* ===== 容器布局 ===== */
.container-wrap {
    display: flex;
    gap: 24px;
    margin-top: 20px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 16px;
}

.left-col {
    width: 210px;
    flex-shrink: 0;
}

.main-col {
    flex: 1;
    min-width: 550px;
}

.right-col {
    width: 260px;
    flex-shrink: 0;
}

/* ===== 卡片组件 ===== */
.card {
    border: 1px solid rgba(46, 125, 50, 0.08);
    border-radius: var(--card-radius);
    padding: 18px 20px;
    margin-bottom: 16px;
    background: #fff;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) ease;
}

    .card:hover {
        box-shadow: var(--card-hover-shadow);
        border-color: rgba(46, 125, 50, 0.15);
    }

    .card h5 {
        font-size: 16px;
        font-weight: 600;
        color: var(--primary-dark);
        margin: 0 0 14px 0;
        padding-bottom: 10px;
        border-bottom: 2px solid var(--primary-bg);
    }

/* ===== 文章卡片 ===== */
.blog-card {
    padding: 20px 24px;
    margin-bottom: 20px;
    transition: all var(--transition-speed) ease;
    border-left: 3px solid transparent;
}

    .blog-card:hover {
        border-left-color: var(--primary-green);
        transform: translateX(4px);
    }

.blog-title {
    font-size: 20px;
    font-weight: 700;
    margin: 8px 0 12px;
}

    .blog-title a {
        color: var(--primary-dark);
        text-decoration: none;
        transition: color var(--transition-speed) ease;
    }

        .blog-title a:hover {
            color: var(--primary-light);
            text-decoration: underline;
        }

/* ===== 文章元信息 ===== */
.flex-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-bg);
}

.author-name {
    font-weight: 600;
    color: var(--primary-dark);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

    .author-name:hover {
        color: var(--primary-light);
    }

.cate-tag {
    color: var(--primary-green);
    font-size: 13px;
    font-weight: 500;
    background: var(--primary-bg);
    padding: 2px 10px;
    border-radius: 12px;
}

.publish-time {
    font-size: 13px;
    color: #888;
}

/* ===== 文章摘要 ===== */
.blog-summary {
    margin: 8px 0 12px;
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 15px;
    text-indent: 2em;
}

    .blog-summary a {
        color: var(--text-secondary);
        text-decoration: none;
    }

        .blog-summary a:hover {
            color: var(--primary-green);
        }

/* ===== 图片列表 ===== */
.img-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0;
}

    .img-list img {
        height: 120px;
        border-radius: 8px;
        object-fit: cover;
        border: 1px solid var(--primary-bg);
        transition: transform var(--transition-speed) ease;
    }

        .img-list img:hover {
            transform: scale(1.02);
        }

/* ===== 文章底部操作栏 ===== */
.blog-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--primary-bg);
}

    .blog-actions .stat-item {
        display: flex;
        align-items: center;
        gap: 4px;
        color: #666;
    }

        .blog-actions .stat-item i {
            color: var(--primary-green);
        }

/* ===== 点赞按钮 ===== */
.like-btn {
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 14px;
    border-radius: 20px;
    background: var(--primary-bg);
    color: var(--primary-dark);
    transition: all var(--transition-speed) ease;
    font-weight: 500;
}

    .like-btn:hover {
        background: #c8e6c9;
        transform: scale(1.02);
    }

    .like-btn.active {
        background: #fce4ec;
        color: #c62828;
    }

    .like-btn .heart-icon {
        font-size: 16px;
    }

/* ===== 按钮样式 ===== */
.btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

.btn-green {
    background: var(--primary-gradient);
    color: #fff;
}

    .btn-green:hover {
        background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #388E3C 100%);
        box-shadow: 0 4px 15px var(--primary-shadow);
    }

.btn-blue {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: #fff;
}

    .btn-blue:hover {
        background: linear-gradient(135deg, #1976D2 0%, #0D47A1 100%);
    }

.btn-red {
    background: linear-gradient(135deg, #ef5350 0%, #d32f2f 100%);
    color: #fff;
}

    .btn-red:hover {
        background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    }

.btn-gray {
    background: #9e9e9e;
    color: #fff;
}

    .btn-gray:hover:not(.disabled) {
        background: #757575;
    }

    .btn-gray.disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.btn-outline-green {
    background: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
}

    .btn-outline-green:hover {
        background: var(--primary-green);
        color: #fff;
    }

/* ===== 分类导航 ===== */
.cate-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .cate-nav a {
        color: #555;
        text-decoration: none;
        padding: 4px 12px;
        border-radius: 6px;
        transition: all var(--transition-speed) ease;
        font-size: 14px;
        display: block;
    }

        .cate-nav a:hover {
            color: var(--primary-green);
            background: var(--primary-bg);
            padding-left: 20px;
        }

        .cate-nav a.active {
            color: var(--primary-dark);
            background: var(--primary-bg);
            font-weight: 600;
        }

/* ===== 分页 ===== */
.pagination {
    text-align: center;
    margin: 24px 0;
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    font-size: 14px;
}

    .pagination .page-info {
        color: var(--text-secondary);
        font-weight: 500;
    }

        .pagination .page-info span {
            color: var(--primary-green);
            font-weight: 700;
        }

/* ===== 评论弹窗 ===== */
.mask {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    animation: fadeIn 0.3s ease;
}

.comment-dialog {
    width: 720px;
    max-height: 85vh;
    overflow-y: auto;
    background: #fff;
    margin: 60px auto;
    padding: 28px 32px;
    border-radius: var(--card-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    border-bottom: 2px solid var(--primary-bg);
    padding-bottom: 14px;
}

    .dialog-header h5 {
        font-size: 20px;
        font-weight: 600;
        color: var(--primary-dark);
        margin: 0;
    }

.close-dialog {
    cursor: pointer;
    font-size: 28px;
    color: #999;
    transition: color var(--transition-speed) ease;
    line-height: 1;
}

    .close-dialog:hover {
        color: #dc3545;
        transform: rotate(90deg);
    }

.dialog-comment-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 16px 0;
    padding: 4px;
}

/* ===== 评论项 ===== */
.comment-item {
    font-size: 14px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

    .comment-item:last-child {
        border-bottom: none;
    }

    .comment-item.reply {
        padding-left: 32px;
        border-left: 3px solid var(--primary-green);
        margin-left: 12px;
        background: var(--primary-bg);
        border-radius: 0 8px 8px 0;
    }

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.comment-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-bg);
}

.comment-user-name {
    font-weight: 600;
    color: var(--primary-dark);
}

.comment-time {
    color: #999;
    font-size: 12px;
}

.reply-to {
    color: var(--primary-green);
    font-size: 12px;
    background: var(--primary-bg);
    padding: 0 8px;
    border-radius: 10px;
}

.comment-content {
    margin: 6px 0 4px;
    word-wrap: break-word;
    color: var(--text-secondary);
    line-height: 1.6;
}

.comment-actions {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

    .comment-actions button {
        padding: 2px 12px;
        font-size: 12px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: all var(--transition-speed) ease;
        font-weight: 500;
    }

.btn-reply {
    background: var(--primary-bg);
    color: var(--primary-green);
}

    .btn-reply:hover {
        background: #c8e6c9;
    }

.btn-delete-comment {
    background: #fde8e8;
    color: #dc3545;
}

    .btn-delete-comment:hover {
        background: #fcd5d5;
    }

/* ===== 回复表单 ===== */
.reply-form {
    margin-top: 10px;
    padding: 14px;
    background: #f8f9fa;
    border-radius: 8px;
    display: none;
    border: 1px solid var(--primary-bg);
}

    .reply-form textarea {
        width: 100%;
        padding: 8px 12px;
        border: 2px solid #e0e0e0;
        border-radius: 6px;
        font-size: 13px;
        resize: vertical;
        transition: border-color var(--transition-speed) ease;
    }

        .reply-form textarea:focus {
            outline: none;
            border-color: var(--primary-green);
            box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.1);
        }

    .reply-form .reply-actions {
        margin-top: 8px;
        display: flex;
        gap: 8px;
    }

.btn-submit-reply {
    background: var(--primary-gradient);
    color: #fff;
    padding: 4px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

    .btn-submit-reply:hover {
        box-shadow: 0 4px 12px var(--primary-shadow);
    }

.btn-cancel-reply {
    background: #9e9e9e;
    color: #fff;
    padding: 4px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

    .btn-cancel-reply:hover {
        background: #757575;
    }

/* ===== 弹窗中的评论输入 ===== */
#commentInput {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    transition: border-color var(--transition-speed) ease;
}

    #commentInput:focus {
        outline: none;
        border-color: var(--primary-green);
        box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.1);
    }

/* ===== Toast通知 ===== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-item {
    padding: 14px 24px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 15px;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast-success {
    background: var(--primary-gradient);
    color: white;
}

.toast-error {
    background: #dc3545;
    color: white;
}

.toast-warning {
    background: #ffc107;
    color: #212529;
}

.toast-info {
    background: #17a2b8;
    color: white;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

    .empty-state i {
        font-size: 48px;
        margin-bottom: 16px;
        color: var(--primary-lighter);
    }

    .empty-state h4 {
        color: var(--primary-dark);
        margin-bottom: 8px;
    }

/* ===== 登录提示框 ===== */
.login-notice {
    background: #fff8e1;
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 20px;
    border-left: 4px solid #ffc107;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #856404;
}

    .login-notice a {
        color: var(--primary-green);
        font-weight: 600;
        text-decoration: underline;
    }

/* ===== 动画 ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--primary-bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--primary-dark);
    }

/* ========================================
   响应式设计
   ======================================== */

/* 平板 */
@media screen and (max-width: 1024px) {
    .container-wrap {
        gap: 16px;
        padding: 0 12px;
    }

    .right-col {
        width: 220px;
    }
}

/* 手机 */
@media screen and (max-width: 768px) {
    .container-wrap {
        flex-direction: column;
        gap: 0;
        padding: 0 8px;
    }

    .left-col, .right-col {
        width: 100%;
        flex-shrink: unset;
    }

    .main-col {
        min-width: unset;
        width: 100%;
    }

    .comment-dialog {
        width: 94%;
        margin: 40px auto;
        padding: 20px;
    }

    .btn {
        padding: 4px 10px;
        font-size: 12px;
    }

    .img-list img {
        height: auto;
        max-height: 100px;
    }

    .blog-actions {
        gap: 10px;
    }

    .avatar {
        width: 36px;
        height: 36px;
    }

    body {
        font-size: 15px;
    }

    .comment-item.reply {
        padding-left: 16px;
        margin-left: 8px;
    }

    .blog-title {
        font-size: 17px;
    }

    .blog-card {
        padding: 16px;
    }

    .card {
        padding: 14px 16px;
    }

    .blog-summary {
        font-size: 14px;
    }

    .comment-dialog {
        width: 98%;
        margin: 16px auto;
        padding: 16px;
        max-height: 95vh;
    }
}

/* 小手机 */
@media screen and (max-width: 400px) {
    .blog-actions {
        gap: 6px;
        font-size: 12px;
    }

    .btn {
        padding: 3px 8px;
        font-size: 11px;
    }

    .like-btn {
        padding: 2px 10px;
        font-size: 12px;
    }

    .img-list img {
        max-height: 80px;
    }
}
