/* Мінімальні перевизначення — основний вигляд з Webflow (main.css) */

.header-section {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: auto;
}

.header-navbar {
  position: relative;
  top: auto;
  margin-top: 0;
}

@media screen and (min-width: 768px) {
  .header-navbar > .wrapper {
    margin-top: 0;
    transition: margin-top 0.2s;
  }

  /* Ховаємо верхню смугу рівно на її виміряну висоту — нижній бар лишається вгорі. */
  .header-navbar.scroll-now {
    overflow: hidden;
    margin-bottom: 0 !important;
  }

  .header-navbar.scroll-now > .wrapper {
    margin-top: calc(-1 * var(--leader-header-top-height, 0px));
  }
}

/**
 * ПК (>=768): дві смуги хедера однакової висоти (вимога — «2 частини хедера однакового розміру»).
 * Верхня (`.header-box`: лого + навігація) і нижня (`.header-bottom`: каталог + пошук + кошик)
 * мали різні `em`-падінги (1em vs .6em) → різна висота (виміряно 67px vs 73px на 1440).
 * Фіксуємо спільну цільову висоту й центруємо вміст, щоб обидві були рівні й не стрибали.
 */
@media screen and (min-width: 768px) {
  /**
   * Спільна цільова висота обох смуг (border-box, щоб padding входив у height і не додавався
   * зверху). ~5.05em від `1vw`-бази ≈ реальна висота нижньої смуги. Верхню центруємо flex-ом,
   * щоб лого/навігація стояли по центру тієї ж висоти.
   */
  .header-box,
  .header-bottom.add-shadow,
  .header-bottom {
    min-height: 5.05em;
    box-sizing: border-box;
  }

  .header-box {
    display: flex;
    align-items: center;
  }
}

/* Відкритий каталог (React state) — Webflow очікує .w--open на toggle */
.header-bottom-catalog-button.w--open .header-bottom-catalog-list {
  display: block;
}

/* Кабінет: ті самі 5.5em, що в fav/compare; без UA-padding у <button>. */
.header-bottom-customers-button.is-account,
.header-bottom-customers-button.is-cabinet {
  box-sizing: border-box;
  flex: none;
  width: 5.5em;
  height: 5.5em;
  min-width: 5.5em;
  min-height: 5.5em;
  padding: 0;
  margin: 0;
  background: transparent !important;
  background-color: transparent !important;
  border: none;
  box-shadow: none;
  cursor: pointer;
  color: inherit;
  transition: none;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
}

.header-bottom-customers-button.is-account:hover,
.header-bottom-customers-button.is-account:focus,
.header-bottom-customers-button.is-account:focus-visible,
.header-bottom-customers-button.is-cabinet:hover,
.header-bottom-customers-button.is-cabinet:focus,
.header-bottom-customers-button.is-cabinet:focus-visible {
  background: transparent !important;
  background-color: transparent !important;
  color: inherit;
  box-shadow: none;
  outline: none;
}

.header-bottom-customers-button.is-account .header-bottom-customers-button-icon,
.header-bottom-customers-button.is-cabinet .header-bottom-customers-button-icon {
  width: 40%;
  height: 40%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-bottom-customers-button.is-account .header-bottom-customers-button-icon svg,
.header-bottom-customers-button.is-cabinet .header-bottom-customers-button-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Лише телефон (<480): як у fav/compare — іконка на весь hit-area (wf-media → 100%) */
@media screen and (max-width: 479px) {
  .header-bottom-customers-button.is-account .header-bottom-customers-button-icon,
  .header-bottom-customers-button.is-cabinet .header-bottom-customers-button-icon {
    width: 100% !important;
    height: 100% !important;
  }
}

/**
 * Випадаюче меню кабінету.
 * Стилі були лише в wf_min.css, який у Next не підключається — без цього
 * список «Вітаємо…» лізе в потік хедера як звичайний <ul>.
 */
.header-cabinet-wrap {
  position: relative;
  display: inline-flex;
  flex: none;
  flex-shrink: 0;
  align-self: center;
  align-items: center;
  justify-content: center;
  width: 5.5em;
  height: 5.5em;
  vertical-align: top;
}

/* Міст під кнопкою: курсор не «губить» hover, поки їде вниз до меню */
.header-cabinet-wrap::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 1.1em;
  z-index: 9998;
  pointer-events: auto;
}

/* em від кнопки (база 1vw) — цятка зменшується разом з іконкою, не лишається 8px */
.header-cabinet-status {
  position: absolute;
  top: 0.55em;
  right: 0.55em;
  width: 1.05em;
  height: 1.05em;
  border-radius: 50%;
  background-color: #22c55e;
  border: 0;
  pointer-events: none;
  z-index: 2;
}

