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

/* 返回首页链接 */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #0071e3;
    text-decoration: none;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(0, 113, 227, 0.05);
    font-size: 14px;
    margin-bottom: 12px;
}

.back-link:hover {
    background: rgba(0, 113, 227, 0.1);
    transform: translateX(-4px);
}

:root {
    /* 苹果风格颜色 */
    --primary-color: #0071e3;
    --primary-hover: #0077ed;
    --primary-active: #006edb;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --bg-white: #ffffff;
    --bg-light: #f5f5f7;
    --bg-canvas: #fbfbfd;
    --border-color: #d2d2d7;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* ==================== 顶部导航 ==================== */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    padding: 40px 0;
}

.workspace {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 24px;
    align-items: start;
}

/* ==================== 左侧上传面板 ==================== */
.upload-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.upload-section {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.upload-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(0, 113, 227, 0.02);
}

.upload-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.upload-icon {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.upload-placeholder p {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

.image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-info {
    background: var(--bg-canvas);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.status-text {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.status-text.success {
    color: #34c759;
}

/* ==================== 中间画布面板 ==================== */
.canvas-panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.canvas-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.canvas-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.selection-info {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-light);
    border-radius: 6px;
}

.btn-reset {
    padding: 6px 12px;
    font-size: 13px;
    color: var(--primary-color);
    background: transparent;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset:hover {
    background: rgba(0, 113, 227, 0.08);
}

.canvas-container {
    position: relative;
    background: var(--bg-canvas);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#canvas {
    display: block;
    max-width: 100%;
    max-height: 600px;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
}

#canvas.dragging {
    cursor: move !important;
}

#canvas.resizing {
    cursor: nwse-resize !important;
}

/* 提高Canvas渲染性能 */
#canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.canvas-tips {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.canvas-tips p {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
}

/* ==================== 右侧预览面板 ==================== */
.preview-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-section {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.preview-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.preview-container {
    position: relative;
    background: var(--bg-canvas);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#previewCanvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    padding: 20px;
}

.preview-placeholder svg {
    margin-bottom: 12px;
}

.preview-placeholder p {
    font-size: 14px;
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    background: var(--primary-active);
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-light);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tips-section {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.tips-section h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.tips-list {
    list-style: none;
    counter-reset: tips-counter;
}

.tips-list li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    counter-increment: tips-counter;
}

.tips-list li::before {
    content: counter(tips-counter);
    position: absolute;
    left: 0;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* ==================== 底部 ==================== */
.footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    margin-top: 40px;
}

.footer-text {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* ==================== 响应式 ==================== */
@media (max-width: 1200px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .upload-panel,
    .preview-panel {
        max-width: 600px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .logo {
        font-size: 22px;
    }

    .main-content {
        padding: 20px 0;
    }

    .workspace {
        gap: 16px;
    }

    .canvas-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

