/*
стилі для хедера

на головній - хедер js'ом міняє фон. коли на самій верхні частині сторінки, то він не має фону, а нижче з'являється темний фон
на решті вторінок фон хедера завжди темний 
*/

.header {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  width: 100%;
  height: 88px;
  background-color: var(--dark_brown);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px var(--padding-x);
  transition: all 0.3s ease;
}
.header.transparent {
  background-color: transparent;
}

.header__left {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--white);
}
.header__logo {
  height: 48px;
}
.header__phone {
  display: flex;
  align-items: center;
  gap: 4px;
  color: white;
}
.header__phone img {
  height: 28px;
}

.header__nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 48px;
  padding: 16px 32px;
}
.header__nav-item {
  display: flex;
  align-items: center;
  position: relative;
}
.header__nav-item.all-services {
  position: static;
}
.header__nav-item span,
.header__nav-link,
.header__nav-item > svg polyline {
  transition: all 0.3s ease-out;
}
.header__nav-item:hover > span,
.header__nav-link:hover {
  color: var(--yellow_pressed);
}
.header__nav-item:hover > svg polyline {
  stroke: var(--yellow_pressed);
}
.header__nav-item span {
  cursor: pointer;
}
.header .dropdown {
  display: none;
}
.header .dropdown.open {
  display: flex;
  flex-direction: column;
  position: absolute;
  left: 0;
  top: calc(100% + 24px);
  border-radius: 16px;
  overflow: hidden;
  background-color: white;
  box-shadow: 0 0 10px 0 rgba(31, 27, 22, 0.15);
}
.header .dropdown a {
  padding: 16px 24px;
  color: var(--dark);
  white-space: nowrap;
  font-weight: 500;
  background-color: white;
  transition: all 0.3s ease-out;
}
.header .dropdown a:hover {
  background-color: var(--bg_beige);
  color: var(--black);
}
.header .bigdropdown {
  display: none;
}
.header .bigdropdown.open {
  width: 100%;
  display: flex;
  flex-direction: column;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  padding: 24px;
  border-radius: 16px;
  overflow: hidden;
  background-color: white;
  box-shadow: 0 0 10px 0 rgba(31, 27, 22, 0.15);
}
.bigdropdown__columns {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}
.bigdropdown__column {
  width: 100%;
  display: flex;
  flex-direction: column;
}
.bigdropdown__column h6 {
  margin-bottom: 24px;
  padding: 0 24px;
}
.bigdropdown__column a {
  padding: 16px 24px;
  color: var(--dark);
  font-weight: 500;
  white-space: nowrap;
  background-color: white;
  width: 100%;
  transition: all 0.3s ease-out;
}
.bigdropdown__column a:hover {
  background-color: var(--bg_beige);
  color: var(--black);
}

.header__right {
  display: flex;
  align-items: center;
  gap: 24px;
}
/* ── Custom Language Switcher ── */
.cleanon-lang-switcher {
  position: relative;
}
.cleanon-lang-switcher__btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 24px;
  border-radius: 1000px;
  background: white;
  backdrop-filter: blur(2.5px);
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.cleanon-lang-switcher__name {
  display: none;
}
.cleanon-lang-switcher__flag {
  width: 22px;
  height: 14px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  border-radius: 2px;
}
.cleanon-lang-switcher__arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--dark);
  transition: transform 0.2s ease;
}
.cleanon-lang-switcher__btn[aria-expanded="true"] .cleanon-lang-switcher__arrow {
  transform: rotate(180deg);
}
.cleanon-lang-switcher__dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  padding: 8px;
  border-radius: 16px;
  background: white;
  box-shadow: 0 0 10px 0 rgba(31, 27, 22, 0.15);
  z-index: 120;
  list-style: none;
  margin: 0;
}
.cleanon-lang-switcher__dropdown[hidden] {
  display: none;
}
.cleanon-lang-switcher__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--dark);
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
  letter-spacing: -0.18px;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}
