/* ==========================================================================
   VISTARA - ADSTERRA & MONETAG RESPONSIVE ADS STYLESHEET
   100% Mobile & Desktop Responsive Styles for All Ad Placements
   Zero Overlap • Zero Viewport Leak • Perfect Responsive Switching
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. UNIVERSAL AD CONTAINER CONTAINMENT & CENTERING
   -------------------------------------------------------------------------- */
/* Outer container wrapper for header ad */
.header-ad-outer-container {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto !important;
    padding: 0 14px !important;
    line-height: 0 !important;
    box-sizing: border-box !important;
}

.ad-placement-wrap,
.ad-slot-container,
.responsive-ad-container {
    display: flex !important;
    flex-direction: column !important; /* Strictly vertical stack, NEVER horizontal row */
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    margin: 6px auto !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    position: relative !important;
    box-sizing: border-box !important;
    clear: both !important;
}

/* Eliminate nested/double margins when an ad slot is inside a responsive container */
.responsive-ad-container > .ad-placement-wrap,
.responsive-ad-container > .ad-slot-container {
    margin: 0 auto !important;
    padding: 0 !important;
}

/* Ensure Adsterra iframes, images, videos, and objects never overflow screen */
.ad-placement-wrap iframe,
.ad-placement-wrap img,
.ad-placement-wrap video,
.ad-placement-wrap object,
.ad-slot-container iframe,
.ad-slot-container img,
.ad-slot-container video,
.ad-slot-container object,
.responsive-ad-container iframe,
.responsive-ad-container img,
.responsive-ad-container video,
.responsive-ad-container object {
    max-width: 100% !important;
    margin: 0 auto !important;
    display: block !important;
    border: none !important;
    box-sizing: border-box !important;
}

/* --------------------------------------------------------------------------
   2. DESKTOP VS MOBILE STRICT VISIBILITY (BULLETPROOF SPECIFICITY)
   -------------------------------------------------------------------------- */

