/**
 * MacCMS 多站点管理器 - 广告容器样式
 * 
 * 这个样式文件提供了广告容器的基础样式
 * 主题开发者可以根据需要覆盖这些样式
 */

/* ========================================
   广告容器基础样式
   ======================================== */

.maccms-multisite-ad-wrapper {
    margin: 20px auto;
    text-align: center;
    clear: both;
    overflow: hidden;
}

.maccms-multisite-ad-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* ========================================
   不同位置的广告样式
   ======================================== */

/* 页面头部广告 */
.mam-ad-header_top {
    margin-bottom: 30px;
    padding: 15px 0;
    background: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}

.mam-ad-header_bottom {
    margin-bottom: 20px;
    padding: 10px 0;
}

/* 内容区广告 */
.mam-ad-content_top {
    margin: 30px 0 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.mam-ad-content_middle {
    margin: 40px 0;
    padding: 25px;
    background: linear-gradient(to bottom, #f8f8f8 0%, #fff 100%);
    border-top: 2px solid #e0e0e0;
    border-bottom: 2px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.mam-ad-content_bottom {
    margin: 30px 0;
    padding: 20px;
    background: #fafafa;
    border-radius: 4px;
}

/* 侧边栏广告 */
.mam-ad-sidebar_top,
.mam-ad-sidebar_middle,
.mam-ad-sidebar_bottom {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mam-ad-sidebar_top {
    margin-top: 0;
}

.mam-ad-sidebar_bottom {
    margin-bottom: 0;
}

/* 页脚广告 */
.mam-ad-footer_top {
    margin: 40px 0 20px;
    padding: 30px 0;
    border-top: 2px solid #e0e0e0;
}

.mam-ad-footer_bottom {
    margin: 20px 0;
    padding: 20px 0;
}

/* 列表项之间的广告 */
.mam-ad-between_posts {
    margin: 30px 0;
    padding: 20px;
    background: #f5f5f5;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
}

/* 弹窗广告 */
.mam-ad-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    max-width: 90%;
    max-height: 90%;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

/* 悬浮广告 */
.mam-ad-floating_left {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    max-width: 150px;
}

.mam-ad-floating_right {
    position: fixed;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    max-width: 150px;
}

/* ========================================
   电影详情页特殊样式
   ======================================== */

/* 播放器相关广告 */
.movie-detail .mam-ad-content_top {
    margin-top: 0;
}

.player-section + .mam-ad-content_middle {
    margin-top: 30px;
    margin-bottom: 30px;
}

/* 电影信息区广告 */
.movie-header .mam-ad-sidebar_top {
    margin-bottom: 20px;
}

.movie-header .mam-ad-sidebar_bottom {
    margin-top: 20px;
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 1200px) {
    .mam-ad-floating_left,
    .mam-ad-floating_right {
        max-width: 120px;
    }
}

@media (max-width: 992px) {
    .mam-ad-floating_left {
        left: 5px;
    }
    
    .mam-ad-floating_right {
        right: 5px;
    }
}

@media (max-width: 768px) {
    .maccms-multisite-ad-wrapper {
        margin: 15px 0;
    }
    
    .mam-ad-content_top,
    .mam-ad-content_middle,
    .mam-ad-content_bottom {
        padding: 15px;
        margin: 20px 0;
    }
    
    .mam-ad-sidebar_top,
    .mam-ad-sidebar_middle,
    .mam-ad-sidebar_bottom {
        padding: 12px;
    }
    
    /* 在移动端隐藏悬浮广告 */
    .mam-ad-floating_left,
    .mam-ad-floating_right {
        display: none;
    }
    
    /* 调整弹窗广告大小 */
    .mam-ad-popup {
        max-width: 95%;
        max-height: 95%;
        padding: 15px;
    }
}

@media (max-width: 576px) {
    .mam-ad-content_middle {
        padding: 12px;
        margin: 15px 0;
    }
    
    .mam-ad-between_posts {
        padding: 15px;
        margin: 20px 0;
    }
}

/* ========================================
   广告加载动画
   ======================================== */

.maccms-multisite-ad-wrapper.loading {
    position: relative;
    min-height: 100px;
    background: #f5f5f5;
}

.maccms-multisite-ad-wrapper.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: ad-spinner 0.8s linear infinite;
}

@keyframes ad-spinner {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========================================
   自定义包装器样式
   ======================================== */

/* 带标题的广告块 */
.ad-container {
    margin: 30px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.ad-container .ad-title {
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2271b1;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* 特色广告块 */
.featured-ad {
    position: relative;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    overflow: hidden;
}

.featured-ad::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

/* 分隔线样式 */
.ad-divider {
    margin: 30px 0;
    border: 0;
    height: 2px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
}

/* ========================================
   广告关闭按钮
   ======================================== */

.mam-ad-closeable {
    position: relative;
}

.mam-ad-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10;
}

.mam-ad-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

/* ========================================
   打印时隐藏广告
   ======================================== */

@media print {
    .maccms-multisite-ad-wrapper,
    .mam-ad-container,
    [class*="mam-ad-"] {
        display: none !important;
    }
}

/* ========================================
   辅助类
   ======================================== */

.ad-section {
    margin: 30px 0;
}

.ad-block {
    display: block;
    margin: 20px auto;
}

.ad-inline {
    display: inline-block;
    margin: 0 10px;
}

.ad-center {
    text-align: center;
}

.ad-left {
    text-align: left;
}

.ad-right {
    text-align: right;
}
