/* Hardcoded AdSense Styles - Nuclear Solution */

/* Remove all dynamic ad containers */
.ad-container, .ad-banner {
    display: none !important;
}

/* Base styles for all ad units */
.ad-sidebar-left,
.ad-sidebar-right,
.ad-main-content,
.ad-footer {
    text-align: center;
    position: relative;
    background-color: #f9f9f9;
    border: 1px solid #e8e8e8;
    transition: opacity 0.3s ease;
}

/* Add "Advertisement" label */
.ad-sidebar-left::before,
.ad-sidebar-right::before,
.ad-main-content::before,
.ad-footer::before {
    content: "Advertisement";
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #999;
    background: white;
    padding: 0 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0.5px;
    z-index: 1;
}

/* Sidebar Ads - Desktop Only */
.ad-sidebar-left,
.ad-sidebar-right {
    display: none;
    position: fixed;
    width: 180px !important; /* Slightly larger than ad to accommodate padding */
    height: 620px !important;
    padding: 10px;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    z-index: 100;
    overflow: hidden;
}

.ad-sidebar-left {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.ad-sidebar-right {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* Main Content Ad */
.ad-main-content {
    margin: 40px auto;
    padding: 15px;
    border-radius: 12px;
    max-width: 970px;
    min-height: 100px;
}

/* Footer Ad */
.ad-footer {
    margin: 60px auto 30px;
    padding: 15px;
    border-radius: 12px;
    max-width: 970px;
    min-height: 120px;
    background: #f5f5f5;
    border-color: #e0e0e0;
    width: 100%;
}

/* Ensure footer ad fills container */
.ad-footer ins.adsbygoogle {
    min-height: 90px !important;
    width: 100% !important;
    max-width: 728px !important;
    margin: 0 auto !important;
}

/* Desktop Only - Show sidebars, hide mobile ads */
@media (min-width: 1400px) {
    .desktop-only {
        display: block !important;
    }
    
    .ad-sidebar-left.desktop-only,
    .ad-sidebar-right.desktop-only {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .mobile-only {
        display: none !important;
    }
    
    /* Ensure main content doesn't overlap with sidebars */
    body {
        position: relative;
        min-height: 100vh;
    }
    
    .container {
        max-width: calc(100% - 400px);
        margin: 0 auto;
    }
    
    main {
        min-height: 650px; /* Ensure there's space for sidebars */
    }
}

/* Mobile/Tablet - Hide sidebars, show mobile ads */
@media (max-width: 1399px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    .ad-main-content {
        margin: 30px auto;
    }
}

/* Mobile specific improvements */
@media (max-width: 768px) {
    .ad-main-content,
    .ad-footer {
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure footer ad is centered */
    .ad-footer {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 15px 0;
    }
}

/* Ensure AdSense ins elements fill their containers */
.ad-sidebar-left ins.adsbygoogle,
.ad-sidebar-right ins.adsbygoogle,
.ad-main-content ins.adsbygoogle,
.ad-footer ins.adsbygoogle {
    background: transparent;
}

/* Loading state */
.ad-sidebar-left:empty,
.ad-sidebar-right:empty,
.ad-main-content:empty,
.ad-footer:empty {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ad-sidebar-left,
    .ad-sidebar-right,
    .ad-main-content,
    .ad-footer {
        border: 2px solid black;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ad-sidebar-left,
    .ad-sidebar-right,
    .ad-main-content,
    .ad-footer {
        background-color: #2a2a2a;
        border-color: #444;
    }
    
    .ad-sidebar-left::before,
    .ad-sidebar-right::before,
    .ad-main-content::before,
    .ad-footer::before {
        background: #1a1a1a;
        color: #888;
    }
}

/* Page-specific adjustments */
.quiz-container .ad-main-content:first-of-type {
    margin-top: 0;
    margin-bottom: 30px;
}

/* Ensure proper spacing */
section + .ad-main-content,
section + .ad-footer {
    margin-top: 50px;
}

.ad-main-content + section,
.ad-footer + section {
    margin-top: 50px;
}