/* ===========================
   تنظیم اندازه کلی تیشرت
   =========================== */

:root {
  /* این عدد قد تیشرت را کنترل می‌کند */
  --tshirt-max-height: min(78svh, 860px);
}

/* ===========================
   صحنه تیشرت
   =========================== */

.cdp-shirt-stage {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.cdp-shirt-wrapper {
  position: relative;
  display: inline-block;
  width: min(100%, 760px);
  max-width: 100%;
  overflow: hidden;
}

.cdp-shirt-image {
  display: block;
  max-height: var(--tshirt-max-height);
  height: auto;
  width: 100%;
  max-width: 100%;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

/* ===========================
   ناحیه چاپ و ۴ کادر
   =========================== */

.cdp-print-area {
  position: absolute;
  inset: 0;
  pointer-events: none; /* بعداً برای درَگ می‌توانی عوض کنی */
  z-index: 2;
}

/* استایل کادر – استایل مشترک */
.cdp-print-box {
  position: absolute;
  border: 2px dashed #111827;
  box-sizing: border-box;
  z-index: 3;
}

/* ۱) FRONT – وسط سینه، بزرگترین ناحیه چاپ */
#boxFront {
  top: 18%;
  left: 30%;
  width: 40%;
  height: 60%;
}

/* ۲) BACK – پشت کمی کوچکتر و بالاتر */
#boxBack {
  top: 18%;
  left: 32%;
  width: 35%;
  height: 50%;
}

/* ۳) RIGHT – سمت راست پایین (مثلاً آستین / پهلو) */
#boxRight {
  top: 56%;
  left: 35%;
  width: 25%;
  height: 30%;
}

/* ۴) LEFT – سمت چپ پایین */
#boxLeft {
  top: 56%;
  left: 39%;
  width: 25%;
  height: 30%;
}

/* مخفی‌کردن کادرهای غیرفعال (با JS کلاسش را عوض می‌کنی) */
.cdp-print-box--hidden {
  display: none;
}

/* ===========================
   دکمه‌های Front / Back / Right / Left
   =========================== */

.cdp-views-switcher {
  display: flex;
  gap: 8px;
  max-width: 100%;
}

/* دکمه کارت‌مانند کوچک، شبیه عکس مرجع */

.cdp-view-btn {
  width: 62px;
  height: 76px;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-size: 10px;
  color: #111827;
  font-weight: 600;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
  flex: 0 0 auto;
}

.cdp-view-btn img {
  width: 32px;
  height: 32px;
  opacity: 1;
}

.cdp-view-btn span {
  line-height: 1;
  font-weight: 500;
}

/* active */

.cdp-view-btn--active {
  border-color: #1118277e;
  box-shadow: 0 0 0 2px #fdd700d2;
  color: #111827;
  background: #ffffff;
}

.cdp-view-btn--active img {
  opacity: 1;
}

/* hover */

.cdp-view-btn:hover {
  transform: translateY(-2px);
  background: #f9fafb;
}

/* Dark Mode */
body.dark-mode .cdp-view-btn {
  background: #5c5c63;
  border-color: #666769;
  color: #ffffff;
}

body.dark-mode .cdp-view-btn--active {
  background: #595a5c;
  border-color: #666769;
  box-shadow: 0 0 0 2px #fdd700d2;
  color: #ffffff;
}

body.dark-mode .cdp-view-btn:hover {
  background: #666769;
}

/* ===========================
   Responsive Scales
   =========================== */

@media (max-width: 768px) {
  :root {
    --tshirt-max-height: min(53svh, 540px);
  }

  .cdp-shirt-stage {
    padding: 0 12px;
    gap: 6px;
  }

  .cdp-shirt-wrapper {
    width: 100%;
    max-width: min(100%, 420px);
    margin-bottom: -12px;
  }

  .cdp-shirt-image {
    width: 100%;
  }

  .cdp-views-switcher {
    justify-content: flex-start;
    overflow-x: auto;
    padding: 0 2px 6px;
    scrollbar-width: none;
  }

  .cdp-views-switcher::-webkit-scrollbar {
    display: none;
  }

  .cdp-view-btn {
    width: 60px;
    height: 74px;
  }
}

@media (max-width: 480px) {
  :root {
    --tshirt-max-height: min(47svh, 430px);
  }

  .cdp-shirt-stage {
    gap: 4px;
    padding: 0 4px;
  }

  .cdp-shirt-wrapper {
    width: min(100%, 340px);
    max-width: 100%;
    margin-bottom: -16px;
  }

  .cdp-views-switcher {
    margin-top: -4px;
    padding-bottom: 4px;
  }

  .cdp-view-btn {
    width: 56px;
    height: 68px;
    font-size: 9px;
    border-radius: 16px;
  }

  .cdp-view-btn img {
    width: 28px;
    height: 28px;
  }

  #boxFront {
    top: 26.4%;
    left: 36.2%;
    width: 27.5%;
    height: 41.3%;
  }

  #boxBack {
    top: 25.8%;
    left: 37.45%;
    width: 24.1%;
    height: 34.4%;
  }

  #boxRight {
    top: 60.7%;
    left: 38.9%;
    width: 17.2%;
    height: 20.7%;
  }

  #boxLeft {
    top: 60.7%;
    left: 42.9%;
    width: 17.2%;
    height: 20.7%;
  }

  .cdp-print-box {
    border-width: 1.5px;
  }
}
