/* 素材编辑弹窗样式 */
#sucai-edit-modal, #new-sucai-edit-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
}

#sucai-edit-modal .modal-content, #new-sucai-edit-modal .modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 1000px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#sucai-edit-modal .close, #new-sucai-edit-modal .close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#sucai-edit-modal .close:hover,
#sucai-edit-modal .close:focus,
#new-sucai-edit-modal .close:hover,
#new-sucai-edit-modal .close:focus {
    color: black;
    text-decoration: none;
}

#sucai-edit-modal h2, #new-sucai-edit-modal h2 {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.edit-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-editor {
    width: 1000px;
    height: 1850px;
    max-width: 800px;
    margin: 20px auto;
}

.image-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    overflow: hidden;
}

#sucai-edit-image {
    display: block;
    width: 100%;
    height: auto;
}

#image-mask {
    position: absolute;
    box-sizing: border-box;
    cursor: move;
    z-index: 30;
    display: block;
}

#image-mask.transparent-mask {
    background-color: transparent;
    border: 2px dashed #ff0000;
    border-width: 2px !important;
}

/* CSS遮罩样式 */
.masked-image-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.masked-image {
    width: 100%;
    height: 100%;
    position: relative;
    -webkit-mask-image: radial-gradient(circle at 0 0, black 0%, black 100%);
    mask-image: radial-gradient(circle at 0 0, black 0%, black 100%);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

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

.overlay-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.7;
    z-index: 20;
    pointer-events: auto; /* 允许叠加图片接收点击和拖拽事件 */
}

/* 新素材编辑弹窗样式 */
.left-panel {
    border-right: 1px solid #ddd;
    padding-right: 15px;
}

.material-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 4px;
    overflow: hidden;
}

.material-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.material-item img {
    display: block;
    border-radius: 3px;
}

.json-data-scroll {
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #eee;
}

.json-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.json-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.json-item h4 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.json-item p {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

.apply-coords {
    margin-top: 8px;
    padding: 5px 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    width: 100%;
}

.apply-coords:hover {
    background-color: #45a049;
}

#overlay-container img {
    border: 1px dashed #4CAF50;
    box-sizing: border-box;
}

#overlay-container img:hover {
    border: 2px solid #4CAF50;
    cursor: move;
}

.editor-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.editor-controls button {
    padding: 8px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.editor-controls button:hover {
    background-color: #45a049;
}

#reset-mask {
    background-color: #f44336;
}

#reset-mask:hover {
    background-color: #d32f2f;
}

/* 素材项多选框样式 */
.image-select-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.image-select-checkbox input[type="checkbox"] {
    display: none;
}

.image-select-checkbox label {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.image-select-checkbox input[type="checkbox"]:checked + label:after {
    content: '✓';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    color: #4CAF50;
    font-weight: bold;
}

/* 调整素材项样式 */
.sucai-item {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sucai-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.sucai-item.selected {
    border: 2px solid #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* jQuery UI 调整大小手柄样式 */
.ui-resizable-handle {
    background-color: #fff;
    border: 1px solid #4CAF50;
    width: 8px;
    height: 8px;
}

.ui-resizable-se {
    right: -5px;
    bottom: -5px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    #sucai-edit-modal .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .editor-controls button {
        padding: 6px 12px;
        font-size: 12px;
    }
}