/* Niktazeh Mobile Fixes - styles */

/* Mobile-only bottom bar */
@media (min-width: 768px) {
  .nmf-bottom-bar { display: none !important; }
}

/* Hard-disable on: single product, cart, checkout */
.single-product .nmf-bottom-bar,
.woocommerce-cart .nmf-bottom-bar,
.woocommerce-checkout .nmf-bottom-bar{ display: none !important; }

@media (max-width: 767px) {
  body.single-product,
  body.woocommerce-cart,
  body.woocommerce-checkout { padding-bottom: 0 !important; }
}

/* Bottom bar */
.nmf-bottom-bar{
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 999999;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 10px 8px;
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  box-shadow: 0 10px 28px rgba(0,0,0,.14);
  border: 1px solid rgba(0,0,0,.06);
  direction: rtl;
}

.nmf-item{
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-decoration: none !important;
  color: inherit;
  padding: 6px 4px;
  border-radius: 14px;
}
.nmf-item:active{ transform: scale(.98); }

.nmf-ico{
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nmf-ico svg{ display:block; width:22px; height:22px; }

.nmf-label{
  font-size: 11px;
  line-height: 1;
  opacity: .9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge */
.nmf-badge{
  position: absolute;
  top: 2px;
  right: 12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(0,0,0,.22);
}

/* Only add bottom padding when bar is present */
@media (max-width: 767px) {
  body.nmf-has-bottom-bar { padding-bottom: 78px !important; }
}

/* CART: hide remove (×) button on mobile */
@media (max-width: 767px) {
  .woocommerce-cart-form td.product-remove,
  .woocommerce-cart-form__contents td.product-remove{ display: none !important; }
  .woocommerce-cart-form a.remove{ display:none !important; }
}

/* CART ONLY: Compact +/- for quantity (simple black) */
@media (max-width: 767px) {
  .woocommerce-cart-form .nmf-qty-wrap,
  .woocommerce-cart-form__contents .nmf-qty-wrap{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,.20);
    background: transparent;
  }

  .woocommerce-cart-form .nmf-qty-btn,
  .woocommerce-cart-form__contents .nmf-qty-btn{
    width: 22px;
    height: 22px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,.22);
    background: transparent;
    color: #111;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    user-select: none;
    flex: 0 0 22px;
  }

  .woocommerce-cart-form .nmf-qty-btn:active,
  .woocommerce-cart-form__contents .nmf-qty-btn:active{ transform: scale(.98); }

  .woocommerce-cart-form .nmf-qty-wrap input.qty,
  .woocommerce-cart-form__contents .nmf-qty-wrap input.qty{
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    text-align: center !important;
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 !important;
    height: 24px !important;
    line-height: 24px !important;
    font-size: 12px !important;
    color: #111 !important;
    box-shadow: none !important;
  }
}

/* Cart qty message (Persian) */
@media (max-width: 767px) {
  .woocommerce-cart-form .nmf-qty-msg,
  .woocommerce-cart-form__contents .nmf-qty-msg{
    display:block;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.4;
    color: #b91c1c;
  }
}

/* Search modal */
.nmf-search-modal{
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: none;
  direction: rtl;
  touch-action: none;
}
.nmf-search-modal.nmf-open{ display:block; }

.nmf-search-overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.nmf-search-panel{
  position: fixed;
  left: 10px;
  right: 10px;
  top: 12px;
  bottom: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(0,0,0,.28);
  padding: 12px;
}

.nmf-search-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 4px 2px 10px;
}
.nmf-search-title{ font-size: 14px; font-weight: 800; }
.nmf-search-close{
  width: 34px; height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  font-size: 22px;
  line-height: 30px;
  cursor: pointer;
}

.nmf-search-form{
  display:flex;
  gap:8px;
  align-items:center;
  padding: 8px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 16px;
}
.nmf-search-input{
  flex: 1 1 auto;
  min-width: 0;
  border: 0 !important;
  outline: none !important;
  font-size: 16px;
  padding: 10px 8px;
  background: transparent !important;
}
.nmf-search-submit{
  flex: 0 0 auto;
  border: 0;
  background: #111;
  color: #fff;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor:pointer;
}

