/* Mobile bottom bar + Agata-like header @ ≤900px */

:root {
  --fm-mobile-bar-h: 56px;
}

.fm-mobile-bar {
  display: none;
}

@media (max-width: 900px) {
  body.fm-proto {
    padding-bottom: calc(var(--fm-mobile-bar-h) + env(safe-area-inset-bottom, 0px));
  }

  .fm-mobile-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 600;
    height: calc(var(--fm-mobile-bar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid #e5e5e5;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
  }

  .fm-mobile-bar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px 4px;
    border: 0;
    background: transparent;
    color: #1a1a1a;
    font: inherit;
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .fm-mobile-bar__item.is-active,
  .fm-mobile-bar__item:hover,
  .fm-mobile-bar__item:focus-visible {
    color: var(--fm-red, #d62828);
  }

  .fm-mobile-bar__icon-wrap {
    position: relative;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
  }

  .fm-mobile-bar__badge {
    position: absolute;
    top: -2px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
  }

  .fm-mobile-bar__badge[hidden] {
    display: none;
  }

  /* Header: logo | search (bez burgera i 3 ikon w hero) */
  .fm-hdr__burger--main,
  .fm-hdr__main > .fm-hdr__tools,
  .fm-hdr-sticky .fm-hdr__tools,
  .fm-hdr-sticky .fm-hdr__burger {
    display: none !important;
  }

  .fm-hdr__main {
    grid-template-columns: auto 1fr !important;
    grid-template-areas: "logo search" !important;
    gap: 10px !important;
    align-items: center;
  }

  .fm-hdr__logo img {
    height: 24px !important;
    width: auto !important;
  }

  .fm-hdr__search {
    grid-area: search;
    max-width: none;
  }

  .fm-hdr__search input {
    height: 40px;
    border-radius: 999px;
    padding-inline: 14px 40px;
    font-size: 14px;
  }

  .fm-hdr-sticky__main {
    grid-template-columns: auto 1fr !important;
    grid-template-areas: "logo search" !important;
  }

  /* Menu drawer — pełnoekranowy overlay (Agata) */
  .fm-hdr__mobile-menu {
    position: fixed;
    inset: 0 0 calc(var(--fm-mobile-bar-h) + env(safe-area-inset-bottom, 0px));
    z-index: 590;
    background: #fff;
    color: #1a1a1a;
    border: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .fm-hdr__mobile-menu .fm-container {
    padding-top: 12px;
  }

  .fm-hdr__mobile-nav a {
    color: #1a1a1a;
    font-size: 16px;
    font-weight: 600;
    border-bottom-color: #eee;
    padding: 14px 0;
  }

  .fm-hdr__mobile-nav a:hover,
  .fm-hdr__mobile-nav a:focus {
    color: var(--fm-red, #d62828);
    background: transparent;
    margin-inline: 0;
    padding-inline: 0;
  }

  body.is-mobile-menu-open {
    overflow: hidden;
  }

  /* PDP: bez sticky ATC — Agata używa dolnego paska nawigacji */
  .va-sticky-mobile {
    display: none !important;
  }

  /* Sticky W górę — lewy dolny, czerwone kółko, mniejsze niż widget */
  .fm-back-top {
    display: grid !important;
    place-items: center;
    position: fixed;
    left: 12px;
    bottom: calc(var(--fm-mobile-bar-h, 56px) + env(safe-area-inset-bottom, 0px) + 14px);
    z-index: 590;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: var(--fm-red, #d62828);
    color: #fff;
    box-shadow: 0 3px 12px rgba(214, 40, 40, 0.35);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .2s, transform .2s, background .15s;
  }
  .fm-back-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .fm-back-top:hover,
  .fm-back-top:focus-visible {
    background: #b81f1f;
    color: #fff;
  }
  .fm-back-top svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
  }
  /* WoodMart native scrollToTop — schowaj / nie koliduj */
  body.fm-proto .scrollToTop,
  body.fm-proto .wd-scroll-to-top {
    display: none !important;
  }

  /* Thulium / floating call-chat — nad paskiem mobile, nie na koszyku */
  #thulium-chat-button,
  #thulium-widget,
  .thulium-chat-button,
  .thulium-launcher,
  [id*="thulium"],
  [class*="thulium-"],
  iframe[src*="thulium.com"] {
    bottom: calc(var(--fm-mobile-bar-h, 56px) + env(safe-area-inset-bottom, 0px) + 18px) !important;
  }
}

/* Globalny fallback (widget często wstrzykuje inline bottom) */
@media (max-width: 900px) {
  body.fm-proto [id*="thulium"],
  body.fm-proto [class*="thulium"] {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (min-width: 901px) {
  .fm-back-top { display: none !important; }
}
