/*
 * Search 2.0 fallback.
 *
 * Este ficheiro fornece apenas estados funcionais do AJAX. O layout da grelha,
 * o número de cartões por linha, os cartões e a paginação pertencem ao
 * AdForest/tema-filho. Em particular, nunca deve sobrepor classes nativas como
 * .adt-search-ads-col-2/3/4/5.
 */
#adforest-ajax-results{position:relative;min-height:80px}
#adforest-ajax-results.adforest-ajax-loading{opacity:.58;pointer-events:none}
#adforest-ajax-results.adforest-ajax-loading:after{content:"";position:absolute;inset:0;background:rgba(255,255,255,.32);z-index:5}
.cvx-search-ajax-error{padding:12px 14px;margin-bottom:14px;border:1px solid #fecaca;background:#fef2f2;color:#991b1b;border-radius:9px}


/* ========================================================================
 * CVX / AdForest 2.3.0.17 — canonical mobile search-filter core
 * Functional rules live in the parent theme; the child theme may skin them.
 * ===================================================================== */
body.adforest-search-ui-core .adt-ads-filter-sidebar .range-slider{
    position:relative;
    min-height:38px;
}
body.adforest-search-ui-core .adt-ads-filter-sidebar .range-slider > .adt-ads-range-slider{
    position:absolute!important;
    width:1px!important;
    height:1px!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    opacity:0!important;
    pointer-events:none!important;
    clip:rect(0 0 0 0)!important;
    clip-path:inset(50%)!important;
}
/* Stable first paint: show a lightweight track until ionRangeSlider owns it. */
body.adforest-search-ui-core .adt-ads-filter-sidebar .range-slider:not(:has(.irs))::before{
    position:absolute;
    top:7px;
    right:4px;
    left:4px;
    height:26px;
    content:"";
    background:
        radial-gradient(circle at 10px 50%, #fff 0 7px, #0d5bc1 8px 10px, transparent 11px),
        radial-gradient(circle at calc(100% - 10px) 50%, #fff 0 7px, #0d5bc1 8px 10px, transparent 11px),
        linear-gradient(#0d5bc1,#0d5bc1) center/100% 6px no-repeat;
}
body.adforest-search-ui-core .adt-ads-filter-sidebar .range-slider .irs{
    position:relative;
    z-index:1;
}

@media (max-width:991.98px){
    body.adforest-search-ui-core.adforest-search-mobile-core.adforest-mobile-filters-open{
        overflow:hidden!important;
        overscroll-behavior:none;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core .adt-ads-filter-sidebar .mobile-filters.adforest-mobile-filter-panel{
        position:fixed!important;
        inset:0 auto 0 0!important;
        z-index:100003!important;
        display:block!important;
        width:min(92vw,420px)!important;
        max-width:420px!important;
        height:100dvh!important;
        margin:0!important;
        overflow-x:hidden!important;
        overflow-y:auto!important;
        background:#f5f7fb!important;
        -webkit-overflow-scrolling:touch;
        overscroll-behavior:contain;
        touch-action:pan-y;
        opacity:0!important;
        visibility:hidden!important;
        transform:translate3d(-104%,0,0)!important;
        transition:transform .22s ease,opacity .18s ease,visibility .18s ease!important;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core .adt-ads-filter-sidebar .mobile-filters.adforest-mobile-filter-panel.active{
        opacity:1!important;
        visibility:visible!important;
        transform:translate3d(0,0,0)!important;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core .mobile-filter-heading{
        position:sticky!important;
        top:0!important;
        z-index:8!important;
        display:flex!important;
        align-items:center!important;
        justify-content:space-between!important;
        min-height:66px!important;
        background:rgba(255,255,255,.98)!important;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core .cvx-filter-close-btn,
    body.adforest-search-ui-core.adforest-search-mobile-core .adforest-filter-close-btn{
        display:inline-flex!important;
        width:40px!important;
        height:40px!important;
        align-items:center!important;
        justify-content:center!important;
        border:0!important;
        border-radius:11px!important;
        cursor:pointer;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core .cvx-mobile-filter-overlay,
    body.adforest-search-ui-core.adforest-search-mobile-core .adforest-mobile-filter-overlay{
        position:fixed!important;
        inset:0!important;
        z-index:100002!important;
        display:block;
        width:100%!important;
        height:100%!important;
        padding:0!important;
        border:0!important;
        background:rgba(7,24,48,.52)!important;
        backdrop-filter:blur(2px);
    }
    body.adforest-search-ui-core.adforest-search-mobile-core .cvx-mobile-filter-overlay[hidden],
    body.adforest-search-ui-core.adforest-search-mobile-core .adforest-mobile-filter-overlay[hidden]{display:none!important}

    /* Select2 is appended to <body>; its stock z-index (~1051) puts the island
       list behind the 100003 mobile drawer. Lift only search-page portals. */
    body.adforest-search-ui-core.adforest-search-mobile-core .select2-container--open{
        z-index:100030!important;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core .select2-dropdown{
        z-index:100031!important;
    }

    /* Category and location drill-downs are secondary surfaces above the
       filter drawer, never behind it. */
    body.adforest-search-ui-core.adforest-search-mobile-core #cat_modal,
    body.adforest-search-ui-core.adforest-search-mobile-core #states_model{
        z-index:100020!important;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core .modal-backdrop{
        z-index:100010!important;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core #cat_modal .modal-dialog,
    body.adforest-search-ui-core.adforest-search-mobile-core #states_model .modal-dialog{
        position:absolute!important;
        inset:0 auto 0 0!important;
        width:min(92vw,420px)!important;
        max-width:420px!important;
        height:100dvh!important;
        min-height:100dvh!important;
        margin:0!important;
        transform:translate3d(-104%,0,0)!important;
        transition:transform .22s ease!important;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core #cat_modal.show .modal-dialog,
    body.adforest-search-ui-core.adforest-search-mobile-core #states_model.show .modal-dialog{
        transform:translate3d(0,0,0)!important;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core #cat_modal .modal-content,
    body.adforest-search-ui-core.adforest-search-mobile-core #states_model .modal-content{
        height:100dvh!important;
        max-height:100dvh!important;
        overflow:hidden!important;
        border-radius:0 18px 18px 0!important;
    }
    body.adforest-search-ui-core.adforest-search-mobile-core #cat_modal .modal-body,
    body.adforest-search-ui-core.adforest-search-mobile-core #states_model .modal-body{
        min-height:0!important;
        overflow-y:auto!important;
        -webkit-overflow-scrolling:touch;
        overscroll-behavior:contain;
        touch-action:pan-y;
    }
}


/* ========================================================================
 * CVX / AdForest 2.3.0.18 — taxonomy unification + structural mobile polish
 * No brand skin here: only layout, state visibility and safe-area behavior.
 * ===================================================================== */
body.adforest-search-2-0-18 .adforest-dynamic-fields-host{display:block;min-width:0}
body.adforest-search-2-0-18 .adforest-dynamic-fields-host.adforest-dynamic-fields-loading{min-height:44px;opacity:.6;pointer-events:none}

@media (max-width:991.98px){
    body.adforest-search-ui-core.adforest-search-2-0-18 .adt-ads-sort-box{
        height:auto!important;
        min-height:0!important;
        align-content:flex-start!important;
        justify-content:flex-start!important;
        gap:14px!important;
        padding:16px!important;
    }
    body.adforest-search-ui-core.adforest-search-2-0-18 .adt-ads-sort-box>h3{
        height:auto!important;
        min-height:0!important;
        margin:0!important;
    }
    body.adforest-search-ui-core.adforest-search-2-0-18 .adt-ads-sort-box .adt-sort-filters{
        position:static!important;
        min-height:0!important;
        margin:0!important;
        align-self:stretch!important;
    }
    body.adforest-search-2-0-18 .adt-ads-filter-content{
        min-height:0!important;
        padding-bottom:calc(118px + env(safe-area-inset-bottom,0px))!important;
    }
    body.adforest-search-2-0-18 .adt-ads-filter-sidebar .mobile-filters-btn{
        z-index:99980!important;
        bottom:calc(86px + env(safe-area-inset-bottom,0px))!important;
    }
    body.adforest-search-2-0-18 .cvx-inline-subcategories,
    body.adforest-search-2-0-18 .expand-collapse.adforest-new-filter{
        height:auto!important;
        min-height:0!important;
    }
    body.adforest-search-2-0-18 .cvx-inline-subcategories .city-select-city>li,
    body.adforest-search-2-0-18 .expand-collapse.adforest-new-filter .city-select-city>li{
        min-height:0!important;
    }
}
