/* =====================================================================
   header.css — объединённый файл шапки (moonshop).
   Содержит: общие/мобильные стили + десктоп (Layout 1 — Классика).
   Для сервера: заменяет раздельные header-common.css и header-layout-1.css.
   ===================================================================== */

/* =====================================================================
   ЧАСТЬ 1 — Общие / мобильные стили (header-common.css)
   ===================================================================== */

/* Только шапка магазина: не трогаем <header> модуля YooAI */
.main-wrapper > header {
  display: flex;
  position: fixed;
  width: 100%;
  min-height: 55px;
  left: 0;
  top: 0;
  background: #fff;
  padding: 14px 0;
  box-shadow: 0px 5px 20px 0px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.header-desktop__wrapper {
  display: none;
}

.header-maincatalog {
  display: none;
}

.header-mobile__wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-mobile__wrapper .logo {
  display: flex;
  max-width: 70px;
}

.mobile-searchbox {
  display: none;
}

.mobile-wrapper__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mob-opencatalog {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.mobile-wrapper__right {
  display: flex;
  align-items: center;
  gap: 22px;
}

.mob-headerbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  flex-direction: row;
  gap: 0;
  padding: 0;
  color: #3a3f47;
  font-size: 22px;
  line-height: 1;
  background: none;
  border: 0;
}
.mob-headerbtn i[class*=icon-] {
  font-size: inherit;
  color: inherit;
  line-height: 1;
  transition: color 0.12s linear;
}
.mob-headerbtn:hover i[class*=icon-] {
  color: var(--links);
}
.mob-headerbtn[data-counter] {
  position: relative;
}
.mob-headerbtn[data-counter]::after {
  position: absolute;
  content: attr(data-counter);
  top: -5px;
  right: -5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border-radius: 50%;
  background-color: var(--red);
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}
.mob-headerbtn[data-counter=""]::after,
.mob-headerbtn[data-counter="0"]::after {
  display: none;
  content: none;
}
.mobile-wrapper__right .account-box {
  display: flex;
  align-items: center;
}


.nav-mobile {
  display: none;
  transform: translate(-100%, 0);
  visibility: hidden;
  transition: all 0.2s linear;
}


ul.accountmenu {
  list-style: none;
  padding: 0;
}
ul.accountmenu li {
  display: flex;
  align-items: center;
  gap: 14px;
}
ul.accountmenu li:not(:last-child) {
  margin-bottom: 8px;
}
.mobile-accountmenu ul.accountmenu li a {
  padding: 7px 0;
  font-size: 16px;
  line-height: 1.3;
  color: #071d37;
  text-decoration: none;
}
ul.accountmenu li i.icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  width: 28px;
}
ul.accountmenu li i.icon[data-counter] {
  position: relative;
  z-index: 0;
}
ul.accountmenu li i.icon[data-counter]::after {
  position: absolute;
  content: attr(data-counter);
  top: -5px;
  right: -5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border-radius: 50%;
  background-color: var(--red);
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
}
ul.accountmenu li span a:not(:first-child) {
  color: #AFB4BF;
}