/* Desktop Devices (> 768px): Show Desktop Banners, Completely Collapse Mobile Banners */
@media (min-width: 769px) {
    .ad-desktop-only,
    .ad-placement-wrap.ad-desktop-only,
    .responsive-ad-container .ad-desktop-only,
    div.ad-desktop-only {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .ad-mobile-only,
    .ad-placement-wrap.ad-mobile-only,
    .responsive-ad-container .ad-mobile-only,
    div.ad-mobile-only {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        overflow: hidden !important;
        pointer-events: none !important;
    }
}

/* Mobile Devices (<= 768px): Strictly Hide Desktop Banners, Display Mobile Banners */
@media (max-width: 768px) {
    .ad-desktop-only,
    .ad-placement-wrap.ad-desktop-only,
    .responsive-ad-container .ad-desktop-only,
    div.ad-desktop-only {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        overflow: hidden !important;
        pointer-events: none !important;
    }

    .ad-mobile-only,
    .ad-placement-wrap.ad-mobile-only,
    .responsive-ad-container .ad-mobile-only,
    div.ad-mobile-only {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Fluid Auto-Responsive Banners (When only 1 banner format exists) */
.ad-auto-responsive {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.ad-auto-responsive iframe {
    max-width: 100% !important;
}

/* Auto-collapse empty ad containers or cards (Zero blank space) */
.ad-placement-wrap:empty,
.responsive-ad-container:empty,
.feed-ad-card.ad-empty,
.feed-ad-card:empty,
.is-ad-empty,
.ad-slot-collapsed,
.responsive-ad-container.is-ad-empty,
.feed-ad-card.is-ad-empty {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden !important;
}

/* --------------------------------------------------------------------------
   3. AD SIZING & RESPONSIVE CONSTRAINTS
   -------------------------------------------------------------------------- */
.ad-slot-banner_728x90,
.ad-slot-monetag_banner_728x90 {
    max-width: 728px;
    width: 100%;
}
.ad-slot-banner_728x90 iframe,
.ad-slot-monetag_banner_728x90 iframe {
    height: 90px;
    width: 728px;
    max-width: 100%;
}

.ad-slot-banner_468x60,
.ad-slot-monetag_banner_468x60 {
    max-width: 468px;
    width: 100%;
}
.ad-slot-banner_468x60 iframe,
.ad-slot-monetag_banner_468x60 iframe {
    height: 60px !important;
    max-height: 60px !important;
    width: 468px !important;
    max-width: 100% !important;
}

.ad-slot-banner_320x50,
.ad-slot-monetag_banner_320x50 {
    max-width: 320px;
    width: 100%;
}
.ad-slot-banner_320x50 iframe,
.ad-slot-monetag_banner_320x50 iframe {
    height: 50px !important;
    max-height: 50px !important;
    width: 320px !important;
    max-width: 100% !important;
}

.ad-slot-banner_300x250,
.ad-slot-monetag_banner_300x250 {
    max-width: 300px;
    width: 100%;
}
.ad-slot-banner_300x250 iframe,
.ad-slot-monetag_banner_300x250 iframe {
    height: 250px !important;
    max-height: 250px !important;
    width: 300px !important;
    max-width: 100% !important;
}

.ad-slot-banner_160x600 {
    max-width: 160px;
    width: 100%;
}
.ad-slot-banner_160x600 iframe {
    height: 600px !important;
    max-height: 600px !important;
    width: 160px !important;
}

.ad-slot-banner_160x300 {
    max-width: 160px;
    width: 100%;
}
.ad-slot-banner_160x300 iframe {
    height: 300px !important;
    max-height: 300px !important;
    width: 160px !important;
}

.ad-slot-native_banner,
.ad-slot-monetag_native_banner {
    width: 100%;
    max-width: 100%;
}

/* --------------------------------------------------------------------------
   4. LOCATION-SPECIFIC PLACEMENT SPACING (TIGHT & SEAMLESS ZERO-GAP MARGINS)
   -------------------------------------------------------------------------- */

/* Header Top Banner (Index page above Hero Banner) */
.header-banner-wrap {
    margin: 6px auto !important;
    padding: 0 !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
}

/* Above Cinema Video Player (Watch Page) */
.ad-above-player {
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
}

/* Mid-Content Banner (Below Description, Above Comments) */
.ad-mid-content {
    margin: 12px auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

/* Native Comments Widget */
.ad-native-comments {
    margin: 18px auto 12px auto !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    overflow: hidden !important;
}

/* Homepage In-Feed Native & Responsive Ads */
.ad-native-homepage {
    margin: 14px auto !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    overflow: hidden !important;
}

/* Bottom Homepage Banner */
.ad-bottom-homepage {
    margin: 20px auto 28px auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

/* Watch Page Sidebar Ads */
.sidebar-ad-card {
    margin-bottom: 14px !important;
    display: flex !important;
    justify-content: center !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.sidebar-vertical-ads {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.sidebar-v-ad {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Reels Vertical Shorts Sponsored Ad Frame */
.reel-ad-frame {
    margin: 0 auto !important;
    display: flex !important;
    justify-content: center !important;
    max-width: 100% !important;
}

/* Single Community Post Page Ads */
.post-top-ad {
    margin: 6px auto 8px auto !important;
    padding: 0 !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    overflow: hidden !important;
}

.post-infeed-ad {
    margin: 14px auto !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    overflow: hidden !important;
}

.post-bottom-ad {
    margin: 18px auto 24px auto !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    overflow: hidden !important;
}

/* --------------------------------------------------------------------------
   5. RESPONSIVE BREAKPOINTS (MOBILE & TABLET SAFEGUARDS)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    /* Mobile Margins & Spacing */
    .header-banner-wrap {
        margin: 4px auto !important;
        padding: 0 !important;
    }

    .ad-placement-wrap,
    .ad-slot-container,
    .responsive-ad-container {
        margin: 4px auto !important;
        padding: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .responsive-ad-container > .ad-placement-wrap,
    .responsive-ad-container > .ad-slot-container {
        margin: 0 auto !important;
        padding: 0 !important;
    }

    .ad-above-player {
        margin: 0 0 6px 0 !important;
        padding: 0 !important;
    }

    .post-top-ad {
        margin: 4px auto 6px auto !important;
        padding: 0 !important;
    }

    .ad-mid-content {
        margin: 8px auto !important;
    }

    .ad-native-comments,
    .ad-native-homepage {
        margin: 10px auto !important;
    }

    /* On Mobile Phones: Hide vertical skyscraper 160x600/160x300 ads */
    .sidebar-vertical-ads {
        display: none !important;
    }

    /* Enforce strict mobile containment & anti-overflow */
    .ad-slot-banner_728x90,
    .ad-slot-banner_468x60,
    .ad-slot-monetag_banner_728x90,
    .ad-slot-monetag_banner_468x60 {
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .ad-placement-wrap iframe,
    .responsive-ad-container iframe {
        max-width: 100% !important;
        overflow: hidden !important;
    }

    /* Scale 728px banners on mobile if only desktop banner exists - Clamp Height with ZERO Gap */
    .ad-slot-banner_728x90.ad-auto-responsive,
    .ad-slot-monetag_banner_728x90.ad-auto-responsive {
        height: calc(90px * (min(100vw - 20px, 480px) / 728)) !important;
        overflow: hidden !important;
    }

    .ad-slot-banner_728x90.ad-auto-responsive iframe,
    .ad-slot-monetag_banner_728x90.ad-auto-responsive iframe {
        transform-origin: center top !important;
        transform: scale(calc(min(100vw - 20px, 480px) / 728)) !important;
        max-width: none !important;
        height: 90px !important;
    }
}
