/* 侧边栏广告通用样式 - 单图+轮播共用 */
.sidebar-ad-single,
.sidebar-ad-carousel {
    width: 100%;
    max-width: 336px;
    margin: 15px auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    position: relative; /* 必须保留：作为绝对定位基准 */
}

/* 轮播广告核心：固定高度 + 相对定位 */
.sidebar-ad-carousel {
    height: calc(100% * 0.7946); /* 336*0.7946≈267px */
    max-height: 267px;
    min-height: 180px; /* 兜底高度，防止窄屏塌陷 */
}

.ad-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.ad-img {
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.4s ease;
    object-fit: cover; /* 保持图片比例 */
    object-position: center;
}

.ad-link:hover .ad-img {
    transform: scale(1.05);
}

.ad-label {
    font-size: 12px;
    color: #999999;
    text-align: center;
    margin: 5px 0 0 0;
    padding: 5px 0;
}

.ad-toggle-btn {
    display: block;
    width: 100%;
    max-width: 336px;
    margin: 0 auto 15px;
    padding: 8px 0;
    border: none;
    border-radius: 4px;
    background: #f5f5f5;
    color: #333333;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.ad-toggle-btn:hover {
    background: #ff6700;
    color: #ffffff;
}

/* 单图广告 文本覆盖层样式 */
.sidebar-ad-single .ad-text-overlay {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    transform: translateY(-50%);
    text-align: center;
    color: #ffffff;
    padding: 20px 0;
    z-index: 2;
    background: linear-gradient(transparent, rgba(0,0,0,0.5), transparent);
}

.sidebar-ad-single .ad-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.sidebar-ad-single .ad-desc {
    font-size: 16px;
    margin: 0 0 25px 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.sidebar-ad-single .ad-tag {
    background: #ff6700;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 500;
}

/* 轮播广告 专属样式 - 核心动画 */
.ad-carousel-item {
    position: absolute; /* 所有轮播项重叠 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0; /* 默认隐藏 */
    transition: opacity 0.5s ease-in-out; /* 淡入淡出动画 */
    pointer-events: none; /* 隐藏时不触发点击 */
}

.ad-carousel-item.active {
    opacity: 1; /* 激活时显示 */
    pointer-events: auto; /* 可点击 */
}

.ad-carousel-item .ad-text-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #ffffff;
    padding: 15px;
    z-index: 2;
}

.ad-carousel-item .ad-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 5px 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.ad-carousel-item .ad-desc {
    font-size: 14px;
    margin: 5px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.6);
}

/* 轮播翻页按钮 */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    z-index: 3;
    transition: background-color 0.3s ease;
}

.carousel-btn:hover {
    background-color: #ff6700;
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

/* 轮播指示器 */
.carousel-indicators {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 3;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.indicator-dot.active {
    background-color: #ff6700;
}

/* 响应式适配 - 移动端通用 */
@media (max-width: 768px) {
    .sidebar-ad-single,
    .sidebar-ad-carousel,
    .ad-toggle-btn {
        max-width: 100%;
        margin: 10px 0;
    }

    .sidebar-ad-carousel {
        height: calc(100% * 0.7946);
        min-height: 150px;
    }

    .sidebar-ad-single .ad-title {
        font-size: 16px;
    }

    .sidebar-ad-single .ad-desc {
        font-size: 12px;
    }

    .carousel-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }

    .indicator-dot {
        width: 6px;
        height: 6px;
    }
}