* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #2ecc71;
    --secondary-dark: #27ae60;
    --accent-color: #9b59b6;
    --accent-dark: #8e44ad;
    --danger-color: #e74c3c;
    --danger-dark: #c0392b;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --bg-color: #f5f5f5;
    --bg-light: #ecf0f1;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-deep: 0 4px 15px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-color);
    font-size: 2rem;
    position: relative;
    padding-bottom: 10px;
}

h1:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    border-radius: 1.5px;
}

.upload-section {
    text-align: center;
    margin: 30px auto 40px;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 600px;
    transition: all 0.5s ease;
}

.upload-btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 16px 40px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.upload-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.upload-btn:active {
    transform: translateY(1px);
}

.test-btn {
    background-color: var(--accent-color);
    color: var(--white);
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
    box-shadow: var(--shadow);
}

.test-btn:hover {
    background-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

input[type="file"] {
    display: none;
}

/* 参数配置区域 */
.processing-options {
    margin: 20px auto;
    padding: 25px;
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    transition: margin 0.3s ease;
    width: 80%;
}

.option {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.option label {
    width: 120px;
    font-weight: bold;
    color: var(--text-color);
}

.option input[type="range"] {
    flex-grow: 1;
    margin: 0 15px;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    -webkit-appearance: none;
    cursor: pointer;
}

.option input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.option input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.option input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.option input[type="range"]::-moz-range-thumb:hover {
    background: var(--primary-dark);
}

.option span {
    min-width: 30px;
    text-align: right;
    color: var(--text-light);
    font-weight: bold;
}

.color-option {
    display: flex;
    align-items: center;
}

.color-option input[type="color"] {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    transition: transform 0.2s;
}

.color-option input[type="color"]:hover {
    transform: scale(1.1);
}

.small-btn {
    padding: 5px 10px;
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.small-btn:hover {
    background-color: #7f8c8d;
}

.checkbox-option {
    display: flex;
    gap: 20px;
}

.checkbox-option label {
    display: flex;
    align-items: center;
    font-weight: normal;
    width: auto;
    cursor: pointer;
}

.checkbox-option input[type="checkbox"] {
    margin-right: 5px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 加载状态容器 */
.loading-container {
    display: none;
    text-align: center;
    position: absolute; /* 绝对定位 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius);
    z-index: 20; /* 确保在最上层 */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-container.active {
    display: flex;
}

.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 对比容器样式 */
.comparison-container {
    position: relative;
    margin: 20px auto; /* 居中显示 */
    height: 500px; /* 固定高度 */
    width: 1000px; /* 默认宽度设置得小一些 */
    max-width: 90%; /* 减小最大宽度 */
    overflow: hidden;
    background-color: #f5f5f5;
    border-radius: var(--radius);
    box-shadow: var(--shadow-deep);
    display: block !important; /* 确保始终显示 */
    transition: all 0.3s ease; /* 添加过渡效果 */
}

#compositeCanvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: fill; /* 填充整个区域 */
    background-color: transparent; /* 透明背景 */
    opacity: 1; /* 始终可见 */
    transition: opacity 0.3s ease;
}

/* 上传覆盖层 */
.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-light);
    z-index: 10;
    transition: all 0.3s ease;
    border-radius: var(--radius);
    border: 2px dashed transparent;
    cursor: pointer;
}

.upload-overlay:hover {
    background-color: rgba(52, 152, 219, 0.05);
    border-color: var(--primary-color);
}

/* 拖放高亮状态 */
.upload-overlay.highlight {
    background-color: rgba(52, 152, 219, 0.1);
    border: 2px dashed var(--primary-color);
}

.upload-icon {
    text-align: center;
    color: var(--text-light);
    transition: transform 0.2s ease;
}

.highlight .upload-icon {
    transform: scale(1.05);
}

.upload-icon svg {
    width: 64px;
    height: 64px;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.upload-icon p {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
}

.upload-btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 12px 25px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
    font-size: 1rem;
    box-shadow: var(--shadow);
}

.upload-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

input[type="file"] {
    display: none;
}

/* 参数配置区域 */
.processing-options {
    margin: 20px auto;
    padding: 25px;
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    transition: margin 0.3s ease;
    max-width: 1200px;
    width: 90%;
}

/* 状态消息 */
.status-message {
    margin: 20px auto;
    padding: 12px;
    text-align: center;
    border-radius: var(--radius);
    display: none;
    animation: fadeIn 0.3s ease-in-out;
    max-width: 800px;
}

/* 操作按钮区域 */
.action-buttons {
    text-align: center;
    margin: 25px auto;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    max-width: 1200px;
    width: 90%;
}

/* 滑块控制在有图片时才显示 */
.slider-control {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.slider-track {
    position: absolute;
    top: 0;
    left: 50%; /* 初始位置 */
    width: 3px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 10;
    transform: translateX(-1px);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.slider-handle {
    position: absolute;
    top: 50%;
    left: 50%; /* 初始位置 */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.95);
    border: 3px solid var(--primary-color);
    transform: translate(-50%, -50%);
    cursor: ew-resize;
    z-index: 11;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    transition: transform 0.1s ease-out, box-shadow 0.2s ease;
}

.slider-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-color);
}

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

.handle-arrows {
    position: relative;
    width: 100%;
    height: 100%;
}

.handle-arrows::before,
.handle-arrows::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 12px;
    height: 3px;
    background-color: var(--primary-color);
    transform-origin: center;
}

