/* =================== МОБІЛЬНИЙ ХЕДЕР (≤760px) — бургер | пошук | лого | кошик =================== */
@media (max-width:760px){

  /* 0) Сплющуємо ВСІ групові обгортки всередині хедера */
  .zf-header.zf-h .wp-block-group,
  .zf-header.zf-h .wp-block-columns,
  .zf-header.zf-h .wp-block-column{ display: contents !important; }

  /* 1) Каркас: [бургер][пошук][ЛОГО][кошик] */
  .zf-header.zf-h{
    display:grid !important;
    grid-template-columns: 44px 44px 1fr 44px;
    grid-template-areas: "nav search logo cart";
    align-items:center;
    gap:10px;
    padding:8px 10px;
    background:#d2d6d2;
    border-radius:12px;
    position:relative;
    z-index:100;
  }

  /* Скидання службових відступів всередині */
  .zf-header .wp-block-group,
  .zf-header .wp-block-columns,
  .zf-header p{ margin:0 !important; padding:0 !important; }

  /* Прив'язуємо ключові елементи до сітки */
  .zf-header :where(nav.wp-block-navigation){ grid-area:nav; }
  .zf-header :where(.zf-h__logo){ grid-area:logo; justify-self:center; min-width:0; display:block !important; }
  .zf-header :where([data-block-name="woocommerce/mini-cart"]){ grid-area:cart; justify-self:end; }

  /* Бургер — квадрат 44×44 */
  .wp-block-navigation__responsive-container-open,
  .wp-block-navigation__responsive-container-close{
    width:44px; height:44px; display:flex !important; align-items:center; justify-content:center;
    border:2px solid #1b3e22; border-radius:10px;
  }
  /* === FiboSearch fallback: примусова іконка лупи через ::before === */
  .zf-header .dgwt-wcas-search-wrapp > a.js-dgwt-wcas-enable-mobile-form,
  .zf-header .dgwt-wcas-search-wrapp > a.dgwt-wcas-enable-mobile-form{
    position: relative;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20% !important;
    height: 100% !important;
    border: 2px solid #1b3e22;
    border-radius: 10px;
    background: transparent;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    color: #1b3e22;               /* колір для іконки */
    font-size: 22px;              /* не обнуляємо! */
  }

  /* ховаємо будь-які внутрішні іконки плагіна, щоб не конфліктували */
  .zf-header .dgwt-wcas-search-wrapp a .dgwt-wcas-ico-magnifier,
  .zf-header .dgwt-wcas-search-wrapp a .dgwt-wcas-ico-magnifier-handler,
  .zf-header .dgwt-wcas-search-wrapp a svg{
    display: none !important;
  }

  /* малюємо свою іконку */
  .zf-header .dgwt-wcas-search-wrapp > a.js-dgwt-wcas-enable-mobile-form::before,
  .zf-header .dgwt-wcas-search-wrapp > a.dgwt-wcas-enable-mobile-form::before{
    content: "";
    display: block;
    width: 22px;
    height: 22px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    /* SVG-лупа зі stroke під колір #1b3e22 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b3e22' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  }

  /* форму/поле все ще прибрані, щоб не розпирали */
  .zf-header .dgwt-wcas-search-wrapp .dgwt-wcas-search-form,
  .zf-header .dgwt-wcas-search-input{
    display: none !important;
  }

  /* ЛОГО по центру, не выше 36px */
  .zf-header .zf-h__logo .wp-block-site-logo,
  .zf-header .zf-h__logo img{ margin:0 auto; height:auto; max-height:56px; width:auto; padding-right: 25px;}

  /* ====== FiboSearch: іконка 44×44 справа від бургера ====== */
  /* сама обгортка пошуку — грід-елемент у колонці "search" */
  .zf-header .dgwt-wcas-search-wrapp{
    grid-area:search;
    justify-self:start; align-self:center;
    width:44px !important; height:44px !important; max-width:44px !important;
    display:block !important; margin:0 !important; padding:0 !important; overflow:hidden;
  }
  /* ховаємо форму/поле, щоб не розпирало шапку */
  .zf-header .dgwt-wcas-search-wrapp .dgwt-wcas-search-form,
  .zf-header .dgwt-wcas-search-input{ display:none !important; }

  /* тригер-посилання (лупа) — точний квадрат, як бургер/кошик */
  .zf-header .dgwt-wcas-search-wrapp > a.js-dgwt-wcas-enable-mobile-form,
  .zf-header .dgwt-wcas-search-wrapp > a.dgwt-wcas-enable-mobile-form{
    display:flex !important; align-items:center !important; justify-content:center !important;
    width:20% !important; height:100% !important;
    border:2px solid #1b3e22; border-radius:10px;
    background:transparent; box-sizing:border-box;
    margin:0 !important; padding:0 !important; line-height:1 !important; font-size:22px !important; 
    color:#1b3e22 !important;
    text-decoration:none !important;
  }
  /* сама іконка всередині */
  .zf-header .dgwt-wcas-search-wrapp a svg,
  .zf-header .dgwt-wcas-search-wrapp a .dgwt-wcas-ico-magnifier{
    display:block !important; width:22px !important; height:22px !important; margin:0 !important;
  }

  /* Кошик — квадрат 44×44 */
  .zf-header [data-block-name="woocommerce/mini-cart"] .wc-block-mini-cart__button{
    width:44px; height:44px; display:flex; align-items:center; justify-content:center;
    border-radius:10px; border:2px solid #1b3e22; background:transparent; padding:0;
  }

  /* Те, що переїхало в меню — ховаємо у шапці */
  .zf-header p > a.button{ display:none !important; }                /* PDF */
  .zf-header .wp-block-woocommerce-customer-account{ display:none !important; }
  .zf-header .zf-h__right p.has-text-align-center{ display:none !important; } /* телефон */

  .zf-menu-extras{ margin-top:10px; padding-top:12px; border-top:1px solid #e7e7e7; display:grid; gap:8px; }
  .zf-menu-extras a.button{ display:block; text-align:center; padding:10px 14px; border-radius:10px; background:#e6f4ea; font-weight:800; }
  .zf-menu-extras .zf-menu-contact{ display:grid; gap:8px; }
  .zf-menu-extras .zf-menu-contact a{ display:block; padding:10px 12px; border:1px solid #e5e5e5; border-radius:10px; }
  /* ——— Лого завжди клікабельне, поверх сусідів ——— */
  .zf-header .zf-h__logo{
    position: relative;
    z-index: 2;                 /* вище за інші іконки */
  }
  .zf-header .zf-h__logo a{
    position: relative;
    z-index: 2;
    pointer-events: auto;       /* на всяк випадок */
    display: inline-block;
  }

  /* ——— Щоб пошук не накривав центр — клікабельна лише кнопка ——— */
  .zf-header .dgwt-wcas-search-wrapp{
    pointer-events: none;       /* обгортка НЕ ловить кліки */
    z-index: 1;
  }
  .zf-header .dgwt-wcas-search-wrapp > a{
    pointer-events: auto;       /* клікається тільки сама лупа */
  }
} /* <-- ВАЖЛИВА ЗАКРИВАЮЧА ДУЖКА ДЛЯ 760px */

/* Щоб зелена панель не перекривала шапку */
@media (max-width:980px){
  #zf-app .zf-topbar{ margin-top:0 !important; position:relative; z-index:0; }
  .zf-header{ position:relative; z-index:100; }
}
@media (min-width: 900px) and (max-width: 1400px) {
  .wc-block-mini-cart__button {
    margin-left: -20px !important;
    margin-right: -20px !important;
  }
}