/**
 * Site 详情页 Description 富文本样式
 * 
 * 使用方法：在后台填写 description 时，可以直接写 HTML 标签
 * 支持：div, h1-h6, p, ul, ol, li, table, thead, tbody, tr, th, td, a, code, blockquote 等
 * 
 * 容器类名：.site-desc-rich
 */

/* ========================================
   1. 基础容器样式
   ======================================== */
.site-desc-rich {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.8;
    color: #374151;
    word-wrap: break-word;
    word-break: break-word;
}

/* ========================================
   2. 标题样式（突出显示）
   ======================================== */
.site-desc-rich h1,
.site-desc-rich h2,
.site-desc-rich h3,
.site-desc-rich h4,
.site-desc-rich h5,
.site-desc-rich h6 {
    font-weight: 700;
    line-height: 1.4;
    margin-top: 1.5em;
    margin-bottom: 0.6em;
    color: #1f2937;
    padding: 0.5em 0.75em;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-left: 4px solid #6366f1;
    border-radius: 0 8px 8px 0;
}

.site-desc-rich h1 {
    font-size: 1.6em;
}

.site-desc-rich h2 {
    font-size: 1.4em;
}

.site-desc-rich h3 {
    font-size: 1.2em;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left-color: #3b82f6;
}

.site-desc-rich h4 {
    font-size: 1.1em;
    background: #f9fafb;
    border-left-color: #6b7280;
}

.site-desc-rich h5,
.site-desc-rich h6 {
    font-size: 1em;
    background: #f9fafb;
    border-left-color: #9ca3af;
}

/* 第一个标题不需要上边距 */
.site-desc-rich > h1:first-child,
.site-desc-rich > h2:first-child,
.site-desc-rich > h3:first-child {
    margin-top: 0;
}

/* ========================================
   3. 段落与行内元素
   ======================================== */
.site-desc-rich p {
    margin: 0 0 1em 0;
}

.site-desc-rich strong,
.site-desc-rich b {
    font-weight: 600;
    color: #1f2937;
}

.site-desc-rich em,
.site-desc-rich i {
    font-style: italic;
    color: #4b5563;
}

.site-desc-rich u {
    text-decoration: underline;
    text-decoration-color: #9ca3af;
    text-underline-offset: 2px;
}

.site-desc-rich s,
.site-desc-rich del {
    text-decoration: line-through;
    color: #9ca3af;
}

/* ========================================
   4. 链接样式（突出显示）
   ======================================== */
