/* Unified header — chrome visibility + shared catalog panel modes
   Канон сайта: <1200px = мобильный шаблон, ≥1200px = десктоп (Bootstrap xl / responsive.css) */

.gs-catalog-panel__mob-head {
  display: none;
}

.gs-catalog-overlay {
  display: none;
}

/* ----- Desktop (≥1200px): mobile chrome off ----- */
@media (min-width: 1200px) {
  .gs-hdr-mob {
    display: none !important;
  }
  .gs-hdr-desk {
    display: block;
  }
  .gs-catalog-panel__mob-head {
    display: none !important;
  }
  body.gs-has-unified-header {
    padding-top: 0;
  }
}

/* ----- Mobile / tablet (≤1199px): desktop chrome off ----- */
@media (max-width: 1199px) {
  .gs-hdr-desk .fn_header > .container > .gs_topbar,
  .gs-hdr-desk .fn_header > .container > .row > .header_nav > .logo,
  .gs-hdr-desk .fn_header > .container > .row > .header_nav > .gs_main_nav,
  .gs-hdr-desk .fn_header > .container > .row > .header_nav > .header_informer,
  .gs-hdr-desk .fn_header > .container > .row > .header_nav > #cart_informer,
  .gs-hdr-desk .fn_header > .container > .row > .header_nav > .header_search,
  .gs-hdr-desk .fn_header > .container > .fixed_search,
  .gs-hdr-desk .fixed_search,
  .gs-hdr-desk .fn_header > .container > .row > .header_nav > ._hm7_wrap > ._hm7_trigger {
    display: none !important;
  }

  /* Keep wrap in DOM for catalog panel + flyouts; collapse layout.
     overflow:visible — иначе fixed #gsCatalogPanel клипается родителем. */
  .gs-hdr-desk {
    position: absolute;
    width: 0;
    height: 0;
    overflow: visible;
    pointer-events: none;
  }
  .gs-hdr-desk ._hm7_wrap {
    margin: 0;
    position: static;
    pointer-events: auto;
  }
  .gs-hdr-desk ._hm7_fly {
    display: none !important;
  }

  /* Скролл >50px: okay.js вешает .fixed на десктопный .fn_header →
     пустая белая полоса + box-shadow вылезает из‑под .ios-header. */
  .gs-hdr-desk .fn_header.fixed,
  .gs-hdr-desk .header.fixed,
  .gs-hdr-desk .fixed.header {
    position: absolute !important;
    top: auto !important;
    left: auto !important;
    width: 0 !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    box-shadow: none !important;
    background: transparent !important;
    -webkit-transform: none !important;
    transform: none !important;
    z-index: -1 !important;
  }

  .gs-hdr-mob {
    display: block;
  }

  /* Shared catalog as bottom sheet */
  .gs-catalog-panel {
    display: none;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-height: 85vh !important;
    border-radius: 16px 16px 0 0 !important;
    z-index: 10050 !important;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2) !important;
    padding: 0 0 24px !important;
    overflow-y: auto !important;
  }
  .gs-catalog-panel.gs-catalog-open {
    display: block !important;
  }
  .gs-catalog-panel__mob-head {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
  }
  .gs-catalog-panel__mob-title {
    font-size: 17px;
    font-weight: 600;
  }
  .gs-catalog-panel__mob-close {
    background: none;
    border: 0;
    padding: 4px;
    cursor: pointer;
    color: #8E8E93;
  }
  .gs-catalog-overlay.active {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10040;
  }

  /* Accordion: nested lists collapsed until .gs-acc-open */
  .gs-catalog-panel .gs-catalog-tree > li > ul {
    display: none;
    padding-left: 12px;
  }
  .gs-catalog-panel .gs-catalog-tree > li.gs-acc-open > ul {
    display: block;
  }
  .gs-catalog-panel .gs-catalog-tree li._hm7_has > ul ul {
    display: none;
  }
  .gs-catalog-panel .gs-catalog-tree li._hm7_has.gs-acc-open > ul {
    display: block;
  }
  .gs-catalog-panel .gs-catalog-tree a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    text-decoration: none;
    color: #000;
    font-size: 16px;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
  }
  .gs-catalog-panel .gs-catalog-tree ._hm7_cnt {
    color: #8E8E93;
    font-size: 13px;
  }
  .gs-catalog-panel .gs-catalog-tree ._hm7_sep {
    margin: 8px 16px;
    border: 0;
    border-top: 0.5px solid rgba(60, 60, 67, 0.12);
  }
  .gs-catalog-panel .gs-catalog-tree__novinki a {
    color: #FF3B30;
    font-weight: 600;
  }

  body.gs-has-unified-header {
    padding-top: calc(44px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }
}
