/* 
 * 详情页交互效果CSS
 * 将JavaScript功能转换为CSS实现
 */

/* ========== 返回顶部按钮效果 ========== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #D4AF37, #8B0000);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.6);
}

/* 通过CSS检测滚动位置 */
body {
    --scroll-threshold: 300px;
}

/* 使用CSS自定义属性控制显示 */
.back-to-top {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 通过JavaScript设置类名，这里提供备用方案 */
@media (scripting: enabled) {
    .back-to-top.visible {
        opacity: 1;
        visibility: visible;
    }
}

/* ========== 图片点击放大效果 ========== */
/* 使用:target伪类实现图片放大 */
.image-container-single img {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.image-container-single img:hover {
    transform: scale(1.02);
}

/* 图片放大层 */
.image-overlay-full {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-overlay-full:target {
    opacity: 1;
    visibility: visible;
}

.image-overlay-full img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border: 3px solid #D4AF37;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    animation: imageZoomIn 0.3s ease;
}

@keyframes imageZoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 关闭按钮 */
.image-overlay-full:before {
    content: "×";
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 3rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    transition: color 0.3s ease;
}

.image-overlay-full:before:hover {
    color: #D4AF37;
}

/* ========== 按钮交互效果 ========== */
.action-btn {
    position: relative;
    overflow: hidden;
}

.action-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.action-btn:hover:before {
    left: 100%;
}

/* 购买按钮特效 */
.btn-buy {
    position: relative;
}

.btn-buy:after {
    content: '💰';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: all 0.3s ease;
}

.btn-buy:hover:after {
    right: 15px;
    opacity: 1;
}

/* 联系按钮特效 */
.btn-contact {
    position: relative;
}

.btn-contact:after {
    content: '💬';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: all 0.3s ease;
}

.btn-contact:hover:after {
    right: 15px;
    opacity: 1;
}

/* ========== 滚动动画效果 ========== */
/* 淡入动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.script-description,
.script-images,
.script-actions {
    animation: fadeInUp 0.6s ease forwards;
}

.script-description {
    animation-delay: 0.1s;
}

.script-images {
    animation-delay: 0.3s;
}

.script-actions {
    animation-delay: 0.5s;
}

/* ========== 响应式调整 ========== */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .image-overlay-full img {
        max-width: 95%;
        max-height: 80%;
    }
    
    .image-overlay-full:before {
        top: 15px;
        right: 20px;
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .back-to-top {
        bottom: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .btn-buy:after,
    .btn-contact:after {
        display: none; /* 小屏幕隐藏特效 */
    }
}

/* ========== 打印样式 ========== */
@media print {
    .back-to-top,
    .image-overlay-full,
    .action-btn:before,
    .btn-buy:after,
    .btn-contact:after {
        display: none !important;
    }
    
    .image-container-single img {
        cursor: default !important;
    }
}

/* ========== 减少运动偏好 ========== */
@media (prefers-reduced-motion: reduce) {
    .back-to-top,
    .image-container-single img,
    .action-btn,
    .btn-buy,
    .btn-contact,
    .script-description,
    .script-images,
    .script-actions {
        transition: none !important;
        animation: none !important;
    }
    
    .image-overlay-full img {
        animation: none !important;
    }
}