/**
 * Advertisement Styles
 * Professional ad placement styling
 */

/* Ad Container Base Styles */
.ad-container {
    margin: 20px 0;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    text-align: center;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-container::before {
    content: 'Advertisement';
    display: block;
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    position: absolute;
    top: 2px;
}

/* Top Banner Ad - completely hidden by default */
#ad-top-banner {
    display: none !important;
}

/* Only show when ad successfully loads AND is filled (not unfilled) */
#ad-top-banner:has(ins.adsbygoogle[data-adsbygoogle-status="done"]:not([data-ad-status="unfilled"])) {
    display: block !important;
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    max-height: 100px;
    margin: 20px auto;
}

.ad-banner-top {
    max-width: 728px;
    width: 100%;
    height: 90px;
    margin: 0 auto;
    display: block;
}

/* Ensure AdSense ads have proper width */
#ad-top-banner ins.adsbygoogle {
    display: block !important;
    width: 728px !important;
    max-width: 100% !important;
    height: 90px !important;
    margin: 0 auto !important;
}

/* Sidebar Ads */
#ad-sidebar-top,
#ad-sidebar-mid {
    margin: 20px 0;
    min-height: 250px;
}

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

/* In-Feed Ads */
.in-feed-ad-container {
    margin: 30px 0;
    padding: 20px 10px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    position: relative;
}

.in-feed-ad-container::before {
    content: 'Sponsored';
    position: absolute;
    top: 5px;
    left: 10px;
    font-size: 9px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* In-Article Ads */
.in-article-ad-container {
    margin: 30px auto;
    padding: 20px;
    max-width: 100%;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    clear: both;
}

.in-article-ad-container::before {
    content: 'Advertisement';
    display: block;
    text-align: center;
    font-size: 10px;
    color: #999;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Bottom Banner */
#ad-bottom-banner {
    margin: 40px auto 20px;
    max-width: 1200px;
    min-height: 90px;
    text-align: center;
}

.ad-banner-bottom {
    max-width: 728px;
    height: 90px;
    margin: 0 auto;
}

/* Mobile Anchor Ad (Sticky Bottom) */
.mobile-anchor-ad {
    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: 5px;
}

/* Ad Blocker Message */
.adblock-message {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px;
    margin: 20px 0;
}

.adblock-notice {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.adblock-notice h3 {
    margin: 0 0 10px;
    font-size: 22px;
    color: #fff;
}

.adblock-notice p {
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.6;
}

.adblock-notice a {
    color: #ffd700;
    text-decoration: underline;
    font-weight: 600;
}

.adblock-notice a:hover {
    color: #fff;
}

/* Responsive Ads */
@media (max-width: 768px) {
    #ad-top-banner:has(ins.adsbygoogle[data-adsbygoogle-status="done"]:not([data-ad-status="unfilled"])) {
        display: block !important;
        width: 100%;
        max-width: 100%;
        min-height: 50px;
        max-height: 60px;
        margin: 10px auto;
    }

    #ad-top-banner ins.adsbygoogle {
        width: 320px !important;
        max-width: 100% !important;
        height: 50px !important;
    }

    .ad-banner-top,
    .ad-banner-bottom {
        max-width: 100%;
        height: 50px;
    }

    .ad-sidebar {
        width: 100%;
        margin: 15px 0;
    }

    #ad-sidebar-top,
    #ad-sidebar-mid {
        margin: 15px 0;
    }

    .in-article-ad-container,
    .in-feed-ad-container {
        margin: 20px 0;
        padding: 15px 10px;
    }

    .mobile-anchor-ad {
        padding: 3px;
    }
}

/* Ad Placeholder (before loaded) - hide to avoid "Loading ad..." when blocked */
.adsbygoogle:not([data-adsbygoogle-status]) {
    display: none;
}

/* Premium Ad Styles for High-Value Placements */
.premium-ad-slot {
    position: relative;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 30px;
    border-radius: 12px;
    margin: 40px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.premium-ad-slot::before {
    content: 'Featured Partner';
    position: absolute;
    top: 10px;
    left: 20px;
    color: #ffd700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

/* Sticky Sidebar Ad */
.sticky-sidebar-ad {
    position: sticky;
    top: 80px;
    margin-bottom: 20px;
}

/* Video Ad Overlay */
.video-ad-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.8);
    padding: 10px;
    z-index: 100;
}

/* Ad Performance Indicators (for testing) */
.ad-debug-info {
    position: absolute;
    top: -20px;
    right: 0;
    font-size: 10px;
    color: #999;
    background: #fff;
    padding: 2px 5px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
}

/* Hide ads on print */
@media print {
    [id^="ad-"],
    .adsbygoogle,
    .in-feed-ad-container,
    .in-article-ad-container,
    .mobile-anchor-ad,
    .adblock-message {
        display: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ad-container {
        background: #1a1a1a;
        border-color: #333;
    }

    .in-article-ad-container {
        background: #1a1a1a;
        border-color: #333;
    }

    .in-feed-ad-container {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    }
}

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

/* Animation for ad load */
@keyframes fadeInAd {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.adsbygoogle[data-adsbygoogle-status="done"] {
    animation: fadeInAd 0.5s ease-in-out;
}
