/* ==========   1. БАЗОВІ КОНСТРУКЦІЇ ХЕДЕРА   ============ */
.header {
  position: relative;
  width: 100%;
  z-index: 100;
}

.header__top {
  padding: 20px 0;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__left {
  display: flex;
  flex-shrink: 0; /*  не дозволяє стискатись */
  align-items: center;
  gap: 60px;
  flex-wrap: nowrap; /* забороняє перенос елементів на новий рядок */
}
/*  ==== логотип та його стилі==== */
.header__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: clamp(36px, 4vw, 40px);
  padding: 4px;

  flex-shrink: 0;
  line-height: 1;
  text-decoration: none;
}

.header__logo-img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
}

.header__logo:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

/* =====Десктопна навігація ======*/
.nav--desktop .nav__list {
  display: flex;
  gap: 40px; /* відстань між пунктами меню */
}

.nav__link {
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  transition: color 0.3s;
  color: inherit;
}
/* =====ховерний ефект першої сторінки home ======*/
.header--home .nav--desktop .nav__link:hover {
  color: #f0f0f0;
}
/* ==========================================================================
   2. КОМПОНЕНТИ (ТЕЛЕФОНИ, АККАУНТ, КОШИК, БУРГЕР)
   ========================================================================== */
.header__actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
  margin-right: 10px;
}

.header__account,
.header__cart svg,
.header__call-btn svg {
  transition:
    transform 0.2s ease,
    color 0.2s ease;
}

.header__account:hover,
.header__cart:hover svg,
.header__call-btn:hover svg {
  transform: scale(1.1);
}

/* ========Блок телефонів (десктоп)========= */

.header__phones {
  position: relative;
  display: inline-block;
  z-index: 1000;
}
.header__call-btn.mobile-only {
  display: none; /* іконка за замовчуванням прихована */
}
.header__phone-main {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.phone-toggle .arrow {
  display: inline-block;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  transition: transform 0.25s ease;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.header__phones.open .phone-toggle .arrow {
  transform: rotate(-135deg);
}

.header__phone-hidden {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: max-content;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.header__phones.open .header__phone-hidden {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* =====
   Корекція видимості другого номера телефону на головній сторінці
   ============== */

/* білий текст */
.header--home .header__phone-hidden {
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #ffffff !important;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Посилання всередині — біле + ховер */
.header--home .header__phone-hidden a {
  color: #ffffff !important;
  text-decoration: none;
  font-weight: 500;
}

/* =======Бургер============ */
.header__burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 20px;
  position: relative;
  z-index: 101;
  background: transparent;
  border: none;
  cursor: pointer;
}

.header__burger span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: currentColor;
  border-radius: 2px;
  transition:
    transform 0.3s ease,
    opacity 0.2s ease,
    background-color 0.3s ease;
}

/* ==========================================================================
   3. НИЖНІЙ РЯДОК (КАТАЛОГ ТА ПОШУК)
   ========================================================================== */
.header__bottom {
  padding: 12px 0;
}

.header__bottom-inner {
  display: flex;
  align-items: center;
  gap: 25px;
}

.header__catalog-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #7c0000;
  color: #fff !important;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 4px;
  font-size: 15px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.header__catalog-btn:hover {
  background: #af0b0b;
}

.header__search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 600px;
  background: #f8f8f8;
  border-radius: 4px;
  overflow: hidden;
  padding-right: 15px;
}
/* Тільки для сторінки з header--home */
.header.header--home .header__search {
  background: #e0e0e0; /* темніший фон пошукового поля */
}
.header__search-input {
  flex: 1;
  padding: 10px 15px;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
}
/* Текст в полі пошуку на головній - темний, щоб було видно на світлому фоні */
.header--home .header__search-input {
  color: #333333; /* темний текст */
}

.header__search-btn {
  padding: 0 15px;
  display: flex;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #333;
}

/* ==========================================================================
   4. ВАРІАНТИ ХЕДЕРА (HOME / DEFAULT)
   ========================================================================== */

.header {
  background: #eeeeee;
  color: #000;
}
.header--home {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  color: #fff;
}
/*  Safari/iOS підтримуватимуть розмиття завдяки -webkit-backdrop-filter */
.header--home.is-blurred {
  background: rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* Кольори іконок та елементів у home-версії */
.header--home .header__account,
.header--home .header__cart svg,
.header--home .header__call-btn svg,
.header--home .header__burger,
.header--home .phone-toggle,
.header--home .header__phone-main a {
  color: #fff;
}

.header--home .phone-toggle .arrow {
  border-color: #fff;
}

.header--home .header__account:hover,
.header--home .header__cart:hover svg,
.header--home .header__call-btn:hover svg {
  color: rgba(255, 255, 255, 0.8);
}
/* Іконки (акаунт, кошик, телефон) — фіксований розмір */
.header__account svg,
.header__cart svg,
.header__call-btn svg {
  min-width: 18px; /* захищає від стискання */
  min-height: 18px;
}

/* ====Стилі для випадаючого меню каталогу=== */
.header__catalog-wrapper {
  position: relative;
  display: inline-block;
}

/* НАЙВАЖЛИВІШЕ: копіюємо стилі з .header__catalog-btn */
.header__catalog-btn--trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #7c0000;
  color: #fff !important;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 4px;
  font-size: 15px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.3s ease;
  cursor: pointer;
  border: none;
  font-family: inherit;
  line-height: normal;
  width: auto;
}

.header__catalog-btn--trigger:hover {
  background: #af0b0b;
}

/* Стрілочка біля кнопки */
.header__catalog-btn--trigger::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 8px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.3s ease;
}

.header__catalog-wrapper:hover .header__catalog-btn--trigger::after {
  transform: rotate(180deg);
}

/* Випадаюче меню */
.header__catalog-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 10px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  margin-top: 5px;
}

