/* EJM Mega Filter modern layout v1.3.0 */
body.ejm-mf-on .mfilter-free-container,
body.ejm-mf-on .mfilter-free-button{display:none !important}

#ejm-mf{position:relative;margin:4px 0 22px;font-family:inherit}
#ejm-mf .mfilter-box{margin:0 !important;padding:0 !important;border:0 !important;background:none !important;box-shadow:none !important;width:auto !important}
#ejm-mf .mfilter-box > .box-heading,
#ejm-mf .mfilter-button,
#ejm-mf .mfp-manual-init,
#ejm-mf .mfilter-head-icon{display:none !important}
#ejm-mf .mfilter-content{margin:0 !important;padding:0 !important;border:0 !important;background:none !important}
#ejm-mf .mfilter-content > ul{margin:0;padding:0;list-style:none}
#ejm-mf li.mfilter-filter-item{display:block !important;margin:0 !important;padding:0 !important;border:0 !important;background:none !important;list-style:none;float:none !important;width:auto !important}
#ejm-mf li.mfilter-filter-item.mfilter-hide{display:none !important}
#ejm-mf .mfilter-gheader{display:none}

/* headings */
#ejm-mf .mfilter-heading{cursor:pointer;margin:0 !important;padding:0 !important;border:0;background:none !important;color:#222 !important;user-select:none}
#ejm-mf .mfilter-heading-content{display:flex;align-items:center;justify-content:center;height:auto !important;overflow:visible !important;padding:0 !important;margin:0 !important;background:none !important;border:0 !important}
#ejm-mf .mfilter-heading-text{display:flex;align-items:center;gap:6px;padding:0 !important;margin:0 !important;float:none !important;width:auto !important;font-size:12px;font-weight:600;letter-spacing:.02em;text-transform:none;color:inherit !important;background:none !important;line-height:1.2}
#ejm-mf .mfilter-heading-text > span{display:inline !important;padding:0 !important;margin:0 !important;background:none !important;color:inherit !important}
#ejm-mf .mfilter-heading-text > span:before,#ejm-mf .mfilter-heading-text > span:after,#ejm-mf .mfilter-heading-text:before,#ejm-mf .mfilter-heading-text:after{display:none !important}
#ejm-mf .ejm-mf-count{font-style:normal;display:none;min-width:17px;height:17px;padding:0 5px;border-radius:9px;background:#111;color:#fff;font-size:10px;font-weight:700;line-height:17px;text-align:center}
#ejm-mf .ejm-has-sel .ejm-mf-count{display:inline-block}
#ejm-mf .mfilter-heading-content:after{content:"";flex:none;display:block;box-sizing:border-box;width:7px;height:7px;margin:-3px 0 0 9px;border-right:1.6px solid currentColor;border-bottom:1.6px solid currentColor;transform:rotate(45deg);transition:transform .15s,margin .15s}
#ejm-mf li.ejm-open > .mfilter-heading .mfilter-heading-content:after{transform:rotate(-135deg);margin-top:3px}

/* options panel */
#ejm-mf .mfilter-content-opts{display:none !important;margin:0 !important;padding:0 !important;border:0 !important;background:#fff}
#ejm-mf li.ejm-open > .mfilter-content-opts{display:block !important}
#ejm-mf .mfilter-opts-container{margin:0 !important;padding:0 !important;border:0 !important;max-height:380px;overflow-y:auto;overscroll-behavior:contain}
#ejm-mf .scroll-wrapper,#ejm-mf .scroll-content,#ejm-mf .mfilter-content-wrapper{max-height:none !important;height:auto !important;overflow:visible !important;margin:0 !important;padding:0 !important;position:static !important}
#ejm-mf .scroll-element,#ejm-mf .mfilter-button-more{display:none !important}
#ejm-mf .mfilter-options,#ejm-mf .mfilter-options-container{margin:0;padding:0}
#ejm-mf .mfilter-live-filter,#ejm-mf .mfilter-search{margin:0 0 10px !important}
#ejm-mf .mfilter-live-filter input,#ejm-mf input.form-control{height:38px;border-radius:6px}
/* live search inside a filter: own icon (Mega Filter's sprite showed a stray arrow), pill shape */
#ejm-mf .mfilter-live-filter{position:relative;margin:0 0 12px !important}
#ejm-mf .mfilter-live-filter:before,#ejm-mf .mfilter-live-filter:after{display:none !important}
#ejm-mf .mfilter-live-filter input.form-control{width:100% !important;height:38px !important;margin:0 !important;padding:0 14px 0 38px !important;border:1px solid #ddd !important;border-radius:19px !important;box-shadow:none !important;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center !important;background-size:15px 15px !important;font-size:13px !important;color:#222}
#ejm-mf .mfilter-live-filter input.form-control:focus{border-color:#111 !important;outline:0}

