/* ============================================================
   گالری اسلایدری + زوم — فروشگاه لنا (فایل مستقل ضدکش)
   دسکتاپ: هاور = زوم لنزی دنبال ماوس | کلیک = تمام‌صفحه
   موبایل: کشیدن = بعد/قبل | ضربه = تمام‌صفحه + پینچ‌زوم
   اکسنت: صورتی برند لنا (#ec4899)
   ============================================================ */

/* --- فریم گالری (بازنویسی استایل قبلی) --- */
.gallery-main { display: block; position: relative; cursor: zoom-in; }
.gallery-track {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0; /* تمام‌عرض فریم: برش همسایه‌ها در لبه فریم انجام شود */
  display: flex;
  direction: ltr; /* ریاضیات translateX مستقل از RTL صفحه */
  transition: transform .35s ease;
  will-change: transform;
}
.gallery-slide {
  flex: 0 0 100%;
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px; /* فاصله بصری عکس از لبه فریم (جای inset قبلی track) */
}
.gallery-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform .16s ease-out;
  transform: none;
}
/* خنثی‌کردن هاور قدیمی scale(1.05) در app.css */
.gallery-main:hover .gallery-track img { transform: none; }

/* --- زوم هاور دسکتاپ --- */
.gallery-main.gal-zoom-on { cursor: zoom-out; }
.gallery-main.gal-zoom-on .gallery-slide img { transform: scale(2.4); }
.gallery-main.gal-zoom-on .gal-arrow,
.gallery-main.gal-zoom-on .gal-dots,
.gallery-main.gal-zoom-on .gal-counter,
.gallery-main.gal-zoom-on .gal-zoom-hint { opacity: 0 !important; pointer-events: none; }

/* --- فلش‌ها (RTL: قبلی = راست، بعدی = چپ) --- */
.gal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .10);
  transition: background .2s, color .2s, opacity .2s;
  z-index: 3;
  opacity: 0;
  padding: 0;
  line-height: 1;
}
.gallery-main:hover .gal-arrow { opacity: 1; }
.gal-arrow:hover { background: #ec4899; color: #fff; border-color: #ec4899; }
.gal-prev { right: 12px; }
.gal-next { left: 12px; }
@media (hover: none) { .gal-arrow { opacity: .85; } }

/* --- نقاط پایین --- */
.gal-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 3;
  opacity: 0;
  transition: opacity .2s;
}
.gallery-main:hover .gal-dots { opacity: 1; }
@media (hover: none) { .gal-dots { opacity: .9; } }
.gal-dot {
  width: 8px; height: 8px;
  border-radius: 99px;
  border: none;
  padding: 0;
  background: #f9a8d4;
  cursor: pointer;
  transition: width .25s, background .25s;
}
.gal-dot.active { width: 20px; background: #ec4899; }

/* --- شمارنده تصویر --- */
.gal-counter {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(15, 23, 42, .55);
  color: #fff;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 99px;
  z-index: 3;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.gallery-main:hover .gal-counter { opacity: 1; }
@media (hover: none) { .gal-counter { opacity: .85; } }

/* --- آیکن راهنمای زوم --- */
.gal-zoom-hint {
  position: absolute;
  bottom: 12px; right: 12px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  border: 1px solid #e2e8f0;
  color: #ec4899;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  z-index: 3;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.gallery-main:hover .gal-zoom-hint { opacity: .95; }
@media (hover: none) { .gal-zoom-hint { opacity: .7; } }

/* --- تصاویر کوچک: همگام با اسلایدر --- */
.gallery-thumbs .thumb { flex-shrink: 0; }

/* ============================================================
   لایت‌باکس تمام‌صفحه (زوم لمسی و دابل‌کلیک)
   ============================================================ */
.gal-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(28, 10, 20, .94);
  display: none;
  align-items: center;
  justify-content: center;
}
.gal-lightbox.is-open { display: flex; }
.gal-lb-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none; /* پینچ مرورگر غیرفعال شود تا پینچ خودمان کار کند */
}
.gal-lb-stage img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  transition: transform .18s ease-out;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.gal-lb-close {
  position: fixed;
  top: 16px; left: 16px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  border: none;
  color: #fff;
  font-size: 19px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
  z-index: 2;
}
.gal-lb-close:hover { background: #ec4899; }
.gal-lb-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .10);
  border: none;
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
  z-index: 2;
}
.gal-lb-arrow:hover { background: rgba(236, 72, 153, .55); }
.gal-lb-prev { right: 18px; }
.gal-lb-next { left: 18px; }
.gal-lb-counter {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  color: #fce7f3;
  background: rgba(236, 72, 153, .35);
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 13px;
  z-index: 2;
  pointer-events: none;
}
.gal-lb-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #f9a8d4;
  font-size: 11.5px;
  z-index: 2;
  white-space: nowrap;
  pointer-events: none;
}
@media (max-width: 640px) {
  .gal-lb-arrow { display: none; }
  .gal-lb-hint { font-size: 10.5px; max-width: 92vw; white-space: normal; text-align: center; }
}
/* ============================================================
   قابلیت رنگ محصول — فروشگاه لنا
   ============================================================ */
.color-select-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 4px 0 16px;
}
.color-select-label {
  font-size: 14px;
  color: #475569;
  margin-bottom: 12px;
}
.color-select-label strong {
  color: #0f172a;
  font-size: 15px;
}
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  position: relative;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  padding: 0;
  outline: none;
}
.color-swatch::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color .15s ease;
  pointer-events: none;
}
/* سایه‌ی داخلی ظریف تا رنگ سفید/روشن هم روی پس‌زمینه دیده شود */
.color-swatch::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  pointer-events: none;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { transform: scale(1.05); }
.color-swatch.selected::after {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,.18);
}
/* رادیوی بومی داخل هر سواچ — انتخاب رنگ حتی بدون جاوااسکریپت به سرور می‌رسد */
.color-swatch .color-radio {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
/* چیپ نمایش رنگ در سبد خرید، تسویه حساب و فاکتور */
.item-color-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 2px 10px;
  margin-top: 4px;
  width: fit-content;
}
.color-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
  flex-shrink: 0;
}
.cart-item-title + .item-color-chip { margin-top: 6px; }
.invoice-item-info .item-color-chip { margin-top: 6px; }
.checkout-item-info .item-color-chip { margin-top: 4px; margin-bottom: 2px; }