/* Archive filters — Digikala-inspired sheet */

/* Toolbar: filter + sort share identical control chrome */
.mk-archive__tools{
  display:flex;align-items:center;justify-content:flex-start;gap:.45rem;flex-wrap:wrap;order:1;
}
.mk-archive__toolbar .woocommerce-ordering{margin:0!important}
.mk-archive__toolbar .woocommerce-result-count{order:2}
/* sort → filter → compare */
.mk-archive__tools .woocommerce-ordering,
.mk-archive__tools .mk-select{order:1;width:auto;flex:0 0 auto;margin:0}
.mk-archive__tools .mk-filter-btn{order:2}
.mk-archive__tools .mk-compare-btn{order:3}
.mk-archive__tools .mk-filter-btn,
.mk-archive__tools .mk-select__trigger{
  position:relative;display:inline-flex;flex-direction:row;align-items:center;justify-content:center;
  gap:.4rem;box-sizing:border-box;
  width:auto;min-width:0;max-width:none;flex:0 0 auto;
  height:40px;min-height:40px;max-height:40px;
  padding:0 12px;margin:0;
  border-radius:8px;border:1px solid var(--mk-gray-line,#e5e7eb);background:#fff;
  cursor:pointer;font:inherit;font-size:14px;font-weight:600;line-height:1;
  color:var(--mk-ink,#111928);direction:rtl;text-align:right;
  box-shadow:none;
}
.mk-archive__tools .mk-filter-btn .mk-select__label,
.mk-archive__tools .mk-select__trigger .mk-select__label{
  flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  text-align:right;line-height:1.2;
}
.mk-archive__tools .mk-filter-btn__ico,
.mk-archive__tools .mk-select__lead-ico{
  flex-shrink:0;width:18px;height:18px;display:block;opacity:.92;color:currentColor;
}
.mk-archive__tools .mk-select__lead-ico svg{display:block;width:18px;height:18px}
.mk-archive__tools .mk-select__chev{flex-shrink:0;width:16px;height:16px;opacity:.85}
.mk-filter-btn__badge{
  position:absolute;top:-7px;right:-7px;left:auto;
  min-width:1.15rem;height:1.15rem;padding:0 .2rem;border-radius:999px;
  background:var(--mk-orange,#ff5d2c);color:var(--mk-black,#0a0a0a);
  font-size:.62rem;font-weight:800;line-height:1;box-sizing:border-box;
  display:inline-flex;align-items:center;justify-content:center;text-align:center;
  pointer-events:none;
}

/* Archive compare button — soft mint/ice gradient, black label */
.mk-archive__tools .mk-compare-btn{
  position:relative;display:inline-flex;align-items:center;justify-content:center;gap:.4rem;
  box-sizing:border-box;width:auto;min-width:0;flex:0 0 auto;
  height:40px;min-height:40px;max-height:40px;padding:0 12px;margin:0;
  border:1px solid var(--mk-gray-line,#e5e7eb);border-radius:8px;cursor:pointer;
  font:inherit;font-size:14px;font-weight:700;line-height:1;
  color:#0a0a0a;direction:rtl;
  background:#fff;
  box-shadow:0 4px 12px rgba(15,23,42,.06);
  transition:transform .15s ease,box-shadow .15s ease,filter .15s ease,border-color .15s ease;
}
.mk-archive__tools .mk-compare-btn:hover{
  filter:brightness(1.02);box-shadow:0 6px 16px rgba(15,23,42,.1);border-color:rgba(15,23,42,.12);
}
.mk-archive__tools .mk-compare-btn:active{transform:scale(.98)}
.mk-archive__tools .mk-compare-btn.is-active{
  border-color: #2e5dea;
}
.mk-compare-btn__ico{display:block;flex-shrink:0;opacity:.95;color:#0a0a0a}
.mk-compare-btn__label{white-space:nowrap;color:#0a0a0a}
.mk-compare-btn__badge{
  position:absolute;top:-7px;right:-7px;
  min-width:1.15rem;height:1.15rem;padding:0 .2rem;border-radius:999px;
  background:#0a0a0a;color:#fff;font-size:.62rem;font-weight:800;line-height:1;
  display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;
  box-shadow:0 2px 6px rgba(15,23,42,.18);pointer-events:none;
}
.mk-compare-btn__badge[hidden]{display:none!important}

/* Mobile: icon-only filter + compare (keep labels for SR — never display:none) */
@media (max-width:767.98px){
  .mk-archive__tools .mk-filter-btn,
  .mk-archive__tools .mk-compare-btn{
    width:40px;min-width:40px;padding:0;gap:0;
  }
  .mk-archive__tools .mk-filter-btn .mk-select__label,
  .mk-archive__tools .mk-compare-btn .mk-compare-btn__label{
    position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;
    overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;
  }
}

/* Card pick mode — same green tick as compare modal */
body.mk-compare-pick-on .mk-card{position:relative}
body.mk-compare-pick-on .mk-card__compare-check{
  display:inline-flex!important;position:absolute;z-index:5;
  inset-block-start:.45rem;inset-inline-start:.45rem;
  width:1.35rem;height:1.35rem;padding:0;margin:0;border:0;border-radius:0;
  background:transparent;cursor:pointer;align-items:center;justify-content:center;
  -webkit-tap-highlight-color:transparent;box-shadow:none;
}
body.mk-compare-pick-on .mk-card__compare-check .mk-compare-modal__check{
  position:static;display:none;width:1.35rem;height:1.35rem;
  align-items:center;justify-content:center;
}
body.mk-compare-pick-on .mk-card.is-compare-on .mk-card__compare-check .mk-compare-modal__check,
body.mk-compare-pick-on .mk-card__compare-check[aria-pressed="true"] .mk-compare-modal__check{
  display:inline-flex;
}
body.mk-compare-pick-on .mk-card__compare-check .mk-toast__tick{display:block;width:1.25rem;height:1.25rem}
body.mk-compare-pick-on .mk-card__compare-check .mk-toast__tick-ring{animation:none}
body.mk-compare-pick-on .mk-card__compare-check .mk-toast__tick-path{
  stroke-dasharray:none;stroke-dashoffset:0;animation:none;
}
/* Unselected: empty circle ring like selectable state */
body.mk-compare-pick-on .mk-card:not(.is-compare-on) .mk-card__compare-check::before{
  content:"";width:1.25rem;height:1.25rem;border-radius:50%;
  border:2px solid rgba(255,255,255,.95);background:rgba(15,23,42,.22);
  box-shadow:0 1px 4px rgba(15,23,42,.18);
}
body.mk-compare-pick-on .mk-card.is-compare-on .mk-card__compare-check::before{display:none}
body.mk-compare-pick-on .mk-card__link{cursor:pointer}

/* Sticky compare bar */
.mk-compare-pick-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -10px 30px rgba(15, 23, 42, .1);
  direction: rtl;
  margin: 0 auto;
  border-radius: 0px;
  border: none;
}
@media (min-width:992px){
  .mk-compare-pick-bar {
    max-width: 400px;
    margin: 0 auto 10px;
    border-radius: 10px;
    border: 1px solid #2e5dea;
  }
}
body.mk-compare-pick-on .mk-compare-pick-bar{display:flex}
@media (max-width:991.98px){
  body.mk-compare-pick-on .mk-compare-pick-bar{
    bottom:var(--mk-bottom-nav-h,0px);
  }
}
.mk-compare-pick-bar__meta{
  display:flex;flex-direction:column;align-items:flex-start;gap:.15rem;min-width:0;
}
.mk-compare-pick-bar__count{font-size:.92rem;font-weight:800;color:#111928}
.mk-compare-pick-bar__actions{display:flex;align-items:center;gap:.45rem;flex-shrink:0}
.mk-compare-pick-bar__cancel{
  height:40px;padding:0 .9rem;border-radius:.8rem;cursor:pointer;font:inherit;font-size:.86rem;font-weight:700;
  border:1px solid #e5e7eb;background:#fff;color:#374151;
}
.mk-compare-pick-bar__go{
  height:40px;padding:0 1.1rem;border:none;border-radius:.8rem;
  cursor:pointer;font:inherit;font-size:.9rem;font-weight:800;color:#fff;
  background:#2e5dea;
  box-shadow:0 4px 12px rgba(15,23,42,.06);
}
.mk-compare-pick-bar__go:disabled{
  opacity:.45;cursor:not-allowed;box-shadow:none;filter:grayscale(.15);
}

.mk-filter{
  position:fixed;inset:0;z-index:1200;display:none;align-items:flex-end;justify-content:center;
}
.mk-filter.is-open{display:flex}
.mk-filter[hidden]{display:none!important}
.mk-filter.is-open[hidden]{display:flex!important}
.mk-filter__backdrop{
  position:absolute;inset:0;background:rgba(15,23,42,.45);border:0;cursor:pointer;
  animation:mk-filter-fade .22s var(--mk-ease,ease);
}
@keyframes mk-filter-fade{from{opacity:0}to{opacity:1}}

/* Transform-only sheet (Instagram-style). Height stays 100%; peek/full/close = translateY. */
.mk-filter__panel{
  position:relative;z-index:1;display:flex;flex-direction:column;
  width:100%;height:100%;max-height:100%;
  background:#fff;overflow:hidden;
  border-radius:1.15rem 1.15rem 0 0;
  transform:translate3d(0,100%,0);
  will-change:transform;
  transition:none;
  touch-action:none;
  animation:none;
}
.mk-filter__panel.is-expanded{border-radius:0}
.mk-filter__panel.is-dragging{transition:none!important}
.mk-filter__panel.is-animating{
  transition:transform .34s cubic-bezier(.32,.72,0,1),border-radius .34s ease!important;
}

.mk-filter__handle{
  display:flex;align-items:center;justify-content:center;
  width:100%;flex-shrink:0;padding:.55rem 0 .2rem;cursor:grab;touch-action:none;
  -webkit-user-select:none;user-select:none;
}
.mk-filter__handle::before{
  content:"";display:block;width:42px;height:4px;border-radius:999px;background:#d1d5db;
}
.mk-filter__handle:active{cursor:grabbing}

/* Head aligns with row content (same 16px inset, RTL) */
.mk-filter__head{
  display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex-shrink:0;
  direction:rtl;min-height:56px;height:56px;padding:0 16px;box-sizing:border-box;
  border-bottom:1px solid rgba(17,25,40,.08);background:#fff;
}
.mk-filter__head-main{
  display:inline-flex;align-items:center;gap:.5rem;min-width:0;flex:1;direction:rtl;
}
.mk-filter__title{
  margin:0;font-size:1.05rem;font-weight:800;color:#111928;text-align:right;
  line-height:1.3;white-space:nowrap;
}
.mk-filter__active-badge{
  display:inline-flex;align-items:center;justify-content:center;
  flex-shrink:0;min-height:1.35rem;padding:.15rem .55rem;border-radius:999px;
  background:rgba(37,99,235,.1);color:#1d4ed8;
  font-size:.72rem;font-weight:750;line-height:1.2;white-space:nowrap;
}
.mk-filter__active-badge[hidden]{display:none!important}
.mk-filter__close{
  width:2.5rem;height:2.5rem;margin:0;padding:0;border:0;border-radius:.75rem;background:transparent;
  display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:#111928;flex-shrink:0;
}
.mk-filter__close:hover{background:rgba(0,0,0,.05)}

.mk-filter__views{flex:1;min-height:0;position:relative;overflow:hidden;background:#fff;touch-action:pan-y}
.mk-filter__view{
  position:absolute;inset:0;display:flex;flex-direction:column;overflow:auto;
  -webkit-overflow-scrolling:touch;
  padding:0 0 calc(.5rem + var(--mk-sheet-shift,0px));background:#fff;
}
.mk-filter__view[hidden]{display:none!important}
.mk-filter__view.is-active{display:flex}

.mk-filter__list{list-style:none;margin:0;padding:0}
.mk-filter__row{border-bottom:1px solid rgba(17,25,40,.08)}
.mk-filter__row-btn{
  display:flex;align-items:center;justify-content:space-between;gap:.75rem;
  width:100%;min-height:56px;padding:.7rem 16px;margin:0;border:0;background:transparent;
  color:#111928;cursor:pointer;font:inherit;text-align:right;-webkit-tap-highlight-color:transparent;
  box-sizing:border-box;
}
.mk-filter__row-text{display:flex;flex-direction:column;align-items:flex-start;gap:.15rem;min-width:0;flex:1}
.mk-filter__row-label{
  display:inline-flex;align-items:center;gap:.45rem;font-size:.95rem;font-weight:650;line-height:1.4;
}
.mk-filter__dot{
  width:8px;height:8px;min-width:8px;min-height:8px;border-radius:50%;
  background:#2563eb;flex-shrink:0;display:none;box-sizing:border-box;
  aspect-ratio:1/1;vertical-align:middle;
}
.mk-filter__row.is-active .mk-filter__dot{display:inline-block}

.mk-filter__row-summary{
  font-size:.78rem;font-weight:500;color:#6b7280;line-height:1.35;
  max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.mk-filter__row-summary:empty{display:none}
.mk-filter__chev{flex-shrink:0;color:#9ca3af;display:inline-flex}

/* In-stock toggle row */
.mk-filter__toggle-row{
  display:flex;align-items:center;justify-content:space-between;gap:.75rem;
  width:100%;min-height:56px;padding:.7rem 16px;margin:0;box-sizing:border-box;
  cursor:pointer;font:inherit;color:#111928;-webkit-tap-highlight-color:transparent;
}
.mk-filter__toggle-label{font-size:.95rem;font-weight:650;line-height:1.4}
.mk-filter-toggle{
  position:relative;width:40px;height:22px;display:inline-block;flex-shrink:0;
}
.mk-filter-toggle input{opacity:0;width:0;height:0;position:absolute}
.mk-filter-toggle span{
  position:absolute;inset:0;background:#cbd5e1;border-radius:999px;transition:.2s;
}
.mk-filter-toggle span:before{
  content:"";position:absolute;width:16px;height:16px;right:3px;top:3px;
  background:#fff;border-radius:50%;transition:.2s;box-shadow:0 1px 2px rgba(0,0,0,.12);
}
.mk-filter-toggle input:checked+span{background:var(--mk-orange,#ff5d2c)}
.mk-filter-toggle input:checked+span:before{transform:translateX(-18px)}

.mk-filter__subhead{
  display:flex;align-items:center;gap:.35rem;flex-shrink:0;direction:rtl;
  min-height:56px;padding:0 16px;box-sizing:border-box;
  border-bottom:1px solid rgba(17,25,40,.06);background:#fff;position:sticky;top:0;z-index:2;
}
.mk-filter__back{
  width:2.5rem;height:2.5rem;border:0;border-radius:.75rem;background:transparent;cursor:pointer;
  display:inline-flex;align-items:center;justify-content:center;color:#111928;flex-shrink:0;padding:0;
  overflow:visible;
}
.mk-filter__back:hover{background:rgba(0,0,0,.05)}
.mk-filter__back .mk-icon,
.mk-filter__back svg{
  display:block;width:20px;height:20px;overflow:visible;flex-shrink:0;
}
.mk-filter__subtitle{margin:0;font-size:.98rem;font-weight:800;color:#111928}

.mk-filter__opts{list-style:none;margin:0;padding:.35rem 0 1rem}
.mk-filter__opt{
  display:flex;align-items:center;justify-content:space-between;gap:.75rem;
  padding:.75rem 16px;cursor:pointer;font-size:.9rem;font-weight:550;color:#111928;
}
.mk-filter__opt input{width:1.1rem;height:1.1rem;accent-color:var(--mk-orange,#ff5d2c);flex-shrink:0}
.mk-filter__opt-name{flex:1;text-align:right}
.mk-filter__opt-count{color:#9ca3af;font-size:.78rem;font-weight:600}
.mk-filter__opt.is-checked{background:rgba(255,93,44,.06)}

.mk-filter__colors{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px 10px;
  padding:16px 14px 1.25rem;direction:rtl;
}
.mk-filter__color{
  display:flex;flex-direction:column;align-items:center;gap:.4rem;cursor:pointer;margin:0;
}
.mk-filter__color-input{position:absolute;opacity:0;pointer-events:none}
.mk-filter__swatch{
  width:52px;height:52px;border-radius:14px;border:1px solid #e5e7eb;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.35);transition:box-shadow .15s ease,transform .15s ease;
}
.mk-filter__color.is-checked .mk-filter__swatch,
.mk-filter__color-input:checked + .mk-filter__swatch{
  box-shadow:0 0 0 2px #fff,0 0 0 4px var(--mk-orange,#ff5d2c);
  transform:scale(1.03);
}
.mk-filter__color-name{font-size:.78rem;font-weight:650;color:#111928;text-align:center}

.mk-filter__price{padding:1rem 16px 1.25rem}
.mk-filter__price-fields{display:grid;grid-template-columns:1fr;gap:.65rem;direction:rtl}
@media (min-width:768px){
  .mk-filter__price-fields{grid-template-columns:1fr 1fr}
}
.mk-filter__price-field{display:flex;flex-direction:column;gap:.35rem;font-size:.8rem;font-weight:650;color:#6b7280}
.mk-filter__price-field input{
  min-height:2.6rem;border:1px solid #e5e7eb;border-radius:.8rem;padding:.5rem .75rem;
  font:inherit;font-weight:700;color:#111928;background:#fff;direction:ltr;text-align:left;
  -moz-appearance:textfield;appearance:textfield;
}
.mk-filter__price-field input::-webkit-outer-spin-button,
.mk-filter__price-field input::-webkit-inner-spin-button{
  -webkit-appearance:none;margin:0;
}
.mk-filter__price-hint{margin:.65rem 0 0;font-size:.75rem;color:#9ca3af}

.mk-filter__foot{
  flex-shrink:0;display:flex;flex-direction:row;align-items:center;gap:.55rem;
  direction:rtl;padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px));
  border-top:1px solid rgba(17,25,40,.08);background:#fff;
  position:relative;z-index:5;
  /* Counter peek translate so apply bar stays in the visible sheet area. */
  transform:translate3d(0,calc(var(--mk-sheet-shift,0px) * -1),0);
  will-change:transform;
}
.mk-filter__panel.is-animating .mk-filter__foot{
  transition:transform .34s cubic-bezier(.32,.72,0,1);
}
.mk-filter__panel.is-dragging .mk-filter__foot{transition:none!important}
.mk-filter__apply{
  flex:1 1 auto;min-width:0;min-height:3rem;border:0;border-radius:.9rem;cursor:pointer;
  background:var(--mk-orange,#ff5d2c);color:#fff;font:inherit;font-size:.95rem;font-weight:800;
  box-shadow:0 8px 20px rgba(255,93,44,.28);
}
.mk-filter__apply:active{transform:scale(.99)}
.mk-filter__clear{
  flex:0 0 auto;min-height:3rem;padding:0 1rem;border:1px solid rgba(255,93,44,.35);
  border-radius:.9rem;background:rgba(255,93,44,.06);color:var(--mk-orange,#ff5d2c);
  font:inherit;font-size:.88rem;font-weight:750;cursor:pointer;white-space:nowrap;
}
.mk-filter__clear[hidden]{display:none!important}

body.mk-filter-open{overflow:hidden;touch-action:none}

/* Desktop: centered modal card (no sheet drag) */
@media (min-width:1024px){
  .mk-filter{align-items:center;padding:1.5rem}
  .mk-filter__panel{
    width:min(440px,100%);height:auto;max-height:min(86vh,720px);
    border-radius:1.15rem;box-shadow:0 24px 60px rgba(15,23,42,.28);
    transform:none;will-change:auto;touch-action:auto;
    animation:mk-filter-pop .25s var(--mk-ease,ease);
  }
  .mk-filter__panel.is-expanded{border-radius:1.15rem}
  .mk-filter__panel.is-animating{transition:none!important}
  @keyframes mk-filter-pop{from{opacity:0;transform:translateY(12px) scale(.98)}to{opacity:1;transform:none}}
  .mk-filter__handle{display:none}
  .mk-filter__views{min-height:360px}
  .mk-filter__view{padding:0 0 .5rem}
  .mk-filter__foot{transform:none;will-change:auto}
  .mk-filter__panel.is-animating .mk-filter__foot{transition:none}
}
