/**
 * B2 商品展示 - 锚点导航样式
 * 
 * 5种颜色风格 + 自定义配色
 * 特性：等宽自适应铺满 + 悬停底框颜色条
 */

/* ========================================
   基础样式 - 强制重置，确保布局正确
======================================== */
.b2ps-anchor-nav {
    display: block !important;
    position: sticky !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: both !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: box-shadow 0.3s ease;
    box-sizing: border-box;
}

.b2ps-anchor-nav.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.b2ps-anchor-container {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
    box-sizing: border-box;
}

/* 等宽自适应列表 */
.b2ps-anchor-list {
    display: flex !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    flex-wrap: nowrap !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box;
}

/* 每个选项等宽 */
.b2ps-anchor-item {
    flex: 1 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    box-sizing: border-box;
}

/* 链接填满整个选项区域 */
.b2ps-anchor-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 14px 16px !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    letter-spacing: 0.3px !important;
    transition: all 0.3s ease;
    white-space: nowrap !important;
    position: relative;
    box-sizing: border-box;
}

/* 悬停底框颜色条 */
.b2ps-anchor-item:hover .b2ps-anchor-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.6;
}

/* 激活底框颜色条 */
.b2ps-anchor-item.active .b2ps-anchor-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: currentColor;
    opacity: 1;
}

.b2ps-anchor-text {
    position: relative;
}

/* 移动端菜单按钮 */
.b2ps-anchor-toggle {
    display: none;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
}

.b2ps-anchor-toggle-icon {
    display: inline-flex;
    flex-direction: column;
    gap: 5px;
    width: 20px;
}

