/* 轮播图核心样式 - 基础布局 */
.custom-carousel {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    overflow: hidden;
    border-radius: 8px;
    box-sizing: border-box; /* 确保padding不影响宽度 */
}

.carousel-slides-wrapper {
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.carousel-slides {
    display: flex;
    transition: transform 0.5s ease;
    will-change: transform; /* 优化动画性能 */
}

.carousel-slide {
    flex: 0 0 auto;
    width: 100%; /* 强制每张幻灯片占满宽度 */
}

.carousel-slide img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block; /* 去除图片底部空白 */
}
/* 确保轮播图在两栏布局中正确显示 */
.wp-block-column .custom-carousel {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.wp-block-column .carousel-slides-wrapper {
    width: 100% !important;
}
/* 切换箭头 - 桌面端样式 */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    padding: 0; /* 清除默认内边距 */
}

.carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.8);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

/* 指示器 - 桌面端样式 */
.carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
    padding: 5px 10px;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.3);
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.carousel-dot.active {
    background: #fff;
}

/* ========== 移动端适配（768px以下） ========== */
@media (max-width: 768px) {
    /* 轮播容器 */
    .custom-carousel {
        margin: 1rem 0 !important;
        border-radius: 4px;
        padding: 0;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 轮播图片适配 */
    .carousel-slide img {
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
        max-height: 300px;
        margin: 0 auto !important;
        display: block !important;
    }

    /* 切换箭头修复 */
    .carousel-arrow {
        width: 30px !important;
        height: 30px !important;
        font-size: 16px !important;
        background: rgba(0, 0, 0, 0.7) !important;
        z-index: 999 !important; /* 确保箭头不被遮挡 */
    }
    .carousel-prev {
        left: 5px !important;
    }
    .carousel-next {
        right: 5px !important;
    }

    /* 指示器优化 */
    .carousel-dots {
        bottom: 10px !important;
        gap: 6px !important;
        background: rgba(0, 0, 0, 0.4) !important;
    }
    .carousel-dot {
        width: 8px !important;
        height: 8px !important;
    }
}

/* 小屏手机适配（480px以下） */
@media (max-width: 480px) {
    .carousel-slide img {
        max-height: 200px !important;
    }
    .carousel-arrow {
        width: 25px !important;
        height: 25px !important;
        font-size: 14px !important;
    }
}
.upload-images-btn {
    margin-bottom: 1rem !important;
}

.carousel-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.carousel-image-item {
    position: relative;
    width: 100px;
    height: 100px;
    overflow: hidden;
    border-radius: 4px;
}

.carousel-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    border: none;
    cursor: pointer;
}

.carousel-empty {
    text-align: center;
    padding: 2rem;
    color: #666;
}