/* ============================================
   Mloun Slide4 - 幻灯片轮播样式 v6
   ============================================ */

/* ---- CSS 变量默认值 ---- */
.mloun-slide4-wrapper {
    --slide-gap: 20px;
    --slide-columns: 4;
    position: relative;
    width: 100%;
}

/* ---- 基础容器 ---- */
.mloun-slide4-wrapper .swiper-wrapper {
    display: flex;
    align-items: stretch;
}

/* ---- 幻灯片项 ---- */
.mloun-slide4-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}

.mloun-slide4-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.mloun-slide4-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

/* ---- 蒙版层 ---- */
.mloun-slide4-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    transition: background-color 0.4s ease;
    z-index: 1;
}

/* ============================================
   默认标题（悬停前始终显示）
   ============================================ */
.mloun-slide4-default-title-wrapper {
    position: absolute;
    left: 0;
    width: 100%;
    z-index: 2;
    padding: 20px;
    box-sizing: border-box;
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
    display: block;
}

/* 默认标题位置 */
.mloun-slide4-item.default-pos-top .mloun-slide4-default-title-wrapper {
    top: 0;
    bottom: auto;
}

.mloun-slide4-item.default-pos-center .mloun-slide4-default-title-wrapper {
    top: 50%;
    transform: translateY(-50%);
}

.mloun-slide4-item.default-pos-bottom .mloun-slide4-default-title-wrapper {
    bottom: 0;
    top: auto;
}

.mloun-slide4-default-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.3;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 0;
    word-wrap: break-word;
    display: inline-block;
    text-align: left;
}

/* ============================================
   悬停内容层（默认隐藏）
   ============================================ */
.mloun-slide4-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    pointer-events: none;
}

/* 悬停内容位置 */
.mloun-slide4-item.hover-pos-top .mloun-slide4-content {
    justify-content: flex-start;
    align-items: center;
}

.mloun-slide4-item.hover-pos-center .mloun-slide4-content {
    justify-content: center;
    align-items: center;
}

.mloun-slide4-item.hover-pos-bottom .mloun-slide4-content {
    justify-content: flex-end;
    align-items: center;
}