.nmf-search-section{ padding: 12px 2px 2px; }
.nmf-search-section-title{
  font-size: 12px;
  font-weight: 800;
  opacity: .9;
  margin-bottom: 10px;
}

.nmf-search-cats{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 480px){
  .nmf-search-cats{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.nmf-cat{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  text-decoration:none !important;
  color: inherit;
  padding: 10px 6px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.9);
}

.nmf-cat-ico{
  width: 54px; height: 54px;
  border-radius: 999px;
  border: 2px solid #7c3aed;
  box-shadow: 0 0 0 6px rgba(124,58,237,.12);
  display:grid;
  place-items:center;
  overflow:hidden;
}
.nmf-cat-ico img{
  width: 34px; height: 34px;
  object-fit: contain;
  display:block;
}

.nmf-cat-name{
  font-size: 11px;
  text-align:center;
  line-height: 1.2;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.nmf-search-links{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.nmf-search-links a{
  text-decoration:none !important;
  color:#111;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.12);
}

/* iOS Safari: prevent input focus zoom inside modal */
@supports (-webkit-touch-callout: none) {
  .nmf-search-panel { -webkit-text-size-adjust: 100%; }
  .nmf-search-input{
    font-size: 16px !important;
    line-height: 1.4 !important;
  }
}


/* Tabs */
.nmf-tabs{
  display:flex;
  gap:8px;
  padding: 10px 2px 2px;
}
.nmf-tab{
  flex:1 1 0;
  border:1px solid rgba(0,0,0,.12);
  background:#fff;
  color:#111;
  padding: 10px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
  cursor:pointer;
}
.nmf-tab.is-active{
  border-color: rgba(124,58,237,.45);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}

.nmf-pane{ display:none; padding-top: 10px; }
.nmf-pane.is-active{ display:block; }

/* Brands grid */
.nmf-brands{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 480px){
  .nmf-brands{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.nmf-brand{
  display:flex;
  align-items:center;
  justify-content:center;
  height: 78px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.98);
  box-shadow: 0 10px 22px rgba(2,6,23,.06);
  text-decoration:none !important;
  overflow:hidden;
  position:relative;
}
.nmf-brand:before{
  content:"";
  position:absolute;
  inset:-40% -30%;
  background: radial-gradient(circle at 35% 30%, rgba(124,58,237,.10), transparent 55%);
  opacity:.85;
  pointer-events:none;
}
.nmf-brand-logo{
  width: 128px;
  height: 44px;
  display:grid;
  place-items:center;
  z-index:1;
}
.nmf-brand-logo img{
  width:100%;
  height:100%;
  object-fit: contain;
  display:block;
}


/* ===== Brands (modal) - chip horizontal scroll (not stretched rectangles) ===== */
.nmf-brands-row{
  display:flex;
  flex-wrap:nowrap;
  gap:12px;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width:none;
  padding: 6px 6px 14px 6px;
  margin: 0;
  direction: rtl;
  scroll-snap-type: x proximity;
  mask-image: linear-gradient(to left, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
}
.nmf-brands-row::-webkit-scrollbar{ height:0; }

.nmf-brand-chip{
  flex: 0 0 auto;
  scroll-snap-align: start;

  height: 64px;
  min-width: 150px;

  display:flex;
  align-items:center;
  justify-content:center;

  padding: 10px 14px;
  border-radius: 16px;

  background: rgba(255,255,255,.0);
  border: 1px solid rgba(2,6,23,.06);

  text-decoration:none !important;
  outline:none;

  transition: transform .18s ease, background .18s ease, border-color .18s ease;
  position:relative;
}

.nmf-brand-chip:hover{
  transform: translateY(-1px);
  background: rgba(124,58,237,.06);
  border-color: rgba(124,58,237,.18);
}
.nmf-brand-chip:focus-visible{
  border-color: rgba(124,58,237,.34);
  box-shadow: 0 0 0 3px rgba(124,58,237,.14);
}

.nmf-brand-logo{
  width: 150px;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
}
.nmf-brand-logo img{
  display:block;
  width: 100%;
  height: auto;
  max-height: 40px;
  object-fit: contain;
  object-position: center;
  transform: translateY(-2px);
}

@media (max-width:520px){
  .nmf-brand-chip{
    width: calc((100% - 14.4px) / 2.2);
    min-width: unset;
    height: 58px;
    padding: 8px 12px;
  }
  .nmf-brand-logo{ width: 100%; }
  .nmf-brand-logo img{ max-height: 34px; transform: translateY(-1px); }
}


/* ===== Brands (modal) - stacked (no horizontal scroll) ===== */
.nmf-brands-stack{
  display:grid;
  grid-template-columns: 1fr; /* زیر هم */
  gap: 10px;
  padding: 10px 2px 6px;
  margin: 0;
}

@media (min-width: 420px){
  .nmf-brands-stack{ grid-template-columns: repeat(2, minmax(0, 1fr)); } /* هنوز جمع‌وجور */
}
@media (min-width: 560px){
  .nmf-brands-stack{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.nmf-brands-stack .nmf-brand-chip{
  width: 100%;
  min-width: 0;
  height: 62px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.0);
  border: 1px solid rgba(2,6,23,.06);
  display:flex;
  align-items:center;
  justify-content:center;
}

.nmf-brands-stack .nmf-brand-logo{
  width: 100%;
  max-width: 150px;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
}
.nmf-brands-stack .nmf-brand-logo img{
  width: 100%;
  height: auto;
  max-height: 36px;
  object-fit: contain;
  object-position: center;
  transform: translateY(-1px);
}

/* If earlier row styles exist, neutralize overflow/mask */
.nmf-brands-row{ overflow: visible !important; mask-image:none !important; -webkit-mask-image:none !important; }


/* ===== Brands (modal) - FORCE 2 columns on ALL mobiles ===== */
@media (max-width: 767px){
  .nmf-brands-stack{
    display:grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important; /* همیشه دوتا */
    gap: 10px !important;
    padding: 10px 2px 6px !important;
  }

  .nmf-brands-stack .nmf-brand-chip{
    width: 100% !important;
    height: 68px !important;
    padding: 10px 12px !important;
    border-radius: 18px !important;
    background: rgba(255,255,255,0) !important;
    border: 1px solid rgba(2,6,23,.10) !important;
    transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  }

  /* Purple border on hover/focus/active */
  .nmf-brands-stack .nmf-brand-chip:hover,
  .nmf-brands-stack .nmf-brand-chip:focus-visible,
  .nmf-brands-stack .nmf-brand-chip:active{
    transform: translateY(-2px);
    background: rgba(124,58,237,.06);
    border-color: rgba(124,58,237,.70) !important;
    box-shadow: 0 0 0 2px rgba(124,58,237,.15);
  }

  .nmf-brands-stack .nmf-brand-logo{
    width: 100% !important;
    max-width: 160px !important;
    height: 100% !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
  }

  /* Default BLACK logos */
  .nmf-brands-stack .nmf-brand-logo img{
    width: 100% !important;
    height: auto !important;
    max-height: 48px !important;
    object-fit: contain !important;
    object-position: center !important;
    transform: translateY(-1px);
    filter: brightness(0) saturate(100%);
    transition: filter .18s ease;
  }

  /* Hover/Focus/Active => restore original color */
  .nmf-brands-stack .nmf-brand-chip:hover .nmf-brand-logo img,
  .nmf-brands-stack .nmf-brand-chip:focus-visible .nmf-brand-logo img,
  .nmf-brands-stack .nmf-brand-chip:active .nmf-brand-logo img{
    filter: none;
  }
}
