/* Monetization Optimized Styles */
.monetization-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

/* Banner Ads */
.banner-ad {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    background: #f8f9fa;
    border-radius: 4px;
    overflow: hidden;
}

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

.banner-ad.medium {
    width: 468px;
    height: 60px;
}

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

/* In-Article Ads */
.in-article-ad {
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    text-align: center;
}

/* Video Ads */
.video-ad-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.video-ad-container iframe,
.video-ad-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Native Ads Grid */
.native-ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.native-ad-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.native-ad-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Floating Ads */
.floating-ad {
    position: fixed;
    z-index: 9998;
    transition: all 0.3s ease;
}

.floating-ad.corner {
    width: 250px;
    height: 250px;
}

.floating-ad.top-left {
    top: 20px;
    left: 20px;
}

.floating-ad.top-right {
    top: 20px;
    right: 20px;
}

.floating-ad.bottom-left {
    bottom: 20px;
    left: 20px;
}

.floating-ad.bottom-right {
    bottom: 20px;
    right: 20px;
}

/* Exit Intent Popup */
.exit-intent-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 999998;
    display: none;
    align-items: center;
    justify-content: center;
}

.exit-intent-popup.show {
    display: flex;
}

.exit-intent-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
}

.exit-intent-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: #ff5252;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Scroll Triggered Ads */
.scroll-ad {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s, transform 0.5s;
}

.scroll-ad.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Time-Based Ads */
.time-based-ad {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    padding: 20px;
    z-index: 9997;
    transition: bottom 0.5s ease;
}

.time-based-ad.show {
    bottom: 0;
}

/* Engagement Ads */
.engagement-ad {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    cursor: pointer;
    transition: transform 0.3s;
}

.engagement-ad:hover {
    transform: scale(1.02);
}

/* Ad Refresh Indicator */
.ad-refresh-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
}

.ad-refresh-indicator::after {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    border: 2px solid #4CAF50;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Ad Performance Metrics */
.ad-metrics {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10000;
    display: none;
}

.ad-metrics.debug {
    display: block;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .banner-ad.large {
        width: 100%;
        max-width: 320px;
        height: 50px;
    }

    .banner-ad.medium {
        width: 100%;
        max-width: 320px;
        height: 50px;
    }

    .floating-ad {
        display: none;
    }

    .native-ads-grid {
        grid-template-columns: 1fr;
    }

    .time-based-ad {
        width: 100%;
        left: 0;
        transform: none;
        border-radius: 8px 8px 0 0;
    }
}

/* High DPI Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ad-container {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Accessibility */
.ad-container:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .ad-container,
    .floating-ad,
    .sticky-ad,
    .exit-intent-popup,
    .time-based-ad {
        display: none !important;
    }
}