/* =========================================================
   ProFinder Mobile Search Filters
   Everything in this file is scoped to max-width: 1024px
   (phone + tablet) and to body.pfmf-active (only ever added
   by this plugin's own JS, only on the search page, only when
   there's real category data to show) - desktop, and every
   other page that happens to reuse .mobile-filters, is
   completely unaffected.
   ========================================================= */

@media (max-width: 1024px) {

  /* ---- Hide the theme's originals this plugin replaces ---- */
  body.pfmf-active .expand-collapse.adforest-new-filter,
  body.pfmf-active .mobile-filters-btn,
  .mobile-filters-btn.pfmf-hidden {
    display: none !important;
  }

  /* =========================================
     Category thumbnail slider
     ========================================= */
  .pfmf-wrap {
    background: #fff;
    margin: 0 0 14px;
    padding-top: 14px;
    border-bottom: 1px solid #eef0ef;
  }

  .pfmf-cats-heading {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8a938f;
    padding: 0 14px;
    margin-bottom: 10px;
  }

  .pfmf-cats-slider {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    gap: 14px;
    padding: 0 14px 14px;
    scrollbar-width: none;
  }
  .pfmf-cats-slider::-webkit-scrollbar {
    display: none;
  }

  .pfmf-cat-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #242424;
  }

  .pfmf-cat-thumb {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    overflow: hidden;
    background: #f2f4f3;
    border: 1px solid #eef0ef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: block;
  }
  .pfmf-cat-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .pfmf-cat-name {
    margin-top: 7px;
    font-size: 11.5px;
    line-height: 1.25;
    font-weight: 600;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .pfmf-cat-item:active .pfmf-cat-thumb {
    border-color: #00a651;
  }

  /* =========================================
     Sticky Sort / Filters action bar
     ========================================= */
  .pfmf-action-bar {
    position: sticky;
    top: 0;
    z-index: 998;
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border-top: 1px solid #eef0ef;
    border-bottom: 1px solid #eef0ef;
  }

  .pfmf-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 12px;
    border-radius: 24px;
    border: 1px solid #dfe3e1;
    background: #fff;
    color: #1e3d2f;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
  }
  .pfmf-pill i {
    font-size: 13px;
    color: #00a651;
  }
  .pfmf-pill:active {
    background: #f4faf7;
    border-color: #00a651;
  }

  .pfmf-filter-btn {
    background: #1e3d2f;
    border-color: #1e3d2f;
    color: #fff;
  }
  .pfmf-filter-btn i {
    color: #fff;
  }
  .pfmf-filter-btn:active {
    background: #16301f;
  }

  /* =========================================
     Sort bottom sheet (its own small sheet,
     independent of the full filters panel)
     ========================================= */
  .pfmf-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 99994;
  }
  .pfmf-wrap.pfmf-sort-open .pfmf-sheet-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .pfmf-sort-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
    padding: 10px 18px 24px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 99995;
    max-height: 70vh;
    overflow-y: auto;
  }
  .pfmf-wrap.pfmf-sort-open .pfmf-sort-sheet {
    transform: translateY(0);
  }

  .pfmf-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 3px;
    background: #dfe3e1;
    margin: 4px auto 14px;
  }

  .pfmf-sheet-title {
    font-size: 15px;
    font-weight: 700;
    color: #161616;
    margin-bottom: 10px;
  }

  .pfmf-sort-options {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .pfmf-sort-option {
    padding: 13px 4px;
    font-size: 14px;
    color: #3a3a3a;
    border-bottom: 1px solid #f1f2f1;
    position: relative;
  }
  .pfmf-sort-option:last-child {
    border-bottom: none;
  }
  .pfmf-sort-option.is-active {
    color: #00a651;
    font-weight: 700;
  }
  .pfmf-sort-option.is-active::after {
    content: "\2713";
    position: absolute;
    right: 4px;
    top: 13px;
    font-weight: 700;
  }

  /* =========================================
     Reskin the theme's own .mobile-filters
     panel (the real, working sidebar filter
     form - get_sidebar('ads')) into an
     app-style bottom sheet instead of today's
     full-screen fade-in overlay. Only the
     presentation changes here - same element,
     same .active toggle class, same close
     button, same form fields underneath.
     ========================================= */
  body.pfmf-active .mobile-filters {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: 88vh;
    border-radius: 18px 18px 0 0 !important;
    transform: translateY(100%);
    opacity: 1 !important;
    transition: transform 0.32s ease !important;
    overflow-y: auto;
    padding: 18px 18px 28px !important;
    box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.22);
  }
  body.pfmf-active .mobile-filters.active {
    transform: translateY(0);
    z-index: 99996 !important;
  }
  body.pfmf-active .mobile-filters::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 3px;
    background: #dfe3e1;
    margin: 0 auto 14px;
  }
  body.pfmf-active .mobile-filters .filter-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f2f4f3;
    color: #1e3d2f;
    border: none;
  }

  /* Dim backdrop behind the reskinned panel, same approach as the sort
     sheet above - only visible while the panel is open. */
  body.pfmf-active .mobile-filters.active::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
  }
}