.b2ps-anchor-toggle-icon span {
    display: block;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.b2ps-anchor-toggle.active .b2ps-anchor-toggle-icon span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.b2ps-anchor-toggle.active .b2ps-anchor-toggle-icon span:nth-child(2) {
    opacity: 0;
}

.b2ps-anchor-toggle.active .b2ps-anchor-toggle-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* 移动端下拉菜单 */
.b2ps-anchor-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 101;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.b2ps-anchor-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.b2ps-anchor-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.b2ps-anchor-dropdown-item {
    margin: 0;
}

.b2ps-anchor-dropdown-link {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

/* ========================================
   商务蓝主题（默认）
======================================== */
.b2ps-anchor-theme-blue {
    background: linear-gradient(135deg, #1e3a5f 0%, #0d253f 100%) !important;
}

.b2ps-anchor-theme-blue .b2ps-anchor-link {
    color: rgba(255, 255, 255, 0.7) !important;
}

.b2ps-anchor-theme-blue .b2ps-anchor-item:hover .b2ps-anchor-link {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.b2ps-anchor-theme-blue .b2ps-anchor-item:hover .b2ps-anchor-link::after {
    background: #ff6b35 !important;
}

.b2ps-anchor-theme-blue .b2ps-anchor-item.active .b2ps-anchor-link {
    color: #fff !important;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%) !important;
}

.b2ps-anchor-theme-blue .b2ps-anchor-item.active .b2ps-anchor-link::after {
    background: #fff !important;
}

.b2ps-anchor-theme-blue .b2ps-anchor-toggle {
    color: #fff;
    background: transparent;
}

.b2ps-anchor-theme-blue .b2ps-anchor-dropdown {
    background: #1e3a5f;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.b2ps-anchor-theme-blue .b2ps-anchor-dropdown-link {
    color: rgba(255, 255, 255, 0.7);
}

.b2ps-anchor-theme-blue .b2ps-anchor-dropdown-item:hover .b2ps-anchor-dropdown-link,
.b2ps-anchor-theme-blue .b2ps-anchor-dropdown-item.active .b2ps-anchor-dropdown-link {
    color: #fff;
    background: rgba(255, 107, 53, 0.2);
}

/* ========================================
   科技灰主题
======================================== */
.b2ps-anchor-theme-gray {
    background: linear-gradient(135deg, #2d3436 0%, #1e272e 100%);
}

.b2ps-anchor-theme-gray .b2ps-anchor-link {
    color: rgba(255, 255, 255, 0.6);
}

.b2ps-anchor-theme-gray .b2ps-anchor-item:hover .b2ps-anchor-link {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.b2ps-anchor-theme-gray .b2ps-anchor-item:hover .b2ps-anchor-link::after {
    background: #74b9ff;
}

.b2ps-anchor-theme-gray .b2ps-anchor-item.active .b2ps-anchor-link {
    color: #fff;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
}

.b2ps-anchor-theme-gray .b2ps-anchor-item.active .b2ps-anchor-link::after {
    background: #fff;
}

.b2ps-anchor-theme-gray .b2ps-anchor-toggle {
    color: #fff;
}

.b2ps-anchor-theme-gray .b2ps-anchor-dropdown {
    background: #2d3436;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.b2ps-anchor-theme-gray .b2ps-anchor-dropdown-link {
    color: rgba(255, 255, 255, 0.7);
}

.b2ps-anchor-theme-gray .b2ps-anchor-dropdown-item:hover .b2ps-anchor-dropdown-link,
.b2ps-anchor-theme-gray .b2ps-anchor-dropdown-item.active .b2ps-anchor-dropdown-link {
    color: #fff;
    background: rgba(116, 185, 255, 0.2);
}

/* ========================================
   活力橙主题
======================================== */
.b2ps-anchor-theme-orange {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
}

.b2ps-anchor-theme-orange .b2ps-anchor-link {
    color: rgba(255, 255, 255, 0.85);
}

.b2ps-anchor-theme-orange .b2ps-anchor-item:hover .b2ps-anchor-link {
    color: #fff;
    background: rgba(0, 0, 0, 0.1);
}

.b2ps-anchor-theme-orange .b2ps-anchor-item:hover .b2ps-anchor-link::after {
    background: #fff;
}

.b2ps-anchor-theme-orange .b2ps-anchor-item.active .b2ps-anchor-link {
    background: rgba(255, 255, 255, 0.95);
    color: #ff6b35;
}

.b2ps-anchor-theme-orange .b2ps-anchor-item.active .b2ps-anchor-link::after {
    background: #ff6b35;
}

.b2ps-anchor-theme-orange .b2ps-anchor-toggle {
    color: #fff;
}

.b2ps-anchor-theme-orange .b2ps-anchor-dropdown {
    background: #ff6b35;
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.3);
}

.b2ps-anchor-theme-orange .b2ps-anchor-dropdown-link {
    color: rgba(255, 255, 255, 0.85);
}

.b2ps-anchor-theme-orange .b2ps-anchor-dropdown-item:hover .b2ps-anchor-dropdown-link,
.b2ps-anchor-theme-orange .b2ps-anchor-dropdown-item.active .b2ps-anchor-dropdown-link {
    color: #ff6b35;
    background: rgba(255, 255, 255, 0.95);
}

/* ========================================
   极简白主题
======================================== */
.b2ps-anchor-theme-white {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.b2ps-anchor-theme-white.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.b2ps-anchor-theme-white .b2ps-anchor-link {
    color: #666;
}

.b2ps-anchor-theme-white .b2ps-anchor-item:hover .b2ps-anchor-link {
    color: #333;
    background: #f5f5f5;
}

.b2ps-anchor-theme-white .b2ps-anchor-item:hover .b2ps-anchor-link::after {
    background: #2563eb;
}

.b2ps-anchor-theme-white .b2ps-anchor-item.active .b2ps-anchor-link {
    color: #2563eb;
    background: transparent;
}

.b2ps-anchor-theme-white .b2ps-anchor-item.active .b2ps-anchor-link::after {
    background: #2563eb;
}

.b2ps-anchor-theme-white .b2ps-anchor-toggle {
    color: #333;
}

.b2ps-anchor-theme-white .b2ps-anchor-dropdown {
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.b2ps-anchor-theme-white .b2ps-anchor-dropdown-link {
    color: #666;
}

.b2ps-anchor-theme-white .b2ps-anchor-dropdown-item:hover .b2ps-anchor-dropdown-link,
.b2ps-anchor-theme-white .b2ps-anchor-dropdown-item.active .b2ps-anchor-dropdown-link {
    color: #2563eb;
    background: #f5f5f5;
}

/* ========================================
   暗夜黑主题
======================================== */
.b2ps-anchor-theme-dark {
    background: #0a0a0a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.b2ps-anchor-theme-dark .b2ps-anchor-link {
    color: rgba(255, 255, 255, 0.5);
}

.b2ps-anchor-theme-dark .b2ps-anchor-item:hover .b2ps-anchor-link {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.b2ps-anchor-theme-dark .b2ps-anchor-item:hover .b2ps-anchor-link::after {
    background: #00d4ff;
}

.b2ps-anchor-theme-dark .b2ps-anchor-item.active .b2ps-anchor-link {
    color: #fff;
    background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
}

.b2ps-anchor-theme-dark .b2ps-anchor-item.active .b2ps-anchor-link::after {
    background: #fff;
}

.b2ps-anchor-theme-dark .b2ps-anchor-toggle {
    color: #fff;
}

.b2ps-anchor-theme-dark .b2ps-anchor-dropdown {
    background: #0a0a0a;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.b2ps-anchor-theme-dark .b2ps-anchor-dropdown-link {
    color: rgba(255, 255, 255, 0.6);
}

.b2ps-anchor-theme-dark .b2ps-anchor-dropdown-item:hover .b2ps-anchor-dropdown-link,
.b2ps-anchor-theme-dark .b2ps-anchor-dropdown-item.active .b2ps-anchor-dropdown-link {
    color: #fff;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(124, 58, 237, 0.2) 100());
}

/* ========================================
   自定义配色主题
======================================== */
.b2ps-anchor-theme-custom {
    background: var(--b2ps-anchor-bg, #1e3a5f);
}

.b2ps-anchor-theme-custom .b2ps-anchor-link {
    color: var(--b2ps-anchor-text, #ffffff);
}

.b2ps-anchor-theme-custom .b2ps-anchor-item:hover .b2ps-anchor-link {
    color: var(--b2ps-anchor-text, #ffffff);
    background: var(--b2ps-anchor-hover-bg, rgba(255, 255, 255, 0.1));
}

.b2ps-anchor-theme-custom .b2ps-anchor-item:hover .b2ps-anchor-link::after {
    background: var(--b2ps-anchor-hover-border, #ff6b35);
}

.b2ps-anchor-theme-custom .b2ps-anchor-item.active .b2ps-anchor-link {
    color: var(--b2ps-anchor-text, #ffffff);
    background: var(--b2ps-anchor-active-bg, #ff6b35);
}

.b2ps-anchor-theme-custom .b2ps-anchor-item.active .b2ps-anchor-link::after {
    background: var(--b2ps-anchor-active-border, #ffffff);
}

.b2ps-anchor-theme-custom .b2ps-anchor-toggle {
    color: var(--b2ps-anchor-text, #ffffff);
}

.b2ps-anchor-theme-custom .b2ps-anchor-dropdown {
    background: var(--b2ps-anchor-bg, #1e3a5f);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.b2ps-anchor-theme-custom .b2ps-anchor-dropdown-link {
    color: var(--b2ps-anchor-text, #ffffff);
}

.b2ps-anchor-theme-custom .b2ps-anchor-dropdown-item:hover .b2ps-anchor-dropdown-link,
.b2ps-anchor-theme-custom .b2ps-anchor-dropdown-item.active .b2ps-anchor-dropdown-link {
    background: var(--b2ps-anchor-hover-bg, rgba(255, 255, 255, 0.1));
}

/* ========================================
   响应式设计
======================================== */
@media screen and (max-width: 768px) {
    .b2ps-anchor-list {
        display: none;
    }
    
    .b2ps-anchor-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .b2ps-anchor-toggle::after {
        content: attr(data-current-label);
        font-size: 14px;
        font-weight: 500;
    }
    
    .b2ps-anchor-dropdown {
        display: block;
    }
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .b2ps-anchor-theme-white {
        background: #1a1a1a;
        border-bottom-color: #333;
    }
    
    .b2ps-anchor-theme-white .b2ps-anchor-link {
        color: #aaa;
    }
    
    .b2ps-anchor-theme-white .b2ps-anchor-item:hover .b2ps-anchor-link {
        color: #fff;
        background: rgba(255, 255, 255, 0.05);
    }
    
    .b2ps-anchor-theme-white .b2ps-anchor-item:hover .b2ps-anchor-link::after {
        background: #60a5fa;
    }
    
    .b2ps-anchor-theme-white .b2ps-anchor-item.active .b2ps-anchor-link {
        color: #60a5fa;
    }
    
    .b2ps-anchor-theme-white .b2ps-anchor-item.active .b2ps-anchor-link::after {
        background: #60a5fa;
    }
    
    .b2ps-anchor-theme-white .b2ps-anchor-toggle {
        color: #fff;
    }
    
    .b2ps-anchor-theme-white .b2ps-anchor-dropdown {
        background: #1a1a1a;
    }
    
    .b2ps-anchor-theme-white .b2ps-anchor-dropdown-link {
        color: #aaa;
    }
    
    .b2ps-anchor-theme-white .b2ps-anchor-dropdown-item:hover .b2ps-anchor-dropdown-link,
    .b2ps-anchor-theme-white .b2ps-anchor-dropdown-item.active .b2ps-anchor-dropdown-link {
        color: #60a5fa;
        background: rgba(255, 255, 255, 0.05);
    }
}
