/* ======================== 全局基础样式======================== */
* {
    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;
    }
}

/*代码块样式*/
        .code-block {
            margin: 1.8rem 0;
            border-radius: 12px;
            background-color: #f6f8fa;
            border: 1px solid #e1e4e8;
            overflow: hidden;
            transition: all 0.2s;
        }
        .code-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.6rem 1rem;
            background-color: #eef2f5;
            border-bottom: 1px solid #e1e4e8;
            font-size: 0.85rem;
            font-family: monospace;
        }
        .code-lang {
            color: #d35400;
            font-weight: 500;
            letter-spacing: 0.5px;
        }
        .copy-btn {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 0.8rem;
            color: #5a4a42;
            padding: 4px 10px;
            border-radius: 6px;
            transition: all 0.2s;
            font-family: inherit;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        .copy-btn:hover {
            background-color: rgba(0,0,0,0.05);
            color: #e67e22;
        }
        .copy-btn.copied {
            color: #27ae60;
        }
        .code-content {
            overflow-x: auto;
        }
        .code-content pre {
            margin: 0;
            padding: 1.2rem;
            background-color: #f6f8fa;
            font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
            font-size: 0.9rem;
            line-height: 1.5;
            color: #24292e;
            white-space: pre-wrap;
            word-wrap: break-word;
        }
        .code-content code {
            font-family: inherit;
        }
        /* 深色模式适配代码块 */
        body.dark-mode .code-block {
            background-color: #1e1e1e;
            border-color: #2d2d2d;
        }
        body.dark-mode .code-header {
            background-color: #2c2c2c;
            border-bottom-color: #3a3a3a;
        }
        body.dark-mode .code-lang {
            color: #ff9d3d;
        }
        body.dark-mode .copy-btn {
            color: #cccccc;
        }
        body.dark-mode .copy-btn:hover {
            background-color: rgba(255,255,255,0.1);
            color: #ff9d3d;
        }
        body.dark-mode .code-content pre {
            background-color: #1e1e1e;
            color: #e8e8e8;
        }
        /* 手机端微调 */
        @media (max-width: 768px) {
            .code-header {
                padding: 0.4rem 0.8rem;
                font-size: 0.75rem;
            }
            .code-content pre {
                padding: 0.8rem;
                font-size: 0.8rem;
            }
        }

/*iframe 视频样式方案*/
/*
所有 iframe 的全局样式*
iframe {
  width: 100%;
  max-width: 800px;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  margin: 0 auto;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
*/
/*针对 .video-container 容器内的 iframe */
.video-container {
  width: 100%;
  max-width: 900px;
  margin: 20px auto;
  position: relative;
}

.video-container iframe {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 悬停效果 */
.video-container iframe:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

/* 方案三：多种尺寸预设（根据场景选择）
.video-small iframe {
  max-width: 560px;
}

.video-medium iframe {
  max-width: 800px;
}

.video-large iframe {
  max-width: 1200px;
}
*/
/*
方案四：圆形/特殊形状（可选
.video-rounded iframe {
  border-radius: 50%;
  aspect-ratio: 1 / 1;  /* 正方形 */
}
*/

/* =========================================
   响应式设计（移动端适配）
   ========================================= */

/* 平板设备（768px 以下） */
@media (max-width: 768px) {
  .video-container {
    max-width: 100%;
    margin: 15px auto;
  }
  
  .video-container iframe {
    border-radius: 12px;
  }
  
  /* 悬停效果在触摸屏上禁用 */
  .video-container iframe:hover {
    transform: none;
  }
}

/* 手机设备（480px 以下） */
@media (max-width: 480px) {
  .video-container iframe {
    border-radius: 8px;
  }
  
  .video-container {
    margin: 10px auto;
  }
}

/* 大屏幕（1200px 以上） */
@media (min-width: 1200px) {
  .video-container {
    max-width: 1000px;
  }
}

/* =========================================
   深色模式适配
   ========================================= */
@media (prefers-color-scheme: dark) {
  .video-container iframe {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

/* =========================================
   工具类（方便快速使用）
   ========================================= */

/* 居中工具类 */
.video-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.video-center iframe {
  margin: 0;
}

/* 全宽视频（撑满容器） */
.video-fullwidth iframe {
  max-width: 100%;
  border-radius: 0;
}

/* 带边框的视频 */
.video-bordered iframe {
  border: 2px solid #ddd;
  box-shadow: none;
}

/* 无圆角视频 */
.video-no-radius iframe {
  border-radius: 0;
}

/* 无阴影视频 */
.video-no-shadow iframe {
  box-shadow: none;
}

/* =========================================
   懒加载占位效果
   ========================================= */
.video-container {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 16px;
  overflow: hidden;
}

/* 加载完成后移除占位背景 */
.video-container iframe {
  background: transparent;
}
