/**
 * 逆流广告系统 - 前端样式
 *
 * @package    Niliu_Ads
 * @author     逆流
 * @version    1.0.0
 */

/* 广告容器 */
.niliu-ads-container {
    position: relative;
    margin: 10px 0;
}

/* 单个广告 */
.niliu-ad {
    position: relative;
    display: block;
    margin-bottom: 10px;
}

.niliu-ad:last-child {
    margin-bottom: 0;
}

/* 图片广告 */
.niliu-ad-image {
    text-align: center;
}

.niliu-ad-image .niliu-ad-link {
    display: block;
}

.niliu-ad-image img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    transition: opacity 0.3s ease;
}

.niliu-ad-image .niliu-ad-link:hover img {
    opacity: 0.9;
}

/* HTML广告 */
.niliu-ad-html {
    overflow: hidden;
}

.niliu-ad-html .niliu-ad-html {
    line-height: 1.5;
}

/* 文字广告 */
.niliu-ad-text {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
}

.niliu-ad-text a {
    color: #0066cc;
    text-decoration: none;
}

.niliu-ad-text a:hover {
    text-decoration: underline;
}

/* ============================================
   轮播广告样式
   ============================================ */
.niliu-ad-carousel {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

.niliu-ad-carousel .carousel-inner {
    position: relative;
    width: 100%;
}

.niliu-ad-carousel .carousel-item {
    display: none;
    width: 100%;
}

.niliu-ad-carousel .carousel-item.active {
    display: block;
}

.niliu-ad-carousel .carousel-item img {
    width: 100%;
    height: auto;
    display: block;
}

.niliu-ad-carousel .carousel-item a {
    display: block;
}

/* 轮播指示器 */
.niliu-ad-carousel .carousel-indicators {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.niliu-ad-carousel .carousel-indicators .indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s;
}

.niliu-ad-carousel .carousel-indicators .indicator.active {
    background: #fff;
}

.niliu-ad-carousel .carousel-indicators .indicator:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* 轮播导航箭头 */
.niliu-ad-carousel .carousel-prev,
.niliu-ad-carousel .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s, background 0.3s;
    z-index: 10;
}

.niliu-ad-carousel:hover .carousel-prev,
.niliu-ad-carousel:hover .carousel-next {
    opacity: 1;
}

.niliu-ad-carousel .carousel-prev:hover,
.niliu-ad-carousel .carousel-next:hover {
    background: rgba(0, 0, 0, 0.6);
}

.niliu-ad-carousel .carousel-prev {
    left: 10px;
}

.niliu-ad-carousel .carousel-next {
    right: 10px;
}

/* ============================================
   视频广告样式
   ============================================ */
.niliu-ad-video {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.niliu-ad-video video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.niliu-ad-video iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
}

/* 视频响应式 */
@media (max-width: 768px) {
    .niliu-ad-carousel .carousel-prev,
    .niliu-ad-carousel .carousel-next {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .niliu-ad-carousel .carousel-indicators .indicator {
        width: 6px;
        height: 6px;
    }
}

/* Widget内的广告 */
.niliu-ads-widget .niliu-ads-container {
    margin: 0;
}

.niliu-ads-widget-content {
    overflow: hidden;
}

/* 广告标识（可选） */
.niliu-ad-label {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 10px;
    border-radius: 2px;
    z-index: 10;
}

/* 响应式 */
@media (max-width: 768px) {
    .niliu-ads-container {
        margin: 8px 0;
    }

    .niliu-ad {
        margin-bottom: 8px;
    }

    .niliu-ad-text {
        padding: 8px;
        font-size: 13px;
    }
}

/* 懒加载占位 */
.niliu-ad-image img[loading="lazy"] {
    background: #f0f0f0;
    min-height: 50px;
}

/* ============================================
   自动挂载位置样式
   ============================================ */

/* 文章顶部广告 */
.niliu-ads-post-top {
    margin-bottom: 20px;
}

/* 文章中部广告 */
.niliu-ads-post-middle {
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* 文章底部广告 */
.niliu-ads-post-bottom {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* 评论区上方广告 */
.niliu-ads-comment-before {
    margin-bottom: 20px;
}

/* 列表页文章间广告 */
.niliu-ads-archive-between {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

/* 页脚上方广告 */
.niliu-ads-footer-before {
    padding: 20px 0;
    text-align: center;
    background: #f5f5f5;
}

/* 移动端底部悬浮广告 */
.niliu-ads-mobile-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 10px;
    text-align: center;
}

.niliu-ads-mobile-bottom .niliu-ads-close {
    position: absolute;
    top: -25px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    line-height: 22px;
    cursor: pointer;
}

.niliu-ads-mobile-bottom .niliu-ad-image img {
    max-height: 50px;
    width: auto;
}

/* 弹窗广告 */
.niliu-ads-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    justify-content: center;
    align-items: center;
}

.niliu-ads-popup-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.niliu-ads-popup-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    background: #333;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    font-size: 20px;
    line-height: 26px;
    cursor: pointer;
    text-align: center;
}

.niliu-ads-popup-close:hover {
    background: #000;
}

/* 广告标识 */
.niliu-ads-container::before {
    content: "广告";
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 10px;
    border-radius: 2px;
    z-index: 10;
    opacity: 0.6;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .niliu-ads-post-top,
    .niliu-ads-post-middle,
    .niliu-ads-post-bottom {
        margin: 15px -15px;
        padding: 10px 15px;
    }

    .niliu-ads-popup-content {
        margin: 20px;
        padding: 15px;
    }

    .niliu-ads-popup-close {
        top: -10px;
        right: -10px;
        width: 28px;
        height: 28px;
        font-size: 18px;
        line-height: 22px;
    }
}

/* ============================================
   模拟文章广告样式
   ============================================ */

/* 模拟文章广告特有样式 */
.niliu-ad-article {
    position: relative;
}

/* 模拟文章广告的推广标签 */
.niliu-ad-article .img-badge.jb-yellow {
    background: linear-gradient(135deg, #f5af19, #f12711);
}

/* 隐藏广告系统默认容器标识 */
.niliu-ad-article .niliu-ads-container::before {
    display: none;
}

/* ============================================
   文章内广告样式
   ============================================ */

.niliu-ads-in-content {
    margin: 25px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #f5af19;
}

.niliu-ads-in-content::before {
    content: "推荐";
    display: inline-block;
    padding: 2px 8px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #f5af19, #f12711);
    color: #fff;
    font-size: 11px;
    border-radius: 3px;
}

.niliu-ads-in-content .niliu-ad {
    margin: 0;
}

.niliu-ads-in-content .niliu-ad-image img {
    border-radius: 6px;
}

/* 文章内广告在暗色模式下 */
.dark-theme .niliu-ads-in-content {
    background: rgba(255, 255, 255, 0.05);
}

/* 文章内卡片广告 */
.niliu-ads-in-content .posts-item {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dark-theme .niliu-ads-in-content .posts-item {
    background: rgba(255, 255, 255, 0.08);
}

/* 响应式 */
@media (max-width: 768px) {
    .niliu-ads-in-content {
        margin: 15px -10px;
        padding: 15px;
        border-radius: 0;
    }
}
