:root {
  --header-bg: #e8e6df;
  --header-text: #522B3A;
  --header-accent: #887755;
  --header-height: 76px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--header-bg);
  border-bottom: none;
}

.body-scroll-lock {
  overflow: hidden !important;
}

.header .navbar {
  min-height: var(--header-height);
  background: transparent;
}

.header__inner {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
}

.header__logo {
  margin: 0;
  padding: 0;
  line-height: 0;
}

.header__logo-img {
  width: auto;
  height: 45px;
  display: block;
  object-fit: contain;
}

.header__collapse {
  align-items: center;
}

/* .header__menu {
  gap: 0.5rem;
} */

.header__link {
  color: var(--header-text) !important;
  /* font-size: 15px; */
  line-height: 1.5;
  padding: 0.7rem 1rem !important;
  position: relative;
  white-space: nowrap;
}

.header__link:hover,
.header__link--active {
  color: var(--header-accent) !important;
}

/* Keep dropdown toggles styled when open (.show) */
.header__link.dropdown-toggle.show {
  color: var(--header-accent) !important;
}

.header__link::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: 0.2rem;
  height: 3px;
  border-radius: 2px;
  background: var(--header-accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.2s ease;
}

.header__link:hover::before,
.header__link--active::before,
.header__link.dropdown-toggle.show::before {
  transform: scaleX(1);
}

.header__link--home::before {
  display: none;
}

.header__home-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header__home-icon svg {
  width: 20px;
  height: 20px;
  color: var(--header-text);
  stroke: currentColor;
}

.header__link--active.header__link--home .header__home-icon svg {
  color: var(--header-accent);
}

.header .dropdown-toggle::after {
  display: inline-block !important;
  content: "";
  border-top: 0.3em solid currentColor;
  border-right: 0.3em solid transparent;
  border-left: 0.3em solid transparent;
  vertical-align: middle;
  margin-left: 5px;
  opacity: 1;
}
.header__submenu {
  margin-top: 0.35rem !important;
  border: 1px solid rgba(63, 44, 52, 0.1);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(27, 19, 23, 0.12);
  padding: 0.4rem;
  min-width: 210px;
}

.header__submenu .dropdown-item {
  color: var(--header-text);
  font-size: 14px;
  font-weight: 600;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  margin: 5px 0;
}

.header__submenu .dropdown-item:hover,
.header__submenu .dropdown-item:focus-visible,
.header__submenu .dropdown-item.active {
  background: rgba(139, 115, 85, 0.12) !important;
  color: var(--header-accent) !important;
}

.header__utils {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-inline-start: 0.65rem;
}

.header__util {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--companies-bg);
  text-decoration: none;
}

.header__util:hover {
  color: var(--header-accent);
}

.header__util-icon {
  width: 16px;
  height: 16px;
}

.header__search-wrap {
  position: relative;
}

.header__search-trigger {
  border: 0;
  background: transparent;
  padding: 0;
}

.header__search-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(300px, 85vw);
  border-radius: 12px;
  border: 1px solid rgba(63, 44, 52, 0.11);
  background: #fff;
  box-shadow: 0 14px 30px rgba(27, 19, 23, 0.12);
  padding: 0.7rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.2s ease;
  z-index: 1040;
}

.header__search-wrap.is-open .header__search-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.header__search-form {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.header__search-input {
  flex: 1;
  border: 1px solid rgba(63, 44, 52, 0.15);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 14px;
}

.header__search-input:focus {
  outline: none;
  border-color: var(--header-accent);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.2);
}

.header__search-submit {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--header-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header__close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--header-text);
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.header__close-btn:hover {
  color: var(--header-accent);
  background: rgba(63, 44, 52, 0.06);
}

.header__close-btn svg {
  width: 24px;
  height: 24px;
}

html[dir="rtl"] .header__close-btn {
  right: auto;
  left: 1rem;
}

.header__toggle {
  padding: 0.2rem 0.35rem;
}

.header__toggle:focus {
  box-shadow: none;
}

.header__overlay {
  display: none;
}

@media (max-width: 1199.98px) {
  .header__inner {
    min-height: 68px;
  }

  .header__logo-img {
    height: 40px;
  }

  .header__overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 12, 14, 0.28);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 1040;
  }

  .header__overlay.is-open {
    opacity: 1;
    visibility: visible;
  }

  .header__collapse {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 88vw);
    margin-top: 0;
    background: var(--header-bg);
    border-top: 0;
    border-inline-start: 1px solid rgba(63, 44, 52, 0.08);
    box-shadow: -10px 0 24px rgba(0, 0, 0, 0.12);
    padding: calc(var(--header-height) + 0.9rem) 1rem 1rem;
    overflow-y: auto;
    z-index: 1045;
  }

  .header__collapse .header__close-btn {
    display: inline-flex !important;
  }

  .header__collapse.collapse:not(.show) {
    display: none;
  }

  .header__collapse.show {
    display: block;
  }

  .header__collapse.collapsing {
    height: auto !important;
    display: block;
    transition: none;
  }

  .header__menu {
    align-items: stretch;
    gap: 0;
  }

  .header__menu .nav-item {
    border-bottom: 1px solid rgba(63, 44, 52, 0.06);
  }

  .header__link {
    padding: 0.9rem 0.1rem !important;
    /* font-size: 14px; */
  }

  .header__link:not(.dropdown-toggle)::after {
    left: 0;
    right: 92%;
    bottom: 8px;
  }

  .header .dropdown-menu {
    border: 0;
    box-shadow: none;
    padding: 0 0 0.35rem 0.9rem;
    margin-top: 0 !important;
    background: transparent;
  }

  .header .dropdown-item {
    border-radius: 6px;
    margin: 0.2rem 0;
    background: rgba(255, 255, 255, 0.42);
  }

  .header__utils {
    margin: 0.5rem 0 0;
    padding-top: 0.4rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }

  html[dir="rtl"] .header__collapse {
    right: auto;
    left: 0;
    border-inline-start: 0;
    border-inline-end: 1px solid rgba(63, 44, 52, 0.08);
    box-shadow: 10px 0 24px rgba(0, 0, 0, 0.12);
  }
}

html[dir="rtl"] .header__search-dropdown {
  right: auto;
  left: 0;
}

html[dir="rtl"] .header .dropdown-toggle::after {
  margin-left: 0;
  margin-right: 5px;
}

@media (min-width: 1200px) {
  .header__menu {
    margin-inline-start: 0.75rem;
  }

  .header__utils {
    margin-inline-start: 0.25rem;
  }
}
