
/* image_comparison_slider/frontend/css/comparison.css */
.comparison-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 500px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    background-color: #f5f5f5;
}

.comparison-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-before {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 3;
    clip-path: inset(0 50% 0 0);
}

.img-before img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-after {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 3px;
    height: 100%;
    background: white;
    z-index: 10;
    transform: translateX(-50%);
    pointer-events: none;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.slider-handle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: ew-resize;
    z-index: 11;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    font-size: 16px;
    touch-action: none;
    user-select: none;
}

.slider-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.slider-handle:active {
    transform: translate(-50%, -50%) scale(0.95);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.action-btns {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.action-btn {
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.reset-btn {
    background: white;
    color: #666;
    border: 1px solid #e5e5e5;
}

.reset-btn:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.download-btn {
    background: linear-gradient(135deg, #1E9FFF 0%, #0d8bf2 100%);
    color: white;
    border: none;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 159, 255, 0.4);
    background: linear-gradient(135deg, #1E9FFF 0%, #0c7fd9 100%);
}

@keyframes particle-fade {
    0% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #ffffff;
    border-radius: 50%;
    pointer-events: none;
    animation: particle-fade 1s forwards;
    z-index: 12;
}

/* 平板设备优化 */
@media (max-width: 1024px) {
    .comparison-container {
        height: 400px;
    }
    
    .action-btns {
        bottom: 25px;
        right: 25px;
    }
}

/* 中小屏幕设备优化 */
@media (max-width: 768px) {
    .comparison-container {
        height: 350px;
        border-radius: 10px;
    }
    
    .slider-handle {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .action-btns {
        bottom: 20px;
        right: 20px;
        gap: 10px;
    }

    .action-btn {
        padding: 10px 20px;
        font-size: 15px;
    }
}

/* 手机设备优化 */
@media (max-width: 480px) {
    .comparison-container {
        height: 250px;
        border-radius: 8px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    }
    
    .slider-handle {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .slider {
        width: 2px;
    }

    .action-btns {
        gap: 8px;
        width: calc(100% - 40px);
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        left: 20px;
        right: 20px;
    }

    .action-btn {
        flex: 1;
        padding: 10px 16px;
        font-size: 14px;
        text-align: center;
    }
}

/* 小型手机设备 */
@media (max-width: 360px) {
    .comparison-container {
        height: 200px;
    }
    
    .slider-handle {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
    
    .action-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .comparison-container {
        height: 70vh;
        max-height: 350px;
    }
    
    .action-btns {
        flex-direction: row;
        bottom: 15px;
    }
}

/* 超宽屏优化 */
@media (min-width: 1600px) {
    .comparison-container {
        max-width: 1000px;
        height: 600px;
    }
    
    .slider-handle {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .comparison-container {
        background-color: #2d2d2d;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    
    .reset-btn {
        background: #333;
        color: #eee;
        border-color: #555;
    }
    
    .reset-btn:hover {
        background: #444;
    }
}
