/* 广告管理插件 - 前端样式 */

/* 广告容器基础样式 */
.ad-container {
    display: inline-block;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.ad-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.ad-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

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

/* 加载状态 */
.ad-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

.ad-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式广告 */
.ad-responsive {
    max-width: 100%;
    height: auto;
}

.ad-responsive img {
    width: 100%;
    height: auto;
}

/* 广告尺寸预设 */
.ad-banner {
    width: 728px;
    height: 90px;
}

.ad-rectangle {
    width: 300px;
    height: 250px;
}

.ad-square {
    width: 250px;
    height: 250px;
}

.ad-skyscraper {
    width: 160px;
    height: 600px;
}

.ad-leaderboard {
    width: 728px;
    height: 90px;
}

.ad-mobile-banner {
    width: 320px;
    height: 50px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ad-banner,
    .ad-leaderboard {
        width: 100%;
        max-width: 320px;
        height: auto;
        min-height: 50px;
    }
    
    .ad-rectangle {
        width: 100%;
        max-width: 300px;
        height: auto;
        min-height: 200px;
    }
    
    .ad-skyscraper {
        width: 100%;
        max-width: 160px;
        height: auto;
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .ad-container {
        margin: 10px auto;
    }
    
    .ad-banner,
    .ad-leaderboard,
    .ad-rectangle,
    .ad-square {
        width: 100%;
        max-width: 280px;
        height: auto;
        min-height: 150px;
    }
    
    .ad-skyscraper {
        width: 100%;
        max-width: 280px;
        height: auto;
        min-height: 200px;
    }
}

/* 广告位置类 */
.ad-center {
    display: block;
    margin: 20px auto;
}

.ad-left {
    float: left;
    margin: 0 20px 20px 0;
}

.ad-right {
    float: right;
    margin: 0 0 20px 20px;
}

.ad-inline {
    display: inline-block;
    vertical-align: top;
    margin: 0 10px;
}

/* 清除浮动 */
.ad-clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* 广告标识 */
.ad-container::before {
    content: "广告";
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 2px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ad-container:hover::before {
    opacity: 1;
}

/* 无广告时的占位符 */
.ad-placeholder {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
    text-align: center;
    min-height: 100px;
}

.ad-placeholder::before {
    content: "暂无广告";
}

/* 广告动画效果 */
.ad-fade-in {
    animation: adFadeIn 0.5s ease-in;
}

@keyframes adFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ad-slide-in {
    animation: adSlideIn 0.5s ease-out;
}

@keyframes adSlideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* 广告边框样式 */
.ad-border-none {
    border: none;
    box-shadow: none;
}

.ad-border-thin {
    border: 1px solid #dee2e6;
}

.ad-border-thick {
    border: 3px solid #0073aa;
}

.ad-border-dashed {
    border: 2px dashed #6c757d;
}

/* 圆角样式 */
.ad-rounded {
    border-radius: 8px;
}

.ad-rounded-lg {
    border-radius: 12px;
}

.ad-circle {
    border-radius: 50%;
}

/* 阴影样式 */
.ad-shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ad-shadow-md {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ad-shadow-lg {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.ad-shadow-none {
    box-shadow: none;
}

/* 特殊效果 */
.ad-grayscale {
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.ad-grayscale:hover {
    filter: grayscale(0%);
}

.ad-blur {
    filter: blur(2px);
    transition: filter 0.3s ease;
}

.ad-blur:hover {
    filter: blur(0);
}

/* 文字覆盖层 */
.ad-overlay {
    position: relative;
}

.ad-overlay::after {
    content: attr(data-overlay-text);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
    padding: 20px 15px 15px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ad-overlay:hover::after {
    opacity: 1;
}

/* 打印时隐藏广告 */
@media print {
    .ad-container {
        display: none !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .ad-container {
        border: 2px solid;
        box-shadow: none;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .ad-container,
    .ad-container img,
    .ad-container::before,
    .ad-container::after {
        transition: none;
        animation: none;
    }
    
    .ad-container:hover {
        transform: none;
    }
    
    .ad-container:hover img {
        transform: none;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .ad-container {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .ad-placeholder {
        background: #2d3748;
        border-color: #4a5568;
        color: #a0aec0;
    }
}