#ejm-mf .mfilter-tb{display:grid !important;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:2px 14px;width:100% !important;margin:0}
#ejm-mf .mfilter-option{display:flex;align-items:center;gap:8px;margin:0 !important;padding:7px 6px !important;border:0;border-radius:6px;background:none;cursor:pointer;float:none !important;width:auto !important}
#ejm-mf .mfilter-option:hover{background:#f5f5f5}
#ejm-mf .mfilter-option.mfilter-hide,#ejm-mf .mfilter-option.mfilter-hide-by-live-filter{display:none !important}
#ejm-mf .mfilter-option.mfilter-disabled{opacity:.45}
#ejm-mf .mfilter-tb-as-td{display:block !important;padding:0 !important;margin:0 !important;border:0 !important;width:auto !important;vertical-align:middle}
#ejm-mf .mfilter-col-input input{margin:0 !important;width:16px;height:16px;accent-color:#111;cursor:pointer}
#ejm-mf .mfilter-option label{flex:1;margin:0 !important;padding:0 !important;font-size:13px;font-weight:400;color:#333;cursor:pointer;line-height:1.35}
#ejm-mf .mfilter-col-count{margin-left:auto !important}
#ejm-mf .mfilter-counter{display:inline !important;background:none !important;border:0 !important;padding:0 !important;margin:0 !important;color:#999 !important;font-size:12px !important;font-weight:400 !important;line-height:1 !important;box-shadow:none !important}
#ejm-mf .mfilter-counter:after,#ejm-mf .mfilter-counter:before{display:none !important}
#ejm-mf .mfilter-counter.mfilter-close{background:none !important;width:auto !important;height:auto !important;text-indent:0 !important}

/* chip groups (short value lists like strength / size) */
#ejm-mf li.ejm-chips .mfilter-tb{display:flex !important;flex-wrap:wrap;gap:8px}
#ejm-mf li.ejm-chips .mfilter-option{padding:7px 14px !important;border:1px solid #ddd;border-radius:18px;background:#fff}
#ejm-mf li.ejm-chips .mfilter-option:hover{border-color:#111;background:#fff}
#ejm-mf li.ejm-chips .mfilter-col-input{position:absolute !important;opacity:0;pointer-events:none;width:1px !important;height:1px;overflow:hidden}
#ejm-mf li.ejm-chips .mfilter-option label{flex:none;font-weight:500;white-space:nowrap}
#ejm-mf li.ejm-chips .mfilter-col-count{margin-left:2px !important}
#ejm-mf li.ejm-chips .mfilter-option.ejm-on{background:#111;border-color:#111}
#ejm-mf li.ejm-chips .mfilter-option.ejm-on label,#ejm-mf li.ejm-chips .mfilter-option.ejm-on .mfilter-counter{color:#fff !important}

/* Mega Filter wraps each option in its own .mfilter-tb: flatten it so hidden values leave no gaps */
#ejm-mf li .mfilter-tb .mfilter-tb{display:contents !important}
#ejm-mf li .mfilter-tb .mfilter-tb.mfilter-hide{display:none !important}

/* loading: Mega Filter is still refreshing counts - keep the options hidden behind a small spinner */
@keyframes ejm-mf-spin{to{transform:rotate(360deg)}}
#ejm-mf.ejm-loading li.ejm-open > .mfilter-content-opts{position:relative;min-height:84px}
#ejm-mf.ejm-loading li.ejm-open > .mfilter-content-opts > *{visibility:hidden}
#ejm-mf.ejm-loading li.ejm-open > .mfilter-content-opts:after{content:"";position:absolute;left:50%;top:50%;width:22px;height:22px;margin:-11px 0 0 -11px;border:2px solid #e2e2e2;border-top-color:#111;border-radius:50%;animation:ejm-mf-spin .7s linear infinite}

