/**
 * 产品图片悬停轮播组件样式
 */

.ecw-hover-carousel-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.ecw-hover-carousel {
    width: 100%;
    height: 530px;
}

.ecw-hover-carousel .swiper-wrapper {
    display: flex;
    align-items: stretch;
}

.ecw-hover-carousel .swiper-slide {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ecw-hover-carousel-item {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: end;
    position: relative;
    padding: 0;
    transition: transform 0.3s ease;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    overflow: hidden;
}

.ecw-hover-carousel-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    z-index: 0;
}

.ecw-hover-carousel-image-container {
    display: none;
}

.ecw-hover-carousel-main-image {
    display: none;
}

.ecw-hover-carousel-hover-image {
    position: absolute;
    width: 138px;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    z-index: 1;
    transform: translateY(50%) scale(0.98); /* 默认隐藏下半部分 */
    transition: transform 0.5s ease-in-out;
}

.ecw-hover-carousel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 默认透明，将由内联样式覆盖 */
    opacity: 0;
    border-radius: 8px;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.ecw-hover-carousel-bg {
    transition: transform 1s ease;
}

.ecw-hover-carousel-item:hover .ecw-hover-carousel-bg {
    transform: scale(1.03);
}

/* 悬停效果 */
/* 鼠标悬停在轮播项上时，提升层级，确保它在最上层 */
.ecw-hover-carousel .swiper-slide:hover .ecw-hover-carousel-item {
    z-index: 10;
}

.ecw-hover-carousel-item:hover .ecw-hover-carousel-hover-image {
    transform: translateY(-26%); /* 上移显示完整图片 */
    transition-delay: 0s; /* 图片立即显示 */
}

.ecw-hover-carousel-item:hover .ecw-hover-carousel-overlay {
    opacity: 1; /* 显示蒙层 */
    transition-delay: 0s; /* 蒙层立即显示 */
}

.ecw-hover-carousel-item:hover .ecw-hover-carousel-title {
    opacity: 1; /* 显示标题 */
    transform: translateY(0); /* 恢复原始位置 */
    transition-delay: 0.2s; /* 标题延迟显示 */
}

/* 离开时的反向动画顺序 */
/* 离开动画的顺序由 transition-delay 控制 */
/* 默认状态已经有 transition-delay，所以离开时会按照相反的顺序动画 */
.ecw-hover-carousel-item .ecw-hover-carousel-hover-image {
    transition-delay: 0.2s; /* 默认延迟，所以离开时会先消失 */
}

.ecw-hover-carousel-item .ecw-hover-carousel-overlay {
    transition-delay: 0.2s; /* 默认延迟，所以离开时会先消失 */
}

.ecw-hover-carousel-item .ecw-hover-carousel-title {
    transition-delay: 0s; /* 默认无延迟，所以离开时会先消失 */
}

.ecw-hover-carousel-content {
    width: 100%;
    display: flex;
    justify-content: center;
    min-height: 32px;
}

.ecw-hover-carousel-title {
    font-size: 28px;
    font-weight: 700;
    color: #333333;
    margin-bottom: 34px;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(20px);
    text-align: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 60%;
}

.ecw-hover-carousel-button {
    display: inline-block;
    padding: 12px 30px;
    background-color: #000000;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.ecw-hover-carousel-button:hover {
    background-color: #333333;
    transform: translateY(-2px);
}

/* 分页器样式 */
.ecw-hover-carousel-pagination.swiper-pagination-bullets.swiper-pagination-horizontal {
    position: absolute;
    bottom: -56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    /* 移除 display: flex 和 gap，让 Swiper 自己管理布局，适配 dynamicBullets */
    text-align: center;
    width: auto;
}

/* 适配 Swiper dynamicBullets 模式的容器宽度 */
.ecw-hover-carousel-pagination.swiper-pagination-bullets-dynamic {
    overflow: hidden;
    font-size: 0;
}