.header__catalog-wrapper:hover .header__catalog-dropdown,
.header__catalog-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.header__catalog-btn--trigger[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* Стилі для посилань у меню */
.header__catalog-dropdown a {
  display: block;
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 16px;
  white-space: nowrap;
}

.header__catalog-dropdown a:hover {
  background-color: #f5f5f5;
  color: #000;
  padding-left: 25px;
}

/* ==================  5. МОБІЛЬНЕ МЕНЮ (OFFCANVAS)
   ======================== */
.mobile-menu {
  position: fixed;
  inset: 0 0 0 auto;
  width: 85vw;
  max-width: 360px;
  height: 100dvh;
  background: #ffffff;
  color: #000000;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.mobile-menu.is-open {
  transform: translateX(0);
}

.offcanvas__header {
  padding: 16px 24px;
}


.nav__list--mobile {
  padding: 0 24px 2px;
  list-style: none;
}

.nav__list--mobile .nav__link {
  display: block;
  padding: 14px 0;
  font-size: 18px;
  font-weight: 500;
  color: #222;
  text-decoration: none;
}
.menu-divider {
  height: 1px;
  background-color: #ccc;
  margin: 10px 0;
  list-style: none;
  padding: 0;
}

.offcanvas__footer {
  padding: 24px;
  border-top: 1px solid #eee;
  font-size: 15px;
}

.offcanvas__phones a {
  display: block;
  margin: 8px 0;
  color: #7c0000;
  text-decoration: none;
}
/* ==емейл та адреса== */
.offcanvas__email a,
.offcanvas__address {
  display: block;
  margin: 20px 0 0; /* невеликий відступ зверху */
  text-decoration: none;
  font-size: 15px;
}
/* ==години роботи== */
.offcanvas__hours {
  margin-top: 20px;
  font-size: 14px;
}

.offcanvas__hours ul {
  list-style: none;
  padding: 0;
  margin: 5px 0 0 0;
}

.offcanvas__hours li {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 4px;
}

.offcanvas__hours .day {
  width: 70px; /* ширина колонки для днів, підлаштуй під текст */
  flex-shrink: 0; /* щоб не стискалося */
}

.offcanvas__hours .time {
  flex-grow: 1; /* займе решту місця */
}

/* Overlay */
.offcanvas-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 999;
}

.mobile-menu.is-open ~ .offcanvas-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Над overlay (z-index 999), інакше іконка малюється під затемненням і «зникає» */
.header__burger.is-active {
  z-index: 1002;
}
/* На головній бургер білий — при відкритті перемикаємо на темний (вища специфічність за .header--home .header__burger) */
.header--home .header__burger.is-active {
  color: #000000;
}
/* Анімація бургера при відкритті */
.header__burger.is-active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.header__burger.is-active span:nth-child(2) {
  opacity: 0;
}
.header__burger.is-active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}
/* Стилі кошика в хедері */
.header__cart {
  position: relative;
  display: inline-flex;
}

.header__cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: #800000;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  border-radius: 20px;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.header__cart-count.is-hidden {
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
}

/* ==========================================================================
   6. АДАПТИВНІСТЬ
   ========================================================================== */
/* Від 1200 px і більше — тільки номери телефону */
@media (min-width: 1200px) {
  .header__phones {
    display: inline-block;
  }
  .header__call-btn.mobile-only {
    display: none !important;
  }
}

/* Менше 1200 px — тільки іконка телефону */
@media (max-width: 1199px) {
  .header__phones {
    display: none !important;
  }
  .header__call-btn.mobile-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (min-width: 992px) {
  .nav--desktop {
    display: block;
  }
  .header__burger,
  .mobile-menu,
  .offcanvas-overlay {
    display: none;
  }
}

@media (max-width: 991px) {
  .desktop-only {
    display: none !important;
  }

  .header__call-btn.mobile-only {
    display: block;
  }

  .header__burger {
    display: flex;
  }

  .nav--desktop {
    display: none;
  }

  .header__bottom-inner {
    display: flex;
    flex-direction: row; /* завжди рядок */
    flex-wrap: nowrap; /* не переносити */
    align-items: center;
    gap: 10px; /* можна 8–12 px */
    padding: 0 15px; /* бокові відступи для краси */
  }

  /* Знімаємо примусову ширину 100% */
  .header__catalog-btn,
  .header__search {
    width: auto;
    max-width: none;
  }

  .header__catalog-btn {
    flex-shrink: 0; /* кнопка не стискається */
    padding: 10px 16px;
    font-size: 14px;
    white-space: nowrap;
  }

  .header__catalog-text-extra {
    display: none; /* "товарів" ховаємо */
  }

  .header__search {
    flex: 1 1 auto; /* займає весь вільний простір */
    min-width: 120px; /* мінімальна ширина, щоб не зникало */
  }

  .header__search-input {
    font-size: 14px;
    padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  .header__bottom-inner {
    flex-direction: row;
    gap: 8px;
    padding: 0 15px;
  }

  .header__catalog-btn {
    width: auto;
    padding: 10px 12px;
    font-size: 14px;
    flex-shrink: 0;
  }

  .header__catalog-text-extra {
    display: none;
  }

  .header__search {
    width: auto;
    flex: 1;
  }

  .header__search-input {
    padding: 8px 10px;
    font-size: 14px;
  }
}

/* iOS blur fallback */
.ios .header--home.is-blurred {
  backdrop-filter: none;
  background: rgba(0, 0, 0, 0.35);
}