.cleanon-lang-switcher__item:hover {
  background-color: var(--bg_beige);
}

.header__login {
  padding: 12px 24px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  background-color: transparent;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-base);
}
.header__account {
  padding: 12px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
}
.header__login:hover,
.header__account:hover {
  border-color: white;
}
.header__login:active,
.header__account:active {
  background: rgba(255, 255, 255, 0.1);
  border-color: white;
}
.header__login:disabled,
.header__account:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.header__menu-btn {
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Close icon — hidden by default, shown on mobile when menu is open */
.header__close-img {
  display: none;
}

/* Login icon — shown on mobile, hidden on desktop */
.header__login-icon {
  display: none;
}

/* Mobile bottom bar — hidden on desktop */
.bigmenu__mobile-bar {
  display: none;
}

/* ── Burger menu overlay ── */
.bigmenu-overlay {
  position: fixed;
  z-index: 98;
  inset: 0;
  background: rgba(27, 14, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.bigmenu-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.bigmenu {
  position: fixed;
  z-index: 99;
  top: 88px;
  left: 0;
  right: 0;
  padding: 8px var(--padding-x) 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(-12px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0s 0.3s;
}
.bigmenu.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0s 0s;
}
.bigmenu__inner {
  background: white;
  border-radius: 16px;
  box-shadow: 0 0 10px 0 rgba(31, 27, 22, 0.15);
  padding: 24px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.bigmenu__col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.bigmenu__col h6 {
  padding: 0 24px;
}
.bigmenu__links {
  display: flex;
  flex-direction: column;
}
.bigmenu__link {
  padding: 16px 24px;
  color: var(--dark);
  border-radius: 8px;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
  white-space: nowrap;
}
.bigmenu__link:hover {
  background-color: var(--bg_beige);
  color: var(--black);
}
.bigmenu__links .button.text-link {
  padding: 16px 24px;
}

/* Sale card */
.bigmenu__sale {
  flex: 0 0 auto;
  width: 360px;
  background: var(--bg_beige);
  border-radius: 24px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}
.bigmenu__sale-badge {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border-radius: 8px;
  padding: 12px 24px;
  box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.15);
}
.bigmenu__sale p {
  color: var(--dark);
}

.header__account-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.header__account-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 160px;
  padding: 8px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(31, 27, 22, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    visibility 0.18s ease,
    transform 0.18s ease;
  z-index: 50;
}

.header__account-menu::before {
  content: "";
  position: absolute;
  top: -12px;
  right: 0;
  width: 100%;
  height: 12px;
}

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

.header__account-menu a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text, #1f1b16);
  font-size: 0.9375rem;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.header__account-menu a:hover {
  background: rgba(244, 180, 0, 0.12);
  color: var(--yellow, #f4b400);
}
.header__account-wrap.is-open .header__account-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.header__account-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.header__account-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 190px;
  padding: 8px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(31, 27, 22, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    visibility 0.18s ease,
    transform 0.18s ease;
  z-index: 100;
}

.header__account-menu::before {
  content: "";
  position: absolute;
  top: -12px;
  right: 0;
  width: 100%;
  height: 12px;
}

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

.header__account-menu a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text, #1f1b16);
  font-size: 0.9375rem;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.header__account-menu a:hover {
  background: rgba(244, 180, 0, 0.12);
  color: var(--yellow, #f4b400);
}

.header__account-wrap--guest .header__account-menu {
  right: 0;
}
@media screen and (max-width: 1750px) {
  .header__phone {
    display: none;
  }
}

@media screen and (max-width: 1400px) {
  .header__nav {
    display: none;
  }
}

/* ── Mobile header (≤768px) ── */
@media (max-width: 768px) {
  /* Header layout */
  .header {
    height: 64px;
    padding: 12px 16px;
  }
  .header__nav {
    display: none;
  }
  .header__phone {
    display: none;
  }
  .header__logo {
    height: 40px;
    width: auto;
  }
  .header__right {
    gap: 16px;
  }
  /* Hide desktop language switcher */
  .header .cleanon-lang-switcher {
    display: none;
  }

  /* Login button: show icon, hide text */
  .header__login {
    padding: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .header__login-icon {
    display: block;
  }
  .header__login-text {
    display: none;
  }

  /* Account button (logged-in) */
  .header__account {
    padding: 8px;
  }
  .header__account img {
    width: 22px;
    height: 22px;
  }

  /* Burger/close icon toggle */
  .header--menu-open .header__burger-img {
    display: none;
  }
  .header--menu-open .header__close-img {
    display: block;
  }

  /* ── Mobile bigmenu ── */
  .bigmenu-overlay {
    display: none;
  }

  .bigmenu {
    top: 64px;
    bottom: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .bigmenu__inner {
    flex: 1;
    overflow-y: auto;
    flex-direction: column;
    padding: 16px;
    border-radius: 0;
    box-shadow: none;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--olive) #f7f3ed;
  }
  .bigmenu__inner::-webkit-scrollbar {
    width: 8px;
  }
  .bigmenu__inner::-webkit-scrollbar-track {
    background: #f7f3ed;
  }
  .bigmenu__inner::-webkit-scrollbar-thumb {
    background: var(--olive);
    border-radius: 12px;
  }

  /* Reorder sections: Sale → Послуги → Навігація → Умови */
  .bigmenu__sale {
    order: 1;
    width: 100%;
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 0;
  }
  /* Послуги (2nd col in DOM) */
  .bigmenu__inner > .bigmenu__col:nth-child(2) {
    order: 2;
  }
  /* Навігація (1st col in DOM) */
  .bigmenu__inner > .bigmenu__col:nth-child(1) {
    order: 3;
  }
  /* Умови (3rd col in DOM) */
  .bigmenu__inner > .bigmenu__col:nth-child(3) {
    order: 4;
  }

  .bigmenu__col {
    gap: 0;
    width: 100%;
    padding: 16px 0;
    border-bottom: 1px solid var(--light);
  }
  .bigmenu__inner > .bigmenu__col:nth-child(3) {
    border-bottom: none;
    padding-bottom: 8px;
  }
  .bigmenu__col h6 {
    padding: 0;
    margin-bottom: 4px;
  }
  .bigmenu__link {
    padding: 12px 16px;
  }

  /* Mobile bottom bar */
  .bigmenu__mobile-bar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    padding: 32px;
    background: var(--dark_brown);
    flex-shrink: 0;
  }
  .bigmenu__mobile-socials {
    display: flex;
    gap: 16px;
    align-items: center;
  }
  .bigmenu__social-btn {
    background: var(--olive);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-sizing: border-box;
  }
  .bigmenu__social-btn img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
  }
  .bigmenu__mobile-phone {
    display: flex;
    align-items: center;
    gap: 4px;
    color: white;
    text-decoration: none;
  }
  .bigmenu__mobile-phone img {
    width: 28px;
    height: 28px;
  }
  /* Mobile lang switcher */
  .bigmenu__mobile-lang-wrap {
    width: 100%;
    position: relative;
  }
  .bigmenu__mobile-lang-wrap .cleanon-lang-switcher {
    width: 100%;
  }
  .bigmenu__mobile-lang-wrap .cleanon-lang-switcher__btn {
    width: 100%;
    justify-content: center;
    border-radius: 8px;
    padding: 8px 16px;
    gap: 12px;
  }
  .bigmenu__mobile-lang-wrap .cleanon-lang-switcher__name {
    display: block;
    font-size: 14px;
    color: var(--dark);
    font-weight: 500;
  }
  .bigmenu__mobile-lang-wrap .cleanon-lang-switcher__dropdown {
    top: auto;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 0;
    width: 100%;
  }
}
