/* 智能回到顶部按钮 - 复用主页面按钮样式和位置 */
/* 当有 fullcard 展开时，主页面按钮会被隐藏，fullcard 按钮会显示在相同位置 */

.smart-back-to-top {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 50px !important;
    height: 50px !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10000 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}

/* 深色主题下的按钮样式 */
[data-theme="dark"] .smart-back-to-top {
    background-color: rgba(255, 255, 255, 0.6) !important;
}

/* 按钮悬停效果 */
.smart-back-to-top:hover {
    background-color: rgba(0, 0, 0, 0.8) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .smart-back-to-top:hover {
    background-color: rgba(255, 255, 255, 0.8) !important;
}

/* 箭头图标 */
.smart-back-to-top::before {
    content: "▲" !important;
    color: white !important;
    font-size: 20px !important;
    font-weight: bold !important;
    line-height: 1 !important;
}

[data-theme="dark"] .smart-back-to-top::before {
    color: black !important;
}

/* 显示动画 */
.smart-back-to-top.show {
    display: flex !important;
    animation: smartFadeInUp 0.3s ease forwards !important;
}

/* 隐藏动画 */
.smart-back-to-top.hide {
    animation: smartFadeOutDown 0.3s ease forwards !important;
}

@keyframes smartFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes smartFadeOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* 当有 fullcard 展开时，隐藏主页面的回到顶部按钮 */
body:has(.book--expanded) .back-to-top-button {
    display: none !important;
}

/* 移动端适配 */
@media screen and (max-width: 736px) {
    .smart-back-to-top {
        bottom: 15px !important;
        right: 15px !important;
        width: 45px !important;
        height: 45px !important;
    }
    
    .smart-back-to-top::before {
        font-size: 18px !important;
    }
}

/* 超小屏幕适配 */
@media screen and (max-width: 480px) {
    .smart-back-to-top {
        bottom: 10px !important;
        right: 10px !important;
        width: 40px !important;
        height: 40px !important;
    }
    
    .smart-back-to-top::before {
        font-size: 16px !important;
    }
}
