
<script>

function closeHsModal(){

    const modal = document.getElementById(
        'hs-profile-modal'
    );

    if(modal){
        modal.classList.remove('active');
    }

    document.body.classList.remove(
        'hs-modal-open'
    );

}

document.addEventListener('click', function(e){

    const btn = e.target.closest('.hs-open-profile');

    if(btn){

        e.preventDefault();

        const userId = btn.dataset.user;

        fetch(horeka_ajax.url, {

            method:'POST',

            headers:{
                'Content-Type':'application/x-www-form-urlencoded'
            },

            body:new URLSearchParams({
                action:'horeka_get_profile_modal',
                user_id:userId
            })

        })
        .then(res => res.text())
        .then(html => {

            const content = document.getElementById(
                'hs-profile-content'
            );

            const modal = document.getElementById(
                'hs-profile-modal'
            );

            if(!content || !modal){
                return;
            }

            content.innerHTML = html;

            modal.classList.add('active');

            document.body.classList.add(
                'hs-modal-open'
            );

        });

    }

    if(e.target.closest('.hs-profile-close')){
        closeHsModal();
    }

    if(
        e.target.classList.contains(
            'hs-profile-overlay'
        )
    ){
        closeHsModal();
    }

});

</script>

<!-- GLOBAL PROFILE MODAL -->

<div id="hs-profile-modal">

    <div class="hs-profile-overlay"></div>

    <div class="hs-profile-box">

        <span class="hs-profile-close">✕</span>

        <div id="hs-profile-content"></div>

    </div>

</div>

<style>

#hs-profile-modal{
    position:fixed;
    inset:0;
    z-index:99999;
    display:none;
}

#hs-profile-modal.active{
    display:flex;
    align-items:center;
    justify-content:center;
}

.hs-profile-overlay{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,0.6);
}

.hs-profile-box{
    position:relative;
    background:#fff;
    width:90%;
    max-width:600px;
    border-radius:14px;
    padding:30px;
    z-index:2;
    max-height:90vh;
    overflow:auto;
}

.hs-profile-close{
    position:absolute;
    top:12px;
    right:16px;
    cursor:pointer;
    font-size:22px;
}

body.hs-modal-open{
    overflow:hidden;
}

</style>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://horeka.se/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://horeka.se/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://horeka.se/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://horeka.se/wp-sitemap-posts-rc_shift-1.xml</loc></sitemap><sitemap><loc>https://horeka.se/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://horeka.se/wp-sitemap-taxonomies-post_tag-1.xml</loc></sitemap><sitemap><loc>https://horeka.se/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
