/* ================================================================
   REAL PROPERTY GURU — AUTH HEADER + MOBILE FOOTER RECOVERY V28
   Scope: standalone /login and /register only, after V27.
   Fixes:
   1) Desktop utility topbar + main header overlap.
   2) Mobile auth pages reuse the existing global footer as compact accordion.
   Locked:
   - Header markup/contents unchanged.
   - Tablet/mobile header untouched.
   - Sticky mobile bottom navigation untouched.
   - Footer HTML not cloned or replaced.
   ================================================================ */

/* ---------------------------------------------------------------
   DESKTOP: stack existing floating header rows instead of top:0 overlap.
   --------------------------------------------------------------- */
@media (min-width:1101px){
    body.rpg-auth-v27-active.rpg-auth-v28-header-stack{
        padding-top:var(--rpg-auth-v28-stack-height,112px)!important;
    }

    body.rpg-auth-v27-active.rpg-auth-v28-header-stack .rpg-market-topbar{
        position:fixed!important;
        top:0!important;
        left:0!important;
        right:0!important;
        width:100%!important;
        z-index:10120!important;
        transform:none!important;
    }

    body.rpg-auth-v27-active.rpg-auth-v28-header-stack #header.rpg-market-header,
    body.rpg-auth-v27-active.rpg-auth-v28-header-stack header#header.rpg-market-header.fixed-header{
        position:fixed!important;
        top:var(--rpg-auth-v28-topbar-height,42px)!important;
        left:0!important;
        right:0!important;
        width:100%!important;
        z-index:10110!important;
        transform:none!important;
        margin:0!important;
    }

    body.rpg-auth-v27-active.rpg-auth-v28-header-stack #header.rpg-market-header .rpg-market-header__lower{
        margin-top:0!important;
        transform:none!important;
    }

    /* Keep the stacked header visually separated from page content. */
    body.rpg-auth-v27-active.rpg-auth-v28-header-stack #header.rpg-market-header{
        box-shadow:0 8px 22px rgba(3,55,40,.065)!important;
    }
}

/* ---------------------------------------------------------------
   MOBILE GLOBAL FOOTER — reuse existing .rpg-market-footer markup.
   This is the compact/accordion behavior used on mobile pages.
   --------------------------------------------------------------- */
