/**
 * HyperMarket M3 — components.css
 * فاز ۳: کامپوننت‌های UI
 * دقیقاً بر اساس تصویر طراحی
 *
 * فهرست:
 *  1. Hero Slideshow
 *  2. Category Row
 *  3. Flash Sale Box (زمینه زرد)
 *  4. Product Card — Grid (داخل Flash Sale)
 *  5. Product Card — Horizontal (ردیف اسکرول)
 *  6. Section badges & chips
 *  7. Buttons
 *  8. Countdown Timer
 */

/* ══════════════════════════════════════════════
   1. HERO SLIDESHOW
══════════════════════════════════════════════ */

.hm-hero {
  margin: 10px 10px 0;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  height: 190px;
  background: #2a1a08;
  touch-action: pan-y;
}

.hm-hero__track {
  display: flex;
  height: 100%;
  will-change: transform;
  transition: transform .42s cubic-bezier(.25, 1, .5, 1);
}

.hm-hero__slide {
  min-width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 22px;
}

/* overlay تیره روی تصویر پس‌زمینه */
.hm-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.20) 55%,
    rgba(0,0,0,0.02) 100%
  );
  z-index: 1;
}

/* تصویر/دکور محصول سمت چپ */
.hm-hero__product {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 136px;
  height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2;
}
.hm-hero__product-box {
  width: 90px;
  height: 128px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.28);
  position: relative;
  overflow: hidden;
}
.hm-hero__product-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
}

/* محتوای متنی — سمت راست */
.hm-hero__content {
  position: relative;
  z-index: 3;
  margin-right: 16px;
  margin-left: 136px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.hm-hero__badge {
  background: #e8380d;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.hm-hero__badge-num {
  font-size: 14px;
  font-weight: 800;
}

.hm-hero__brand {
  background: #e8380d;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  padding: 3px 14px;
  border-radius: 8px;
  margin-bottom: 7px;
  letter-spacing: .5px;
  display: inline-block;
}

.hm-hero__title {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 3px;
}
.hm-hero__subtitle {
  color: rgba(255,255,255,.82);
  font-size: 11px;
  line-height: 1.5;
  margin-bottom: 13px;
}

.hm-hero__btn {
  background: #fff;
  color: #222;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 3px 10px rgba(0,0,0,.18);
  border: none;
  cursor: pointer;
  transition: transform .15s;
  font-family: inherit;
}
.hm-hero__btn:active { transform: scale(.94); }
.hm-hero__btn .material-symbols-rounded { font-size: 14px; }

/* Dots */
.hm-hero__dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 10;
}
.hm-hero__dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: rgba(255,255,255,.38);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all .3s cubic-bezier(.25,1,.5,1);
  flex-shrink: 0;
}
.hm-hero__dot.active {
  background: #fff;
  width: 18px;
}

/* ══════════════════════════════════════════════
   2. CATEGORY ROW
══════════════════════════════════════════════ */

.hm-cat-row {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 14px 10px 8px;
  gap: 0;
}
.hm-cat-row::-webkit-scrollbar { display: none; }

.hm-cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hm-cat-item__img {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: #fff;
  border: 1.5px solid #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  box-shadow: 0 1px 5px rgba(0,0,0,.05);
}
.hm-cat-item__img img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.hm-cat-item__img.active,
.hm-cat-item:hover .hm-cat-item__img {
  border-color: #FFC107;
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(255,193,7,.28);
}

.hm-cat-item__label {
  font-size: 11px;
  color: #444;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════
   3. FLASH SALE BOX
   دقیقاً زمینه زرد #FFC107 با گوشه‌های گرد
══════════════════════════════════════════════ */

.hm-flash-sale {
  margin: 6px 10px;
  background: #FFC107;
  border-radius: 24px;
  overflow: hidden;
  padding-bottom: 14px;
}

.hm-flash-sale__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 12px;
}

.hm-flash-sale__title {
  font-size: 14px;
  font-weight: 700;
  color: #222;
}

/* تایمر شمارش معکوس */
.hm-countdown {
  background: rgba(0,0,0,.13);
  border-radius: 10px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  gap: 1px;
  direction: ltr;
}
.hm-countdown__value {
  font-size: 15px;
  font-weight: 800;
  color: #1a1a1a;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  min-width: 22px;
  text-align: center;
  display: inline-block;
}
.hm-countdown__sep {
  font-size: 15px;
  font-weight: 800;
  color: #1a1a1a;
  margin: 0 1px;
}

/* گرید ۳ ستونه داخل Flash Sale */
.hm-flash-sale__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 0 8px;
}

/* ══════════════════════════════════════════════
   4. PRODUCT CARD — GRID
   (داخل Flash Sale — کارت سفید کوچک)
══════════════════════════════════════════════ */

.hm-p-card {
  background: #fff;
  border-radius: 16px;
  padding: 8px 7px 34px; /* padding-bottom برای دکمه + */
  position: relative;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  -webkit-tap-highlight-color: transparent;
}
.hm-p-card:active { transform: scale(.95); }
.hm-p-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.09); }

/* badge تخفیف — گوشه بالا راست */
.hm-p-card__disc {
  position: absolute;
  top: 7px;
  right: 7px;
  background: #e8380d;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  z-index: 1;
  letter-spacing: .2px;
}

/* تصویر محصول */
.hm-p-card__img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 5px;
  overflow: hidden;
}
.hm-p-card__img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* قیمت */
.hm-p-card__price {
  font-size: 11px;
  font-weight: 700;
  color: #222;
  direction: ltr;
  text-align: right;
  display: block;
  line-height: 1.3;
}
.hm-p-card__price-unit {
  font-size: 9px;
  font-weight: 400;
  color: #888;
}
.hm-p-card__old {
  font-size: 9px;
  color: #bbb;
  text-decoration: line-through;
  direction: ltr;
  text-align: right;
  display: block;
}

