/**
 * Критичные мобильные правки — подключается в footer.php ПОСЛЕ кэша Bitrix.
 * Меню + кнопки карточки каталога.
 */

@media screen and (max-width: 991px) {
  /* ─── Нижнее меню — равномерная сетка по ширине экрана ─── */
  nav.mob_menu[data-rs-mob-nav="1"] {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 2147483000 !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    background: #fff !important;
    border-radius: 8px 8px 0 0 !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.04) !important;
    overflow: hidden !important;
  }

  nav.mob_menu[data-rs-mob-nav="1"] .mob_menu__track {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-around !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 12px 10px calc(10px + env(safe-area-inset-bottom, 0)) !important;
    box-sizing: border-box !important;
    gap: 0 !important;
  }

  nav.mob_menu[data-rs-mob-nav="1"] .mob_menu__track > a {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 0 2px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1.15 !important;
    color: #000 !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  nav.mob_menu[data-rs-mob-nav="1"] a img,
  nav.mob_menu[data-rs-mob-nav="1"] a .mob-menu-icon {
    display: block !important;
    width: auto !important;
    height: 24px !important;
    max-width: 25px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
    opacity: 1 !important;
    filter: none !important;
  }

  nav.mob_menu[data-rs-mob-nav="1"] a.mob-menu-item--catalog {
    font-weight: 600 !important;
    color: #1A1A1A !important;
  }

  nav.mob_menu[data-rs-mob-nav="1"] a.mob-menu-item--catalog .mob-menu-icon,
  nav.mob_menu[data-rs-mob-nav="1"] a.mob-menu-item--catalog img {
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    filter: none !important;
    -webkit-filter: none !important;
    opacity: 1 !important;
  }

  /* ─── Каталог: без горизонтальной полосы прокрутки ─── */
  html.rs-is-mobile {
    overflow-x: clip;
    max-width: 100%;
  }

  html.rs-is-mobile body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0)) !important;
    overflow-x: clip;
    max-width: 100%;
  }

  html.rs-is-mobile #middle,
  html.rs-is-mobile #center.container,
  html.rs-is-mobile .row.mb-4,
  html.rs-is-mobile .catalog-section {
    max-width: 100%;
    overflow-x: clip;
  }

  html.rs-is-mobile footer .footer_items.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  html.rs-is-mobile .side-filter,
  html.rs-is-mobile .backdrop-side {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    box-sizing: border-box !important;
  }

  /* ─── Кнопки карточки каталога (не блок «Техника с наработкой») ─── */
  .catalog-section:not(.mod-offers) .product-card-app > .product-item-mobile-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 12px !important;
    order: 10 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 8px 0 8px !important;
    margin: 4px 0 0 !important;
  }

  .catalog-section:not(.mod-offers) .product-card-app > .product-item-mobile-actions .btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    height: 50px !important;
    padding: 0 8px !important;
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 500 !important;
    border-radius: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    line-height: 1.15 !important;
    text-align: center !important;
    text-decoration: none !important;
    box-shadow: none !important;
    white-space: nowrap !important;
  }

  .catalog-section:not(.mod-offers) .product-card-app > .product-item-mobile-actions .btn-get-kp {
    background: #fff !important;
    border: 1.5px solid #FD7E14 !important;
    color: #FD7E14 !important;
  }

  .catalog-section:not(.mod-offers) .product-card-app > .product-item-mobile-actions .btn-call {
    background: #fff !important;
    border: 1.5px solid #2563EB !important;
    color: #2563EB !important;
  }

  .catalog-section:not(.mod-offers) .product-card-app > .product-item-mobile-actions .btn-call__icon {
    flex-shrink: 0 !important;
    width: 18px !important;
    height: 18px !important;
  }

  .catalog-section:not(.mod-offers) .product-card-app .price-info {
    display: none !important;
  }
}

@media screen and (max-width: 767px) {
  /* ─── Техника с наработкой — компактные карточки в карусели ─── */
  .mod-offers-block {
    position: relative;
    margin-bottom: 24px;
  }

  .mod-offers-block > .row,
  .mod-offers-block > .row > .col,
  .mod-offers-block .mod-offers,
  .mod-offers-block .mod-offers .news-list.owl-carousel {
    position: static !important;
    max-width: 100%;
    overflow-x: clip;
  }

  .mod-offers-block .mod-offers .owl-stage-outer {
    position: relative !important;
    overflow: hidden !important;
    max-width: 100%;
  }

  .mod-offers-block .title__offers {
    max-width: none !important;
    font-size: 22px !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    margin: 0 0 12px 0 !important;
    padding: 0 8px;
    display: block !important;
  }

  .mod-offers .news-list.owl-carousel {
    padding: 0 8px !important;
    position: static !important;
  }

  .mod-offers .owl-item > .product-item,
  .mod-offers .product-item-container .product-item,
  .mod-offers .product-card-app {
    height: auto !important;
    min-height: 0 !important;
  }

  .mod-offers .product-card-app {
    display: flex !important;
    flex-direction: column !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    overflow: hidden !important;
  }

  .mod-offers .product-card-app .product-item-gallery {
    margin: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .mod-offers .product-card-app .product-item-gallery__viewport {
    height: auto !important;
    min-height: 0 !important;
    max-height: 104px !important;
    overflow: hidden !important;
  }

  .mod-offers .product-card-app .product-item-gallery__track {
    display: block !important;
    overflow: hidden !important;
    scroll-snap-type: none !important;
    touch-action: auto !important;
  }

  .mod-offers .product-card-app .product-item-gallery__slide,
  .mod-offers .product-card-app .product-item-gallery__slide--link {
    flex: none !important;
    min-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    border-radius: 12px 12px 0 0 !important;
    display: block !important;
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer !important;
  }

  .mod-offers .product-card-app .product-item-gallery__slide:not(:first-child) {
    display: none !important;
  }

  .mod-offers .product-card-app .product-item-gallery__slide img {
    width: 100% !important;
    height: 96px !important;
    min-height: 96px !important;
    max-height: 104px !important;
    object-fit: cover !important;
    border-radius: 12px 12px 0 0 !important;
  }

  .mod-offers .product-item-gallery__overlay,
  .mod-offers .product-item-gallery__dots,
  .mod-offers .product-item-badges,
  .mod-offers .product-card-app > .product-item-mobile-actions,
  .mod-offers .product-item-specs-mobile,
  .mod-offers .product-item-specs-line,
  .mod-offers .product-card-app .price-info,
  .mod-offers .product-card-app .properties,
  .mod-offers-block .mod-offers .news-list.owl-carousel .owl-nav {
    display: none !important;
  }

  .mod-offers .product-card-app .card-body {
    padding: 8px !important;
    flex: 1 1 auto !important;
  }

  .mod-offers .product-item-mobile-price {
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    margin-bottom: 4px !important;
  }

  .mod-offers .product-item-mobile-price .price-muted {
    font-size: 12px !important;
    font-weight: 400 !important;
  }

  .mod-offers .card-body .name {
    margin-bottom: 0 !important;
  }

  .mod-offers .card-body .name .product-item-title,
  .mod-offers .card-body .name .h4 {
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1.25 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media screen and (min-width: 992px) {
  nav.mob_menu[data-rs-mob-nav="1"] {
    display: none !important;
  }
}
