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

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

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

header {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 72% !important;
   margin: 0 auto;
   left: 0;
   right: 0;
}

h1 {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.tool-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.tool-group, .control-group {
    display: flex;
    gap: 10px;
}

.tool-btn, .action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover, .action-btn:hover {
    background-color: #f0f0f0;
    border-color: #aaa;
}

.tool-btn.active {
    background-color: #e6f7ff;
    border-color: #1890ff;
    color: #1890ff;
}

.action-btn {
    width: auto;
    padding: 0 15px;
    background-color: #1890ff;
    color: white;
    border: none;
    font-weight: 500;
}

.action-btn:hover {
    background-color: #40a9ff;
    border-color: #40a9ff;
}

.action-btn svg {
    margin-right: 5px;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 70vh;
}

.upload-area {
    width: 100%;
    height: 300px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    cursor: pointer;
    transition: all 0.3s;
    background-color: #fff;
}

.upload-area:hover {
    border-color: #1890ff;
    background-color: #f0f7ff;
}

.upload-area p {
    font-size: 18px;
    color: #888;
    margin-bottom: 10px;
}

.canvas-container {
    position: relative;
    width: 100%;
    height: 80vh;
    overflow: auto;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* 修改后的容器样式，使其更适合直接显示图片 */
.canvas-container.image-view-mode {
    display: flex !important;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
    max-height: 80vh;
}

/* 图片容器样式 */
#image-container {
    position: relative;
    min-height: 100px;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* 图片样式 */
#image-container img {
    max-width: 100%;
    height: auto;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* 添加样式确保drawing-overlay能完全覆盖图片 */
.drawing-overlay {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: auto !important;
    cursor: crosshair;
}

/* 确保fabric canvas正确显示 */
.canvas-container canvas {
    display: block !important;
    position: relative !important;
    touch-action: none;
}

/* 确保上层Canvas正确显示 */
.upper-canvas {
    position: absolute !important;
}

#editor-canvas {
    display: block;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.tips {
    width: 100%;
    max-width: 800px;
    margin: 30px auto;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.tips h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.tips ul {
    list-style: none;
    padding: 0;
}

.tips li {
    padding: 8px 0;
    display: flex;
    align-items: flex-start;
}

.tip-icon {
    font-size: 20px;
    margin-right: 10px;
    min-width: 30px;
    text-align: center;
}

@media (max-width: 768px) {
    .tool-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .upload-area {
        height: 200px;
    }
    
    .canvas-container {
        height: 50vh;
        max-height: 90vh;
    }
    
    .tips {
        padding: 15px;
    }
    
    .tips li {
        font-size: 14px;
    }
}

.loading-indicator {
    margin-top: 20px;
    text-align: center;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #1890ff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    margin-top: 15px;
    color: #f5222d;
    text-align: center;
    padding: 10px;
    border-radius: 4px;
    background-color: #fff1f0;
    border: 1px solid #ffccc7;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}

/* 矩形注释样式 */
.rectangle-annotation {
    position: absolute;
    border: 3px solid #ff0000;
    background-color: transparent;
    box-sizing: border-box;
    cursor: move;
}

/* 调整手柄样式 */
.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: white;
    border: 1px solid #ff0000;
    z-index: 11;
}

.handle-nw { cursor: nw-resize; top: -4px; left: -4px; }
.handle-ne { cursor: ne-resize; top: -4px; right: -4px; }
.handle-sw { cursor: sw-resize; bottom: -4px; left: -4px; }
.handle-se { cursor: se-resize; bottom: -4px; right: -4px; }

/* 虚化区域和选择框样式 */
.blur-area {
    position: absolute;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 15;
    pointer-events: none;
}

.mosaic-selection-box {
    position: absolute;
    border: 2px dashed #007bff;
    background-color: rgba(0, 123, 255, 0.1);
    box-sizing: border-box;
    z-index: 20;
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    right: -5px;
    bottom: -5px;
    background-color: #007bff;
    cursor: nwse-resize;
    z-index: 21;
}

/* 确保画布覆盖整个图片区域 */
.mosaic-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
} 