.mloun-slide4-content-inner {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.mloun-slide4-hover-title {
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.3;
    word-wrap: break-word;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    text-align: center;
    width: 100%;
}

.mloun-slide4-desc {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #ffffff;
    max-width: 85%;
    text-align: center;
    width: 100%;
}

.mloun-slide4-desc p {
    margin: 0 0 8px 0;
}

.mloun-slide4-desc p:last-child {
    margin-bottom: 0;
}

.mloun-slide4-desc a {
    color: inherit;
    text-decoration: underline;
}

.mloun-slide4-desc strong,
.mloun-slide4-desc b {
    font-weight: 700;
}

.mloun-slide4-desc em,
.mloun-slide4-desc i {
    font-style: italic;
}

.mloun-slide4-btn {
    display: inline-block;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    background-color: #ff8c42;
    padding: 10px 25px;
    border-radius: 4px;
    transition: all 0.3s ease;
    pointer-events: auto;
    cursor: pointer;
    border: none;
    line-height: 1.4;
    margin-top: 5px;
    text-align: center;
}

.mloun-slide4-btn:hover {
    background-color: #1b4f7c;
    color: #ffffff;
}

/* ============================================
   悬停/激活状态
   ============================================ */
.mloun-slide4-item:hover .mloun-slide4-overlay,
.mloun-slide4-item.active .mloun-slide4-overlay {
    background-color: rgba(0, 0, 0, 0.7);
}

.mloun-slide4-item:hover img,
.mloun-slide4-item.active img {
    transform: scale(1.05);
}

.mloun-slide4-item:hover .mloun-slide4-default-title-wrapper,
.mloun-slide4-item.active .mloun-slide4-default-title-wrapper {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

.mloun-slide4-item.default-pos-center:hover .mloun-slide4-default-title-wrapper,
.mloun-slide4-item.default-pos-center.active .mloun-slide4-default-title-wrapper {
    opacity: 0;
    transform: translateY(-50%) translateY(-8px);
}

.mloun-slide4-item:hover .mloun-slide4-content-inner,
.mloun-slide4-item.active .mloun-slide4-content-inner {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   箭头样式
   ============================================ */
.mloun-slide4-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.mloun-slide4-arrow:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.mloun-slide4-arrow svg {
    width: 20px;
    height: 20px;
    display: block;
}

.mloun-slide4-prev {
    left: 10px;
}

.mloun-slide4-next {
    right: 10px;
}

/* ============================================
   分页点
   ============================================ */
.mloun-slide4-wrapper .swiper-pagination {
    position: relative;
    margin-top: 20px;
    bottom: 0;
}

.mloun-slide4-wrapper .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: all 0.3s ease;
}

.mloun-slide4-wrapper .swiper-pagination-bullet-active {
    background-color: #ffffff;
    transform: scale(1.2);
}

/* ============================================
   编辑器预览修复 - 强制轮播，不换行
   ============================================ */

/* 编辑器中强制轮播容器 */
.elementor-editor-active .mloun-slide4-wrapper.swiper,
.elementor-editor-preview .mloun-slide4-wrapper.swiper {
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* 编辑器中强制横向排列，绝对不换行 */
.elementor-editor-active .mloun-slide4-wrapper.swiper > .swiper-wrapper,
.elementor-editor-preview .mloun-slide4-wrapper.swiper > .swiper-wrapper,
.elementor-editor-active .mloun-slide4-wrapper > .swiper-wrapper,
.elementor-editor-preview .mloun-slide4-wrapper > .swiper-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    transform: none !important;
    transition: none !important;
    width: auto !important;
    min-width: 100% !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* 编辑器中每个 slide 固定百分比宽度 */
.elementor-editor-active .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item,
.elementor-editor-preview .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item {
    width: calc((100% - (var(--slide-gap) * 3)) / 4) !important;
    margin-right: var(--slide-gap) !important;
    margin-bottom: 0 !important;
    flex-shrink: 0 !important;
    position: relative !important;
    display: block !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    box-sizing: border-box !important;
    float: none !important;
    clear: none !important;
}

/* 最后一个 slide 没有右边距 */
.elementor-editor-active .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item:last-child,
.elementor-editor-preview .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item:last-child {
    margin-right: 0 !important;
}

/* 编辑器中默认标题强制可见 */
.elementor-editor-active .mloun-slide4-wrapper .mloun-slide4-default-title-wrapper,
.elementor-editor-preview .mloun-slide4-wrapper .mloun-slide4-default-title-wrapper {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    transform: none !important;
}

.elementor-editor-active .mloun-slide4-wrapper .default-pos-center .mloun-slide4-default-title-wrapper,
.elementor-editor-preview .mloun-slide4-wrapper .default-pos-center .mloun-slide4-default-title-wrapper {
    transform: translateY(-50%) !important;
}

/* 编辑器中内容层默认隐藏 */
.elementor-editor-active .mloun-slide4-wrapper .mloun-slide4-content-inner,
.elementor-editor-preview .mloun-slide4-wrapper .mloun-slide4-content-inner {
    opacity: 0 !important;
    transform: translateY(15px) !important;
}

/* 编辑器中悬停时切换 */
.elementor-editor-active .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item:hover .mloun-slide4-default-title-wrapper,
.elementor-editor-preview .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item:hover .mloun-slide4-default-title-wrapper {
    opacity: 0 !important;
    transform: translateY(-8px) !important;
}

.elementor-editor-active .mloun-slide4-wrapper .default-pos-center.mloun-slide4-item:hover .mloun-slide4-default-title-wrapper,
.elementor-editor-preview .mloun-slide4-wrapper .default-pos-center.mloun-slide4-item:hover .mloun-slide4-default-title-wrapper {
    opacity: 0 !important;
    transform: translateY(-50%) translateY(-8px) !important;
}

.elementor-editor-active .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item:hover .mloun-slide4-content-inner,
.elementor-editor-preview .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item:hover .mloun-slide4-content-inner {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.elementor-editor-active .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item:hover .mloun-slide4-overlay,
.elementor-editor-preview .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item:hover .mloun-slide4-overlay {
    background-color: rgba(0, 0, 0, 0.7) !important;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 1024px) {
    .mloun-slide4-default-title,
    .mloun-slide4-hover-title {
        font-size: 20px;
    }

    .mloun-slide4-desc {
        font-size: 13px;
    }

    .mloun-slide4-arrow {
        width: 36px;
        height: 36px;
    }

    .mloun-slide4-prev {
        left: 8px;
    }

    .mloun-slide4-next {
        right: 8px;
    }

    /* 平板编辑器 2列 */
    .elementor-editor-active .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item,
    .elementor-editor-preview .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item {
        width: calc((100% - var(--slide-gap)) / 2) !important;
    }
}

@media (max-width: 768px) {
    .mloun-slide4-default-title,
    .mloun-slide4-hover-title {
        font-size: 18px;
    }

    .mloun-slide4-desc {
        font-size: 12px;
        max-width: 90%;
    }

    .mloun-slide4-btn {
        padding: 8px 20px;
        font-size: 13px;
    }

    .mloun-slide4-content,
    .mloun-slide4-default-title-wrapper {
        padding: 15px;
    }

    .mloun-slide4-prev {
        left: 5px;
    }

    .mloun-slide4-next {
        right: 5px;
    }

    /* 手机编辑器 1列 */
    .elementor-editor-active .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item,
    .elementor-editor-preview .mloun-slide4-wrapper .swiper-slide.mloun-slide4-item {
        width: 100% !important;
        margin-right: 0 !important;
    }
}

/* 手机端点击模式 */
@media (max-width: 767px) {
    .mloun-slide4-item .mloun-slide4-content-inner {
        opacity: 0;
        transform: translateY(15px);
    }

    .mloun-slide4-item.active .mloun-slide4-content-inner {
        opacity: 1;
        transform: translateY(0);
    }

    .mloun-slide4-item.active .mloun-slide4-default-title-wrapper {
        opacity: 0;
    }

    .mloun-slide4-item.active .mloun-slide4-overlay {
        background-color: rgba(0, 0, 0, 0.7);
    }

    .mloun-slide4-item.active img {
        transform: scale(1.05);
    }
}

/* 无障碍 */
.mloun-slide4-arrow:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.mloun-slide4-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
