/**
 * Шапка в стиле старого сайта (header-legacy)
 * Фон: замените путь на свой в .inner, если нужен фон со специями (например /upload/header-bg.jpg)
 */
#subHeader2 {
  border: none;
  min-height: 0;
  background: #fff;
}

#subHeader2 .header-legacy {
  border: none;
  background: #fff;
  min-height: 0;
}

#subHeader2 .header-legacy .inner {
  background-color: #fff;
  background-image: url(/images/header/header-bg.jpg);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  display: flex;
  min-height: 259px;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
}

/* При сжатии экрана больше 50% (ширина < 960px) убираем фон шапки */
@media (max-width: 960px) {
  #subHeader2 .header-legacy .inner {
    background-image: none;
  }
}

#subHeader2 .header-legacy .inner .left {
  padding: 2em 1em;
  position: relative;
}

#subHeader2 .header-legacy .inner .left .logo-link {
  background-image: url(/images/header/logo-market.svg);
  background-position: left center;
  background-repeat: no-repeat;
  background-size: contain;
  display: block;
  height: 62px;
  width: 280px;
  max-width: 100%;
  text-indent: -9999px;
  overflow: hidden;
}

#subHeader2 .header-legacy .inner .left .title {
  color: #565656;
  display: inline-block;
  font-family: "Lato", "Helvetica Neue", sans-serif;
  font-size: 30px;
  font-weight: 300;
  margin: 0.25em 0;
  line-height: 1.3;
}

#subHeader2 .header-legacy .inner .left .sticker.sticker-since2003 {
  background: url(/images/header/header-begin-date.svg) center center no-repeat;
  background-size: contain;
  display: inline-block;
  height: 81px;
  width: 81px;
  position: relative;
  top: 0.5em;
  left: 0.5em;
  vertical-align: middle;
}

/* Правая колонка — контакты */
#subHeader2 .header-legacy .inner .right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.5em 1.25em 1.5em 0.5em;
  text-align: right;
}

#subHeader2 .header-legacy .inner .right .item {
  border-bottom: solid 1px #eee;
  color: #565656;
  font-family: "Lato", "Helvetica Neue", sans-serif;
  font-size: 16px;
  padding: 0 1.25em 0 0.5em;
}

#subHeader2 .header-legacy .inner .right .item:last-child {
  border-bottom: none;
}

#subHeader2 .header-legacy .inner .right .item.item-phone {
  line-height: 3em;
}

#subHeader2 .header-legacy .inner .right .item.item-phone a {
  font-family: "Lato", "Helvetica Neue", sans-serif;
  font-size: 24px;
  color: #565656;
  text-decoration: none;
  transition: color 0.2s ease;
  cursor: pointer;
}

#subHeader2 .header-legacy .inner .right .item.item-phone a:hover {
  color: #d1844f;
  text-decoration: underline;
}

#subHeader2 .header-legacy .inner .right .item.item-messengers {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: auto;
  max-width: 14em;
  margin-left: auto;
  margin-right: 30px;
  gap: 20px;
  flex-wrap: nowrap;
  padding-right: 0;
  box-sizing: border-box;
}

#subHeader2 .header-legacy .inner .right .item.item-messengers .contact__info_link-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  text-decoration: none;
}

#subHeader2 .header-legacy .inner .right .item.item-messengers .contact__info_link-social svg,
#subHeader2 .header-legacy .inner .right .item.item-messengers .contact__info_link-social img {
  width: 26px;
  height: 26px;
  display: block;
}

#subHeader2 .header-legacy .inner .right .item.item-shipping {
  line-height: 3em;
}

#subHeader2 .header-legacy .inner .right .item.item-worktime {
  line-height: 24px;
  padding-top: 0.5em;
}

#subHeader2 .header-legacy .inner .right .item.item-worktime p {
  margin: 0.15em 0 0 0;
  font-weight: normal;
}

/* Иконки в правой колонке */
#subHeader2 .header-legacy .inner .right .item i.icon {
  background-position: center center;
  background-repeat: no-repeat;
  display: inline-block;
  position: relative;
  top: 6px;
  margin: 0 0.5em 0 0;
  vertical-align: middle;
}

#subHeader2 .header-legacy .inner .right .item.item-shipping i.icon {
  top: 7px;
}

#subHeader2 .header-legacy i.icon.icon-phone {
  width: 22px;
  height: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23AEAEAE'%3E%3Cpath d='M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z'/%3E%3C/svg%3E");
  background-size: contain;
}