.handle-arrows::before {
    left: 10px;
    transform: translateY(-50%) rotate(-45deg);
    box-shadow: 0 -7px 0 var(--primary-color);
}

.handle-arrows::after {
    right: 10px;
    transform: translateY(-50%) rotate(45deg);
    box-shadow: 0 -7px 0 var(--primary-color);
}

.slider-handle:hover .handle-arrows::before,
.slider-handle:hover .handle-arrows::after {
    background-color: var(--accent-color);
}

.slider-handle:hover .handle-arrows::before {
    box-shadow: 0 -7px 0 var(--accent-color);
}

.slider-handle:hover .handle-arrows::after {
    box-shadow: 0 -7px 0 var(--accent-color);
}

/* 按钮样式 */
button {
    padding: 12px 25px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s, transform 0.1s;
    box-shadow: var(--shadow);
}

button:hover {
    background-color: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(1px);
}

#resetBtn {
    background-color: var(--danger-color);
}

#resetBtn:hover {
    background-color: var(--danger-dark);
}

button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.status-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.status-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

/* 指引文字 */
.instructions {
    text-align: center;
    margin: 15px auto;
    font-size: 14px;
    color: var(--text-light);
    font-style: italic;
    max-width: 800px;
    opacity: 0; /* 初始隐藏 */
    transition: opacity 0.3s ease;
    height: 0;
    overflow: hidden;
}

/* 有图片时的状态 */
.has-image #compositeCanvas {
    opacity: 1;
}

.has-image .slider-control {
    opacity: 1;
}

.has-image .instructions {
    opacity: 1;
    height: auto;
    margin-top: 10px;
    margin-bottom: 15px;
}

.has-image .upload-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: -1; /* 确保完全隐藏 */
}

/* 响应式调整 */
@media (max-width: 768px) {
    .processing-options {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    .option {
        margin-bottom: 12px;
    }
    
    .option label {
        width: 100px;
        font-size: 14px;
    }
    
    .comparison-container {
        height: 300px; /* 移动设备上使用较小高度 */
        width: 400px; /* 移动设备上默认宽度更小 */
        max-width: 90%;
    }
    
    .upload-icon svg {
        width: 48px;
        height: 48px;
    }
    
    .upload-icon p {
        font-size: 14px;
        margin-bottom: 15px;
    }
    
    .slider-handle {
        width: 40px;
        height: 40px;
    }
    
    button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

.copyright {
    text-align: right;
    font-size: 12px;
    color: #bbb;
    margin-top: 20px;
    opacity: 0.7;
    font-style: italic;
} 