@media (max-width: 768.99px) {

  /* 1) Скрываем десктопные блоки */
  .header__bar,
  .favorite_header,
  .header__cart {
    display: none !important;
  }

  header, .header__inner {
    background: linear-gradient(0deg, #111 20%, #081549 80%);
  }
  /* 2) Делаем контейнер .header__inner невысоким */
  .header__inner {
    position: relative;
    max-height: 65px; /* компактная высота (можно 50px) */
    overflow: visible;
  }
  /* Логотип по центру, иконки слева/справа */
  .header__logo {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
  }
  .header__logo img {
    height: 24px; 
    width: auto;
  }

  .mobile-burger, .mobile-search-icon, .mobile-menu-header__close, .mobile-nav__item i {
    background: linear-gradient(266.26deg, #008fee 20%, #000aff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  /* Бургер слева */
  .mobile-burger {
    position: absolute;
    top: 50%; left: 10px;
    transform: translateY(-50%);
    display: block;
  }
  .mobile-burger button, .mobile-search-icon button {
    background: none;
  }
  .mobile-burger button, .mobile-search-icon button, .mobile-menu-header__close {
    border: none;
    font-size: 24px;
    cursor: pointer;
  }

  /* Лупа справа */
  .mobile-search-icon {
    position: absolute;
    top: 50%; right: 10px;
    transform: translateY(-50%);
    display: block;
  }

  /* 3) Поиск (изначально скрыт) */
  .header__search {
    display: none;
    width: 100%;
    background: linear-gradient(0deg, #081549 20%, #111 80%);
    padding: 10px; 
    box-sizing: border-box;
    /* overflow: visible — чтобы live_search не обрезалось */
    overflow: visible;
    z-index: 999999;
  }
  /* При открытом поиске (класс на body) */
  body.mobile-search-open .header__search {
    display: block;
    border-radius: 12px;
    margin: 20px 0 0 0;
    box-shadow: 4px 5px 4px #000aff;
  }

  .header__search .search_form .input-group {
      width: 100%;
  }
  
  /* 4) Мобильное меню (выезжает слева) */
  #mobile-menu-header {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 50%;
    background: linear-gradient(90deg, #111 20%, #081549 100%);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999999;
    overflow-y: auto;
    padding: 20px;
  }
  #mobile-menu-header.active {
    transform: translateX(0);
  }
  .mobile-menu-backdrop {
    display: none;
  }
  body.menu-open .mobile-menu-backdrop {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100000;
    cursor: pointer;
    background: transparent;
  }
  body.menu-open .header__inner {
    position: relative;
    z-index: 100010;
  }
  .mobile-menu-header__close {
    position: absolute;
    top: 10px; right: 10px;
  }
  .mobile-menu-header-inner {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
  }
  .mobile-menu-header-inner a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    padding: 10px 0;
    border-bottom: 1px solid #333;
  }

  /* 5) Блюрим остальной контент (кроме шапки и меню) */
  body.menu-open > *:not(#mobile-menu-header):not(header) {
    filter: blur(4px);
    transition: filter 0.3s ease;
  }
  .fixed-mobile-btn-primary {
    position: fixed !important;
    font-size: 24px;
    min-height: 60px;
    left: 2.5%; /* Центрируем кнопку */
    right: auto;
    z-index: 9999;
    width: 95vw !important; /* Ширина кнопки - 95% от ширины экрана */
    box-sizing: border-box; /* Учитываем паддинги и границы */
    display: flex !important; /* Для выравнивания содержимого */
    justify-content: center !important; /* Центрируем содержимое кнопки по горизонтали */
    align-items: center !important; /* Центрируем содержимое кнопки по вертикали */
    text-align: center !important; /* Центрируем текст */
    border: none;
    box-shadow: 0px 0px 0 5px #000aff3d;
    background: linear-gradient(180deg, #008fee 0%, #000aff 100%);
    margin-top: 0 !important;
    margin-bottom: -5px !important;
    transition: font-size 0.3s ease-in-out, box-shadow 0.3s ease-in-out !important;
}
.fixed-mobile-btn-primary:hover {
  font-size: 27px;
  box-shadow: 0px 0px 0 8px #000aff3d;
}
/* Базовые стили для initial-button */
.initial-button {
  transition: opacity 0.3s ease;
  opacity: 1;
  visibility: visible;
}

/* Класс для скрытия кнопки */
.hidden-fixed-button {
  opacity: 0 !important;
  visibility: hidden !important;
}

  /* Скрытие иконок в кнопках btn-primary в мобильной версии */
  .btn-primary img {
    display: none;
  }

  /* Стили для футера на мобильных устройствах */
  .footer__top .wrapper {
    flex-direction: column;
  }
  
  .footer__top-left {
    width: 100%;
    margin: 20px 0 40px 0;
    padding: 0;
    text-align: left;
  }
  
  .footer-logo-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center;
  }
  
  .footer-logo-container .footer__top-right {
    margin: 0;
    padding: 0;
    list-style: none;
    width: auto !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
  }
  
  .footer-logo-container img {
    margin: 0 auto;
  }

  /* Добавляем отступ снизу для пунктов меню в футере */
  .footer__avg {
    padding-bottom: 85px !important; /* Высота мобильного меню + отступ */
  }

}

  .mobile-menu-footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: linear-gradient(0deg, rgba(26, 25, 25, 0.96) 20%, rgba(8, 21, 73, 0.96) 80%);
    z-index: 10000;
  }
  .mobile-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 0;
  }
  .mobile-nav__item {
    text-align: center;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
  }
  .mobile-nav__item i {
    display: block;
    font-size: 22px;
    margin-bottom: 5px;
  }
  .mobile-nav__item span {
    font-size: 13px;
    color: #fff;
  }
  #TalkMe-container {
    display: none; /* Скрыт по умолчанию */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999; /* Поверх всех элементов */
    background-color: rgba(0, 0, 0, 0.8); /* Затемнение */
}
#closeChat {
  opacity: 0; /* Плавное скрытие */
  display: block;
  position: fixed;
  width: 20px;
  top: 15px;
  right: 20px;
  z-index: 10000 !important; /* Поверх всех элементов */
  font-size: 1.5em;
  color: white;
  cursor: pointer;
  background: none;
  border: none;
  transition: opacity 0.3s; /* Эффект плавного появления */
}

