/* ============================================================
   کارت محصول پریمیوم + گرید + مودال مشاهدهٔ سریع
   🧑‍🏫 این فایل در base.html لود می‌شود تا کارت‌ها همه‌جا یک‌شکل باشند.
   ============================================================ */

/* ---------- گرید محصولات ---------- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}

/* ---------- کارت محصول ---------- */
.product-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--t) var(--ease-out),
              box-shadow var(--t) var(--ease),
              border-color var(--t) var(--ease);
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

/* بج تخفیف */
.product-card .discount-tag {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--gradient-brand);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  z-index: 3;
  box-shadow: var(--shadow-brand);
}

/* دکمه‌های شناور (علاقه‌مندی + مشاهدهٔ سریع) */
.card-float-actions {
  position: absolute;
  top: 14px; left: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease-out);
}
.product-card:hover .card-float-actions { opacity: 1; transform: translateX(0); }
.icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
  transition: all var(--t) var(--ease-spring);
}
.icon-btn:hover { color: var(--brand); transform: scale(1.12); }
.wish-btn.active { background: #fef2f2; }
/* 🧑‍🏫 رنگ رو صریح ست می‌کنیم (نه ارث‌بری از parent) که روی هر پس‌زمینه‌ای
   (حتی شیشه‌ای روی عکس محصول) همیشه واضح دیده بشه. */
.wish-btn { color: #64748b; }
.wish-btn.active { color: #ef4444; }
.wish-btn .heart-path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: fill 0.15s ease;
}
.wish-btn.active .heart-path {
  fill: currentColor;
}
.wish-form { display: flex; }

/* تصویر */
.product-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 210px;
  padding: 20px;
  background: var(--gradient-soft);
  overflow: hidden;
}
.product-thumb img {
  max-height: 100%; max-width: 100%; object-fit: contain;
  transition: transform var(--t-slow) var(--ease-out);
}
.product-card:hover .product-thumb img { transform: scale(1.08); }
.product-thumb .dummy-img { color: var(--text-muted); font-size: 0.85rem; text-align: center; }

/* اطلاعات */
.product-info { padding: 16px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.tech-specs { font-size: 0.74rem; color: var(--text-muted); display: flex; gap: 5px; align-items: center; }
.tech-specs .dot { opacity: 0.5; }
.product-info h3 { font-size: 0.9rem; line-height: 1.7; min-height: 3em; font-weight: 600; }
.product-info h3 a { color: var(--text); text-decoration: none; transition: color var(--t-fast); }
.product-info h3 a:hover { color: var(--brand); }

/* امتیاز ستاره */
.card-rating { display: flex; align-items: center; gap: 2px; font-size: 0.85rem; }
.card-rating .star { color: #d6dbe2; }
.card-rating .star.full { color: #fbbf24; }
.card-rating .rating-num { color: var(--text-muted); font-size: 0.75rem; margin-right: 4px; }

/* وضعیت موجودی */
.stock-badge { font-size: 0.74rem; font-weight: 600; display: inline-flex; width: fit-content; }
.stock-badge.in { color: var(--success); }
.stock-badge.out { color: var(--text-muted); }

/* قیمت */
.price-box { margin-top: auto; padding-top: 4px; }
.price-box .old-price {
  display: block; color: var(--text-muted); text-decoration: line-through; font-size: 0.78rem;
}
.price-box .main-price { font-weight: 800; color: var(--text); font-size: 1.05rem; }
.price-box .main-price small { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }

/* دکمهٔ افزودن به سبد */
.add-to-cart-btn {
  width: 100%;
  border: none;
  background: var(--text);
  color: #fff;
  padding: 11px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: background var(--t) var(--ease), transform var(--t-fast) var(--ease-spring);
}
.add-to-cart-btn:hover:not(:disabled) { background: var(--gradient-brand); transform: translateY(-1px); }
.add-to-cart-btn:active:not(:disabled) { transform: scale(0.97); }
.add-to-cart-btn:disabled { background: var(--border-strong); cursor: not-allowed; }

/* حالت خالی */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state p { margin-bottom: 18px; }

/* ---------- مودال مشاهدهٔ سریع ---------- */
.qv-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t) var(--ease);
}
.qv-overlay.open { opacity: 1; pointer-events: auto; }
.qv-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 820px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(20px) scale(0.98);
  transition: transform var(--t) var(--ease-out);
}
.qv-overlay.open .qv-modal { transform: translateY(0) scale(1); }
.qv-close {
  position: absolute; top: 14px; left: 14px; z-index: 5;
  width: 38px; height: 38px; border-radius: var(--radius-full);
  border: none; background: var(--bg); cursor: pointer; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center; color: var(--text-soft);
  transition: all var(--t) var(--ease);
}
.qv-close:hover { background: var(--brand-light); color: var(--brand); }
.qv-loading { padding: 60px; text-align: center; }

.qv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 28px; }
.qv-image {
  position: relative; background: var(--gradient-soft); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 280px;
}
.qv-image img { max-width: 100%; max-height: 320px; object-fit: contain; }
.qv-image .discount-tag {
  position: absolute; top: 14px; right: 14px; background: var(--gradient-brand);
  color: #fff; font-size: 0.78rem; font-weight: 800; padding: 4px 10px; border-radius: var(--radius-full);
}
.qv-info h2 { font-size: 1.3rem; margin: 8px 0; letter-spacing: -0.02em; }
.qv-desc { color: var(--text-soft); font-size: 0.9rem; line-height: 2; margin: 12px 0; }
.qv-info .price-box { margin: 16px 0; }
.qv-actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.qv-actions form { flex: 1; }
.qv-actions .btn { width: 100%; }

@media (max-width: 640px) {
  .qv-grid { grid-template-columns: 1fr; }
}

/* ---------- گرید ۲ محصول در هر ردیف، موبایل ---------- */
@media (max-width: 640px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .product-thumb {
    height: 130px;
    padding: 10px;
  }
  .product-info {
    padding: 10px;
    gap: 6px;
  }
  .product-info h3 {
    font-size: 0.78rem;
    line-height: 1.5;
  }
  .tech-specs { font-size: 0.68rem; }
  .card-rating { font-size: 0.72rem; }
  .card-rating .rating-num { display: none; } /* روی کارت کوچیک جا نمی‌شه، فقط ستاره کافیه */
  .stock-badge { font-size: 0.68rem; }
  .price-box .old-price { font-size: 0.68rem; }
  .price-box .main-price { font-size: 0.88rem; }
  .add-to-cart-btn {
    padding: 8px;
    font-size: 0.76rem;
  }
  .discount-tag { top: 8px; right: 8px; font-size: 0.68rem; padding: 3px 7px; }
  .card-float-actions { top: 8px; left: 8px; gap: 5px; }
  .icon-btn { width: 30px; height: 30px; }
}