/* bar: filters + the theme's Sort / Show / grid toolbar in one design */
#ejm-mf .ejm-mf-bar{display:flex;flex-wrap:wrap;align-items:center;gap:10px 8px}
#ejm-mf .product-filter{margin:0 !important;padding:0 !important;border:0 !important;background:none !important;box-shadow:none !important}
#ejm-mf .product-filter .row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 !important}
#ejm-mf .product-filter .row:before,#ejm-mf .product-filter .row:after{display:none !important}
#ejm-mf .product-filter [class*="col-"]{float:none !important;width:auto !important;min-height:0;padding:0 !important;margin:0 !important;text-align:left}
#ejm-mf .product-filter .input-group{display:inline-flex !important;align-items:center;width:auto !important;height:34px;margin:0;padding:0 0 0 14px;border:1px solid #ddd;border-radius:17px;background:#fff;transition:border-color .15s}
#ejm-mf .product-filter .input-group:hover{border-color:#111}
#ejm-mf .product-filter .input-group-addon{display:inline-block !important;width:auto !important;margin:0 4px 0 0 !important;padding:0 !important;border:0 !important;border-radius:0 !important;background:none !important;color:#777 !important;font-size:12px;font-weight:500;height:auto !important;line-height:1 !important;align-self:center;white-space:nowrap;text-transform:none;letter-spacing:0}
#ejm-mf .product-filter select.form-control{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:block;float:none;width:auto !important;min-width:0;height:32px !important;margin:0 !important;padding:0 30px 0 0 !important;border:0 !important;border-radius:0 17px 17px 0 !important;background:transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23222' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 13px center !important;background-size:10px 6px !important;box-shadow:none !important;outline:0;color:#222 !important;font-size:12px !important;font-weight:600;line-height:32px;text-overflow:ellipsis;cursor:pointer}
#ejm-mf .product-filter .button-group{display:inline-flex;align-items:center;gap:2px;height:34px;margin:0;padding:2px;border:1px solid #ddd;border-radius:17px;background:#fff}
#ejm-mf .product-filter .btn-view{display:inline-flex;align-items:center;justify-content:center;min-width:28px;width:auto;height:28px;margin:0 !important;padding:0 9px !important;border:0 !important;border-radius:14px !important;background:none !important;box-shadow:none !important;color:#666 !important;font-size:12px !important;font-weight:600;line-height:1;transition:background .15s,color .15s}
#ejm-mf .product-filter .btn-view:hover{color:#111 !important}
#ejm-mf .product-filter .btn-view.active{background:#111 !important;color:#fff !important}
#ejm-mf .product-filter .btn-view i{font-size:13px;line-height:1}

/* Sort By / Show dropdown card (replaces the browser's small option list) */
#ejm-mf .ejm-mf-sel{position:relative;cursor:pointer}
#ejm-mf .ejm-mf-sel select.form-control{pointer-events:none}
#ejm-mf .ejm-mf-sel.ejm-open{border-color:#111}
#ejm-mf .ejm-mf-menu{display:none;position:absolute;top:calc(100% + 8px);left:-1px;z-index:320;box-sizing:border-box;width:max-content;min-width:calc(100% + 2px);max-width:calc(100vw - 30px);max-height:340px;overflow-y:auto;overscroll-behavior:contain;margin:0;padding:6px;border:1px solid #e6e6e6;border-radius:12px;background:#fff;box-shadow:0 14px 36px rgba(0,0,0,.14);text-align:left;cursor:default}
#ejm-mf .ejm-mf-sel.ejm-open .ejm-mf-menu{display:block}
#ejm-mf .ejm-mf-menu-item{display:flex !important;align-items:center;justify-content:space-between;gap:18px;width:100% !important;min-width:150px;height:auto !important;margin:0 !important;padding:9px 12px !important;border:0 !important;border-radius:8px !important;background:none !important;box-shadow:none !important;color:#333 !important;font-size:13px !important;font-weight:400;line-height:1.3 !important;text-align:left;text-transform:none !important;letter-spacing:0 !important;white-space:nowrap;cursor:pointer}
#ejm-mf .ejm-mf-menu-item:hover,#ejm-mf .ejm-mf-menu-item:focus-visible{background:#f5f5f5 !important;color:#111 !important;outline:0}
#ejm-mf .ejm-mf-menu-item.ejm-on{color:#111 !important;font-weight:600}
#ejm-mf .ejm-mf-menu-item.ejm-on:after{content:"";flex:none;width:12px;height:12px;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") center/contain no-repeat}

/* toggle, drawer chrome */
#ejm-mf .ejm-mf-toggle,#ejm-mf .ejm-mf-head,#ejm-mf .ejm-mf-foot,#ejm-mf .ejm-mf-backdrop{display:none}

