/**
 * AdSense Fix - Previene problemi con Auto Ads
 *
 * SOLUZIONE DEFINITIVA:
 * - Il mobile menu drawer (position:fixed, translateX(100%)) era l'UNICO elemento
 *   che causava overflow orizzontale.
 * - overflow-x: hidden su html/body tagliava i banner AdSense Auto Ads.
 * - overflow: clip su body previene la scrollbar orizzontale SENZA tagliare gli ads,
 *   perché clip non crea un contesto di scorrimento (gli elementi fixed/sticky non
 *   vengono clippati come con hidden).
 *
 * @package TeenSerie
 */

/* ========================================
   FIX OVERFLOW ORIZZONTALE
   ======================================== */

/*
 * overflow: clip previene la scrollbar orizzontale senza creare scrolling context.
 * A differenza di overflow: hidden, non forza overflow-y: auto sugli elementi figli
 * e non taglia gli iframe/elementi fixed di AdSense Auto Ads.
 */
html {
    overflow-y: visible;
    width: 100%;
}

body {
    overflow-x: clip;
    overflow-y: visible;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* I container interni NON devono avere overflow-x: hidden
   perché forza overflow-y: auto creando scrollbar interne */
#page,
.site,
#content,
.site-content,
main {
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
}

/* ========================================
   FIX ADSENSE CONTAINERS
   ======================================== */

ins.adsbygoogle {
    display: block;
    overflow: visible;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

ins.adsbygoogle iframe {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box;
}

.teenserie-ad-container {
    overflow: visible;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.teenserie-ad-container iframe,
.teenserie-ad-container ins {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box;
}

/* ========================================
   FIX ANCHOR ADS (banner fisso in basso)
   ======================================== */

body > ins.adsbygoogle[data-anchor-status],
ins.adsbygoogle[data-ad-format="anchor"] {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    z-index: 999;
}

/* ========================================
   FIX VIGNETTE ADS (full-screen overlay)
   ======================================== */

body > div[data-google-query-id],
div[data-google-vignette] {
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* ========================================
   FIX AUTO ADS IN-PAGE
   ======================================== */

ins.adsbygoogle[data-ad-status="filled"] {
    display: block;
    max-width: 100%;
    width: 100%;
    overflow: visible;
}

/* ========================================
   FIX MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 767px) {
    ins.adsbygoogle {
        min-width: 0;
        width: 100% !important;
        overflow: visible;
    }

    .teenserie-ad-container {
        width: 100% !important;
        overflow: visible;
        padding: 0;
    }

    body > ins.adsbygoogle[data-anchor-status],
    ins.adsbygoogle[data-ad-format="anchor"] {
        max-height: 90px;
    }
}

/* ========================================
   FIX SCROLLBAR WEBKIT
   ======================================== */

body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

body.dark-mode::-webkit-scrollbar-track {
    background: #1e293b;
}

body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

body.dark-mode::-webkit-scrollbar-thumb {
    background: #475569;
}

body.dark-mode::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Nascondi scrollbar interne su #page/.site per evitare doppie scrollbar */
#page::-webkit-scrollbar,
.site::-webkit-scrollbar {
    display: none;
    width: 0;
}

#page,
.site {
    scrollbar-width: none;
}
