/* 图片形状裁剪工具样式 */

/* 画布相关样式 */
#crop-workspace {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#main-canvas, #overlay-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-width: 90%;
    max-height: 90%;
}

#overlay-canvas {
    pointer-events: none;
    z-index: 10;
}

/* 裁剪控制手柄 */
.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 20;
}

.crop-handle.nw { cursor: nw-resize; }
.crop-handle.ne { cursor: ne-resize; }
.crop-handle.sw { cursor: sw-resize; }
.crop-handle.se { cursor: se-resize; }
.crop-handle.n { cursor: n-resize; }
.crop-handle.s { cursor: s-resize; }
.crop-handle.w { cursor: w-resize; }
.crop-handle.e { cursor: e-resize; }

/* 裁剪框样式 */
.crop-overlay {
    position: absolute;
    border: 2px solid #007bff;
    border-radius: 4px;
    background: rgba(0,123,255,0.1);
    pointer-events: none;
    z-index: 15;
}

/* 自由绘制模式 */
.freehand-mode {
    cursor: crosshair;
}

.freehand-path {
    stroke: #007bff;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 形状预览 */
.shape-preview {
    position: absolute;
    pointer-events: none;
    z-index: 12;
}

.shape-preview.square {
    border: 2px dashed #007bff;
}

.shape-preview.circle {
    border: 2px dashed #007bff;
    border-radius: 50%;
}

.shape-preview.triangle {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid rgba(0,123,255,0.3);
}

/* 工具按钮状态 */
.tool-active {
    background: #007bff !important;
    color: white !important;
    border-color: #007bff !important;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3) !important;
}

.tool-active:hover {
    background: #0056b3 !important;
    border-color: #0056b3 !important;
}

/* 相框按钮特殊样式 */
#no-frame.tool-active {
    background: #6c757d !important;
    border-color: #6c757d !important;
}

#simple-frame.tool-active {
    background: #8B4513 !important;
    border-color: #8B4513 !important;
}

#decorative-frame.tool-active {
    background: linear-gradient(135deg, #FFD700, #FFA500) !important;
    border-color: #FFD700 !important;
    color: #333 !important;
}

/* 加载状态 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 15px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 水印保护 */
.watermark-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.9);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    color: #666;
    pointer-events: none;
    z-index: 50;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* 防止右键和拖拽 */
.crop-result img,
.crop-result canvas {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-drag: none;
    -ms-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

.crop-result {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    position: relative;
}

/* 错误提示 */
.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .shape-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .shape-btn {
        font-size: 20px;
    }
    
    .shape-btn .shape-name {
        font-size: 9px;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .upload-zone {
        padding: 20px;
    }
    
    .controls-section {
        margin-bottom: 15px;
    }
}