/* active filters row: same pill language as the filter bar */
#ejm-mf .ejm-mf-active{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:12px}
#ejm-mf .ejm-mf-active.ejm-empty{display:none}
#ejm-mf .ejm-mf-active-label{margin-right:2px;color:#777;font-size:12px;font-weight:500;letter-spacing:0;text-transform:none}
#ejm-mf .ejm-mf-chip{display:inline-flex;align-items:center;gap:8px;height:30px;margin:0;padding:0 6px 0 13px;border:1px solid #111;border-radius:15px;background:#111;color:#fff;font-size:12px;font-weight:600;line-height:1;cursor:pointer;transition:background .15s,color .15s}
#ejm-mf .ejm-mf-chip:hover{background:#fff;color:#111;border-color:#111}
#ejm-mf .ejm-mf-chip-x{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:50%;background:rgba(255,255,255,.18);font-size:14px;line-height:1}
#ejm-mf .ejm-mf-chip:hover .ejm-mf-chip-x{background:#eee}
#ejm-mf .ejm-mf-clear{display:inline-flex;align-items:center;height:30px;margin:0;padding:0 13px;border:1px solid #ddd;border-radius:15px;background:#fff;color:#111;font-size:12px;font-weight:600;line-height:1;text-decoration:none;cursor:pointer;transition:border-color .15s}
#ejm-mf .ejm-mf-clear:hover{border-color:#111}

/* category description: keep "Read more" right under the faded text, not after a block of white space */
html body #content .category-description.ejm-is-collapsible{margin-bottom:6px}
html body #content .category-description.ejm-is-collapsible:not(.ejm-is-expanded)::after{height:2.4em;background:linear-gradient(rgba(255,255,255,0),#fff 100%)}
html body #content #ejm-category-description-toggle.ejm-category-description-toggle{margin:0 0 18px !important}

/* ---------- Desktop: filter bar ---------- */
@media (min-width:992px){
  #ejm-mf .ejm-mf-panel,#ejm-mf .ejm-mf-body{display:block;position:static}
  #ejm-mf .ejm-mf-panel{flex:0 1 auto;min-width:0}
  #ejm-mf .ejm-mf-tools{display:flex;align-items:center;margin-left:auto}
  #ejm-mf .mfilter-content > ul{display:flex !important;flex-wrap:wrap;gap:8px}
  #ejm-mf li.mfilter-filter-item{position:relative}
  #ejm-mf .mfilter-heading{display:inline-flex;align-items:center;height:34px;padding:0 14px !important;border:1px solid #ddd;border-radius:17px;background:#fff !important;transition:border-color .15s,box-shadow .15s}
  #ejm-mf .mfilter-heading:hover,#ejm-mf li.ejm-open > .mfilter-heading{border-color:#111}
  #ejm-mf li.ejm-has-sel > .mfilter-heading{border-color:#111;box-shadow:inset 0 0 0 1px #111}
  #ejm-mf .mfilter-content-opts{position:absolute !important;top:calc(100% + 8px);left:0;z-index:300;min-width:280px;max-width:min(720px,92vw);padding:16px !important;border:1px solid #e6e6e6 !important;border-radius:12px;box-shadow:0 14px 36px rgba(0,0,0,.14)}
  #ejm-mf li.ejm-wide > .mfilter-content-opts{width:680px}
  #ejm-mf li.ejm-chips > .mfilter-content-opts{width:max-content;max-width:420px}
}