@media (max-width:767px){
    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer{
        display:block!important;
        padding:0!important;
        margin:0!important;
        background:linear-gradient(145deg,#034b37,#00583f 58%,#07573f)!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer > .container{
        width:100%!important;
        max-width:none!important;
        padding:22px 14px calc(22px + env(safe-area-inset-bottom))!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__grid{
        display:block!important;
        width:100%!important;
    }

    /* Brand/contact stays visible at top but becomes compact. */
    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__brand{
        display:grid!important;
        grid-template-columns:56px minmax(0,1fr)!important;
        column-gap:12px!important;
        row-gap:8px!important;
        align-items:center!important;
        padding:0 0 16px!important;
        margin:0 0 4px!important;
        border-bottom:1px solid rgba(255,255,255,.12)!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__logo{
        width:56px!important;
        height:44px!important;
        display:flex!important;
        align-items:center!important;
        justify-content:center!important;
        padding:5px!important;
        border-radius:9px!important;
        background:#fff!important;
        overflow:hidden!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__logo img{
        display:block!important;
        width:100%!important;
        max-width:100%!important;
        height:auto!important;
        max-height:34px!important;
        object-fit:contain!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__brand > p{
        grid-column:2!important;
        grid-row:1!important;
        align-self:center!important;
        margin:0!important;
        color:rgba(255,255,255,.82)!important;
        font-size:12px!important;
        line-height:1.45!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__contact{
        grid-column:1 / -1!important;
        display:flex!important;
        flex-wrap:wrap!important;
        gap:7px 13px!important;
        margin:1px 0 0!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__contact a{
        display:inline-flex!important;
        align-items:center!important;
        gap:5px!important;
        margin:0!important;
        color:rgba(255,255,255,.82)!important;
        font-size:12px!important;
        line-height:1.3!important;
        text-decoration:none!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__contact svg{
        width:14px!important;
        height:14px!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__socials{
        grid-column:1 / -1!important;
        display:flex!important;
        gap:7px!important;
        margin-top:2px!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__socials a{
        width:32px!important;
        height:32px!important;
        display:grid!important;
        place-items:center!important;
        margin:0!important;
        border:1px solid rgba(255,255,255,.19)!important;
        border-radius:50%!important;
        background:rgba(255,255,255,.065)!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__socials svg{
        width:16px!important;
        height:16px!important;
    }

    /* Footer link groups become the existing global mobile accordion. */
    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__col{
        display:block!important;
        width:100%!important;
        margin:0!important;
        padding:0!important;
        border-bottom:1px solid rgba(255,255,255,.105)!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__col > h4{
        position:relative!important;
        display:flex!important;
        align-items:center!important;
        justify-content:space-between!important;
        width:100%!important;
        min-height:48px!important;
        margin:0!important;
        padding:0 34px 0 2px!important;
        color:#fff!important;
        font-size:13px!important;
        line-height:1.25!important;
        font-weight:800!important;
        cursor:pointer!important;
        user-select:none!important;
        -webkit-tap-highlight-color:transparent!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__col > h4::after{
        content:"+"!important;
        position:absolute!important;
        right:4px!important;
        top:50%!important;
        transform:translateY(-50%)!important;
        display:grid!important;
        place-items:center!important;
        width:24px!important;
        height:24px!important;
        border:1px solid rgba(255,255,255,.16)!important;
        border-radius:7px!important;
        color:rgba(255,255,255,.9)!important;
        font-size:17px!important;
        line-height:1!important;
        font-weight:500!important;
        transition:transform .16s ease,background-color .16s ease!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__col.is-open > h4::after{
        content:"−"!important;
        background:rgba(255,255,255,.08)!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__col > a{
        display:none!important;
        width:100%!important;
        margin:0!important;
        padding:0 2px!important;
        color:rgba(255,255,255,.74)!important;
        font-size:12px!important;
        line-height:1.45!important;
        text-decoration:none!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__col.is-open > a{
        display:block!important;
        padding-top:5px!important;
        padding-bottom:8px!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__col.is-open > a:last-child{
        padding-bottom:14px!important;
    }

    /* Newsletter remains visible as the final mobile footer action. */
    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__newsletter{
        display:block!important;
        width:100%!important;
        margin:16px 0 0!important;
        padding:0!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__newsletter h4{
        margin:0 0 5px!important;
        color:#fff!important;
        font-size:13px!important;
        line-height:1.25!important;
        font-weight:800!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__newsletter p{
        margin:0 0 10px!important;
        color:rgba(255,255,255,.72)!important;
        font-size:12px!important;
        line-height:1.45!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__newsletter-form{
        display:grid!important;
        grid-template-columns:minmax(0,1fr) 42px!important;
        width:100%!important;
        min-height:44px!important;
        margin:0!important;
        padding:0!important;
        overflow:hidden!important;
        border-radius:10px!important;
        background:#fff!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__newsletter-form input[type="email"]{
        min-width:0!important;
        width:100%!important;
        height:44px!important;
        margin:0!important;
        padding:0 12px!important;
        border:0!important;
        outline:0!important;
        background:#fff!important;
        color:#27352e!important;
        font-size:16px!important;
        box-shadow:none!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__newsletter-form button{
        width:42px!important;
        height:44px!important;
        display:grid!important;
        place-items:center!important;
        margin:0!important;
        padding:0!important;
        border:0!important;
        border-radius:0!important;
        background:#099d59!important;
        color:#fff!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__newsletter-form button svg{
        width:17px!important;
        height:17px!important;
    }

    body.rpg-auth-v27-active .rpg-market-footer.rpg-auth-v28-mobile-footer .rpg-market-footer__bottom{
        display:grid!important;
        gap:4px!important;
        margin:17px 0 0!important;
        padding:14px 0 0!important;
        border-top:1px solid rgba(255,255,255,.11)!important;
        color:rgba(255,255,255,.58)!important;
        font-size:12px!important;
        line-height:1.4!important;
    }

    /* IMPORTANT:
       No selector for rpgx-mobile-bottom / rpgp-mobile-bottom / bottom-nav exists here.
       The existing sticky bottom menu remains owned by the global mobile system. */
}
