/* ==========================================================================
   Site Header
   ========================================================================== */

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-5);
  z-index: 9999;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-2);
}

/* Announcement bar */
.announcement-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: var(--space-2) var(--space-5);
  background-color: var(--color-secondary);
  color: #fff;
  font-size: var(--text-sm);
  text-align: center;
}

.announcement-bar__link {
  color: #fff;
  text-decoration: underline;
}

.announcement-bar__link:hover {
  opacity: 0.85;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background-color: var(--color-bg);
  border-bottom: 1px solid transparent;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.site-header.is-scrolled {
  border-color: #F4F4F4;
}

body.search-is-open .site-header__nav {
  opacity: 0;
  pointer-events: none;
  min-width: 0;
  overflow: hidden;
}

body.search-is-open .site-header__utility {
  opacity: 0;
  pointer-events: none;
}

body.search-is-open .site-header__logo {
  flex: 0 0 auto;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--space-5);
}

/* Logo */
.site-header__logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.site-header__logo .custom-logo-link,
.site-header__site-name {
  display: block;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: var(--text-base);
}

.site-header__logo img {
  width: auto;
  max-width: none;
}

/* Two-column mobile layout wrappers.
   On desktop (>=1024px) both cols become display:contents so their children
   remain direct flex items of .site-header__inner — all existing desktop
   rules apply unchanged. */
.site-header__left-col {
  flex-shrink: 0;
}

.site-header__right-col {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

@media (width >= 1024px) {
  .site-header__left-col,
  .site-header__right-col {
    display: contents;
  }
}

/* Nav zone (desktop) */
.site-header__nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* Utility zone */
.site-header__utility {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Hamburger (mobile only) */
.site-header__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: var(--space-1);
  flex-shrink: 0;
}

.site-header__hamburger-icon,
.site-header__hamburger-icon::before,
.site-header__hamburger-icon::after {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--color-secondary);
  border-radius: 2px;
  transition: transform 0.2s;
}

.site-header__hamburger-icon {
  position: relative;
}

.site-header__hamburger-icon::before,
.site-header__hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.site-header__hamburger-icon::before {
  top: -6px;
}

.site-header__hamburger-icon::after {
  top: 6px;
}

/* Utility buttons */
.utility-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  height: 35px;
  border-radius: var(--radius-pill);
  background-color: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.utility-btn:hover {
  opacity: 0.8;
  text-decoration: none;
}

.utility-btn__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.utility-btn__label {
  font-size: var(--text-sm);
  color: var(--color-text);
}

.utility-btn--icon {
  width: 35px;
  height: 35px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-pill);
  background-color: transparent;
  border: none;
  color: var(--color-primary);
  position:relative;
}

/* Cart badge */
.utility-btn--cart {
  position: relative;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background-color: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.cart-badge:empty {
  display: none;
}

.wishlist-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background-color: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.wishlist-badge:empty {
  display: none;
}

/* ==========================================================================
   Search bar — always visible pill, expands on click/focus
   ========================================================================== */

.site-header__search-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 35px;
  width: 188px;
  padding: 0 var(--space-3);
  background-color: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  cursor: pointer;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.15s;
}

.site-header__search-bar.is-open {
  width: 514px;
  overflow: visible;
  cursor: text;
}

.site-header__search-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.site-header__search-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--color-primary);
  pointer-events: none;
}

.site-header__search-bar .search-overlay__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  border: none;
  font-size: var(--text-sm);
  color: var(--color-text);
  appearance: none;
  outline: none;
  caret-color: var(--color-primary);
  cursor: pointer;
}

/* Hide native browser clear button on search input (WebKit + IE/Edge legacy) */
.site-header__search-bar .search-overlay__input::-webkit-search-cancel-button,
.site-header__search-bar .search-overlay__input::-webkit-search-decoration,
.site-header__search-bar .search-overlay__input::-webkit-search-results-button,
.site-header__search-bar .search-overlay__input::-webkit-search-results-decoration {
  appearance: none;
  -webkit-appearance: none;
  display: none;
}

.site-header__search-bar .search-overlay__input::-ms-clear,
.site-header__search-bar .search-overlay__input::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}

.site-header__search-bar.is-open .search-overlay__input {
  cursor: text;
}

.site-header__search-bar.is-open .search-overlay__input {
  font-size: 16px;
}

/* Close button: hidden in collapsed state */
.site-header__search-close {
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: transparent;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
  padding: 0;
}

.site-header__search-close:hover {
  opacity: 1;
}

.site-header__search-close svg {
  width: 12px;
  height: 12px;
}

.site-header__search-bar.is-open .site-header__search-close {
  display: inline-flex;
}

/* B2B utility button override */
.utility-btn--b2b {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-size: var(--text-sm);
  padding: 0 var(--space-4);
}

/* Mobile responsive */
@media (width < 1024px) {
  .site-header__nav {
    display: none;
  }

  .site-header__hamburger {
    display: flex;
  }

  .utility-btn__label {
    display: none;
  }

  .site-header__search-bar {
    display: none;
  }

  /* Mobile search popup: shown as full-width fixed bar when search is open */
  .site-header__search-bar.is-open {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 56px;
    border-radius: 0;
    border-color: transparent;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-bg);
    padding-inline: var(--space-4);
    z-index: 201;
    box-shadow: 0 1px 6px rgb(0 0 0 / 8%);
  }

  .site-header .utility-btn--b2b {
    display: none;
  }

  .site-header .lang-switcher {
    display: none;
  }

  .site-header__logo img {
    height: 18px;
    max-width: 167px;
    width: auto;
  }
}

/* Narrow viewport — prevent header overflow on ≤390px devices */
@media (width < 480px) {
  .site-header__logo img {
    max-width: 130px;
  }

  .site-header__inner {
    gap: 12px;
  }
}

/* Prevent any header child from creating horizontal scroll */
body {
  overflow-x: clip;
}

/* Body scroll lock */
body.is-locked {
  overflow: hidden;
  overscroll-behavior: contain;
}

@media (width < 1024px) {
  .site-header__hamburger-icon, .site-header__hamburger-icon::before, .site-header__hamburger-icon::after{
    height:1px;
    background-color: var(--color-primary);
  }
  .site-header__hamburger{
    height:25px;
    width:19px;
    padding:0;
  }
  .site-header__logo img{
    max-width:165px;
  }
  .cart-badge,
  .wishlist-badge{
    min-width: 15px;
    height: 15px;
    font-size: 9px;
  }
  .site-header__right-col{
    gap:25px;
  }
  .site-header__utility{
    gap:8px;
  }
  .utility-btn__icon{
    width:16px;
    height:17px;
  }
}
