/* ====== OneMiro Left-Sidebar TOC v2 ====== */

/* --- 扩大布局容器 --- */
.single-layout {
    max-width: 1400px;
}

/* --- 文章居中（无右侧sidebar时） --- */
.single-content {
    margin: 0 auto;
    max-width: 1100px;
}

/* --- 文章头部 --- */
.single-article-title {
    font-size: 28px; font-weight: 800; color: #111;
    line-height: 1.35; margin-bottom: 10px;
    padding-bottom: 16px; border-bottom: 2px solid #e5e7eb;
    text-align: center;
}
.single-article-meta {
    padding-bottom: 16px; margin-bottom: 24px;
    border-bottom: 1px solid #f0f0f0;
    justify-content: center;
}

/* --- 隐藏正文中插件自动插入的TOC --- */
.single-article-body #ez-toc-container {
    display: none !important;
}

/* --- 摘要框 --- */
.single-article-body .onemi-takeaways {
    background: #f5f5f5;
    border-left: none;
    border-radius: 0 10px 10px 0;
    padding: 20px 24px; margin: 24px 0;
}
.single-article-body .onemi-takeaways h3 {
    color: #000; font-size: 1.05em;
    margin: 0 0 12px 0;
}

/* --- 文章图片居中撑满 --- */
.single-article-body img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 15px auto;
    border-radius: 4px;
}

/* --- 左侧浮动TOC --- */
.onemi-toc-sidebar {
    display: none;          /* mobile default: hidden */
    position: fixed;
    top: 70px;
    width: 260px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    z-index: 50;
    background: #f5f5f5;
    padding: 20px 20px 20px 22px;
    border-radius: 12px;
}
.onemi-toc-sidebar::-webkit-scrollbar { width: 4px; }
.onemi-toc-sidebar::-webkit-scrollbar-track { background: transparent; }
.onemi-toc-sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.onemi-toc-sidebar .toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}
.onemi-toc-sidebar .toc-label {
    font-size: 11px; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 2.5px;
    margin: 0; padding: 0; border: none;
}
.toc-collapse-btn {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: 1px solid #d1d5db;
    border-radius: 6px; cursor: pointer;
    color: #6b7280; font-size: 16px; font-weight: 700;
    line-height: 1; padding: 0;
    transition: all 0.2s;
}
.toc-collapse-btn:hover {
    background: #e5e7eb; color: #374151;
}
/* 收缩状态 */
.onemi-toc-sidebar.collapsed {
    width: 44px;
    padding: 10px 8px;
    overflow: hidden;
}
.onemi-toc-sidebar.collapsed .toc-header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
    flex-direction: column;
    gap: 4px;
}
.onemi-toc-sidebar.collapsed .toc-label {
    font-size: 9px; letter-spacing: 1px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}
/* 隐藏插件自带收缩按钮 */
.onemi-toc-sidebar .ez-toc-title-toggle,
.onemi-toc-sidebar .ez-toc-toggle,
.onemi-toc-sidebar .ez-toc-title-container {
    display: none !important;
}


/* TOC 列表样式 - 复用插件class */
.onemi-toc-sidebar ul.ez-toc-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
.onemi-toc-sidebar .ez-toc-list li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
.onemi-toc-sidebar .ez-toc-list li::before {
    content: none !important;
    display: none !important;
}

/* H2 项 */
.onemi-toc-sidebar .ez-toc-list > li > a {
    display: block;
    padding: 7px 10px 7px 12px;
    font-size: 13.5px; font-weight: 600;
    color: #374151; text-decoration: none;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
    transition: all 0.15s ease;
    line-height: 1.5;
    margin: 0;
}
.onemi-toc-sidebar .ez-toc-list > li > a:hover {
    color: #2563eb;
    background: #f0f7ff;
    border-left-color: #2563eb;
}

/* H3 子项 */
.onemi-toc-sidebar .ez-toc-list ul.ez-toc-list-level-3 {
    padding: 0 0 6px 18px !important;
    margin: 0 !important;
}
.onemi-toc-sidebar .ez-toc-list ul li a {
    display: block;
    padding: 5px 10px 5px 12px;
    font-size: 12.5px; font-weight: 400;
    color: #64748b; text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.15s;
    line-height: 1.4;
    margin: 0;
}
.onemi-toc-sidebar .ez-toc-list ul li a:hover {
    color: #2563eb;
    background: #f0f7ff;
    border-left-color: #93c5fd;
}