#subHeader2 .header-legacy i.icon.icon-shipping {
  width: 25px;
  height: 25px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Cpath fill='%23AEAEAE' d='M47.4 2.2c-1.9-1.9-5.1-1.4-7 0.4l-9.5 9.5L13.2 5.5c-1.7-.4-3.4-1-5.5 1.1-1.1 1.1-3.3 3.3 0 6.6l12.1 9.9-7.9 7.9-7.4-1.8c-1.1-.3-1.8-.1-2.4.6-.3.4-2.3 1.9-.9 3.3l8.6 6.7 6.7 8.6c1 1 2 0.4 3.3-.9.8-.8.7-1.3.4-2.5l-1.7-7.3 7.8-7.9 9.9 12.1c3.3 3.3 5.5 1.1 6.6 0 2.1-2.1 1.5-3.8 1.1-5.5l-6.5-17.7 9.5-9.5c1.4-1.4 1.8-4.6 0-6.4z'/%3E%3C/svg%3E");
  background-size: contain;
}

#subHeader2 .header-legacy i.icon.icon-worktime {
  width: 25px;
  height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Cpath fill='%23AEAEAE' d='M39.9 4.6c-7.1-4-16.2-1.6-20.3 5.3l-6 10.1L2.5 27.1l11.6 6.5c-2.1 3.5-.8 7.9 2.7 9.9 3.6 2 8.1.8 10.2-2.7l11.6 6.5.8-13 6-10.1C49.4 17.5 47 8.6 39.9 4.6z'/%3E%3C/svg%3E");
  background-size: contain;
}

/* Строка с поиском и корзиной под старой шапкой */
#subHeader2 .header-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid #eee;
  background: #fff;
  flex-wrap: nowrap;
  min-width: 0;
}

/* Поле поиска сжимается при нехватке места, корзина всегда видна */
#subHeader2 .header-tools-search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 600px;
}

#subHeader2 .header-tools-search .searchContainer,
#subHeader2 .header-tools-search .searchContainerInner,
#subHeader2 .header-tools-search #topSearch2 .searchContainer,
#subHeader2 .header-tools-search #topSearch2 .searchContainerInner,
#subHeader2 .header-tools-search input[type="text"] {
  min-width: 0 !important;
  max-width: 100% !important;
}

#subHeader2 .header-tools-cart {
  flex: 0 0 auto;
  min-width: 56px;
}

/* Форма поиска по каталогу — светло-зелёный фон для привлечения внимания */
#subHeader2 .header-tools #topSearch2 .searchContainerInner,
#subHeader2 .header-tools #topSearch2 #searchQuery,
#subHeader2 .header-tools #topSearch2 .searchContainer,
#subHeader2 .header-tools .header-search-in-column2 .searchContainer,
#subHeader2 .header-tools .header-search-in-column2 .searchContainerInner,
#subHeader2 .header-tools input[type="text"] {
  background-color: #e8f5e9 !important;
  border-color: #a5d6a7 !important;
}
#subHeader2 .header-tools #topSearch2 #searchQuery::placeholder {
  color: #2e7d32;
  opacity: 0.85;
}

/* Адаптив: контакты всегда справа вверху, на мобильной — белый фон для читаемости */
@media (max-width: 900px) {
  #subHeader2 .header-legacy .inner {
    flex-direction: row;
    align-items: flex-start;
    min-height: 0;
    padding: 1em;
    background-position: 75% 55%;
  }

  #subHeader2 .header-legacy .inner .left {
    flex: 1 1 auto;
    min-width: 0;
  }

  #subHeader2 .header-legacy .inner .right {
    flex: 0 0 auto;
    padding: 0.75em 1em;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }

  /* На мобильной скрыть «Доставка по всей России» и «Режим работы» */
  #subHeader2 .header-legacy .inner .right .item.item-shipping,
  #subHeader2 .header-legacy .inner .right .item.item-worktime {
    display: none !important;
  }
}

