﻿/* Journal Mobile Filter v2 - Fragrancebg.com
 * File: catalog/view/theme/journal3/jmf/jmf-v4.css
 * (суфиксът -v4 е cache busting — Cloudflare кешира с 99 дни max-age;
 *  при промяна преименувай на -v5 и обнови install.xml)
 * Only active up to 760px (mobile). On desktop the standard Journal filter remains.
 * z-index на панелите е над bottom mobile menu лентата (2147483645). */

@media (max-width: 760px) {

  /* Hide the standard floating filter trigger - we replace it with a top bar */
  .mobile-filter-trigger { display: none !important; }

  /* Hide the original sort bar on mobile - replaced by our two-button .jmf-bar */
  .products-filter { display: none !important; }

  /* Two-button bar at top of products listing */
  .jmf-bar {
    display: flex;
    gap: 10px;
    margin: 0 0 12px;
    width: 100%;
  }
  .jmf-bar .jmf-btn {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #222;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    line-height: 1;
  }
  .jmf-bar .jmf-btn:hover,
  .jmf-bar .jmf-btn:focus { outline: none; }
  .jmf-bar .jmf-btn .jmf-ico {
    width: 16px; height: 16px; flex: 0 0 16px;
  }
  .jmf-bar .jmf-btn .jmf-caret {
    margin-left: auto;
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #555;
  }
  .jmf-bar .jmf-count {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9px;
    background: rgba(31, 99, 56, 1); /* зелено — Fragrancebg */
    color: #fff;
    font-size: 11px;
    text-align: center;
  }

  /* Full-screen filter & sort panels */
  .jmf-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    /* над bottom mobile menu (2147483645) — иначе лентата закрива Apply бутона */
    z-index: 2147483646;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease;
  }
  .jmf-panel-backdrop.open { opacity: 1; visibility: visible; }

  .jmf-panel {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 2147483647;
    transform: translateY(100%);
    transition: transform .3s ease;
    display: flex;
    flex-direction: column;
  }
  .jmf-panel.open { transform: translateY(0); }

  .jmf-panel-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
  }
  .jmf-panel-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    flex: 1;
  }
  .jmf-panel-head .jmf-reset {
    background: none;
    border: 1px solid #d8d8d8;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    margin-right: 10px;
    cursor: pointer;
  }
  .jmf-panel-head .jmf-close {
    background: none;
    border: 0;
    font-size: 22px;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
    color: #444;
  }

  .jmf-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 16px 14px;
  }

  /* Move the Journal filter module inside our panel cleanly */
  .jmf-panel-body .module-filter,
  .jmf-panel-body .module-filter .module-body { background: transparent; box-shadow: none; padding: 0; }
  .jmf-panel-body .module-filter > .title.module-title,
  .jmf-panel-body .module-filter > h3.title { display: none; }

  .jmf-panel-foot {
    flex: 0 0 auto;
    border-top: 1px solid #eee;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: #fff;
  }

  /* Selected filter tags (chips) above the Apply button */
  .jmf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
  }
  .jmf-tags:empty { display: none; }
  .jmf-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f4f4f6;
    border-radius: 16px;
    font-size: 12px;
    color: #333;
  }
  .jmf-tag .jmf-tag-x {
    cursor: pointer;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ddd;
    color: #555;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
  }
  .jmf-tags-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
  }
  .jmf-clear-all {
    background: none;
    border: 0;
    color: #777;
    text-decoration: underline;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
  }

  .jmf-apply {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 6px;
    background: rgba(31, 99, 56, 1); /* зелено — Fragrancebg */
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }
  .jmf-apply[disabled] { opacity: .55; cursor: default; }

  /* Sort panel - list of options */
  .jmf-sort-list { list-style: none; margin: 0; padding: 4px 0; }
  .jmf-sort-list li {
    padding: 14px 4px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
  }
  .jmf-sort-list li.active { color: rgba(31, 99, 56, 1); font-weight: 600; } /* зелено — Fragrancebg; чекмаркът (::after) наследява цвета */
  .jmf-sort-list li.active::after { content: "✓"; }

  /* Lock body scroll when a panel is open */
  body.jmf-locked { overflow: hidden; }
}

/* Hide our mobile bar on desktop */
@media (min-width: 761px) {
  .jmf-bar,
  .jmf-panel,
  .jmf-panel-backdrop { display: none !important; }
}