/* 当前激活高亮 */
.onemi-toc-sidebar .ez-toc-link.active {
    color: #2563eb !important;
    border-left-color: #2563eb !important;
    background: #f0f7ff !important;
}

/* --- Desktop: 显示sidebar，计算left位置 --- */
@media (min-width: 1200px) {
    .onemi-toc-sidebar {
        display: block;
        left: calc((100vw - 1280px) / 2 - 280px);
    }
}

/* --- Tablet (1024-1199px): 显示但更窄间距 --- */
@media (min-width: 1024px) and (max-width: 1199px) {
    .onemi-toc-sidebar {
        display: block;
        left: 8px;
        width: 240px;
        border-radius: 12px;
        padding: 18px 18px 18px 20px;
    }
}

/* --- Mobile: 隐藏fixed sidebar，显示正文内TOC --- */
@media (max-width: 1023px) {
    .onemi-toc-sidebar { display: none !important; }
    .single-article-body #ez-toc-container { display: block !important; }
}

@media (max-width: 768px) {
    .single-article-title { font-size: 22px; padding-bottom: 12px; }
    .single-article-body #ez-toc-container {
        top: 56px !important;
        padding: 10px 14px 8px !important;
        border-radius: 8px !important;
        margin: 0 0 20px 0 !important;
    }
}

/* ====== 上一篇 / 下一篇导航 ====== */
.post-nav {
    margin: 40px 0 0 0;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}
.post-nav-inner {
    display: flex;
    gap: 20px;
}
.post-nav-item {
    flex: 1;
    min-width: 0;
}
.post-nav-item.post-nav-prev {
    text-align: left;
}
.post-nav-item.post-nav-next {
    text-align: right;
}
.post-nav-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
}
.post-nav-link:hover {
    background: #f0f7ff;
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(37,99,235,0.08);
}
.post-nav-label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.post-nav-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-nav-link:hover .post-nav-title {
    color: #2563eb;
}

/* ====== 相关文章 ====== */
.related-articles {
    margin: 50px 0 0 0;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}
.related-title {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    margin-bottom: 20px;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.related-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}
.related-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 12px rgba(37,99,235,0.08);
}
.related-card-link {
    display: block;
    padding: 16px;
    text-decoration: none;
}
.related-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.5;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-card-link:hover .related-card-title {
    color: #2563eb;
}
.related-card-date {
    font-size: 12px;
    color: #94a3b8;
}

/* Tablet: 2列 */
@media (max-width: 768px) {
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .post-nav-inner {
        flex-direction: column;
    }
    .post-nav-item.post-nav-next {
        text-align: left;
    }
}

