/*
Theme Name:     Traveler Childtheme
Description:    Traveler Child Theme
Theme URI:      https://travelerwp.com/
Author:         the ShineTheme
Author URI:     http://shinetheme.com
Version:        1.0
Template:       traveler
*/

#nav-book {display:none !important}

@media screen and (max-width: 767px) {
    .price-wrapper {
        display: none !important;
    }
	.btn-v2.btn-primary.btn-mpopup.btn-green {
    display: flex;
    align-items: center; /* Vertically center the content */
    justify-content: center; /* Horizontally center the content */
    width: 200px; /* Adjust the width as needed */
    height: 50px; /* Adjust the height as needed */
    text-align: center; /* Center the text horizontally */
    text-decoration: none; /* Remove underline */
    color: white; /* Text color */
    border: none; /* Remove border */
	margin-left: 22%;	
	}
}
.section-footer {display: none!important;}
.service-avatar {display: none!important;}
.st-banner-search-form.style_2 {
    width: 500px;
    margin-left: auto;
    margin-right: auto;
}
#dropdown-destination-hotel {width: 300px;}

@media (max-width: 767px) {
    .st-banner-search-form.style_2 {
        width: 350px !important;
        margin-left: auto;
        margin-right: auto;
    }
	.btn.btn-primary.btn-search {
		width: 50%!important;
		margin-left: auto;
        margin-right: auto;
		margin-top: 10px!important;
		margin-bottom: 10px!important;
		border-radius: 20px!important;
	}
	.elementor-element-bc16010 {height: 300px !important;}
	.elementor-element-6c3c642 {height: 300px !important;}
}
@media screen and (max-width: 991px) {
    .header__left .logo img {
        width: 250px!important;
        object-fit: cover;
    }
}

/* Matches any .banner that also has an st_* hash class */
.banner[class*="st_"]{
  background: url("https://modmixmap.travelerwp.com/wp-content/uploads/2022/04/banner-search-form.png")
              center/cover no-repeat !important;
}
/* Mobile first: full width */
.st-banner-search-form.style_2{
  width: 100%;
  max-width: 100%;
}

/* Desktop (Bootstrap lg and up: ≥992px) */
@media (min-width: 992px){
  .st-banner-search-form.style_2{
    width: 700px !important;
    max-width: 700px;
    margin-left: auto;   /* center it */
    margin-right: auto;
  }
}
add_filter('gettext', function($translated, $original, $domain) {

}, 20, 3);
add_filter('gettext', function($translated, $original, $domain) {

    // obuhvata
    if (stripos($original, 'obuhvata') !== false) {
        return 'U CIJENU UKLJUČENO';
    }

    // ne obuhvata
    if (stripos($original, 'ne obuhvata') !== false) {
        return 'U CIJENU NIJE UKLJUČENO';
    }

    return $translated;

}, 20, 3);
add_action('wp_footer', function() {
?>
add_action('wp_footer', function() {
?>
<script>
document.addEventListener("DOMContentLoaded", function() {

    document.querySelectorAll('*').forEach(function(el) {

        if (el.childNodes.length === 1 && el.innerText.trim() === 'CIJENA ARANŽMANA OBUHVATA') {
            el.innerText = 'U CIJENU UKLJUČENO';
        }

        if (el.childNodes.length === 1 && el.innerText.trim() === 'CIJENA ARANŽMANA NE OBUHVATA') {
            el.innerText = 'U CIJENU NIJE UKLJUČENO';
        }

    });

});
</script>
<?php
});
	add_action('wp_footer', function() {
    echo '<div style="position:fixed;bottom:0;left:0;background:red;color:white;z-index:9999;">TEST RADI</div>';
});
	add_action('wp_footer', function() {
?>
<script>
document.addEventListener("DOMContentLoaded", function() {
    // funkcija koja provjerava i zamjenjuje tekst
    function zamijeniTekst(el) {
        if (!el) return;

        if (el.textContent.trim() === 'CIJENA ARANŽMANA OBUHVATA') {
            el.textContent = 'U CIJENU UKLJUČENO';
        }

        if (el.textContent.trim() === 'CIJENA ARANŽMANA NE OBUHVATA') {
            el.textContent = 'U CIJENU NIJE UKLJUČENO';
        }
    }

    // Observer koji gleda cijeli body
    const observer = new MutationObserver(function(mutationsList) {
        for (let mutation of mutationsList) {
            if (mutation.type === 'childList') {
                mutation.addedNodes.forEach(function(node) {
                    if (node.nodeType === Node.ELEMENT_NODE) {
                        zamijeniTekst(node);
                        node.querySelectorAll('*').forEach(zamijeniTekst);
                    }
                });
            }
        }
    });

    observer.observe(document.body, { childList: true, subtree: true });

    // odmah probaj zamijeniti postojeće elemente (ako već postoje)
    document.querySelectorAll('li, div, span, strong').forEach(zamijeniTekst);
});
</script>
<?php
});