/**
 * AdSense Compliance Stylesheet
 * 
 * This stylesheet ensures proper ad placement and separation from interactive elements
 * in compliance with Google AdSense Publisher Policies.
 * 
 * Key Requirements:
 * - Ads must be clearly separated from buttons, navigation, and interactive elements
 * - Minimum 30px separation from clickable elements
 * - Clear visual distinction between ads and site content
 * - Responsive ad containers that work across devices
 */

/* ============================================
   AD UNIT ZONES
   ============================================ */

/**
 * Standard ad unit container
 * Use this class to wrap all AdSense ad units
 */
.ad-unit-zone {
    margin-top: 50px;
    margin-bottom: 50px;
    padding: 20px 0;
    text-align: center;
    position: relative;
    clear: both;
    min-height: 100px;
}

/**
 * Ensure minimum separation from interactive elements
 */
.ad-unit-zone::before,
.ad-unit-zone::after {
    content: '';
    display: block;
    height: 30px;
}

/**
 * Ad label for transparency
 * Required to clearly identify advertising content
 */
.ad-label {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    font-weight: 500;
}

/* ============================================
   AD PLACEMENT VARIATIONS
   ============================================ */

/**
 * Top of page ad placement
 * Place after header/navigation, before main content
 */
.ad-unit-top {
    margin-top: 30px;
    margin-bottom: 40px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/**
 * In-content ad placement
 * Use between content sections with clear separation
 */
.ad-unit-content {
    margin: 60px auto;
    padding: 30px 20px;
    max-width: 100%;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

/**
 * Sidebar ad placement
 * For sidebar or column-based layouts
 */
.ad-unit-sidebar {
    margin: 30px 0;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/**
 * Bottom of page ad placement
 * Place before footer, after main content
 */
.ad-unit-bottom {
    margin-top: 60px;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e9ecef;
}

/* ============================================
   SEPARATION FROM INTERACTIVE ELEMENTS
   ============================================ */

/**
 * Ensure ads are never placed within or adjacent to:
 * - Buttons and CTAs
 * - Navigation menus
 * - Form elements
 * - Pop-ups or modals
 * - Dropdown menus
 */

/* Minimum spacing from buttons */
.btn + .ad-unit-zone,
.ad-unit-zone + .btn,
a.btn + .ad-unit-zone,
.ad-unit-zone + a.btn {
    margin-top: 50px !important;
}

/* Minimum spacing from navigation */
nav + .ad-unit-zone,
.ad-unit-zone + nav,
.navbar + .ad-unit-zone,
.ad-unit-zone + .navbar {
    margin-top: 50px !important;
}

/* Minimum spacing from forms */
form + .ad-unit-zone,
.ad-unit-zone + form {
    margin-top: 50px !important;
}

/* Prevent ads in modal/overlay contexts */
.modal .ad-unit-zone,
.overlay .ad-unit-zone,
.popup .ad-unit-zone {
    display: none !important;
}

/* ============================================
   RESPONSIVE AD CONTAINERS
   ============================================ */

/**
 * Responsive ad wrapper
 * Ensures ads display properly across all device sizes
 */
.ad-responsive-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    margin: 0 auto;
}

/* Desktop ad sizes */
@media (min-width: 992px) {
    .ad-responsive-wrapper {
        max-width: 970px;
    }
    
    .ad-unit-zone {
        min-height: 250px;
    }
}

/* Tablet ad sizes */
@media (min-width: 768px) and (max-width: 991px) {
    .ad-responsive-wrapper {
        max-width: 728px;
    }
    
    .ad-unit-zone {
        min-height: 200px;
    }
}

/* Mobile ad sizes */
@media (max-width: 767px) {
    .ad-responsive-wrapper {
        max-width: 320px;
    }
    
    .ad-unit-zone {
        margin-top: 40px;
        margin-bottom: 40px;
        min-height: 150px;
    }
    
    .ad-unit-content {
        margin: 40px auto;
        padding: 20px 10px;
    }
}

/* ============================================
   VISUAL DISTINCTION
   ============================================ */

/**
 * Ensure ads are visually distinct from site content
 * while maintaining design consistency
 */

.ad-unit-zone {
    /* Subtle background to distinguish from content */
    background: linear-gradient(to bottom, 
        rgba(248, 249, 250, 0.3) 0%, 
        rgba(248, 249, 250, 0.5) 50%, 
        rgba(248, 249, 250, 0.3) 100%
    );
}

/**
 * Ad container border (optional, for additional clarity)
 */
.ad-unit-zone.bordered {
    border: 1px dashed #dee2e6;
    border-radius: 4px;
    padding: 25px;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/**
 * Ensure ads don't interfere with screen readers
 * and keyboard navigation
 */

.ad-unit-zone {
    /* Allow screen readers to skip ad content */
    role: complementary;
    aria-label: "Advertisement";
}

/* Ensure focus indicators are visible even near ads */
.ad-unit-zone:focus-within {
    outline: none;
}

/* ============================================
   CONTENT-RICH PAGE REQUIREMENTS
   ============================================ */

/**
 * Ensure sufficient content before first ad
 * Minimum 600 words or substantial content required
 */

.content-section {
    min-height: 400px;
    margin-bottom: 40px;
}

/* First ad should appear after meaningful content */
.content-section:first-of-type + .ad-unit-zone {
    margin-top: 60px;
}

/* ============================================
   DARK THEME COMPATIBILITY
   ============================================ */

/**
 * Ensure ad containers work with ArbitEngine's dark theme
 */

@media (prefers-color-scheme: dark) {
    .ad-unit-zone {
        background: linear-gradient(to bottom, 
            rgba(26, 26, 26, 0.3) 0%, 
            rgba(26, 26, 26, 0.5) 50%, 
            rgba(26, 26, 26, 0.3) 100%
        );
    }
    
    .ad-unit-content {
        background: #1a1a1a;
        border-color: #2d2d2d;
    }
    
    .ad-unit-sidebar {
        background: #1a1a1a;
        border-color: #2d2d2d;
    }
    
    .ad-label {
        color: #adb5bd;
    }
}

/* Dark theme class-based (if using manual toggle) */
body.dark-theme .ad-unit-zone {
    background: linear-gradient(to bottom, 
        rgba(26, 26, 26, 0.3) 0%, 
        rgba(26, 26, 26, 0.5) 50%, 
        rgba(26, 26, 26, 0.3) 100%
    );
}

body.dark-theme .ad-unit-content {
    background: #1a1a1a;
    border-color: #2d2d2d;
}

body.dark-theme .ad-label {
    color: #adb5bd;
}

/* ============================================
   PRINT STYLES
   ============================================ */

/**
 * Hide ads when printing
 */
@media print {
    .ad-unit-zone,
    .ad-unit-top,
    .ad-unit-content,
    .ad-unit-sidebar,
    .ad-unit-bottom {
        display: none !important;
    }
}

/* ============================================
   DEVELOPER NOTES
   ============================================ */

/**
 * IMPORTANT GUIDELINES FOR DEVELOPERS:
 * 
 * 1. NEVER place ad code within:
 *    - Button containers (<button>, <a class="btn">)
 *    - Navigation elements (<nav>, <ul class="navbar">)
 *    - Form elements (<form>, <input>)
 *    - Modal/overlay containers
 *    - Dropdown menus
 * 
 * 2. ALWAYS ensure:
 *    - Minimum 30px separation from interactive elements
 *    - Clear "Advertisement" label above ad units
 *    - Sufficient content (600+ words) before first ad
 *    - Ads are responsive and work on all devices
 * 
 * 3. TESTING:
 *    - Test ad placement on desktop, tablet, and mobile
 *    - Verify separation from all interactive elements
 *    - Check that ads don't interfere with navigation
 *    - Ensure ads are clearly distinguishable from content
 * 
 * 4. COMPLIANCE:
 *    - Review Google AdSense Program Policies regularly
 *    - Never encourage clicks on ads
 *    - Never place ads on error pages or empty pages
 *    - Ensure ads.txt file is properly configured
 */
