/* 核心：让外层容器水平居中 */
.wrap.page-header {
 /* 固定宽度（根据你的需求调整，也可用max-width适配） */
  margin: 0 auto; /* 左右自动边距 → 水平居中 */
  display: flex; /* 弹性布局：让内部元素横向排列（可选，根据布局需求） */
  align-items: center; /* 垂直居中（可选） */
  justify-content: space-between; /* 元素分散对齐（可选） */
  padding: 10px 0; /* 内边距（可选） */
}


/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    list-style: none;
}

/* 轮播容器 - 核心修正：补充水平居中 + 优化margin逻辑 */
.ad-carousel-container {
    position: relative;
    width: 700px; /* 图片宽度（改为350px，符合你的修改） */
    height: 90px; /* 图片高度 */
    overflow: hidden; 
    border-radius: 4px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
    /* 修正1：水平居中 + 上下20px间距，左右自适应（原20px会导致无法居中） */
    margin: 5px auto; 
    /* 新增：响应式高度过渡 */
    transition: height 0.3s ease;
}

/* 轮播轨道 - 横向排列（无问题） */
.ad-carousel {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    height: 100%;
    transition: left 0.5s ease; 
}

/* 轮播项 - 固定尺寸（无问题） */
.ad-slide {
    width: 700px; 
    height: 90px; 
    flex-shrink: 0; 
}

/* 轮播图片 - 核心修正：移除硬编码，改用继承+自适应 */
.ad-slide img {
    /* 修正2：移除固定尺寸，改为100%继承父级 */
    width: 100%;
    height: 100%;
    object-fit: cover; 
    display: block; 
    /* 新增：图片加载过渡 */
    transition: opacity 0.3s ease;
}
/* 可选：图片加载中占位 */
.ad-slide img:not([src]) {
    background: #f5f5f5;
}

/* 导航按钮 - 优化交互 */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    /* 修正3：加深按钮背景，提升辨识度 */
    background-color: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background-color 0.3s;
    /* 新增：防点击穿透 + 禁用文本选择 */
    pointer-events: auto;
    user-select: none;
}

/* 左/右按钮（无结构问题） */
.prev-btn { left: 5px; }
.next-btn { right: 5px; }

/* 按钮hover效果（无问题） */
.carousel-btn:hover {
    background-color: rgba(255,255,255,1);
}

/* 指示器容器（无结构问题） */
.carousel-indicators {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

/* 指示器样式 - 优化辨识度 */
.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    /* 修正4：加深未激活指示器背景 */
    background-color: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    /* 新增：禁用文本选择 */
    user-select: none;
}
/* 激活的指示器 - 强化视觉 */
.indicator.active {
    background-color: #ffffff;
    /* 新增：激活时放大，提升辨识度 */
    transform: scale(1.2);
}

/* 响应式适配 - 核心修正：补全图片尺寸适配 */
@media (max-width: 480px) {
    .ad-carousel-container {
        width: 90%;
        height: auto; /* 高度自适应 */
        margin: 10px auto; /* 小屏缩小上下间距 */
    }
    .ad-slide {
        width: 100%;
        height: auto; /* 跟随容器高度 */
    }
    /* 修正5：补全响应式下图片的高度自适应 */
    .ad-slide img {
        height: auto;
        min-height: 70px; /* 保证最小高度 */
    }
    /* 小屏优化按钮尺寸 */
    .carousel-btn {
        width: 26px;
        height: 26px;
        font-size: 14px;
    }
}

