.style-selector-container {
    margin-bottom: 20px;
    position: relative;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 15px;
    background-color: #fafafa;
}

.style-selector-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.style-selector-title h3 {
    margin: 0;
    font-size: 1.1rem;
}

.style-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.style-option {
    width: 90px;
    border: 2px solid #e9e9e9;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: all 0.2s ease;
}

.style-option:hover {
    border-color: #c9c9c9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.style-option.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 1px #007bff;
}

.style-preview {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
}

.style-name {
    font-size: 0.85rem;
    text-align: center;
    padding: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: #f8f8f8;
    color: #333;
}

.delete-style-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff4d4f;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.style-option:hover .delete-style-btn {
    opacity: 1;
}

.delete-style-btn:hover {
    background-color: rgba(255, 255, 255, 1);
}

.edit-style-btn {
    position: absolute;
    top: 30px;
    right: 4px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #28a745;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 3;
}

.style-option:hover .edit-style-btn {
    opacity: 1;
}

.edit-style-btn:hover {
    background-color: rgba(255, 255, 255, 1);
}

.move-up-btn {
    position: absolute;
    top: 56px;
    right: 4px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0069d9;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.move-down-btn {
    position: absolute;
    top: 82px;
    right: 4px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0069d9;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.style-option:hover .move-up-btn,
.style-option:hover .move-down-btn {
    opacity: 1;
}

.move-up-btn:hover,
.move-down-btn:hover {
    background-color: rgba(255, 255, 255, 1);
    color: #0056b3;
}

.ai-drawing-modal,
.add-style-modal,
.edit-style-modal,
#add-3d-style-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.add-style-modal.active,
.edit-style-modal.active,
.ai-drawing-modal.active {
    display: flex;
}

.ai-drawing-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    cursor: pointer;
}

.modal-content,
.ai-drawing-modal-content {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
    z-index: 9999;
}

.modal-header,
.ai-drawing-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.modal-title,
.ai-drawing-modal-header h2 {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #666;
}

.modal-body form,
.ai-drawing-modal-body form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-drawing-modal-body,
.modal-body {
    margin-bottom: 15px;
}

.ai-drawing-modal-footer,
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
}

.form-group input,
.form-group textarea,
#add-3d-style-modal .form-group input,
#add-3d-style-modal .form-group textarea {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group .form-text,
#add-3d-style-modal .form-text {
    font-size: 12px;
    color: #666;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.cancel-btn {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
}

.submit-btn {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
}

.preview-container {
    margin-top: 10px;
}

.preview-container img {
    max-width: 100%;
    max-height: 200px;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

/* 编辑弹窗预览图片容器 */
.edit-preview-container {
    margin-top: 10px;
}

.edit-preview-container img {
    max-width: 100%;
    max-height: 200px;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.ai-drawing-modal button.btn,
#add-3d-style-modal button.btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 14px;
}

.ai-drawing-modal .btn-primary,
#add-3d-style-modal .btn-primary {
    background-color: #007bff;
    color: white;
}

.ai-drawing-modal .btn-primary:hover,
#add-3d-style-modal .btn-primary:hover {
    background-color: #0069d9;
}

.ai-drawing-modal .btn-secondary,
#add-3d-style-modal .btn-secondary {
    background-color: #6c757d;
    color: white;
}

.ai-drawing-modal .btn-secondary:hover,
#add-3d-style-modal .btn-secondary:hover {
    background-color: #5a6268;
}

.ai-drawing-modal .error-message,
#add-3d-style-modal .error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
}

@media (max-width: 768px) {
    .style-selector {
        gap: 8px;
    }

    .style-option {
        width: 80px;
    }
}

@media (max-width: 480px) {
    .style-option {
        width: 70px;
    }

    .style-name {
        font-size: 0.75rem;
    }
}

body #add-3d-style-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

body #add-3d-style-modal .ai-drawing-modal-content {
    position: relative;
    z-index: 10000;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}