/* ==========================================================================
   WaveLocal Mobile Filter Bar (wl-mfb)
   Drop-in bottom sticky bar for PrestaShop 8 + Amazzing Filter
   Theme: Warehouse
   ========================================================================== */

/* Mobile only — matches Amazzing's compact breakpoint (767px) */
@media (max-width: 767px) {

  /* Hide Amazzing's floating side-tab filter button */
  #amazzing_filter .compact-toggle.sticky {
    display: none !important;
  }

  /* Reserve space at bottom of page so bar doesn't cover product cards / pagination */
  #wrapper,
  #content-wrapper {
    padding-bottom: 64px;
  }

  /* ------------------------- Bottom Bar ------------------------- */
  .wl-mfb {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040; /* below offcanvas (1045) but above page content */
    display: flex;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    height: 56px;
    /* iOS safe area */
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-sizing: content-box;
  }

  .wl-mfb__btn {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: 0;
    padding: 0 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #1a2b4a; /* matches BathroomKing dark navy */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease;
    min-height: 56px;
  }

  .wl-mfb__btn:active {
    background-color: #f3f4f6;
  }

  .wl-mfb__btn + .wl-mfb__btn {
    border-left: 1px solid #e5e7eb;
  }

  .wl-mfb__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .wl-mfb__label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .wl-mfb__label-current {
    font-weight: 400;
    color: #6b7280;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
  }

  /* Active filter count badge */
  .wl-mfb__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #c8a96a; /* BathroomKing gold */
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    line-height: 1;
  }

  .wl-mfb__badge:empty {
    display: none;
  }

  /* ------------------------- Sort Sheet ------------------------- */
  .wl-mfb-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .wl-mfb-sheet-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .wl-mfb-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1051;
    background: #F5F3EF;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .wl-mfb-sheet.is-open {
    transform: translateY(0);
  }

  .wl-mfb-sheet__handle {
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 8px auto 4px;
    flex-shrink: 0;
  }

  .wl-mfb-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 8px;
    flex-shrink: 0;
  }

  .wl-mfb-sheet__title {
    font-size: 16px;
    font-weight: 700;
    color: #1a2b4a;
    margin: 0;
  }

  .wl-mfb-sheet__close {
    background: transparent;
    border: 0;
    padding: 6px;
    color: #6b7280;
    cursor: pointer;
    line-height: 0;
  }

  .wl-mfb-sheet__list {
    list-style: none;
    margin: 0;
    padding: 4px 0 8px;
    overflow-y: auto;
    flex: 1 1 auto;
  }

  .wl-mfb-sheet__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    color: #1a2b4a;
    text-decoration: none;
    font-size: 15px;
    transition: background-color 0.15s ease;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
  }

  .wl-mfb-sheet__item:active,
  .wl-mfb-sheet__item:hover {
    background-color: #ebe7df;
    color: #1a2b4a;
    text-decoration: none;
  }

  .wl-mfb-sheet__item.is-current {
    font-weight: 600;
  }

  .wl-mfb-sheet__check {
    width: 18px;
    height: 18px;
    color: #c8a96a;
    flex-shrink: 0;
    opacity: 0;
  }

  .wl-mfb-sheet__item.is-current .wl-mfb-sheet__check {
    opacity: 1;
  }

  /* Body lock when sheet open */
  body.wl-mfb-sheet-open {
    overflow: hidden;
  }

  /* ------------------------- Onboarding wiggle ------------------------- */
  @keyframes wl-mfb-wiggle {
    0%   { transform: rotate(0deg); }
    15%  { transform: rotate(-6deg); }
    30%  { transform: rotate(5deg); }
    45%  { transform: rotate(-4deg); }
    60%  { transform: rotate(3deg); }
    75%  { transform: rotate(-2deg); }
    100% { transform: rotate(0deg); }
  }

  .wl-mfb__btn--filter.is-wiggling .wl-mfb__icon {
    animation: wl-mfb-wiggle 700ms ease-in-out;
    transform-origin: center;
  }

  /* Subtle highlight on the button itself during wiggle */
  .wl-mfb__btn--filter.is-wiggling {
    background-color: #faf7f1;
    transition: background-color 300ms ease;
  }

  @media (prefers-reduced-motion: reduce) {
    .wl-mfb__btn--filter.is-wiggling .wl-mfb__icon {
      animation: none;
    }
  }
}

/* Hide everything above mobile breakpoint */
@media (min-width: 768px) {
  .wl-mfb,
  .wl-mfb-sheet,
  .wl-mfb-sheet-backdrop {
    display: none !important;
  }
}