.header-cabinet-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 9999;
  min-width: 240px;
  padding: 8px 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 15, 20, 0.12);
  color: #222;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.header-cabinet-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 18px;
  width: 12px;
  height: 12px;
  background-color: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  transform: rotate(45deg);
  pointer-events: none;
}

.header-cabinet-wrap:hover .header-cabinet-menu,
.header-cabinet-wrap:focus-within .header-cabinet-menu,
.header-cabinet-menu.is-cabinet-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.header-cabinet-menu-head {
  padding: 10px 16px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.header-cabinet-menu-kicker {
  margin: 0 0 2px;
  color: #888;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.header-cabinet-menu-name {
  margin: 0;
  color: #111;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.header-cabinet-menu-list {
  margin: 0;
  padding: 6px 0;
  list-style: none;
}

.header-cabinet-menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 16px;
  color: #222;
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.header-cabinet-menu-link:hover {
  color: #ee1d36;
  background-color: rgba(249, 0, 7, 0.06);
}

.header-cabinet-menu-logout {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 14px 16px 10px;
  color: #666;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: solid rgba(0, 0, 0, 0.06);
  border-width: 1px 0 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.35;
  letter-spacing: normal;
  text-transform: none;
}

.header-cabinet-menu-logout:hover {
  color: #ee1d36;
  background-color: rgba(249, 0, 7, 0.06);
}

.header-cabinet-menu-stat {
  flex-shrink: 0;
  min-width: 2.75rem;
  margin-left: auto;
  padding-left: 12px;
  color: #666;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
}

.header-cabinet-menu-stat.is-red {
  color: #ee1d36;
}

@media screen and (max-width: 767px) {
  .header-cabinet-wrap::after {
    display: none;
  }

  /* Розмір задає кнопка (font-size:4em + 5em), обгортка лише обгортає */
  .header-cabinet-wrap {
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
  }

  .header-bottom-customers-button.is-account,
  .header-bottom-customers-button.is-cabinet {
    width: 5em !important;
    height: 5.5em !important;
    min-width: 5em !important;
    min-height: 5.5em !important;
    font-size: 4em !important;
  }

  .header-cabinet-status {
    top: 0.35em;
    right: 0.55em;
    width: 0.55em;
    height: 0.55em;
  }

  /* wf-media ховає меню; показуємо лише відкритий стан (тап).
     Кнопка акаунта внизу екрана — меню відкривається над нею. */
  .header-cabinet-menu {
    display: none;
    position: absolute;
    top: auto;
    bottom: calc(100% + 4px);
    right: auto;
    left: 0;
    transform: translateY(-4px);
  }

  .header-cabinet-wrap:hover .header-cabinet-menu:not(.is-cabinet-open),
  .header-cabinet-wrap:focus-within .header-cabinet-menu:not(.is-cabinet-open) {
    display: none;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .header-cabinet-menu.is-cabinet-open {
    display: block;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  html .header-cabinet-wrap:has(.header-cabinet-menu.is-cabinet-open) {
    overflow: visible;
  }

  .header-cabinet-menu::before {
    top: auto;
    right: auto;
    bottom: -6px;
    left: 28px;
    margin-left: 0;
    border-top: 0;
    border-left: 0;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }
}

/* 480–767: як десктоп — 5.5em, inherit (не 3em) */
@media screen and (max-width: 767px) and (min-width: 480px) {
  .header-cabinet-wrap {
    width: 5.5em !important;
    height: 5.5em !important;
  }

  html .header-bottom-customers-button.is-account,
  html .header-bottom-customers-button.is-cabinet {
    width: 5.5em !important;
    height: 5.5em !important;
    min-width: 5.5em !important;
    min-height: 5.5em !important;
    font-size: inherit !important;
    padding: 0 !important;
  }

  html .header-bottom-customers-button.is-account .header-bottom-customers-button-icon,
  html .header-bottom-customers-button.is-cabinet .header-bottom-customers-button-icon {
    width: 40% !important;
    height: 40% !important;
    margin-top: 0;
  }

  .header-cabinet-status {
    top: 0.3em;
    right: 0.5em;
    width: 0.5em;
    height: 0.5em;
  }
}

@media screen and (max-width: 479px) {
  /* Розмір задає кнопка з font-size:4em — wrap auto */
  .header-cabinet-wrap {
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .header-bottom-customers-account-root .header-bottom-customers-button.is-account,
  .header-bottom-customers-account-root .header-bottom-customers-button.is-cabinet {
    width: 5em !important;
    min-width: 5em !important;
    height: 5.5em !important;
    min-height: 5.5em !important;
    font-size: 4em !important;
  }

  .header-bottom-customers-button.is-account .header-bottom-customers-button-icon,
  .header-bottom-customers-button.is-cabinet .header-bottom-customers-button-icon {
    width: 40% !important;
    height: 40% !important;
  }

  .header-cabinet-status {
    top: 0.35em;
    right: 0.55em;
    width: 0.55em;
    height: 0.55em;
  }
}

/**
 * Mobile: нижня панель fixed одразу (раніше лише після wf-media.css → стрибок з потоку в низ екрана).
 * Підписи/розміри іконок — у main.css (критичний каскад).
 */
@media screen and (max-width: 767px) {
  .header-bottom,
  .header-bottom.add-shadow {
    background-color: #f8f8fb;
    color: #17181a;
    position: fixed;
    inset: auto 0 0;
    z-index: 999;
    box-shadow: 0 -3px 9px #0003;
  }
}

/**
 * Дві форми пошуку в HTML одразу: видима лише потрібна для брейкпоінта.
 * Раніше одну форму переносили JS після гідрації — через це інпут блимав.
 */
@media screen and (min-width: 768px) {
  .header-navbar > form.header-bottom-search {
    display: none !important;
  }
}

@media screen and (max-width: 767px) {
  .header-bottom form.header-bottom-search {
    display: none !important;
  }
}

/**
 * Іконка бургера: інлайн-стилі з wf/index.html, які не потрапили в Webflow CSS.
 * Три порожні div всередині .burger-box стають білими смужками.
 */
@media screen and (max-width: 767px) {
  .header-navbar .burger-box.w-nav-button {
    display: flex !important;
  }
}

.burger-box > div {
  height: 2px;
  padding: 0;
  width: auto;
  background: #fff;
  position: relative;
  transition: 0.15s;
}

.burger-box > div:nth-child(1) {
  top: -6px;
}

.burger-box > div:nth-child(3) {
  bottom: -6px;
}

.burger-box.w--open > div:nth-child(1) {
  top: 2px;
  transform: rotate(45deg);
}

.burger-box.w--open > div:nth-child(2) {
  opacity: 0;
}

.burger-box.w--open > div:nth-child(3) {
  bottom: 2px;
  transform: rotate(-45deg);
}

/**
 * Підказки пошуку в шапці. Форма є на кожній сторінці, тож ці стилі не можна
 * тримати в search.css — той файл підключається лише на /search.
 */
form.header-bottom-search.leader-search-form {
  z-index: 40;
  overflow: visible;
}

.header-section:has(form.is-suggest-open),
.header-bottom:has(form.is-suggest-open),
.header-navbar:has(form.is-suggest-open),
.header-navbar.scroll-now:has(form.is-suggest-open) {
  overflow: visible;
}

form.header-bottom-search .leader-search-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
  box-sizing: border-box;
  max-height: min(70vh, 420px);
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  padding: 6px 0;
  color: #121323;
  font-family: Inter, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.25;
  text-align: left;
}

form.header-bottom-search .leader-search-suggest[hidden] {
  display: none !important;
}

form.header-bottom-search .leader-search-suggest-empty {
  padding: 18px 20px;
  color: #6b6b75;
  font-size: 15px;
}

form.header-bottom-search .leader-search-suggest-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 28px;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
  color: #121323;
  border-bottom: 1px solid #ececf0;
}

form.header-bottom-search .leader-search-suggest-item:last-child {
  border-bottom: 0;
}

form.header-bottom-search .leader-search-suggest-item:hover {
  background: #f7f7f9;
}

form.header-bottom-search .leader-search-suggest-media {
  width: 56px;
  height: 56px;
  border: 1px solid #e6e6ea;
  border-radius: 8px;
  overflow: hidden;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

form.header-bottom-search .leader-search-suggest-media img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  display: block;
}

form.header-bottom-search .leader-search-suggest-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

form.header-bottom-search .leader-search-suggest-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: #121323;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

form.header-bottom-search .leader-search-suggest-prices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

form.header-bottom-search .leader-search-suggest-old {
  color: #9a9aa3;
  text-decoration: line-through;
  font-size: 13px;
}

form.header-bottom-search .leader-search-suggest-price {
  color: #121323;
  font-size: 15px;
  font-weight: 700;
}

form.header-bottom-search .leader-search-suggest-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #b3191d;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

form.header-bottom-search .leader-search-suggest-arrow {
  color: #b3191d;
  font-size: 18px;
  line-height: 1;
  justify-self: end;
}

@media screen and (max-width: 767px) {
  form.header-bottom-search .leader-search-suggest {
    left: 50%;
    right: auto;
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    transform: translateX(-50%);
    max-height: min(68vh, 360px);
  }

  form.header-bottom-search .leader-search-suggest-item {
    grid-template-columns: 48px minmax(0, 1fr) 24px;
    gap: 10px;
    padding: 10px 12px;
  }

  form.header-bottom-search .leader-search-suggest-media {
    width: 48px;
    height: 48px;
  }

  form.header-bottom-search .leader-search-suggest-name {
    font-size: 13px;
  }
}