@media (min-width: 769px) {

  /* Прячем мобильные элементы */
  .mobile-burger,
  .mobile-search-icon,
  #mobile-menu-header,
  .mobile-menu-backdrop,
  .mobile-menu-footer {
    display: none !important;
  }
  .header__search {
    display: block; 
    overflow: visible;
  }
}

/* Колоночная компоновка для экранов ≤380px */
@media (max-width: 380px) {
  .product-item__overlay_search {
      flex-direction: column;
      align-items: flex-start;
      gap: 8px;
  }
  
  .q_link .product-item__overlay_search {
      align-items: center; 
      flex-direction: row;
  }
  
  .product-item__content_search {
      width: 100%;
  }
  
  .product-item__title_search {
      flex: 1;
      margin-right: 0; /* Убираем правый отступ в колоночной компоновке */
      max-width: none; /* Убираем ограничение в колоночной компоновке */
  }
  
  .product-item__right_search {
      width: 100%;
      justify-content: flex-start; /* Выравниваем лейбл по левому краю */
      gap: 6px;
  }
}

/* Промежуточные размеры экрана - сохраняем горизонтальную компоновку */
@media (max-width: 576px) and (min-width: 401px) {
  .product-item_search a {
    padding: 12px 15px;
  }
  
  .product-item__content_search i {
    font-size: 11px;
    flex-shrink: 0;
  }
  
  .product-item__title_search {
    font-size: 15px;
    margin-right: 12px; /* Уменьшаем отступ на средних экранах */
    max-width: calc(100% - 22px); /* Ограничиваем с учетом иконки */
  }
  
  .product-item__right_search {
    gap: 10px; /* Уменьшаем gap на средних экранах */
  }
  
  .product-item__right_search .catalog-card__lable {
    font-size: 11px;
    padding: 3px 7px;
  }
}

@media(max-width: 450px){
  body.mobile-search-open .header__search {
    margin-left: 0;
    margin-right: 0;
  }
  
  .header__search {
    padding: 0;
  }
  
  .header__search .live_search {
    left: 0;
    right: 0;
    width: 100%;
    margin: 7px 0 0 0;
  }
  
  .product-item_search a {
    padding: 12px 12px;
  }
  
  .q_link a {
      padding: 8px 12px; 
  }
  
  .product-item__content_search i {
    font-size: 11px;
  }
  
  .product-item__title_search {
    font-size: 14px;
    margin-right: 10px; /* Уменьшаем отступ на маленьких экранах */
    max-width: calc(100% - 20px); /* Уменьшаем с учетом иконки */
  }
  
  .product-item__right_search {
    gap: 8px; /* Уменьшаем gap на маленьких экранах */
  }
  
  .product-item__right_search .catalog-card__lable {
    font-size: 11px;
    padding: 3px 7px;
  }
}

/* Очень маленькие экраны ≤400px */
@media(max-width: 400px){
  .product-item_search a {
    padding: 10px 8px;
  }
  
  .q_link a {
      padding: 8px; 
  }
  
  .product-item__content_search i {
    font-size: 10px;
    flex-shrink: 0; /* Иконка не сжимается */
  }
  
  .product-item__title_search {
    font-size: 13px;
    margin-right: 8px;
    max-width: calc(100% - 18px); /* Еще меньше для иконки */
  }
  
  .product-item__right_search {
    gap: 6px;
  }
  
  .product-item__right_search .catalog-card__lable {
    font-size: 10px;
    padding: 2px 5px;
  }
}

/* Экстремально маленькие экраны ≤350px */
@media(max-width: 350px){
  .product-item_search a {
    padding: 8px 6px;
  }
  
  .product-item__content_search {
    gap: 8px;
  }
  
  .product-item__title_search {
    font-size: 12px;
    margin-right: 6px;
    max-width: calc(100% - 16px);
  }
  
  .product-item__right_search {
    gap: 4px;
  }
  
  .product-item__right_search .catalog-card__lable {
    font-size: 9px;
    padding: 2px 4px;
  }
}