.ecw-hover-carousel-wrapper .ecw-hover-carousel-pagination .swiper-pagination-bullet {
    width: 6px;
    height: 6px;
    margin: 0 2px; /* 使用 margin 替代 gap */
    background-color: rgba(7, 9, 49, 0.5);
    border-radius: 50%;
    opacity: 1;
    transition: all 0.3s ease;
    display: inline-block; /* 确保 block 布局下横向排列 */
}

/* 仅在非 dynamic 模式下（PC端）启用长条激活样式 */
.ecw-hover-carousel-wrapper .ecw-hover-carousel-pagination:not(.swiper-pagination-bullets-dynamic) .swiper-pagination-bullet.swiper-pagination-bullet-active {
    background-color: rgba(7, 9, 49, 1);
    width: 24px;
    border-radius: 30px;
}

/* 在 dynamic 模式下（移动端），激活样式保持圆形，仅变色 */
.ecw-hover-carousel-wrapper .ecw-hover-carousel-pagination.swiper-pagination-bullets-dynamic .swiper-pagination-bullet.swiper-pagination-bullet-active {
    background-color: rgba(7, 9, 49, 1);
    transform: scale(1); /* 确保不被意外缩放 */
}

.ecw-hover-carousel-wrapper .swiper-pagination-bullet:hover {
    background-color: rgba(7, 9, 49, 0.9);
}

/* 导航箭头样式 */
.ecw-hover-carousel-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0;
    z-index: 10;
}

.ecw-hover-carousel-prev,
.ecw-hover-carousel-next {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.ecw-hover-carousel-prev {
    transform: translateX(-55px);
}
.ecw-hover-carousel-next {
    transform: translateX(55px);
}

.ecw-hover-carousel-prev:hover::after,
.ecw-hover-carousel-next:hover::after {
    border-color: #333;
}

.ecw-hover-carousel-prev::after,
.ecw-hover-carousel-next::after {
    content: '';
    width: 16px;
    height: 16px;
    border-top: 2px solid #000;
    border-right: 2px solid #000;
}

.ecw-hover-carousel-prev::after {
    transform: rotate(-135deg);
}

.ecw-hover-carousel-next::after {
    transform: rotate(45deg);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ecw-hover-carousel-wrapper {
        width: 100vw;
        margin: 0 -20px;
    }
    .ecw-hover-carousel {
        height: 300px;
    }
    
    .ecw-hover-carousel-item {
        padding: 10px;
        max-width: 300px;
    }
    
    .ecw-hover-carousel-image-container {
        display: none;
    }
    
    .ecw-hover-carousel-title {
        margin-bottom: 0;
        opacity: 1;
        max-width: 100%;
        transform: translateY(0);
    }

    .ecw-hover-carousel-hover-image {
        width: 69px;
        transform: none;
        top: 18px;
    }
    .ecw-hover-carousel-prev,
    .ecw-hover-carousel-next {
        display: none;
    }
    .ecw-hover-carousel-item:hover .ecw-hover-carousel-overlay {
        opacity: 0;
    }
    .ecw-hover-carousel-item:hover .ecw-hover-carousel-hover-image {
        transform: none;
    }
    
    .ecw-hover-carousel-item:hover .ecw-hover-carousel-title {
        transform: translateY(0);
    }
    .ecw-hover-carousel-wrapper .ecw-hover-carousel-pagination .swiper-pagination-bullet {
        width: 4px;
        height: 4px;
        margin: 0 2px;
    }

    .ecw-hover-carousel-wrapper .ecw-hover-carousel-pagination .swiper-pagination-bullet.swiper-pagination-bullet-active {
        width: 10px;
        border-radius: 16px;
    }
    .ecw-hover-carousel-pagination.swiper-pagination-bullets.swiper-pagination-horizontal {
        bottom: -32px;
    }
}

@media (max-width: 480px) {
    .ecw-hover-carousel {
        height: 260px;
    }
    
    .ecw-hover-carousel-item {
        max-width: 250px;
        padding: 4px 10px;
    }
    
    .ecw-hover-carousel-image-container {
        display: none;
    }
}
