/**
 * 四为侧边导航小部件样式
 * Version: 1.0.7 - 支持禁用粘性定位
 */

/* ==========================================
   侧边导航容器
   ========================================== */
.siwei-sidebar-nav-widget {
    width: 250px;
    flex-shrink: 0;
}

/* Sticky 定位直接应用到 Elementor widget 层级（仅当启用时） */
.elementor-widget-siwei_sidebar_nav:has(.siwei-nav-sticky) {
    position: -webkit-sticky; /* Safari 兼容性 */
    position: sticky;
    top: 100px;
    align-self: flex-start;
    z-index: 10; /* 确保在其他内容之上 */
}

/* 静态定位（禁用粘性时） */
.elementor-widget-siwei_sidebar_nav:has(.siwei-nav-static) {
    position: relative;
    align-self: flex-start;
}

/* 备选方案：针对不支持 :has() 的浏览器 */
@supports not selector(:has(*)) {
    /* 默认启用 sticky（与开关默认值一致） */
    .elementor-widget-siwei_sidebar_nav {
        position: -webkit-sticky;
        position: sticky;
        top: 100px;
        align-self: flex-start;
        z-index: 10;
    }

    /* 通过 data 属性禁用 */
    .elementor-widget-siwei_sidebar_nav[data-sticky="no"] {
        position: relative;
    }
}

.siwei-sidebar-nav-container {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* 最大高度限制，避免超出视口 */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
}

/* ==========================================
   导航标题
   ========================================== */
.siwei-sidebar-nav-title {
    padding: 20px;
    background: linear-gradient(135deg, #006aa6 0%, #003460 100%);
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* ==========================================
   菜单列表
   ========================================== */
.siwei-sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.siwei-sidebar-nav-item {
    border-bottom: 1px solid #f0f0f0;
}

.siwei-sidebar-nav-item:last-child {
    border-bottom: none;
}

/* ==========================================
   菜单链接
   ========================================== */
.siwei-sidebar-nav-link {
    display: block;
    padding: 15px 20px;
    color: #333333;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.siwei-sidebar-nav-link:hover {
    background: #cce5ff;
    color: #006aa6;
    padding-left: 25px;
}

/* 激活状态 */
.siwei-sidebar-nav-link.active {
    background: #cce5ff;
    color: #006aa6;
    font-weight: 600;
}

/* 激活指示器（左侧蓝色竖条） */
.siwei-sidebar-nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #006aa6;
}

/* ==========================================
   响应式设计
   ========================================== */

/* 平板端 */
@media (max-width: 900px) {
    .siwei-sidebar-nav-widget {
        width: 100%;
        margin-bottom: 30px;
    }

    .siwei-sidebar-nav-container {
        position: relative;
        top: auto;
    }
}

/* 手机端 */
@media (max-width: 768px) {
    .siwei-sidebar-nav-widget {
        display: none; /* 移动端默认隐藏 */
    }

    /* 如果需要在移动端显示，可以注释掉上面的 display: none; 并使用以下样式 */
    /*
    .siwei-sidebar-nav-widget {
        width: 100%;
    }

    .siwei-sidebar-nav-title {
        padding: 15px;
        font-size: 16px;
    }

    .siwei-sidebar-nav-link {
        padding: 12px 15px;
        font-size: 14px;
    }

    .siwei-sidebar-nav-link:hover {
        padding-left: 20px;
    }
    */
}

/* ==========================================
   Elementor 容器兼容性
   ========================================== */

/* Elementor 编辑器中禁用 sticky（避免编辑困难） */
.elementor-editor-active .elementor-widget-siwei_sidebar_nav,
.elementor-editor-active .elementor-widget-siwei_sidebar_nav:has(.siwei-nav-sticky) {
    position: relative !important;
    top: auto !important;
}

/* ==========================================
   打印样式
   ========================================== */
@media print {
    .siwei-sidebar-nav-widget {
        display: none;
    }
}
