/**
* Theme Name: Ignavo Child
* Description: This is a child theme of Ignavo, generated by Merlin WP.
* Author: <a href="http://themeforest.net/user/KlbTheme">KlbTheme (Sinan ISIK)</a>
* Template: ignavo
* Version: 1.0.3
*/




/* --- Scoped header rating styles (won't clash with theme) --- */
.trs-header-rating{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-weight:600;
  line-height:1;
}

.trs-stars{
  position:relative;
  display:inline-flex;
  gap:2px;
  /* lock the star bar footprint so overlays can't blow up */
  width:88px;            /* 5 * 16px + 4 * 2px gap = 88 */
  height:16px;
}

.trs-star{
  width:16px !important;
  height:16px !important;
  display:block;
  flex:0 0 16px;
}

.trs-stars--base{ color:#c9c9c9; }
.trs-stars--base .trs-star path{ fill:currentColor; }

.trs-stars--fill{
  position:absolute;
  left:0; top:0;
  height:16px;
  overflow:hidden;
  color:#f5c518;         /* gold */
  pointer-events:none;
}
.trs-stars--fill .trs-star path{ fill:currentColor; }

.trs-rating-text{ white-space:nowrap; }

/* guard against global svg rules */
.trs-header-rating svg{ max-width:none !important; }




/* Remove ALL native select arrows across browsers */
select {
  -webkit-appearance: none !important;  /* Safari/Chrome */
  -moz-appearance: none !important;     /* Firefox */
  appearance: none !important;          /* Standard */
  background-image: none !important;    /* kill theme bg icons */
  background: #fff;                     /* or match your field bg */
  padding-right: 2.2em;                 /* space for custom arrow */
}

/* Hide legacy IE arrow */
select::-ms-expand { display: none !important; }

/* Container must be positioned */
select,
.elementor-field-type-select,
.elementor-select-wrapper {
  position: relative;
}

/* Add one universal custom arrow */
select:after,
.elementor-select-wrapper:after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #111;   /* arrow colour */
  border-bottom: 2px solid #111;
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;           /* keep clicks working */
}

/* Kill any theme-injected arrow elements */
.e-select__arrow,
.ignavo-select-arrow,
.elementor-field-type-select i[class*="icon"],
.elementor-field-type-select svg[class*="arrow"] {
  display: none !important;
}



/* Mobile Bottom Bar (child theme, independent of Ignavo) */
#trs-mobile-bottom-bar{
  position:fixed; left:0; right:0; bottom:0;
  display:none; /* JS toggles ≤768px */
  justify-content:space-around; align-items:center; gap:8px;
  padding:10px 12px; background:#fff;
  border-top:1px solid rgba(0,0,0,.08);
  z-index:10050;
}
#trs-mobile-bottom-bar .trs-mbb__list{ display:flex; gap:16px; margin:0; padding:0; list-style:none; }
#trs-mobile-bottom-bar .trs-mbb__list > li > a{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius:10px; text-decoration:none;
  color:#0f172a; font-weight:600; line-height:1;
}
#trs-mobile-bottom-bar .trs-mbb__list > li > a:hover{ background:rgba(15,23,42,.06); }
@media (max-width:768px){ body{ padding-bottom:64px; } }
.scroll-top,[class*="go-top"],[class*="scrolltop"]{ bottom:88px !important; right:16px !important; z-index:10060 !important; }





/* ===== Floating pill with icons + first-word labels ===== */
#trs-mobile-bottom-bar{
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  z-index: 10050;

  display: none;
  width: 86%;
  max-width: 420px;
  background: rgba(255, 255, 255, 1);
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  padding: 6px 10px;

  -webkit-backdrop-filter: saturate(160%) blur(6px);
  backdrop-filter: saturate(160%) blur(6px);

  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
#trs-mobile-bottom-bar.is-visible{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

#trs-mobile-bottom-bar .trs-mbb__list{
  display:flex; align-items:center; justify-content:space-between;
  gap: 8px; margin:0; padding:0; list-style:none; width:100%;
}
#trs-mobile-bottom-bar .trs-mbb__list > li{ flex:1 1 0; text-align:center; }

#trs-mobile-bottom-bar .trs-mbb__list > li > a{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  color:#0f172a;
  font-size:11px;
  font-weight:600;
  line-height:1.2;
  gap:3px;
}
#trs-mobile-bottom-bar .trs-mbb__img{
  width:22px; height:22px;
  object-fit:contain; display:block;
}
#trs-mobile-bottom-bar .trs-mbb__list > li > a:hover{ transform:translateY(-1px); }
#trs-mobile-bottom-bar .current-menu-item > a,
#trs-mobile-bottom-bar .trs-mbb__list > li > a:active{
  background: rgba(0,0,0,.08);
  border-radius:12px;
  padding:4px;
}





/* ===== Hide the theme's built-in mini mobile menu ===== */
.klb-mobile-bottom,
.site-mobile-navigation,
.klb-mobile-bottom.site-mobile-navigation,
.klb-mobile-bottom .site-mobile-navigation {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}




/* --- Mobile: keep hamburger left, center logo perfectly --- */
@media (max-width: 767px) {

  /* Adjust this if your hamburger is wider/narrower */
  :root { --burger-gap: 56px; }  /* try 48–64px if needed */

  /* 1) Equalise header padding so centre = screen centre */
  body .elementor-location-header .elementor-section.elementor-section-boxed > .elementor-container,
  body .elementor-location-header .elementor-section > .elementor-container {
    padding-left: var(--burger-gap) !important;
    padding-right: var(--burger-gap) !important;
    position: relative; /* context for the toggle */
    min-height: 64px;
  }

  /* 2) Pin the hamburger to the left */
  .elementor-location-header .elementor-menu-toggle {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
  }

  /* 3) Centre the logo */
  .elementor-location-header .elementor-widget-image {
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
  }
  .elementor-location-header .elementor-widget-image img {
    display: block;
    margin: 0 auto;
    height: 36px;   /* optional: adjust */
    width: auto;
  }
}




<?php
/**
 * Force selected page template (or ACF-specified template) even if the theme overrides it.
 * Paste in functions.php (preferably in a child theme).
 */

add_filter('template_include', function ($template) {
    if (!is_page()) {
        return $template;
    }

    $page_id = get_queried_object_id();

    // 1) Respect the template chosen in Page Attributes (wp-admin)
    $slug = get_page_template_slug($page_id); // e.g. 'templates/page-custom.php' or 'page-custom.php'
    if ($slug && $slug !== 'default') {
        $located = locate_template($slug);
        if ($located) {
            return $located; // Runs very late (see priority below) to beat the theme's override
        }
    }

    // 2) Optionally allow an ACF field to force a template
    //    Create a text field named 'template_file' (or 'page_template') with value like:
    //    'templates/page-custom.php' or 'page-custom.php'
    if (function_exists('get_field')) {
        $acf_template = get_field('template_file', $page_id);
        if (!$acf_template) {
            $acf_template = get_field('page_template', $page_id);
        }

        if ($acf_template) {
            $acf_template = ltrim($acf_template, '/');

            // Try common locations
            $candidates = array(
                $acf_template,
                'templates/' . $acf_template,
            );

            foreach ($candidates as $cand) {
                $located = locate_template($cand);
                if ($located) {
                    return $located;
                }
            }
        }
    }

    // 3) Fallback to whatever WordPress/the theme chose
    return $template;
}, 9999); // High priority so this wins over theme filters