/* ============================================================
   侧边栏收起开关（iOS 滑动开关风格）
   放置在文章详情页 .single-metabox 元数据行尾部
   ============================================================ */

/* ── 开关容器 ── */
.zm-sidebar-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 10px;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── 隐藏原生 checkbox ── */
.zm-sidebar-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

/* ── 滑轨 ── */
.zm-sidebar-switch .zm-sw-track {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--muted-2-color, #ccc);
    border-radius: 22px;
    transition: background 0.3s;
}

/* ── 滑块（圆形把手） ── */
.zm-sidebar-switch .zm-sw-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}

/* ── 选中状态（侧边栏已隐藏 → 开关亮起） ── */
.zm-sidebar-switch input:checked + .zm-sw-track {
    background: var(--focus-color, #3b82f6);
}
.zm-sidebar-switch input:checked + .zm-sw-track::after {
    transform: translateX(18px);
}

/* ── hover ── */
.zm-sidebar-switch:hover .zm-sw-track {
    filter: brightness(0.92);
}

/* ============================================================
   侧边栏隐藏 / 展开状态
   ============================================================ */
.zm-sidebar-hidden .sidebar {
    display: none !important;
}
.zm-sidebar-hidden .content-layout {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

/* 过渡动画 */
.zm-sidebar-anim .content-layout {
    transition: margin 0.35s ease;
}

/* ============================================================
   移动端隐藏开关（侧边栏本身已隐藏）
   ============================================================ */
@media (max-width: 991px) {
    .zm-sidebar-switch {
        display: none !important;
    }
}

/* ============================================================
   暗色模式
   ============================================================ */
body.dark-theme .zm-sidebar-switch .zm-sw-track {
    background: rgba(255, 255, 255, 0.15);
}
body.dark-theme .zm-sidebar-switch input:checked + .zm-sw-track {
    background: var(--focus-color, #3b82f6);
}
