/* Canvas Editor Styles */
.canvas-editor-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.canvas-editor-container {
    background: #2c2c2c;
    border-radius: 8px;
    width: 95%;
    height: 95%;
    max-width: 1600px;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.canvas-editor-header {
    background: #1a1a1a;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
}

.canvas-editor-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 500;
}

.btn-close-editor {
    background: transparent;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-close-editor:hover {
    background: #444;
    color: #fff;
}

.canvas-toolbar {
    background: #1a1a1a;
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    border-bottom: 1px solid #444;
    overflow-x: auto;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-right: 1px solid #444;
}

.toolbar-group:last-child {
    border-right: none;
}

.group-label {
    color: #999;
    font-size: 12px;
    margin-right: 5px;
    white-space: nowrap;
}

.tool-btn {
    background: #333;
    border: 1px solid #555;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.tool-btn:hover {
    background: #444;
    border-color: #666;
}

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

.tool-btn i {
    font-size: 16px;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.color-picker-wrapper label {
    color: #999;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    margin: 0;
}

.color-picker {
    width: 40px;
    height: 36px;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    background: #333;
    padding: 2px;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.brush-width-slider {
    width: 100px;
    height: 6px;
    border-radius: 3px;
    background: #444;
    outline: none;
    cursor: pointer;
}

.brush-width-slider::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1890ff;
    cursor: pointer;
}

.brush-width-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1890ff;
    cursor: pointer;
    border: none;
}

.brush-width-value {
    color: #fff;
    font-size: 12px;
    min-width: 40px;
    text-align: center;
}

.canvas-workspace {
    flex: 1;
    padding: 20px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.canvas-wrapper {
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#fabricCanvas {
    border: 1px solid #ddd;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn i {
    font-size: 14px;
}

.btn-success {
    background: #52c41a;
    color: #fff;
}

.btn-success:hover {
    background: #73d13d;
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-warning {
    background: #faad14;
    color: #fff;
}

.btn-warning:hover {
    background: #ffc53d;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .canvas-editor-container {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .canvas-editor-header {
        border-radius: 0;
    }

    .canvas-toolbar {
        padding: 8px 10px;
        gap: 8px;
    }

    .toolbar-group {
        padding: 3px 5px;
        gap: 5px;
    }

    .tool-btn {
        padding: 6px 10px;
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .group-label {
        display: none;
    }

    .brush-width-slider {
        width: 60px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .canvas-workspace {
        padding: 10px;
    }
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #1890ff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Fabric.js 覆盖样式 */
.canvas-container {
    margin: 0 auto !important;
}

.upper-canvas {
    cursor: crosshair !important;
}

.upper-canvas.drawing-mode {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="none" stroke="black" stroke-width="2"/></svg>') 12 12, crosshair !important;
}
