/* 通用样式 - AI处理工具页面 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部导航 */
.header {
    background: white;
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.back-btn:hover {
    transform: translateX(-5px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.page-title {
    font-size: 1.8rem;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* 上传区域 */
.upload-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px 30px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #fff;
}

.upload-area.has-image {
    border-color: #4caf50;
    padding: 10px;
}

.upload-area.has-comparison {
    border: none;
    padding: 0;
    background: transparent;
    cursor: default;
}

.upload-area.has-comparison:hover {
    border: none;
    background: transparent;
}

.upload-placeholder {
    color: #666;
}

.upload-placeholder .upload-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.upload-placeholder h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.upload-placeholder p {
    font-size: 0.9rem;
    color: #999;
}

.preview-image {
    max-width: 100%;
    max-height: 500px;
    border-radius: 10px;
    display: none;
}

.upload-actions {
    margin-top: 20px;
    text-align: center;
}

/* 控制面板 */
.control-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.control-group {
    margin-bottom: 25px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.control-group select,
.control-group input[type="text"],
.control-group input[type="number"],
.control-group input[type="color"] {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #667eea;
}

.control-group .help-text {
    font-size: 0.85rem;
    color: #999;
    margin-top: 5px;
}

/* 按钮样式 */
.btn {
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* 结果区域 */
.result-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
    display: none;
}

.result-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.result-item {
    text-align: center;
}

.result-item img {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s;
}

.result-item img:hover {
    transform: scale(1.05);
}

.result-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.result-actions .btn {
    padding: 8px 20px;
    font-size: 0.9rem;
}

/* 加载动画 */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .page-title {
        font-size: 1.4rem;
    }
    
    .result-images {
        grid-template-columns: 1fr;
    }
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
    max-width: 350px;
}

.toast-success {
    background: #4caf50;
}

.toast-error {
    background: #f44336;
}

.toast-info {
    background: #2196f3;
}

.toast-warning {
    background: #ff9800;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Loading遮罩 */
#global-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#global-loading .loading-content {
    background: white;
    padding: 40px 50px;
    border-radius: 15px;
    text-align: center;
}

#global-loading .loading-text {
    margin-top: 20px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

/* 图片对比组件样式（按钮切换版本） */
.image-comparison-container {
    width: 100%;
    max-width: 100%;
}

.image-comparison-wrapper {
    position: relative;
    width: 100%;
    max-height: 500px; /* 限制最大高度 */
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #f5f5f5;
}

.comparison-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-layer.active {
    opacity: 1;
    position: relative;
}

.comparison-image {
    width: 100%;
    height: auto;
    max-height: 500px; /* 限制最大高度 */
    object-fit: contain; /* 保持比例 */
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.image-label {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
}

.comparison-toggle {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: rgba(102, 126, 234, 0.95);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
    user-select: none;
}

.toggle-btn:hover {
    background: rgba(102, 126, 234, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.toggle-btn:active,
.toggle-btn.active {
    background: rgba(118, 75, 162, 0.95);
    transform: translateY(0);
}

.toggle-icon {
    font-size: 20px;
}

.toggle-text {
    font-size: 15px;
}

.comparison-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-download {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-preview {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-preview:hover {
    background: #f0f0f0;
}

.btn-reset {
    background: #6c757d;
    color: white;
}

.btn-reset:hover {
    background: #5a6268;
}

.comparison-tip {
    text-align: center;
    color: #666;
    font-size: 13px;
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

/* 优化移动端 */
@media (max-width: 768px) {
    .comparison-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        min-width: unset;
    }
    
    .toggle-btn {
        padding: 12px 25px;
        font-size: 14px;
    }
    
    .toggle-icon {
        font-size: 18px;
    }
    
    .toggle-text {
        font-size: 13px;
    }
    
    .comparison-tip {
        font-size: 12px;
    }
    
    .image-label {
        font-size: 12px;
        padding: 6px 12px;
    }
}
