/* ======================== 全局基础样式======================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Helvetica Neue", "微软雅黑", "Hiragino Sans GB", Arial, sans-serif;
    background-color: #f9f3ed;
    color: #5a4a42;
    line-height: 1.8;
    font-size: 16px;
    padding: 2rem 1rem;
}

a {
    text-decoration: none;
    transition: all 0.2s ease;
}

ul, li {
    list-style: none;
}

/* ======================== 文章详情页布局 ======================== */
.post-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 200px 1fr 280px;
    gap: 2rem;
}

/* ======================== 左侧标签区 ======================== */
.post-tags-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.tags-header {
    font-size: 1.1rem;
    color: #e67e22;
    font-weight: 500;
    margin-bottom: 0.8rem;
}

.post-tags-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.post-tag-item {
    padding: 0.5rem 1rem;
    background-color: #fff5eb;
    border-radius: 8px;
    color: #d35400;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.2s ease;
}

.post-tag-item:hover {
    background-color: #fde6d2;
    transform: translateX(4px);
}

.back-home {
    padding: 0.6rem 1rem;
    background-color: #e67e22;
    color: white;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.back-home:hover {
    background-color: #d35400;
}

/* ======================== 中间正文区 ======================== */
.post-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.post-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid #f0e6dc;
    padding-bottom: 1.5rem;
}

.post-title {
    font-size: 2rem;
    color: #333;
    margin-bottom: 1rem;
}

.post-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: #999;
}

.post-body {
    font-size: 1.05rem;
    color: #444;
}

.post-body p {
    margin-bottom: 1.5rem;
}

.post-body h2 {
    color: #e67e22;
    margin: 2rem 0 1rem;
    font-size: 1.5rem;
}

.post-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

/* 正文超链接样式 */
.post-body a {
    color: #e67e22;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px dotted #fde6d2;
}

/* 鼠标悬停效果 */
.post-body a:hover {
    color: #d35400;
    border-bottom: 1px solid #d35400;
    transition: all 0.2s ease;
}

/* ======================== 右侧附件下载卡片 ======================== */
.post-attachments {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.attachment-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.attachment-header {
    font-size: 1.1rem;
    color: #e67e22;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attachment-header i {
    font-size: 1.2rem;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background-color: #fff5eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.attachment-item:hover {
    background-color: #fde6d2;
    transform: translateX(2px);
}

.attachment-icon {
    font-size: 1.2rem;
    color: #d35400;
    width: 24px;
    text-align: center;
}

.attachment-info {
    flex: 1;
}

.attachment-name {
    font-size: 0.95rem;
    color: #5a4a42;
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.attachment-size {
    font-size: 0.8rem;
    color: #999;
}

.attachment-download {
    color: #e67e22;
    font-size: 1.1rem;
}

.attachment-download:hover {
    color: #d35400;
}

/* ======================== 密码弹窗样式 ======================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-box {
    background: #fff;
    border-radius: 14px;
    width: 90%;
    max-width: 380px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-box h3 {
    margin-bottom: 1rem;
    color: #e67e22;
    font-size: 1.2rem;
}

.modal-box p {
    color: #666;
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.modal-box input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 0.4rem;
    outline: none;
    transition: border 0.2s ease;
}

.modal-box input:focus {
    border-color: #e67e22;
}

.error-tip {
    color: #e74c3c;
    font-size: 0.85rem;
    height: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.modal-btns {
    display: flex;
    gap: 0.6rem;
}

.modal-btns button {
    flex: 1;
    padding: 0.8rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.btn-confirm {
    background: #e67e22;
    color: white;
}

.btn-confirm:hover {
    background: #d35400;
}

/* ======================== 响应式适配 ======================== */
@media (max-width: 992px) {
    .post-detail-container {
        grid-template-columns: 1fr;
    }

    .post-tags-sidebar, .post-attachments {
        position: static;
    }

    .post-tags-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .post-content {
        padding: 1.5rem 1rem;
    }

    .post-title {
        font-size: 1.6rem;
    }
}

/* 深色模式与浅色模式切换按钮 */

.theme-toggle-btn {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 9999;
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.95);
    color: #333;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    transform: translateY(-2px);
}

/* 深色模式 */

body.dark-mode {
    background: #121212;
    color: #e8e8e8;
}

/* 中间正文卡片 */
body.dark-mode .post-content,
body.dark-mode .attachment-card,
body.dark-mode .modal-box {
    background: #1e1e1e !important;
    color: #e8e8e8 !important;
    border-color: rgba(255,255,255,0.08);
}

/* 标题 */
body.dark-mode .post-title {
    color: #ffffff !important;
}

/* 时间 */
body.dark-mode .post-meta {
    color: rgba(255,255,255,0.65) !important;
}

/* 正文 */
body.dark-mode .post-body {
    color: rgba(255,255,255,0.88) !important;
}

/* 小标题 */
body.dark-mode .post-body h2 {
    color: #ff9d3d !important;
}

/* 附件名称 */
body.dark-mode .attachment-name {
    color: #ffffff !important;
}

/* 附件大小 */
body.dark-mode .attachment-size {
    color: rgba(255,255,255,0.65) !important;
}

/* 附件卡片 */
body.dark-mode .attachment-item,
body.dark-mode .post-tag-item {
    background: rgba(255,255,255,0.06) !important;
    color: #ffffff !important;
}

/* 返回主页按钮 */
body.dark-mode .back-home {
    background: #e67e22 !important;
    color: #ffffff !important;
}

/* 弹窗输入框 */
body.dark-mode .modal-box input {
    background: #2a2a2a;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.08);
}

/* 左下角按钮 */
body.dark-mode .theme-toggle-btn {
    background: rgba(30,30,30,0.95);
    color: #ffffff;
}

/* 手机适配 */
@media (max-width: 768px) {
    .theme-toggle-btn {
        left: 15px;
        bottom: 15px;
        padding: 10px 14px;
        font-size: 13px;
    }
}