.site-desc-rich a {
    color: #6366f1;
    text-decoration: underline;
    text-decoration-color: #a5b4fc;
    text-underline-offset: 3px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.site-desc-rich a:hover {
    color: #4f46e5;
    text-decoration-color: #6366f1;
    text-decoration-thickness: 2px;
}

/* ========================================
   5. 列表样式
   ======================================== */
.site-desc-rich ul,
.site-desc-rich ol {
    margin: 0 0 1em 0;
    padding-left: 1.5em;
}

.site-desc-rich li {
    margin-bottom: 0.5em;
    position: relative;
}

.site-desc-rich ul li::marker {
    color: #6366f1;
}

.site-desc-rich ol li::marker {
    color: #6366f1;
    font-weight: 600;
}

/* 无序列表小圆点样式 */
.site-desc-rich ul li::before {
    content: '';
    position: absolute;
    left: -1.2em;
    top: 0.65em;
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
}

/* 嵌套列表 */
.site-desc-rich ul ul,
.site-desc-rich ol ol,
.site-desc-rich ul ol,
.site-desc-rich ol ul {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

/* ========================================
   6. 任务列表样式
   ======================================== */
.site-desc-rich input[type="checkbox"] {
    margin-right: 0.5em;
    accent-color: #6366f1;
}

/* ========================================
   7. 代码样式
   ======================================== */
.site-desc-rich code {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.875em;
    background: #f3f4f6;
    color: #7c3aed;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.site-desc-rich pre {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.875em;
    background: #1f2937;
    color: #e5e7eb;
    padding: 1em 1.25em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0 0 1em 0;
    line-height: 1.6;
}

.site-desc-rich pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: 1em;
}

/* ========================================
   8. 引用块样式
   ======================================== */
.site-desc-rich blockquote {
    margin: 0 0 1em 0;
    padding: 1em 1.25em;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-left: 4px solid #6366f1;
    border-radius: 0 8px 8px 0;
    color: #4b5563;
    font-style: italic;
}

.site-desc-rich blockquote p:last-child {
    margin-bottom: 0;
}

.site-desc-rich blockquote cite {
    display: block;
    margin-top: 0.75em;
    font-size: 0.875em;
    font-style: normal;
    color: #6b7280;
}

/* ========================================
   9. 表格样式
   ======================================== */
.site-desc-rich table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1em 0;
    font-size: 0.9em;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.site-desc-rich thead {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.site-desc-rich th {
    color: #ffffff;
    font-weight: 600;
    text-align: left;
    padding: 0.875em 1em;
    letter-spacing: 0.02em;
}

.site-desc-rich td {
    padding: 0.75em 1em;
    border-bottom: 1px solid #e5e7eb;
}

.site-desc-rich tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.site-desc-rich tbody tr:hover {
    background-color: #f5f3ff;
}

/* ========================================
   10. Div 区块样式
   ======================================== */
.site-desc-rich div {
    margin-bottom: 1em;
}

/* 常用 div 容器类 */
.site-desc-rich .info-box,
.site-desc-rich .tip-box,
.site-desc-rich .warning-box,
.site-desc-rich .danger-box {
    padding: 1em 1.25em;
    border-radius: 8px;
    margin-bottom: 1em;
    border-left: 4px solid;
}

.site-desc-rich .info-box {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.site-desc-rich .tip-box {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #166534;
}

.site-desc-rich .warning-box {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.site-desc-rich .danger-box {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

/* ========================================
   11. 分隔线样式
   ======================================== */
.site-desc-rich hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
    margin: 2em 0;
}

/* ========================================
   12. 图片样式
   ======================================== */
.site-desc-rich img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5em 0;
}

.site-desc-rich figure {
    margin: 1em 0;
}

.site-desc-rich figcaption {
    text-align: center;
    font-size: 0.875em;
    color: #6b7280;
    margin-top: 0.5em;
}

/* ========================================
   12.5 视频与嵌入式内容样式
   ======================================== */
.site-desc-rich video {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
}

.site-desc-rich iframe {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 8px;
}

/* 响应式视频容器：包裹 16:9 的视频 */
.site-desc-rich .video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    margin-bottom: 1em;
}

.site-desc-rich .video-wrapper iframe,
.site-desc-rich .video-wrapper video,
.site-desc-rich .video-wrapper embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
}

/* ========================================
   13. 响应式适配
   ======================================== */
@media (max-width: 768px) {
    .site-desc-rich {
        font-size: 14px;
    }

    .site-desc-rich h1 {
        font-size: 1.5em;
    }

    .site-desc-rich h2 {
        font-size: 1.3em;
    }

    .site-desc-rich h3 {
        font-size: 1.15em;
    }

    /* 表格横向滚动，防止内容被挤压 */
    .site-desc-rich table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 0.85em;
        -webkit-overflow-scrolling: touch;
    }

    .site-desc-rich th,
    .site-desc-rich td {
        padding: 0.5em 0.75em;
        white-space: nowrap;
    }

    /* 移动端视频自适应 — 保持 16:9 比例 */
    .site-desc-rich iframe {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9;
    }
}

/* ========================================
   14. 打印样式
   ======================================== */
@media print {
    .site-desc-rich {
        font-size: 12pt;
        color: #000;
    }
    
    .site-desc-rich a {
        color: #000;
        text-decoration: underline;
    }
    
    .site-desc-rich pre,
    .site-desc-rich blockquote {
        background: #f5f5f5;
        border-color: #ccc;
    }
}
