/* ==============================================
   LX Sidebar Trigger — 前端样式
   
   结构：
   .lx-sidebar-trigger   → 触发器（图标/文字按钮，在页面流中）
   .lx-sidebar-overlay   → 遮罩层（fixed, 默认隐藏）
   .lx-sidebar-panel     → 侧边栏面板（fixed, 默认在屏幕外）
     .lx-sidebar-header  → 顶部栏（关闭按钮）
     .lx-sidebar-panel-body → 内容区（可滚动）
   ============================================== */

/* ---------- 触发器 ---------- */
.lx-sidebar-trigger {
    display: inline-block;
}

.lx-sidebar-trigger-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 16px;
    line-height: 1.5;
    padding: 8px 16px;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

.lx-sidebar-trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: none;
    padding: 8px;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

.lx-sidebar-trigger-icon i {
    display: flex;
    width: 1em;
    height: 1em;
    align-items: center;
    justify-content: center;
}

.lx-sidebar-trigger-icon svg {
    display: block;
}

/* ---------- 遮罩层 ---------- */
.lx-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lx-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ---------- 侧边栏面板 ---------- */
.lx-sidebar-panel {
    position: fixed;
    top: 0;
    height: 100%;
    width: 400px;
    background-color: #ffffff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease;
}

/* 默认：在屏幕外 */
.lx-sidebar-panel.position-left {
    left: 0;
    transform: translateX(-100%);
}

.lx-sidebar-panel.position-right {
    right: 0;
    transform: translateX(100%);
}

/* 激活：滑入屏幕 */
.lx-sidebar-panel.active.position-left,
.lx-sidebar-panel.active.position-right {
    transform: translateX(0);
}

/* Keep the drawer below the WordPress admin bar for logged-in admins. */
body.admin-bar .lx-sidebar-overlay,
body.admin-bar .lx-sidebar-panel {
    top: 32px;
    height: calc(100% - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .lx-sidebar-overlay,
    body.admin-bar .lx-sidebar-panel {
        top: 46px;
        height: calc(100% - 46px);
    }
}

/* ---------- 顶部栏（关闭按钮） ---------- */
.lx-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
    padding: 12px 16px;
}

.lx-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: none;
    padding: 6px;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    transition: all 0.2s ease;
}

.lx-sidebar-close i {
    display: flex;
    width: 1em;
    height: 1em;
    align-items: center;
    justify-content: center;
}

.lx-sidebar-close svg {
    display: block;
}

.lx-sidebar-close:hover {
    cursor: pointer;
}

/* ---------- 侧边栏内容区 ---------- */
.lx-sidebar-panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.lx-sidebar-panel-body::-webkit-scrollbar {
    width: 6px;
}

.lx-sidebar-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.lx-sidebar-panel-body::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.lx-sidebar-panel-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.25);
}

/* 占位文字 */
.lx-sidebar-placeholder {
    color: #999;
    font-size: 14px;
    text-align: center;
    padding: 40px 20px;
    margin: 0;
}

/* 防止侧边栏打开时页面滚动 */
body.lx-sidebar-open {
    overflow: hidden;
}

/* ==============================================
   响应式适配
   ============================================== */
@media (max-width: 767px) {
    .lx-sidebar-panel {
        width: 85vw !important;
    }
}

/* ==============================================
   Elementor 编辑器兼容：编辑器中直接展示侧边栏内容
   ============================================== */
/* Elementor editor/preview intentionally uses the same fixed off-canvas
   behavior as the front-end page, so the canvas preview matches production. */