/* ====== CTA 全宽 ====== */
.onemi-cta-fullwidth {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-top: 40px;
    margin-bottom: 30px;
}
.onemi-cta-hardcoded {
    background: linear-gradient(135deg, #c7000b, #8b0000);
    color: #fff; padding: 35px 24px; border-radius: 0;
    text-align: center;
    max-width: 1110px; margin: 0 auto;
}
.onemi-cta-hardcoded h3 {
    color: #fff; margin: 0 0 12px 0; font-size: 30px;
    background: none !important; padding: 0 !important;
    display: block !important;
}
.onemi-cta-hardcoded p {
    margin: 0 0 16px 0; line-height: 1.6; color: #fff;
}
.onemi-cta-hardcoded .onemi-cta-links {
    margin: 0; font-size: 1.1em;
}
.onemi-cta-hardcoded .onemi-cta-links a {
    color: #fff; text-decoration: underline;
}
.onemi-cta-hardcoded .onemi-cta-links strong a {
    color: #ffd700;
}

/* 隐藏插件自带的收缩按钮 */
.onemi-toc-sidebar .ez-toc-title-toggle,
.onemi-toc-sidebar .ez-toc-toggle,
.onemi-toc-sidebar .ez-toc-title-container {
    display: none !important;
}

/* ====== Right-Side FAQ Sidebar (categorized Q&A accordion) ====== */
.onemi-faq-sidebar {
    display: none;
    position: fixed;
    top: 70px;
    width: 280px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    z-index: 50;
    background: #f5f5f5;
    padding: 20px 20px 16px 22px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.onemi-faq-sidebar::-webkit-scrollbar { width: 4px; }
.onemi-faq-sidebar::-webkit-scrollbar-track { background: transparent; }
.onemi-faq-sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.onemi-faq-sidebar .faq-sb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}
.onemi-faq-sidebar .faq-sb-label {
    font-size: 11px; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 2.5px;
}
.onemi-faq-sidebar .faq-collapse-btn {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: 1px solid #d1d5db;
    border-radius: 6px; cursor: pointer;
    color: #6b7280; font-size: 16px; font-weight: 700;
    line-height: 1; padding: 0;
    transition: all 0.2s;
}
.onemi-faq-sidebar .faq-collapse-btn:hover {
    background: #e5e7eb; color: #374151;
}
.onemi-faq-sidebar .faq-sb-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.onemi-faq-sidebar .faq-sb-cat-name {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 6px;
    padding-left: 2px;
    letter-spacing: 0.5px;
}
.onemi-faq-sidebar .faq-sb-item {
    border-bottom: 1px solid #eef0f3;
    padding: 0;
}
.onemi-faq-sidebar .faq-sb-item:last-child {
    border-bottom: none;
}
.onemi-faq-sidebar .faq-sb-q {
    display: flex;
    align-items: flex-start;
    padding: 8px 4px 8px 0;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    list-style: none;
    line-height: 1.5;
    transition: color 0.15s;
}
.onemi-faq-sidebar .faq-sb-q::-webkit-details-marker {
    display: none;
}
.onemi-faq-sidebar .faq-sb-q::before {
    content: +;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    margin-top: 1px;
    font-size: 14px;
    font-weight: 700;
    color: #94a3b8;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    transition: all 0.2s;
}
.onemi-faq-sidebar .faq-sb-item[open] .faq-sb-q::before {
    content: 2212;
    color: #2563eb;
    border-color: #93c5fd;
    background: #f0f7ff;
}
.onemi-faq-sidebar .faq-sb-q:hover {
    color: #2563eb;
}
.onemi-faq-sidebar .faq-sb-a {
    padding: 0 4px 12px 26px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.7;
}
.onemi-faq-sidebar .faq-sb-a strong {
    color: #374151;
    font-weight: 600;
}
.onemi-faq-sidebar .faq-sb-footer {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}
.onemi-faq-sidebar .faq-sb-more {
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
}
.onemi-faq-sidebar .faq-sb-more:hover {
    text-decoration: underline;
}
.onemi-faq-sidebar.collapsed {
    width: 44px;
    padding: 10px 8px;
    overflow: hidden;
}
.onemi-faq-sidebar.collapsed .faq-sb-header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
    flex-direction: column;
    gap: 4px;
}
.onemi-faq-sidebar.collapsed .faq-sb-label {
    font-size: 9px; letter-spacing: 1px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}
@media (min-width: 1200px) {
    .onemi-faq-sidebar {
        display: block;
        right: calc((100vw - 1280px) / 2 - 280px);
    }
}
@media (min-width: 1024px) and (max-width: 1199px) {
    .onemi-faq-sidebar {
        display: block;
        right: 8px;
        width: 250px;
        padding: 18px 18px 14px 20px;
    }
}
@media (max-width: 1023px) {
    .onemi-faq-sidebar { display: none !important; }
}

/* ===== Mobile TOC Bar: always visible below header ===== */
.onemi-toc-bar {
    max-width: 100vw;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: #fff;
    z-index: 999;
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 0 12px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border-bottom: 1px solid #eee;
}
.onemi-toc-bar::-webkit-scrollbar { display: none; }

/* TOC项 — 胶囊按钮, 2 items visible (~170px each) */
.onemi-toc-bar a {
    display: -webkit-inline-box;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    height: auto;
    min-height: 30px;
    max-height: 40px;
    padding: 5px 14px;
    font-size: 13px;
    line-height: 15px;
    font-weight: 500;
    color: #555;
    background: #f5f5f5;
    border-radius: 18px;
    text-decoration: none;
    flex-shrink: 0;
    max-width: 170px;
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    transition: all 0.2s;
    vertical-align: middle;
}
.onemi-toc-bar a:active {
    background: #eee;
}
.onemi-toc-bar a.active {
    color: #fff;
    background: #C7000B;
}

/* 手机端隐藏文章内嵌 EZ-TOC */
@media (max-width: 1023px) {
    .single-article-body #ez-toc-container {
        display: none !important;
    }
}
/* 桌面端不显示 TOC bar */
@media (min-width: 1024px) {
    .onemi-toc-bar { display: none !important; }
}


