/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 头部 */
.app-header {
    background: rgba(255,255,255,0.95);
    padding: 15px 30px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.app-header h1 {
    font-size: 1.8em;
    color: #667eea;
    margin-bottom: 5px;
}

.app-header p {
    color: #666;
    font-size: 0.9em;
}

/* 主内容区 */
.app-main {
    display: flex;
    flex: 1;
    gap: 15px;
    padding: 15px;
    overflow: hidden;
}

/* 左侧工具栏 */
.toolbar {
    width: 320px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.tool-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.tool-section:last-child {
    border-bottom: none;
}

.tool-section h3 {
    margin-bottom: 12px;
    color: #333;
    font-size: 1em;
}

/* 右侧统一预览区 */
.preview-area {
    flex: 1;
    overflow: hidden;
}

.unified-preview {
    height: 100%;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 标签栏 */
.preview-tabs {
    display: flex;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0;
    border-radius: 10px 10px 0 0;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95em;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.1);
    color: white;
}

.tab-btn.active {
    background: rgba(255,255,255,0.2);
    color: white;
    border-bottom-color: white;
}

.tab-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tab-icon {
    font-size: 1.2em;
}

.tab-label {
    font-weight: 500;
}

/* 预览视口 */
.preview-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
}

.preview-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.preview-panel.active {
    opacity: 1;
    visibility: visible;
}

.preview-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.preview-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s;
    user-select: none;
}

.preview-content img:hover {
    transform: scale(1.02);
}

/* 对比模式 - 可拖动滑块 */
.compare-panel {
    background: #1a1a1a;
}

.image-compare-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.compare-image-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.compare-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
}

.compare-after {
    z-index: 1;
}

.compare-before {
    z-index: 2;
    clip-path: inset(0 50% 0 0);
}

.compare-label-overlay {
    position: absolute;
    top: 20px;
    padding: 8px 16px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.compare-after .compare-label-overlay {
    right: 20px;
}

.compare-before .compare-label-overlay {
    left: 20px;
}

.compare-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: white;
    cursor: ew-resize;
    z-index: 3;
    transform: translateX(-50%);
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: ew-resize;
}

.slider-arrow {
    color: #667eea;
    font-size: 1.2em;
    font-weight: bold;
}

.slider-line {
    width: 2px;
    height: 30px;
    background: #667eea;
}

/* 风格切换模式 */
.style-panel {
    background: white;
}

.style-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.style-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 600px;
    margin-bottom: 30px;
}

.style-item {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.style-item:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.style-item.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.style-preview {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.style-icon {
    font-size: 3em;
}

.style-name {
    font-weight: 600;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
}

.style-desc {
    font-size: 0.85em;
    color: #666;
}

.style-hint {
    padding: 12px 20px;
    background: #e7f3ff;
    border-radius: 8px;
    color: #0066cc;
    font-size: 0.9em;
}

/* 底部工具栏 */
.preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tool-btn {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.tool-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

.tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.zoom-display {
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.85em;
    color: #667eea;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

.placeholder {
    color: #999;
    font-size: 0.9em;
    text-align: center;
}

/* 图片查看器 */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.image-viewer.active {
    display: flex;
}

.image-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
}

.image-viewer-container.dragging {
    cursor: grabbing;
}

.image-viewer img {
    position: absolute;
    max-width: none;
    max-height: none;
    transition: transform 0.1s ease-out;
    user-select: none;
    -webkit-user-drag: none;
}

.image-viewer-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 2001;
}

.viewer-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.viewer-btn:hover {
    background: rgba(255,255,255,0.3);
}

.zoom-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    backdrop-filter: blur(10px);
}

.placeholder {
    color: #999;
    font-size: 0.9em;
    text-align: center;
}

/* 按钮样式 */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 14px 20px;
    font-size: 1.1em;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-icon {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s;
}

.btn-icon:hover:not(:disabled) {
    background: rgba(255,255,255,0.3);
}

.btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* 输入框 */
textarea, .select-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: inherit;
}

textarea {
    resize: vertical;
}

.file-status {
    margin-top: 8px;
    color: #666;
    font-size: 0.85em;
}

.file-info {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.85em;
    line-height: 1.6;
}

.hint {
    margin-top: 6px;
    padding: 6px;
    background: #e7f3ff;
    border-radius: 4px;
    font-size: 0.8em;
    color: #0066cc;
}

/* 标签 */
.tags-group {
    margin-top: 10px;
}

.tags-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85em;
    color: #666;
}

.tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.tag-btn {
    padding: 4px 10px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.tag-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 进度条 */
.progress-container {
    margin-top: 10px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    margin-top: 6px;
    text-align: center;
    color: #667eea;
    font-size: 0.85em;
}

/* 滚动条 */
.toolbar::-webkit-scrollbar {
    width: 6px;
}

.toolbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.toolbar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.toolbar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 响应式 */
@media (max-width: 1200px) {
    .compare-container {
        flex-direction: column;
    }
    
    .compare-divider {
        width: 100%;
        height: 2px;
    }
}

@media (max-width: 768px) {
    .app-main {
        flex-direction: column;
    }
    
    .toolbar {
        width: 100%;
        max-height: 300px;
    }
    
    .preview-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1 1 45%;
        min-width: 120px;
    }
    
    .preview-toolbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center;
    }
}
