/* 回到顶部按钮样式 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* 按钮可见状态 */
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* 鼠标悬停效果 */
.back-to-top:hover,
.back-to-top.hover {
    background-color: #0056b3;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

/* 聚焦状态（键盘导航） */
.back-to-top:focus,
.back-to-top.focus {
    outline: 3px solid #007bff;
    outline-offset: 3px;
}

/* 点击状态 */
.back-to-top:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.5);
}

/* 加载动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.back-to-top.visible {
    animation: fadeInUp 0.5s ease-out;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* 深色模式适配 */
[data-theme="dark"] .back-to-top {
    background-color: #4dabf7;
    box-shadow: 0 4px 12px rgba(77, 171, 247, 0.3);
}

[data-theme="dark"] .back-to-top:hover,
[data-theme="dark"] .back-to-top.hover {
    background-color: #339af0;
    box-shadow: 0 6px 20px rgba(77, 171, 247, 0.4);
}

[data-theme="dark"] .back-to-top:focus,
[data-theme="dark"] .back-to-top.focus {
    outline: 3px solid #4dabf7;
    outline-offset: 3px;
}

/* 高对比度模式适配 */
@media (prefers-contrast: high) {
    .back-to-top {
        background-color: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .back-to-top:hover,
    .back-to-top.hover {
        background-color: #333;
    }
    
    .back-to-top:focus,
    .back-to-top.focus {
        outline: 3px solid #fff;
        outline-offset: 2px;
    }
}

/* 减少动画模式适配 */
@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        transition: none;
    }
    
    .back-to-top.visible {
        animation: none;
    }
}