/* 侧边栏样式 */
.sidebar-item {
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    position: relative;
    display: block;
    transform-origin: top;
    animation: slideDown 0.3s ease-out;
}

.sidebar-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-left-color: #4CAF50;
}

.sidebar-item.active {
    background-color: rgba(0, 0, 0, 0.05);
    border-left-color: #4CAF50;
    font-weight: 500;
}

.item-content {
    flex: 1;
    cursor: pointer;
    user-select: none;
    /* 禁止文本选择 */
    -webkit-user-select: none;
    /* Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE/Edge */
}

.item-actions {
    display: none;
    position: absolute;
    top: 5px;
    right: 5px;
    gap: 5px;
}

.sidebar-item:hover .item-actions {
    display: flex;
}

.edit-btn,
.delete-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.edit-btn {
    background: #2ecc71;
}

.edit-btn:hover {
    background: #27ae60;
    transform: scale(1.1);
}

.delete-btn {
    background: #ff4757;
}

.delete-btn:hover {
    background: #ff6b81;
    transform: scale(1.1);
}

/* 加载动画样式 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* 确保在最上层 */
}

.spinner {
    border: 8px solid #f3f3f3;
    /* Light grey */
    border-top: 8px solid #3498db;
    /* Blue */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 错误消息样式 */
.error-message {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    text-align: center;
}

/* 添加系统按钮样式 */
.add-decor {
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

.add-decor:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

.add-icon {
    font-size: 24px;
    margin-bottom: 8px;
    line-height: 1;
    vertical-align: middle;
    margin-right: 8px;
    margin-top: 7px;
}


/* 主区域样式 */
.main-area {
    padding: 20px;
    width: 100%;
}


/* 添加图片按钮样式 */
.add-image-btn {
    height: 180px;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 auto;
    width: 80%;
}

.add-image-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

/* 产品图片容器样式 */
.product-image {
    text-align: center;
    position: relative;
    height: 230px;
}

.product-image img {
    height: 260px;
    width: 260px;
    object-fit: cover;
    margin-bottom: 10px;
}

.image-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: none;
    gap: 5px;
}

.product-image:hover .image-actions {
    display: flex;
}

/* 预览容器样式 */
.preview-container {
    width: 100px;
    height: 100px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}

/* 上传组样式 */
.upload-group {
    display: flex;
    gap: 20px;
}

.upload-left {
    flex: 1;
}

.file-label {
    display: inline-block;
    padding: 8px 16px;
    background: #4CAF50;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.file-label:hover {
    background: #45a049;
}

input[type="file"] {
    display: none;
}

.file-name {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    color: #666;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #666;
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}


/* 工程案例图片按钮样式 */
.project-images-btn {
    width: 50%;
    padding: 8px 12px;
    margin-top: 5px;
    margin-bottom: 15px;
    margin-left: auto;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    text-align: center;
    display: block;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInSlideDown 0.3s ease-out forwards;
}

.project-images-btn:hover {
    background-color: #e9ecef;
    color: #3498db;
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

/* 激活状态 */
.project-images-btn.active {
    background-color: #e8f4fc;
    color: #3498db;
    border-color: #3498db;
    transition: all 0.3s ease;
}

/* 侧边栏容器样式 */
.sidebar {
    width: 15vw;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 35vh);
    overflow-y: auto;
    position: fixed;
    left: 2vw;
    top: 20vh;
}

/* 自定义滚动条样式 */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 侧边栏项目动画 */
.sidebar-item {
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    position: relative;
    display: block;
    transform-origin: top;
    animation: slideDown 0.3s ease-out;
}

/* 工程案例按钮动画和样式 */
.project-images-btn {
    width: 50%;
    padding: 8px 12px;
    margin-top: 5px;
    margin-bottom: 15px;
    margin-left: auto;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    text-align: center;
    display: block;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInSlideDown 0.3s ease-out forwards;
}

/* 添加按钮动画 */
.add-decor {
    animation: slideDown 0.3s ease-out;
}

/* 定义滑入动画 */
@keyframes fadeInSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    0% {
        transform: translateY(-10px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}


@keyframes itemMove {
    0% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* 激活状态过渡 */
.project-images-btn.active {
    background-color: #e8f4fc;
    color: #3498db;
    border-color: #3498db;
    transition: all 0.3s ease;
}

.project-images-btn:hover {
    background-color: #e9ecef;
    color: #3498db;
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

/* 确保内容不会溢出 */
.sidebar>* {
    max-width: 100%;
}

/* 主内容区域布局 */
.main-content {
    display: flex;
    gap: 20px;
    padding: 20px;
    position: relative;
    margin-top: 210px;
}

/* 右侧内容区域容器 */
.right-content {
    margin-left: 23vw;
    width: calc(100% - 500px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 主区域样式 */
.main-area-decor {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    row-gap: 60px;
    padding: 20px;
    border-radius: 12px;
}

/* 编辑器区域样式 */
.editor-wrapper-data {
    width: 100%;
    padding: 20px;
    display: block;
}

/* ================================================
   响应式布局 — decor 页面
   ================================================ */

@media screen and (max-width: 1199px) {
    .sidebar { width: 200px; left: 1vw; }
    .right-content { margin-left: 220px; width: calc(100% - 260px); }
    .main-area-decor { grid-template-columns: repeat(4, 1fr); row-gap: 45px; }
    .product-image img { width: 200px; height: 200px; }
}

@media screen and (max-width: 991px) {
    .sidebar { width: 170px; padding: 15px; left: 1vw; top: 16vh; }
    .sidebar-item { padding: 10px 14px; font-size: 14px; }
    .right-content { margin-left: 195px; width: calc(100% - 215px); }
    .main-area-decor { grid-template-columns: repeat(3, 1fr); row-gap: 30px; }
    .product-image img { width: 160px; height: 160px; }
    .product-image { height: auto; }
    .main-content { margin-top: 170px; }
}

@media screen and (max-width: 767px) {
    .main-content { flex-direction: column; margin-top: 120px; padding: 5px; }
    .sidebar {
        position: relative;
        left: auto;
        top: auto;
        width: 100%;
        height: auto;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        padding: 10px;
        margin-bottom: 15px;
        border-radius: 8px;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar-item {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 20px;
        animation: none;
    }
    .sidebar::-webkit-scrollbar { height: 3px; }
    .right-content { margin-left: 0; width: 100%; }
    .main-area-decor { grid-template-columns: repeat(2, 1fr); row-gap: 25px; padding: 10px; }
    .product-image img { width: 40vw; height: 40vw; max-width: 180px; max-height: 180px; }
    .product-image { height: auto; }
    .product-image span { font-size: 12px; }
    .editor-wrapper-data { padding: 10px; }
    .editor-wrapper-data img { max-width: 100% !important; height: auto !important; }
}

@media screen and (max-width: 480px) {
    .main-content { margin-top: 100px; }
    .sidebar { padding: 8px; gap: 5px; }
    .sidebar-item { padding: 8px 12px; font-size: 12px; border-radius: 16px; }
    .main-area-decor { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
    .product-image img { width: 42vw; height: 42vw; max-width: 150px; max-height: 150px; }
    .product-image span { width: 42vw; max-width: 150px; font-size: 11px; }
}