/* Multilingual LP header styles (ported from legacy theme, scoped to this template). */

body.page-template-template-multilingual-header,
body.page-template-template-multilingual-header-php {
  padding-top: 0 !important;
  --hb-admin-bar-offset: 0px;
}

body.page-template-template-multilingual-header.admin-bar,
body.page-template-template-multilingual-header-php.admin-bar {
  --hb-admin-bar-offset: var(--wp-admin-bar-height, 32px);
}

/* WP switches admin bar height at 782px. */
@media screen and (max-width: 782px) {
  body.page-template-template-multilingual-header.admin-bar,
  body.page-template-template-multilingual-header-php.admin-bar {
    --hb-admin-bar-offset: var(--wp-admin-bar-height-mobile, 46px);
  }
}

body.page-template-template-multilingual-header #wpadminbar,
body.page-template-template-multilingual-header-php #wpadminbar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
}

/* Minimal bootstrap-like utilities used by header markup (scoped). */
body.page-template-template-multilingual-header .container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

body.page-template-template-multilingual-header .row {
  display: flex;
  flex-wrap: wrap;
}

body.page-template-template-multilingual-header .col-12 {
  flex: 0 0 100%;
  max-width: 100%;
}

body.page-template-template-multilingual-header .d-flex { display: flex !important; }
body.page-template-template-multilingual-header .d-block { display: block !important; }
body.page-template-template-multilingual-header .d-none { display: none !important; }
body.page-template-template-multilingual-header .position-relative { position: relative !important; }

body.page-template-template-multilingual-header .align-items-start { align-items: flex-start !important; }
body.page-template-template-multilingual-header .align-items-center { align-items: center !important; }
body.page-template-template-multilingual-header .justify-content-between { justify-content: space-between !important; }
body.page-template-template-multilingual-header .justify-content-start { justify-content: flex-start !important; }
body.page-template-template-multilingual-header .justify-content-end { justify-content: flex-end !important; }

body.page-template-template-multilingual-header .text-center { text-align: center !important; }

body.page-template-template-multilingual-header .gap-2 { gap: 0.5rem !important; }
body.page-template-template-multilingual-header .ms-2 { margin-left: 0.5rem !important; }

@media (min-width: 992px) {
  body.page-template-template-multilingual-header .d-lg-flex { display: flex !important; }
  body.page-template-template-multilingual-header .d-lg-none { display: none !important; }
  body.page-template-template-multilingual-header .text-lg-start { text-align: left !important; }
}

@media (min-width: 576px) {
  body.page-template-template-multilingual-header .gap-sm-4 { gap: 1.5rem !important; }
}

@media (min-width: 1400px) {
  body.page-template-template-multilingual-header .gap-xxl-18 { gap: 4.5rem !important; }
}

/* Header Landing Page */
.hb-header-lp {
  top: 0;
  left: 0;
  width: 100%;
  z-index: 90;
  position: relative;
  height: 100px;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  background-color: #C60C30;
}

.hb-header-lp .container,
.hb-header-lp .row,
.hb-header-lp .col-12,
.hb-header-lp .hb-header-right {
  height: 100%;
}

/* When admin bar is present, keep header at the top but push its CONTENT below the bar. */
body.page-template-template-multilingual-header.admin-bar .hb-header-lp,
body.page-template-template-multilingual-header-php.admin-bar .hb-header-lp {
  box-sizing: border-box;
  padding-top: var(--hb-admin-bar-offset);
  height: calc(100px + var(--hb-admin-bar-offset));
}

.hb-header-lp.fixed {
  position: fixed;
  background-color: #C60C30;
  top: 0;
}

.hb-header-lp .menu-mobile-btn {
  padding: 8px 12px !important;
  text-decoration: none;
}

.hb-header-lp .menu-mobile-btn .bar {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  margin: 4px 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.hb-header-lp .menu-mobile-btn.open .bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.hb-header-lp .menu-mobile-btn.open .bar:nth-child(2) {
  opacity: 0;
}

.hb-header-lp .menu-mobile-btn.open .bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.hb-header-lp .hb-header-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hb-header-lp .hb-header-menu ul li {
  margin-right: 0;
  padding: 5px 0.75rem;
}

.hb-header-lp .hb-header-menu ul li a {
  color: inherit;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 400;
}

.hb-header-lp .hb-header-menu .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  width: 100%;
  background: #c60c30;
  padding-bottom: 5px;
  text-align: center;
}

