/**
 * 图片对比查看器样式
 */

.image-compare-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 头部控制栏 */
.viewer-header {
    background: #FFFFFF;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.viewer-title {
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.viewer-btn {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    color: #1F2937;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.viewer-btn:hover {
    background: #008d94;
    border-color: #008d94;
    color: white;
    transform: translateY(-1px);
}

.viewer-btn.active {
    background: #008d94;
    border-color: #008d94;
    color: white;
}

.viewer-close {
    color: #FF453A;
}

.viewer-close:hover {
    background: #FF453A;
    color: white;
}

.viewer-divider {
    width: 1px;
    height: 24px;
    background: #E5E7EB;
}

.zoom-level {
    color: #008d94;
    font-weight: 600;
    font-size: 14px;
    min-width: 50px;
    text-align: center;
}

/* 内容区域 */
.viewer-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.viewer-canvas {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    overflow: hidden;
}

.viewer-canvas:active {
    cursor: grabbing;
}

/* 左右对比模式 */
.mode-side-by-side {
    display: flex;
    gap: 20px;
    padding: 20px;
}

.image-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.compare-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease-out;
    transform-origin: center center;
}

.image-label-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 141, 148, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

/* 滑动对比模式 */
.mode-slider {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    user-select: none;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
}

.slider-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    pointer-events: none;
}

.slider-after {
    position: relative;
}

.slider-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.slider-before {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    object-fit: contain;
}

.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: transparent;
    cursor: ew-resize;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    touch-action: none;
}

.slider-line {
    flex: 1;
    width: 4px;
    background: #008d94;
    box-shadow: 0 0 10px rgba(0, 141, 148, 0.8);
    pointer-events: none;
}

.slider-button {
    width: 40px;
    height: 40px;
    background: #008d94;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 0 15px rgba(0, 141, 148, 0.8);
    user-select: none;
    pointer-events: none;
}

.slider-label-left,
.slider-label-right {
    position: absolute;
    top: 10px;
    background: rgba(0, 141, 148, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    z-index: 3;
    pointer-events: none;
}

.slider-label-left {
    left: 10px;
}

.slider-label-right {
    right: 10px;
}

/* 叠加对比模式 */
.mode-overlay {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.overlay-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 100%;
    max-height: 100%;
}

.overlay-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease-out;
    transform-origin: center center;
}

.overlay-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.overlay-bottom {
    position: relative;
}

.overlay-top {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.overlay-label-bottom,
.overlay-label-top {
    position: absolute;
    background: rgba(0, 141, 148, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
}

.overlay-label-bottom {
    bottom: 10px;
    right: 10px;
}

.overlay-label-top {
    top: 10px;
    left: 10px;
}

.opacity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: #1F2937;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 24px;
    border-radius: 8px;
}

.opacity-control label {
    font-size: 14px;
    font-weight: 600;
}

.opacity-control input[type="range"] {
    width: 300px;
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.opacity-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #008d94;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 141, 148, 0.5);
}

.opacity-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #008d94;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(0, 141, 148, 0.5);
}

.opacity-control span {
    min-width: 50px;
    text-align: center;
    color: #008d94;
    font-weight: 600;
}

/* 底部标签 */
.viewer-footer {
    background: #FFFFFF;
    padding: 15px 20px;
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.image-label {
    color: #6B7280;
    font-size: 14px;
    font-weight: 600;
}

/* 响应式 */
@media (max-width: 768px) {
    .mode-side-by-side {
        flex-direction: column;
        gap: 10px;
    }
    
    .viewer-controls {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .viewer-btn {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .opacity-control input[type="range"] {
        width: 200px;
    }
}
