/**
 * 粘性侧边导航栏样式
 * 独立样式文件，不影响现有页面元素
 * 使用BEM命名规范确保样式隔离
 */

/* 粘性导航容器 */
.sticky-nav-container {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 1000;
    width: 80px;
    max-height: 80vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* 页面加载后显示 */
.sticky-nav-container.sticky-nav-visible {
    opacity: 1;
    visibility: visible;
}

/* 导航主体 */
.sticky-nav__wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 导航标题 */
.sticky-nav__title {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* 导航列表 */
.sticky-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 导航项 */
.sticky-nav__item {
    display: block;
}

/* 导航链接 */
.sticky-nav__link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 40px;
    margin: 0 auto;
    color: #666;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 导航链接悬停效果 */
.sticky-nav__link:hover {
    background: rgba(3, 150, 255, 0.1);
    color: #0396FF;
    transform: translateX(-2px);
}

/* 导航链接激活状态 - 提高特异性避免冲突 */
.sticky-nav-container .sticky-nav__wrapper .sticky-nav__list .sticky-nav__item .sticky-nav__link.sticky-nav__link--active,
.sticky-nav__link.sticky-nav__link--active {
    background: linear-gradient(135deg, #0396FF, #b3e0fa) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(3, 150, 255, 0.3) !important;
    border-color: #0396FF !important;
}

/* 确保其他状态不会覆盖激活状态 */
.sticky-nav-container .sticky-nav__wrapper .sticky-nav__list .sticky-nav__item .sticky-nav__link:hover:not(.sticky-nav__link--active) {
    background: rgba(3, 150, 255, 0.1) !important;
    color: #0396FF !important;
    transform: translateX(-2px);
}

/* 导航链接提示文本 */
.sticky-nav__link::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-right: 8px;
    pointer-events: none;
    z-index: 1001;
}

/* 悬停显示提示 */
.sticky-nav__link:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 滚动指示器 */
.sticky-nav__progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, #0396FF, #b3e0fa);
    border-radius: 2px;
    transition: height 0.3s ease;
}

/* 返回顶部按钮 */
.sticky-nav__back-to-top {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.sticky-nav__back-to-top .sticky-nav__link {
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

.sticky-nav__back-to-top .sticky-nav__link:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .sticky-nav-container {
        right: 10px;
        width: 70px;
    }

    .sticky-nav__link {
        width: 54px;
        height: 36px;
        font-size: 11px;
    }
}

@media (max-width: 768px) {
    .sticky-nav-container {
        display: none;
    }
}

/* 滚动条样式 */
.sticky-nav-container::-webkit-scrollbar {
    width: 4px;
}

.sticky-nav-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.sticky-nav-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}

.sticky-nav-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* 动画效果 */
@keyframes sticky-nav-fade-in {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

.sticky-nav-container.sticky-nav-visible {
    animation: sticky-nav-fade-in 0.5s ease forwards;
}

/* 活跃项指示器动画 */
@keyframes sticky-nav-pulse {
    0% {
        box-shadow: 0 2px 8px rgba(3, 150, 255, 0.3);
    }
    50% {
        box-shadow: 0 2px 16px rgba(3, 150, 255, 0.6);
    }
    100% {
        box-shadow: 0 2px 8px rgba(3, 150, 255, 0.3);
    }
}

.sticky-nav__link.sticky-nav__link--active {
    animation: sticky-nav-pulse 2s ease-in-out infinite;
}