/* =========================================================
   CashInWall AdsKeeper Balanced + Visible - FINAL v9
   Put this at the END of:
   public_html/admin/themes/default/assets/css/ciw-home-optimized.css

   Goal:
   - PC: AdsKeeper visible and balanced inside page width
   - Phone forced-PC page: do not break the scaled desktop layout
   - Remove old 430px / 100vw overrides before this block if possible
   ========================================================= */

/* Always keep the AdsKeeper section renderable, even while waiting for ads. */
body #ciwAdskeeperSection.ciw-adskeeper-section,
body section#ciwAdskeeperSection.ciw-adskeeper-section,
body #ciwAdskeeperSection.ciw-adskeeper-section.ciw-adskeeper-empty,
body #ciwAdskeeperSection.ciw-adskeeper-section.ciw-adskeeper-loaded {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;

    width: 100% !important;
    max-width: 1140px !important;
    min-width: 0 !important;

    margin: 18px auto 28px auto !important;
    padding: 0 15px !important;

    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    clear: both !important;
    box-sizing: border-box !important;
}

body #ciwAdskeeperWidget,
body #ciwAdskeeperWidget[data-type="_mgwidget"],
body #ciwAdskeeperSection #ciwAdskeeperWidget,
body #ciwAdskeeperSection [data-type="_mgwidget"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;

    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 1px !important;

    margin: 0 auto !important;
    padding: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

body #ciwAdskeeperWidget > *,
body #ciwAdskeeperWidget iframe,
body #ciwAdskeeperWidget ins,
body #ciwAdskeeperWidget table,
body #ciwAdskeeperWidget div,
body #ciwAdskeeperWidget a,
body #ciwAdskeeperWidget img,
body #ciwAdskeeperWidget [class*="mg"],
body #ciwAdskeeperWidget [id*="MarketGid"],
body #ciwAdskeeperSection .mgbox,
body #ciwAdskeeperSection .mgbox *,
body #ciwAdskeeperSection [class*="mg"],
body #ciwAdskeeperSection [id*="MarketGid"] {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

body #ciwAdskeeperWidget iframe,
body #ciwAdskeeperWidget ins,
body #ciwAdskeeperWidget table,
body #ciwAdskeeperWidget div,
body #ciwAdskeeperSection .mgbox,
body #ciwAdskeeperSection [class*="mg"] {
    width: 100% !important;
}

body #ciwAdskeeperWidget img {
    max-width: 100% !important;
    height: auto !important;
}

/* PC/laptop: keep ads wide but not detached from the layout. */
@media (min-width: 992px) {
    body #ciwAdskeeperSection.ciw-adskeeper-section,
    body section#ciwAdskeeperSection.ciw-adskeeper-section,
    body #ciwAdskeeperSection.ciw-adskeeper-section.ciw-adskeeper-empty,
    body #ciwAdskeeperSection.ciw-adskeeper-section.ciw-adskeeper-loaded {
        width: 100% !important;
        max-width: 1140px !important;
        min-width: 0 !important;
        margin-top: 18px !important;
        margin-bottom: 30px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        overflow: visible !important;
    }
}

/* Forced-PC-on-phone pages use a 1280px canvas. Keep the slot aligned with that canvas. */
@media (max-width: 991px) {
    body #ciwAdskeeperSection.ciw-adskeeper-section,
    body section#ciwAdskeeperSection.ciw-adskeeper-section,
    body #ciwAdskeeperSection.ciw-adskeeper-section.ciw-adskeeper-empty,
    body #ciwAdskeeperSection.ciw-adskeeper-section.ciw-adskeeper-loaded {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 14px auto 20px auto !important;
        padding: 0 10px !important;
        overflow: visible !important;
        left: auto !important;
        transform: none !important;
    }
}