.mobile-contacts {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.header-hours p,
.header-address p,
.footer-address p {
  margin: 0;
}

.header-address {
  color: #636d7a;
  font-size: 14px;
  line-height: 1.45;
}
.footer-address {
  color: var(--ms-footer-muted, #EDEEE9);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
.footer-email {
  color: var(--ms-footer-link, #fff) !important;
}

.header-v2-phone-menu .header-address {
  margin: 10px 0 12px;
}

.header-v2-phone-menu .header-email {
  display: block;
  margin-bottom: 14px;
}

.footer-email {
  display: inline-block;
  margin-top: 8px;
  color: var(--ms-footer-link, var(--links, #3498DB));
  font-size: 14px;
  text-decoration: none;
}

.mobile-searchbox {
  position: absolute;
  display: block;
  left: 0;
  top: 100%;
  width: 100%;
  padding: 10px 16px;
  opacity: 0;
  visibility: hidden;
  transform: scaleY(0);
  transform-origin: 0 0;
  transition: all 0.12s ease-in;
  background: #fff;
}
.mobile-searchbox.opened {
  opacity: 1;
  visibility: visible;
  transform: scaleY(1);
  transition: all 0.12s ease-in;
}

/* Поисковая форма — базовый flex (мобильная версия) */
.search-form {
  position: relative;
  display: flex;
  align-items: stretch;
  border-radius: 8px;
  border: none;
  background: #fff;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #dadee7;
}
.search-form__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding-left: 12px;
  color: #afb4bf;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}
.search-form__icon i[class*=icon-] {
  font-size: inherit;
  line-height: 1;
}
.search-form input[type=search] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 10px 10px 8px;
  width: 100%;
  outline: none;
  border: none;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
  background: transparent;
}
.search-form input[type=search]::-moz-placeholder {
  color: var(--alt);
}
.search-form input[type=search]::placeholder {
  color: var(--alt);
}
.search-form button[type=submit] {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  margin: 0;
  border: 1px solid var(--ms-btn-bg, var(--links));
  border-radius: 0;
  background: var(--ms-btn-bg, var(--links));
  color: #fff;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.12s linear, border-color 0.12s linear;
}
.search-form button[type=submit]:hover {
  background-color: color-mix(in srgb, var(--ms-btn-bg, var(--links)) 84%, #000);
  border-color: color-mix(in srgb, var(--ms-btn-bg, var(--links)) 84%, #000);
}
.search-form button[type=submit] span {
  color: inherit;
}

@media screen and (min-width: 576px) {
  .main-wrapper > header {
    padding: 12px 0;
  }
  .header-mobile__wrapper {
    gap: 18px;
  }
  .mobile-wrapper__right {
    flex: 1;
  }
  .mobile-searchbox {
    display: flex;
    opacity: 1;
    visibility: visible;
    transform: none;
    position: static;
    padding: 0;
    width: 100%;
  }
  .mob-headerbtn {
    width: 36px;
    height: 36px;
    font-size: 22px;
  }
  .mob-headerbtn.mob-opensearch {
    display: none;
  }
  .mob-headerbtn[data-counter]::after {
    top: 0px;
    right: -5px;
  }
  .mob-opencatalog {
    font-size: 17px;
  }
  .mobile-wrapper__left {
    gap: 30px;
  }
  .header-mobile__wrapper .logo {
    max-width: 90px;
  }
  .header-mobile__wrapper .logo img {
    width: 100%;
    height: 100%;
  }

  .search-form {
    width: 100%;
  }
}


/* =====================================================================
   ЧАСТЬ 2 — Десктоп Layout 1 / Классика (header-layout-1.css)
   ===================================================================== */

@media screen and (min-width: 992px) {
  .main-wrapper > header {
    position: relative;
    padding: 29px 0;
    box-shadow: none;
    border-bottom: 1px solid #ECEEF2;
    z-index: initial;
    margin-bottom: 28px;
  }
  header.header-simple {
    position: fixed;
    background: #F6F7FA;
    box-shadow: 0px 5px 20px 0px rgba(0, 0, 0, 0.15);
    padding: 18px 0;
    z-index: 1000;
  }
  header.header-simple nav#top {
    display: none;
  }
  header.header-simple .search-vars {
    min-width: -moz-fit-content;
    min-width: fit-content;
  }
  header.header-simple .header-top {
    margin: 0;
  }
  header.header-simple .header-top__opts {
    display: none;
  }
  header.header-simple .header-menu {
    display: none;
  }
  header.header-simple .header-desktop__wrapper {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  header.header-simple .header-desktop__rightinf {
    display: none;
  }
  header.header-simple .header-top__contact {
    margin: 0;
  }
  header.header-simple .header-desktop__inner {
    width: 100%;
    display: flex;
    align-items: center;
  }
  header.header-simple .header-contacts {
    padding-bottom: 0;
  }
  header.header-simple .header__container {
    max-width: 1844px;
  }
  header.header-simple .button-acc span {
    display: none;
  }
  header.header-simple .header-middle {
    width: 100%;
    align-items: center;
  }
  header.header-simple .header-search.desktop-searchbox {
    max-width: inherit;
  }
  header.header-simple .header-middle__right {
    align-items: center;
  }
  header.header-simple .button-acc[data-counter]::after {
    right: -8px;
  }
  header.header-simple .header-contacts .button-callback {
    display: none;
  }
  header.header-simple .header-top .logo {
    margin-right: 44px;
    width: var(--ms-logo-header-w, 95px);
    height: var(--ms-logo-header-h, 42px);
  }
  header.header-simple .header-maincatalog {
    width: calc(100% - 210px);
  }
  .header-mobile__wrapper {
    display: none;
  }
  /* Обёртка: logo + inner + right contact info */
  .header-desktop__wrapper {
    display: flex;
    flex-direction: row;
    align-items: stretch; /* правая колонка тянется по высоте left+меню */
    gap: 48px;
  }
  /* Основная часть растягивается, правый блок — фиксирован */
  .header-desktop__inner {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }
  /* Правая колонка: НЕ fit-content — длинный адрес раздувает её до 750px+
     и сжимает поиск. Фиксируем потолок ширины. */
  .header-desktop__rightinf {
    flex: 0 0 auto;
    max-width: 280px;
    width: auto;
    display: flex;
    flex-direction: column;
    padding-top: 0px;
    margin-left: 0;
    align-items: flex-end;
  }
  .header-desktop__rightinf .header-address {
    max-width: 100%;
    text-align: right;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  .header-desktop__rightinf .header-email {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .header-desktop__rightinf .button-callback {
    margin-top: auto;
  }
  .header-desktop__rightinf .soc-list {
    justify-content: flex-end;
    margin-bottom: 10px;
  }
  .header-top {
    display: flex;
    margin-bottom: 20px;
    align-items: center;
  }
  .header-top .logo {
    margin-right: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    width: var(--ms-logo-header-w, 145px);
    height: var(--ms-logo-header-h, 71px);
  }
  .header-top .logo img {
    display: block;
    width: var(--ms-logo-header-img-w, 100%);
    height: var(--ms-logo-header-img-h, 100%);
    object-fit: contain;
    object-position: left center;
  }
  .header-topmenu {
    flex: 1 282px;
  }
  .header-topmenu > ul > li:hover > a {
    text-decoration: none;
    color: var(--links);
  }
  /* Только корневой список — иначе flex ломает ul внутри dropdown */
  .header-topmenu > ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
  }
  .header-topmenu > ul > li {
    padding-bottom: 10px;
    margin-bottom: -10px;
  }
  .header-topmenu > ul > li > a {
    color: #000;
    font-size: 16px;
    font-weight: 400;
    line-height: 18px;
  }
  .header-topmenu > ul > li:hover > a {
    text-decoration-color: inherit;
    transition: all 0.12s linear;
  }
  /* Компактный dropdown верхней полосы (не mega из forms.css) */
  .header-topmenu > ul > li.dropdown {
    padding-right: 18px;
  }
  .header-topmenu > ul > li.dropdown > .dropdown-menu {
    min-width: 180px;
    width: max-content;
    max-width: 320px;
    padding: 8px 0;
    top: calc(100% + 6px);
    font-size: 14px;
  }
  .header-topmenu > ul > li.dropdown:hover > .dropdown-menu {
    top: calc(100% + 6px);
  }
  .header-topmenu > ul > li.dropdown > .dropdown-menu .dropdown-inner {
    display: block;
    width: auto;
  }
  .header-topmenu > ul > li.dropdown > .dropdown-menu .dropdown-inner > ul {
    display: block;
    width: auto;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .header-topmenu > ul > li.dropdown > .dropdown-menu .dropdown-inner > ul > li {
    padding: 0;
    margin: 0;
    width: auto;
    min-width: 100%;
  }
  .header-topmenu > ul > li.dropdown > .dropdown-menu .dropdown-inner > ul > li > a {
    display: block;
    padding: 8px 16px;
    color: #000;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    text-decoration: none;
  }
  .header-topmenu > ul > li.dropdown > .dropdown-menu .dropdown-inner > ul > li:hover > a {
    color: var(--links);
    background: rgba(0, 0, 0, 0.04);
  }
  .header-top__opts {
    display: flex;
    align-items: flex-start;
    gap: 10px 22px;
    margin-right: 52px;
  }
  .header-top__opts .btn-group {
    display: flex;
  }
  .header-top__opts .btn-group.open .btn > span,
  .header-top__opts .btn-group:hover .btn > span {
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: all 0.12s linear;
  }
  .header-top__opts .btn-group > .btn {
    padding: 0;
    color: var(--links);
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
    border: none;
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
  }
  .header-top__opts .btn-group > .btn i.icon {
    font-size: 6px;
  }
  .header-top__opts .btn-group > .btn span {
    transition: all 0.12s linear;
  }
  .header-top__contact {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-bottom: 20px;
  }
  .header-top__contact > span,
  .header-top__contact .header-hours {
    color: #000;
    text-align: right;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
  }

  /* Поисковая форма — десктоп (переопределяет мобильный базис) */
  .search-form {
    position: relative;
    display: flex;
    align-items: stretch;
    background: #fff;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px #dadee7;
    overflow: hidden;
  }
  .search-form__icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding-left: 16px;
    font-size: 16px;
    color: #afb4bf;
    pointer-events: none;
  }
  .search-form input[type=search] {
    flex: 1 1 auto;
    min-width: 0;
    padding: 13px 12px 13px 10px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
    background: transparent;
  }
  .search-form button[type=submit] {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    font-size: 16px;
    background-color: var(--links);
    color: #fff;
    border: none;
    border-radius: 0;
    white-space: nowrap;
    transition: background-color 0.12s linear;
  }
  .search-form button[type=submit]:hover {
    background-color: #2b85c0;
  }
  .search-form button[type=submit] span {
    color: inherit;
  }

  #form-currency:hover,
  #form-language:hover {
    cursor: pointer;
  }
  #form-currency:hover .dropdown-menu,
  #form-language:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
  }
  #form-currency:hover span.current span,
  #form-language:hover span.current span {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  #form-currency span.current,
  #form-language span.current {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
  }
  #form-currency span.current > span,
  #form-language span.current > span {
    padding: 0;
    color: var(--links);
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
  }
  #form-currency .dropdown-menu,
  #form-language .dropdown-menu {
    position: absolute;
    display: block;
    left: auto;
    right: 0;
    top: calc(100% + 8px);
    width: max-content;
    min-width: 100%;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    animation: displayAnim 0.2s ease;
    z-index: 1100;
  }
  .header-middle {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    min-width: 0;
  }
  /* Средняя строка: кнопка каталога + поиск + иконки */
  .header-middle__left {
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
    gap: 24px;
  }
  .header-middle__right {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 50px;
  }
  .header-top__row {
    display: flex;
    gap: 84px;
  }
  .header-options {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    margin-left: 14px;
  }
  .header-contacts {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
    margin-top: auto;
  }
  button.open-catalog {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    background-color: var(--ms-catalog-bg, var(--links));
    color: var(--ms-catalog-text, #fff);
    border-radius: 5px;
    padding: 15px 26px;
    transition: background-color 0.12s linear, filter 0.12s linear;
  }
  button.open-catalog::before {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 18px;
    font-family: "icons";
    content: "\e920";
    transition: all 0.12s linear;
  }
  button.open-catalog span {
    font-size: 17px;
    line-height: 1;
    font-weight: bold;
  }
  button.open-catalog.opened {
    z-index: 1000;
  }
  button.open-catalog.opened::before {
    content: "\e91d";
    transition: all 0.12s linear;
  }
  button.open-catalog:hover {
    filter: brightness(0.92);
  }
  /* Контейнер поиска — basis=0 + min-width чтобы не схлопнулся */
  .header-search.desktop-searchbox {
    flex: 1 1 0;
    min-width: 180px;
    position: relative;
  }
  .header-search.desktop-searchbox.opened .search-form {
    z-index: 1000;
  }
  .search-vars {
    display: none;
    opacity: 0;
    visibility: hidden;
  }
  /* Категории — полная ширина под шапкой */
  .header-menu {
    margin-top: 20px;
  }
  .header-menu .navbar {
    min-height: initial;
    border: none;
    margin: 0;
    border-radius: 0;
  }
  .header-menu .navbar::before,
  .header-menu .navbar::after {
    display: none;
  }
  .header-menu .navbar .dropdown {
    padding-right: 18px;
  }
  .header-menu .navbar ul.nav.navbar-nav {
    display: flex;
    flex-wrap: wrap;
    float: none;
    gap: 14px 30px;
  }
  .header-menu .navbar ul.nav.navbar-nav::before,
  .header-menu .navbar ul.nav.navbar-nav::after {
    display: none;
  }
  .header-menu .navbar ul.nav.navbar-nav > li {
    padding-bottom: 10px;
    margin-bottom: -10px;
    float: none;
  }
  /* 50% считается по всей высоте пункта, включая padding-bottom — шеврон уезжает вниз */
  .header-menu .navbar ul.nav.navbar-nav > li.dropdown::after {
    top: calc(50% - 5px);
  }
  .header-menu .navbar ul.nav.navbar-nav > li > .dropdown-menu {
    border-radius: 8px;
  }
  .header-menu .navbar ul.nav.navbar-nav > li > .dropdown-menu .dropdown-inner ul {
    gap: 0;
  }
  .header-menu .navbar ul.nav.navbar-nav > li > .dropdown-menu .dropdown-inner ul li a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: transparent;
  }
  .header-menu .navbar ul.nav.navbar-nav > li > .dropdown-menu .dropdown-inner ul li:hover > a {
    text-decoration-color: inherit;
    transition: all 0.12s linear;
  }
  /* Шеврон (↓) в навигации категорий — вертикальное выравнивание */
  .header-menu .navbar ul.nav.navbar-nav > li > a {
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
  }
  .header-menu .navbar .nav > li > a:focus,
  .header-menu .navbar .nav > li > a:hover {
    background-color: transparent;
  }
  body:has(.header-simple) .header__container {
    position: relative;
  }
}

@media screen and (min-width: 1280px) {
  header.header-simple .header-desktop__rightinf {
    display: flex;
    padding: 0;
    flex-direction: row;
    align-items: center;
    gap: 30px;
  }
  header.header-simple .header-desktop__rightinf .phone-link {
    font-size: 15px;
  }
  header.header-simple .header-desktop__rightinf .phone-link:last-child {
    margin-bottom: 0;
  }
  header.header-simple .header-desktop__rightinf .soc-list {
    margin: 0;
  }
  header.header-simple .header-desktop__rightinf .button-callback {
    display: none;
  }
  .header-top {
    align-items: center;
  }
  .header-top .logo {
    margin-right: 70px;
  }
  .header-top__contact > span,
  .header-top__contact .header-hours {
    font-size: 15px;
  }
  .header-topmenu > ul {
    gap: 10px 36px;
  }
  .header-middle {
    gap: 44px;
  }
  .header-middle__left {
    gap: 30px;
  }
  .header-top__row {
    display: flex;
    align-items: center;
    gap: 106px;
  }
  .header-menu .navbar ul.nav.navbar-nav {
    gap: 14px 30px;
  }
  .header-menu .navbar ul.nav.navbar-nav > li > a {
    padding: 0;
    display: flex;
    font-size: 17px;
  }
  .header-desktop__rightinf {
    padding-top: 25px;
    margin-left: 0;
  }
  .header-desktop__rightinf .button-callback {
    margin-top: auto;
  }
}

@media screen and (min-width: 1600px) {
  .search-vars {
    min-width: inherit;
  }
}