/* دکمه + افزودن به سبد */
.hm-p-card__add {
  position: absolute;
  bottom: 7px;
  left: 7px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #FFC107;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  color: #333;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: transform .14s, background .14s;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  font-family: inherit;
}
.hm-p-card__add:active { transform: scale(.84); background: #ffb300; }
.hm-p-card__add--added { background: #22c55e !important; color: #fff !important; font-size: 14px !important; }

/* ══════════════════════════════════════════════
   5. PRODUCT CARD — HORIZONTAL
   (ردیف اسکرول — کارت بزرگ‌تر)
══════════════════════════════════════════════ */

/* ردیف اسکرول */
.hm-p-row {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 14px 16px;
}
.hm-p-row::-webkit-scrollbar { display: none; }

.hm-p-card-h {
  background: #fff;
  border-radius: 18px;
  padding: 10px 9px 38px;
  width: 130px;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  border: 1px solid #f0f0f0;
  transition: transform .18s, box-shadow .18s;
  -webkit-tap-highlight-color: transparent;
}
.hm-p-card-h:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.hm-p-card-h:active { transform: scale(.95); }

/* badge تخفیف */
.hm-p-card-h__disc {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #e8380d;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  z-index: 1;
}

/* badge چندعدد (×۲) */
.hm-p-card-h__multi {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #f0f0f0;
  color: #555;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  z-index: 1;
}

/* تصویر */
.hm-p-card-h__img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 11px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  margin-bottom: 7px;
  overflow: hidden;
}
.hm-p-card-h__img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* نام محصول */
.hm-p-card-h__name {
  font-size: 11px;
  color: #333;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 30px;
}

/* قیمت جدید */
.hm-p-card-h__price {
  font-size: 12px;
  font-weight: 700;
  color: #e8380d; /* رنگ قرمز/نارنجی — دقیق تصویر */
  direction: ltr;
  text-align: right;
  display: block;
  line-height: 1.3;
}
.hm-p-card-h__price small {
  font-size: 9px;
  font-weight: 400;
  color: #aaa;
}

/* قیمت قدیم — خط خورده */
.hm-p-card-h__old {
  font-size: 9px;
  color: #ccc;
  text-decoration: line-through;
  direction: ltr;
  text-align: right;
  display: block;
  line-height: 1.2;
}

/* دکمه + */
.hm-p-card-h__add {
  position: absolute;
  bottom: 9px;
  left: 9px;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: #FFC107;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 700;
  color: #333;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: transform .14s, background .14s;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  font-family: inherit;
}
.hm-p-card-h__add:active { transform: scale(.84); background: #ffb300; }
.hm-p-card-h__add--added { background: #22c55e !important; color: #fff !important; font-size: 14px !important; }

/* ══════════════════════════════════════════════
   6. BUTTONS — M3 Style
══════════════════════════════════════════════ */

.hm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.hm-btn:active { transform: scale(.94); }

.hm-btn--filled {
  background: #FFC107;
  color: #333;
  box-shadow: 0 2px 8px rgba(255,193,7,.35);
}
.hm-btn--outlined {
  background: transparent;
  color: #FFC107;
  border: 1.5px solid #FFC107;
}
.hm-btn--tonal {
  background: rgba(255,193,7,.15);
  color: #b38600;
}
.hm-btn--full { width: 100%; }
.hm-btn--large { padding: 14px 24px; font-size: 14px; }
.hm-btn--sm { padding: 7px 14px; font-size: 11px; }
.hm-btn .material-symbols-rounded { font-size: 16px; }

/* ══════════════════════════════════════════════
   7. CHIPS
══════════════════════════════════════════════ */

.hm-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1.5px solid #ddd;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #444;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.hm-chip.active,
.hm-chip:hover {
  background: #FFC107;
  border-color: #FFC107;
  color: #333;
}

/* ══════════════════════════════════════════════
   8. STOCK BAR (Flash Sale)
══════════════════════════════════════════════ */

.hm-stock-bar {
  width: 100%;
  height: 3px;
  background: #f0f0f0;
  border-radius: 99px;
  margin-top: 4px;
  overflow: hidden;
}
.hm-stock-bar__fill {
  height: 100%;
  background: #e8380d;
  border-radius: 99px;
  transition: width .5s ease;
}

/* ══════════════════════════════════════════════
   9. SEARCH FIELD
══════════════════════════════════════════════ */

.hm-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 14px;
  padding: 0 14px;
  height: 44px;
  box-shadow: 0 2px 14px rgba(0,0,0,.1);
  border: 1px solid rgba(255,255,255,.7);
}
.hm-search-field .material-symbols-rounded { font-size: 20px; color: #aaa; }
.hm-search-field input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: #222;
  outline: none;
}
.hm-search-field input::placeholder { color: #bbb; }

/* ══════════════════════════════════════════════
   10. SEARCH DROPDOWN
══════════════════════════════════════════════ */

.hm-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14);
  overflow: hidden;
  z-index: 200;
  max-height: 320px;
  overflow-y: auto;
}

.hm-search-item__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f5f5f5;
  transition: background .15s;
}
.hm-search-item__link:hover { background: #fffde8; }
.hm-search-item__image {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: #f5f5f5;
}
.hm-search-item__title { font-size: 12px; font-weight: 500; color: #222; }
.hm-search-item__price { font-size: 11px; color: #e8380d; font-weight: 600; }
.hm-search-highlight { background: #FFF3CD; border-radius: 2px; }