.hb-header-lp .menu-item-has-children {
  position: relative;
}

.hb-header-lp .menu-item-has-children:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Keep CTA button square + simple (override theme/global .btn styles). */
body.page-template-template-multilingual-header .hb-header-lp .btn.btn-gray {
  appearance: none !important;
  -webkit-appearance: none !important;
  background-color: #fff !important;
  color: #C60C30 !important;
  border: 1px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 12px 18px !important;
  margin-right: 30px;
  white-space: nowrap;
  line-height: 1.1 !important;
  text-transform: none !important;
  letter-spacing: normal !important;

  overflow: visible !important;
  transition: none !important;
  cursor: pointer;
}

body.page-template-template-multilingual-header .hb-header-lp .btn.btn-gray:hover,
body.page-template-template-multilingual-header .hb-header-lp .btn.btn-gray:focus {
  background-color: #fff !important;
  color: #C60C30 !important;
  border-color: transparent !important;
}

.hb-custom-language-switcher-lp {
  width: 100%;
  z-index: 999999;
  border-radius: 100px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.hb-custom-language-switcher-lp .language-selector .wpml-ls-sub-menu {
  border: none;
  background-color: #fff;
  padding-top: 16px;
  margin-top: -16px;
  z-index: -1;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.hb-custom-language-switcher-lp .wpml-ls-statics-shortcode_actions {
  background-color: transparent;
}

.hb-custom-language-switcher-lp .wpml-ls-legacy-dropdown-click {
  width: auto;
  min-width: 150px;
}

.hb-custom-language-switcher-lp .wpml-ls-legacy-dropdown-click .wpml-ls-flag {
  border-radius: 50%;
  width: 20px;
  height: 20px;
}

.hb-custom-language-switcher-lp .wpml-ls-legacy-dropdown-click .wpml-ls-flag + span {
  margin-left: 0.6em;
}

.hb-custom-language-switcher-lp .wpml-ls-legacy-dropdown-click a.wpml-ls-item-toggle:after {
  content: unset;
}

.hb-custom-language-switcher-lp .language-selector .wpml-ls-item a {
  border: none;
  font-size: 10px;
  font-weight: 300;
  color: #2C2C2C !important;
  background-color: #fff !important;
  border-radius: 100px;
  padding: 4px 10px 4px 4px !important;
}

.hb-custom-language-switcher-lp .language-selector .wpml-ls-item a:focus,
.hb-custom-language-switcher-lp .language-selector .wpml-ls-item a:visited,
.hb-custom-language-switcher-lp .language-selector .wpml-ls-item a:hover {
  color: #2c2c2c;
}

/* WPML Language Selector arrow */
.hb-header-lp .js-wpml-ls-item-toggle {
  position: relative;
  padding-right: 1.75rem !important;
  cursor: pointer;
  color: inherit;
}

.hb-header-lp .js-wpml-ls-item-toggle:before {
  content: '';
  position: absolute;
  top: 50%;
  right: 0.65rem;
  width: 0.35rem;
  height: 0.35rem;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  transition: transform 0.25s ease;
  pointer-events: none;
}

.hb-header-lp .js-wpml-ls-item-toggle.active:before,
.hb-header-lp .js-wpml-ls-item-toggle[aria-expanded='true']:before {
  transform: translateY(-40%) rotate(-135deg);
}

@media (hover: hover) {
  .hb-header-lp .hb-header-menu ul li a:hover:after,
  .hb-header-lp .hb-header-language-switcher ul li a:hover:after,
  .hb-header-lp .hb-header-menu ul li a.btn-gray:hover:after {
    content: none;
  }

  .hb-header-lp .js-wpml-ls-item-toggle {
    padding-right: 2.1rem !important;
  }

  .hb-header-lp .js-wpml-ls-item-toggle:before {
    right: 0.9rem;
  }
}

@media (max-width: 1200px) {
  .hb-header-lp .btn.btn-gray {
    margin-right: 20px;
  }

  .hb-header-lp .hb-header-menu {
    margin-left: 0;
  }
}

@media (max-width: 992px) {
  .hb-header-lp {
    height: 60px;
    min-height: 60px;
    padding-bottom: 0;
    overflow-x: hidden;
  }

  body.page-template-template-multilingual-header.admin-bar .hb-header-lp,
  body.page-template-template-multilingual-header-php.admin-bar .hb-header-lp {
    /* Push header content below admin bar while keeping a single row. */
    padding-top: var(--hb-admin-bar-offset);
    height: calc(60px + var(--hb-admin-bar-offset));
    min-height: calc(60px + var(--hb-admin-bar-offset));
  }

  /* Mobile header layout: single row (logo left; language + hamburger right). */
  body.page-template-template-multilingual-header .hb-header-right,
  body.page-template-template-multilingual-header-php .hb-header-right {
    flex-direction: row;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px;
    width: 100%;
  }

  body.page-template-template-multilingual-header .hb-header-right > .d-flex.gap-2,
  body.page-template-template-multilingual-header-php .hb-header-right > .d-flex.gap-2 {
    width: auto;
    flex: 1 1 auto;
    justify-content: flex-start;
    padding-left: 8px;
    padding-right: 8px;
    box-sizing: border-box;
  }

  body.page-template-template-multilingual-header .hb-header-logo,
  body.page-template-template-multilingual-header-php .hb-header-logo {
    display: flex;
    justify-content: flex-start;
    width: auto;
  }

  /* Shrink logo on mobile so everything fits in one line. */
  body.page-template-template-multilingual-header .hb-header-logo svg,
  body.page-template-template-multilingual-header-php .hb-header-logo svg {
    width: 120px;
    height: auto;
    display: block;
  }

  body.page-template-template-multilingual-header .hb-header-logo img,
  body.page-template-template-multilingual-header-php .hb-header-logo img {
    height: 28px;
    width: auto;
    display: block;
  }

  body.page-template-template-multilingual-header .hb-header-right > .d-flex.d-lg-none,
  body.page-template-template-multilingual-header-php .hb-header-right > .d-flex.d-lg-none {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 12px;
    padding-left: 8px;
    padding-right: 8px;
    box-sizing: border-box;
  }

  /* Prevent language switcher from taking full width and pushing the hamburger off-screen. */
  body.page-template-template-multilingual-header .hb-custom-language-switcher-lp,
  body.page-template-template-multilingual-header-php .hb-custom-language-switcher-lp {
    width: auto;
    max-width: 70vw;
  }

  body.page-template-template-multilingual-header .hb-custom-language-switcher-lp .wpml-ls-legacy-dropdown-click,
  body.page-template-template-multilingual-header-php .hb-custom-language-switcher-lp .wpml-ls-legacy-dropdown-click {
    min-width: 0;
    max-width: 70vw;
  }

  body.page-template-template-multilingual-header .hb-custom-language-switcher-lp a.wpml-ls-item-toggle,
  body.page-template-template-multilingual-header-php .hb-custom-language-switcher-lp a.wpml-ls-item-toggle {
    max-width: 70vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.page-template-template-multilingual-header .hb-header-lp .menu-mobile-btn,
  body.page-template-template-multilingual-header-php .hb-header-lp .menu-mobile-btn {
    flex: 0 0 auto;
  }

  .hb-header-lp .hb-header-menu .sub-menu {
    position: relative;
    top: 0;
    left: 0;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    background: transparent;
    padding-bottom: 0px;
  }

  .hb-header-lp .hb-header-menu {
    position: fixed;
    top: calc(60px + var(--hb-admin-bar-offset));
    max-height: calc(100% - 60px - var(--hb-admin-bar-offset));
    right: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(198, 12, 48, 0.8);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    padding: 30px;
    z-index: -1;
    visibility: hidden;
    -webkit-transition: all 500ms cubic-bezier(0.65, 0, 0.35, 1);
    transition: all 500ms cubic-bezier(0.65, 0, 0.35, 1);
    -webkit-transform: translateY(-100%);
    transform: translateY(-100%);
  }

  .hb-header-lp .hb-header-menu ul li {
    -webkit-transition: all 250ms cubic-bezier(0.65, 0, 0.35, 1);
    transition: all 250ms cubic-bezier(0.65, 0, 0.35, 1);
    -webkit-transition-delay: 0ms;
    transition-delay: 0ms;
    opacity: 0;
    -webkit-transform: translateY(50%);
    transform: translateY(50%);
  }

  .hb-header-lp .hb-header-menu ul li a {
    display: inline-block;
    margin: 10px;
  }

  .hb-header-lp .hb-header-menu.show {
    display: block;
    visibility: visible;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }

  .hb-header-lp .hb-header-menu.show ul li {
    -webkit-transition-delay: 250ms;
    transition-delay: 250ms;
    -webkit-transform: translateY(0);
    transform: translateY(0);
    opacity: 1;
  }
}