/* На узких экранах — логотип и слоган слева, телефон и мессенджеры в правый верхний угол; лого и слоган увеличены в 1.2 раза */
@media (max-width: 768px) {
  #subHeader2 .header-legacy .inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5em;
    padding: 1em;
    min-height: 0;
    position: relative;
  }

  #subHeader2 .header-legacy .inner .left {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5em 0;
    padding-right: 1em;
    margin-right: 140px;
  }

  #subHeader2 .header-legacy .inner .left .logo-link {
    height: 32px;
    width: 150px;
  }

  #subHeader2 .header-legacy .inner .left .title {
    font-size: 12px;
    line-height: 1.2;
    margin: 0.15em 0;
  }

  #subHeader2 .header-legacy .inner .left .sticker.sticker-since2003 {
    height: 36px;
    width: 36px;
    top: 0.25em;
    left: 0.25em;
  }

  #subHeader2 .header-legacy .inner .right {
    position: absolute;
    top: calc(0.5em + 10px);
    right: calc(0.5em - 5px);
    flex: none;
    padding: 0.35em 0.45em;
    text-align: right;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transform: scale(0.8);
    transform-origin: top right;
  }

  #subHeader2 .header-legacy .inner .right .item.item-phone a {
    font-size: 18px;
  }
  #subHeader2 .header-legacy .inner .right .item.item-messengers .contact__info_link-social svg,
  #subHeader2 .header-legacy .inner .right .item.item-messengers .contact__info_link-social img {
    width: 22px !important;
    height: 22px !important;
  }

  /* Поиск по каталогу магазина: сдвиг влево 20px, уменьшен в 1.3 раза, надпись по центру */
  #subHeader2 .header-tools {
    padding: 5px 0;
    overflow: visible;
  }
  #subHeader2 .header-tools-search {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
    margin-left: -20px;
  }
  #subHeader2 .header-tools-search .searchContainer,
  #subHeader2 .header-tools #topSearch2 .searchContainer {
    display: flex !important;
    max-width: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    table-layout: auto !important;
  }
  #subHeader2 .header-tools-search .searchContainerInner,
  #subHeader2 .header-tools #topSearch2 .searchContainerInner {
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 4px 6px 4px 12px !important;
    border-radius: 18px !important;
    box-sizing: border-box;
    overflow: visible;
    height: auto !important;
  }
  #subHeader2 .header-tools-search .searchColumn,
  #subHeader2 .header-tools #topSearch2 .searchColumn {
    display: flex !important;
    align-items: center !important;
    vertical-align: middle;
  }
  #subHeader2 .header-tools-search .searchColumn:first-child,
  #subHeader2 .header-tools #topSearch2 .searchColumn:first-child {
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }
  #subHeader2 .header-tools-search .searchColumn:last-child,
  #subHeader2 .header-tools #topSearch2 .searchColumn:last-child {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 42px !important;
  }
  #subHeader2 .header-tools-search input[type="text"],
  #subHeader2 .header-tools #topSearch2 #searchQuery {
    font-size: 12px !important;
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 42px 0 32px !important;
    line-height: 26px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    border-radius: 15px !important;
    text-align: center !important;
    background-position: 10px center !important;
    background-size: 14px 14px !important;
  }
  #subHeader2 .header-tools #topSearch2 #searchQuery::placeholder {
    font-size: 12px !important;
    opacity: 0.9;
  }
  #subHeader2 .header-tools-search #goSearch,
  #subHeader2 .header-tools #topSearch2 #goSearch {
    min-height: 26px !important;
    height: 26px !important;
    width: 42px !important;
    min-width: 42px !important;
    flex-shrink: 0 !important;
    background-position: center center !important;
    background-size: 20px 20px !important;
  }
}

@media (max-width: 560px) {
  #subHeader2 .header-legacy .inner {
    background-position: 80% 60%;
  }

  #subHeader2 .header-legacy .inner .left .title {
    font-size: 12px;
  }

  #subHeader2 .header-legacy .inner .right {
    padding: 0.35em 0.45em;
    top: calc(0.5em + 10px);
    right: calc(0.5em - 5px);
  }
  #subHeader2 .header-legacy .inner .right .item.item-phone a {
    font-size: 18px;
  }
  #subHeader2 .header-legacy .inner .right .item.item-messengers .contact__info_link-social svg,
  #subHeader2 .header-legacy .inner .right .item.item-messengers .contact__info_link-social img {
    width: 22px !important;
    height: 22px !important;
  }

  #subHeader2 .header-tools {
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
  }

  #subHeader2 .header-tools-search {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    margin-left: -20px;
  }
  #subHeader2 .header-tools-search .searchContainer,
  #subHeader2 .header-tools #topSearch2 .searchContainer {
    display: flex !important;
  }
  #subHeader2 .header-tools-search .searchContainerInner,
  #subHeader2 .header-tools #topSearch2 .searchContainerInner {
    padding: 4px 6px 4px 12px !important;
    border-radius: 18px !important;
    overflow: visible;
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
  }
  #subHeader2 .header-tools-search .searchColumn:first-child,
  #subHeader2 .header-tools #topSearch2 .searchColumn:first-child {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  #subHeader2 .header-tools-search .searchColumn:last-child,
  #subHeader2 .header-tools #topSearch2 .searchColumn:last-child {
    flex: 0 0 auto !important;
    min-width: 42px !important;
  }
  #subHeader2 .header-tools-search input[type="text"],
  #subHeader2 .header-tools #topSearch2 #searchQuery {
    font-size: 12px !important;
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 42px 0 32px !important;
    line-height: 26px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    border-radius: 15px !important;
    text-align: center !important;
    background-position: 10px center !important;
    background-size: 14px 14px !important;
  }
  #subHeader2 .header-tools-search #goSearch,
  #subHeader2 .header-tools #topSearch2 #goSearch {
    min-height: 26px !important;
    height: 26px !important;
    width: 42px !important;
    min-width: 42px !important;
    flex-shrink: 0 !important;
    background-position: center center !important;
    background-size: 20px 20px !important;
  }
}