/* ===== 文章正文表格基础样式（2026-07-26 补） ===== */
.single-article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.8em 0;
    font-size: 15px;
    line-height: 1.6;
    background: #fff;
}
.single-article-body thead th {
    background: #f7f7f8;
    color: #222;
    font-weight: 600;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid #e3e5e8;
    border-bottom: 2px solid #C7000B;
}
.single-article-body tbody td {
    padding: 11px 14px;
    border: 1px solid #e3e5e8;
    color: #444;
    vertical-align: top;
}
.single-article-body tbody tr:nth-child(even) {
    background: #fafbfc;
}
.single-article-body tbody tr:hover {
    background: #fff5f5;
}

/* 手机端表格防溢出 v3.0.19：表格默认table-layout:auto按内容撑宽，
   且border-collapse:collapse时overflow-x在table上无效（W3C已知行为），
   改用table-layout:fixed强制100%宽+单元格长词硬断行 */
@media (max-width: 768px) {
    .single-article-body table {
        table-layout: fixed;
        width: 100% !important;
    }
    .single-article-body td,
    .single-article-body th {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

/* v3.0.15: 移动端导航图片约束 + overflow加强 */
.mob-img-bottom {
    max-width: 100% !important;
    height: auto !important;
}
.mob-overlay {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}
/* 全局img安全约束 */
img {
    max-width: 100%;
    box-sizing: border-box;
}

/* ===== v3.0.20: Mobile FAQ floating button + bottom sheet (<1024px) ===== */
.onemi-faq-fab,
.onemi-faq-sheet,
.onemi-faq-backdrop { display: none; }
@media (max-width: 1023px) {
    .onemi-faq-fab {
        display: flex;
        align-items: center;
        gap: 8px;
        position: fixed;
        left: 16px;
        bottom: calc(24px + env(safe-area-inset-bottom, 0px));
        z-index: 9990;
        height: 48px;
        padding: 0 20px;
        border: none;
        border-radius: 999px;
        background: #1a1a1a;
        color: #fff;
        font-family: inherit;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        box-shadow: 0 4px 14px rgba(0,0,0,.28);
        -webkit-tap-highlight-color: transparent;
    }
    .onemi-faq-fab:active { transform: scale(.96); }
    .onemi-faq-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 9991;
        opacity: 0;
        visibility: hidden;
        transition: opacity .25s;
    }
    .onemi-faq-backdrop.show { opacity: 1; visibility: visible; }
    .onemi-faq-sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9992;
        max-height: 75vh;
        background: #fff;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0,0,0,.18);
        transform: translateY(102%);
        transition: transform .28s ease;
    }
    .onemi-faq-sheet.open { transform: translateY(0); }
    .faq-mb-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 18px 12px;
        border-bottom: 1px solid #eee;
    }
    .faq-mb-title { font-size: 13px; font-weight: 700; letter-spacing: 2px; color: #94a3b8; }
    .faq-mb-close {
        width: 30px; height: 30px;
        border: none; border-radius: 50%;
        background: #f1f5f9; color: #475569;
        font-size: 18px; line-height: 1; cursor: pointer;
    }
    .faq-mb-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 18px;
    }
    .faq-mb-cat-name { font-size: 14px; font-weight: 700; color: #111827; margin: 12px 0 6px; }
    .faq-mb-cat:first-child .faq-mb-cat-name { margin-top: 2px; }
    .faq-mb-item { border-bottom: 1px solid #f1f5f9; }
    .faq-mb-q {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 11px 2px;
        font-size: 14px;
        font-weight: 500;
        color: #1f2937;
        cursor: pointer;
        list-style: none;
    }
    .faq-mb-q::-webkit-details-marker { display: none; }
    .faq-mb-q::after { content: '+'; font-size: 18px; color: #94a3b8; flex-shrink: 0; }
    .faq-mb-item[open] .faq-mb-q::after { content: '\2212'; }
    .faq-mb-a { padding: 0 2px 12px; font-size: 13.5px; line-height: 1.65; color: #4b5563; }
    .faq-mb-footer {
        padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid #eee;
        text-align: center;
    }
    .faq-mb-more { font-size: 13px; font-weight: 600; color: #2563eb; text-decoration: none; }
    .faq-mb-more:hover { text-decoration: underline; }
}