/* ---------- Mobile: button + bottom drawer ---------- */
@media (max-width:991px){
  /* row 1: [Filter] [Sort by ...]   row 2: [Show 30]  ...  [grid | list] */
  #ejm-mf .ejm-mf-bar{gap:8px}
  #ejm-mf .ejm-mf-tools,#ejm-mf .ejm-mf-tools .product-filter,#ejm-mf .ejm-mf-tools .product-filter .row{display:contents}
  #ejm-mf .ejm-mf-toggle{order:1;flex:0 0 auto;display:flex;align-items:center;justify-content:center;gap:8px;width:auto;height:40px;padding:0 18px;border:0;border-radius:20px;background:#111;color:#fff;font-size:13px;font-weight:600;letter-spacing:.02em;text-transform:none;line-height:1;cursor:pointer}
  #ejm-mf .ejm-mf-toggle-icon{position:relative;width:16px;height:11px;border-top:1.6px solid #fff;border-bottom:1.6px solid #fff}
  #ejm-mf .ejm-mf-toggle-icon:before{content:"";position:absolute;left:3px;right:3px;top:3px;height:1.6px;background:#fff}
  #ejm-mf .ejm-tool-sort{order:2;flex:1 1 calc(100% - 140px);min-width:0}
  #ejm-mf .ejm-tool-limit{order:3;flex:0 0 auto}
  #ejm-mf .product-filter .row .ejm-tool-view{order:4;flex:0 0 auto;margin-left:auto !important}
  #ejm-mf .product-filter .ejm-tool-sort .input-group{display:flex !important;width:100% !important;height:40px;border-radius:20px}
  #ejm-mf .product-filter .ejm-tool-sort select.form-control{flex:1;width:100% !important;height:38px !important;line-height:38px;font-size:13px !important}
  #ejm-mf .ejm-tool-sort .input-group-addon{font-size:12px}
  #ejm-mf .product-filter .input-group{height:36px;border-radius:18px}
  #ejm-mf .product-filter select.form-control{height:34px !important;line-height:34px}
  #ejm-mf .product-filter .button-group{height:36px;border-radius:18px}
  #ejm-mf .product-filter .btn-view{min-width:32px;height:30px;border-radius:15px !important}
  #ejm-mf .ejm-mf-menu-item{padding:12px 14px !important;font-size:14px !important}
  /* closed backdrop carries no colour: mobile browsers tint their top bar from fixed elements at the top */
  #ejm-mf .ejm-mf-backdrop{display:block;position:fixed;inset:0;z-index:2147483001;background:transparent;visibility:hidden;pointer-events:none;transition:background-color .25s,visibility 0s linear .25s}
  body.ejm-mf-open #ejm-mf .ejm-mf-backdrop{background:rgba(0,0,0,.45);visibility:visible;pointer-events:auto;transition:background-color .25s,visibility 0s}
  #ejm-mf .ejm-mf-panel{position:fixed;left:0;right:0;bottom:0;z-index:2147483002;display:flex;flex-direction:column;height:86vh;height:86dvh;background:#fff;border-radius:16px 16px 0 0;box-shadow:0 -10px 30px rgba(0,0,0,.2);transform:translateY(105%);transition:transform .28s ease;visibility:hidden}
  body.ejm-mf-open #ejm-mf .ejm-mf-panel{transform:none;visibility:visible}
  body.ejm-mf-open{overflow:hidden}
  #ejm-mf .ejm-mf-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid #eee;font-size:16px;text-transform:uppercase;letter-spacing:.04em}
  #ejm-mf .ejm-mf-close{flex:0 0 36px;width:36px !important;height:36px !important;min-width:0;padding:0 !important;margin:0;border:0;border-radius:50%;background:#f2f2f2;color:#222;font-size:22px;line-height:36px;text-align:center;cursor:pointer}
  #ejm-mf .ejm-mf-body{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:0 18px}
  #ejm-mf .mfilter-content > ul{display:block !important}
  #ejm-mf li.mfilter-filter-item{border-bottom:1px solid #eee !important}
  #ejm-mf .mfilter-heading{display:flex;align-items:center;width:100%;min-height:48px}
  #ejm-mf .mfilter-heading-content{width:100%}
  #ejm-mf .mfilter-heading-text{flex:1;font-size:14px}
  #ejm-mf .mfilter-content-opts{position:static !important;padding:0 0 16px !important}
  #ejm-mf .mfilter-opts-container{max-height:none;overflow:visible}
  #ejm-mf .mfilter-tb{grid-template-columns:1fr 1fr;gap:0 10px}
  #ejm-mf .mfilter-option{padding:10px 4px !important}
  #ejm-mf .mfilter-option label{font-size:14px}
  #ejm-mf .ejm-mf-foot{display:flex;gap:10px;padding:12px 18px;padding-bottom:calc(12px + env(safe-area-inset-bottom));border-top:1px solid #eee;background:#fff}
  #ejm-mf .ejm-mf-btn{flex:1 1 0;min-width:0;width:auto !important;height:42px;margin:0;padding:0 10px !important;border-radius:21px;font-size:13px;font-weight:600;line-height:1.2;white-space:nowrap;text-transform:none;letter-spacing:0;cursor:pointer}
  #ejm-mf .ejm-mf-btn-ghost{border:1px solid #ddd;background:#fff;color:#222}
  #ejm-mf .ejm-mf-btn-main{flex:1.6 1 0;border:0;background:#111;color:#fff}
}
