/* ===============================
    Product Detail Modal
    (این فایل باید تو همه صفحات لینک بشه)
==================================*/

.pm-clickable {
  cursor: pointer;
}

.pm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease;
  z-index: 1200;
}

.pm-overlay.open {
  opacity: 1;
  visibility: visible;
}

.pm-modal {
  background: #ffffff;
  border-radius: 26px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 26px 30px 32px;
  transform: translateY(30px);
  transition: transform .3s ease;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.3);
}

.pm-overlay.open .pm-modal {
  transform: translateY(0);
}

.pm-close {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-size: 17px;
  cursor: pointer;
  transition: .2s;
  z-index: 2;
}

.pm-close:hover {
  background: var(--c-primary-soft);
  color: #fff;
}

.pm-breadcrumb {
  font-size: .85rem;
  color: var(--c-text-muted);
  margin-bottom: 20px;
  padding-left: 50px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pm-breadcrumb a {
  color: var(--c-text-muted);
  text-decoration: none;
}

.pm-breadcrumb a:hover {
  color: var(--c-primary);
}

.pm-crumb-name {
  color: var(--c-primary);
  font-weight: 600;
}

.pm-body {
  display: flex;
  gap: 34px;
  align-items: flex-start;
}

/* سمت راست (چون سایت راست‌به‌چپه) = گالری عکس */
.pm-gallery {
  flex: 0 0 380px;
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: 380px;
}

.pm-main-img-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 320px;
  border-radius: 20px;
  overflow: hidden;
  background: var(--c-primary-light);
  cursor: zoom-in;
}

.pm-gallery .pm-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pm-zoom-hint {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  pointer-events: none;
}

/* دکمه‌های قبلی/بعدی روی عکس اصلی؛ فقط تو موبایل نشون داده می‌شن
   (تو دسکتاپ همون ردیف تامب‌نیل‌ها کافیه) */
.pm-main-nav {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .38);
  color: #fff;
  font-size: .85rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.pm-main-prev {
  right: 8px;
}

.pm-main-next {
  left: 8px;
}

.pm-thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.pm-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--c-primary-light);
  flex-shrink: 0;
}

.pm-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pm-thumb.active {
  border-color: var(--c-primary, #16a34a);
}

/* سمت چپ = مشخصات و خرید */
.pm-details {
  flex: 1;
  min-width: 0;
}

.pm-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--c-text);
  margin-bottom: 12px;
  line-height: 1.6;
}

.pm-stock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-size: .85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 30px;
  margin-bottom: 18px;
}

.pm-stock.out-of-stock {
  background: #fde8e8;
  color: #dc2626;
}

.pm-out-of-stock-msg {
  display: none;
  align-items: center;
  gap: 8px;
  background: #fde8e8;
  color: #dc2626;
  font-size: .9rem;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 14px;
  margin-bottom: 6px;
}

.pm-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 18px;
}

.pm-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #374151;
  font-size: .92rem;
}

.pm-features li i {
  color: var(--c-primary);
  font-size: .8rem;
  flex-shrink: 0;
}

.pm-installment-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff7e6;
  border: 1px solid #f3d98b;
  color: #6b5115;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 22px;
  transition: background .2s;
}

.pm-installment-hint:hover {
  background: #fdf0cc;
}

.pm-installment-hint i {
  color: #b8860b;
  font-size: 1rem;
  flex-shrink: 0;
}

.pm-buy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.pm-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.pm-price {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--c-primary);
}

.pm-price-unit {
  color: var(--c-text-muted);
  font-size: .95rem;
}

.pm-qty {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 12px;
  background: var(--c-primary-light);
  border-radius: 999px;
  padding: 6px 10px;
  flex-shrink: 0;
}

/* ردیف پایینی: دکمه علاقه‌مندی کنار دکمه افزودن به سبد خرید */
.pm-add-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pm-add-row .pm-add-btn {
  flex: 1;
  width: auto;
}

/* دسکتاپ: fav و qty کنار هم در سمت چپ buy-row */
.pm-actions-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.pm-fav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .25s var(--ease);
  flex-shrink: 0;
}

.pm-fav-btn:hover {
  border-color: #e0245e;
  color: #e0245e;
  transform: scale(1.06);
}

.pm-fav-btn.active {
  background: #e0245e;
  border-color: #e0245e;
  color: #fff;
}

.pm-qty-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
  line-height: 1;
}

.pm-qty-btn:hover {
  background: var(--c-primary-dark);
}

.pm-qty-btn:active {
  transform: scale(0.9);
}

.pm-qty-value {
  min-width: 20px;
  text-align: center;
  font-weight: 700;
  color: var(--c-text);
}

.pm-add-btn {
  width: 100%;
  background: var(--c-primary);
  color: #fff;
  border: none;
  padding: 13px 26px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background .25s, transform .25s;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.pm-add-btn:hover {
  background: var(--c-primary-dark);
  transform: translateY(-2px);
}

/* ================= آیکون کاربر داخل منوی همبرگری ================= */
.menu-drawer-user {
  padding: 4px 12px 14px;
  margin: 0 12px 8px;
  border-bottom: 1px solid #e5e7eb;
}

.menu-drawer-user .guest-badge,
.menu-drawer-user .user-badge {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 10px 6px;
  border-radius: 12px;
  color: var(--c-text);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .25s, color .25s;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.menu-drawer-user .guest-badge i,
.menu-drawer-user .user-badge i {
  width: 22px;
  text-align: center;
  color: var(--c-primary);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.menu-drawer-user .guest-badge:hover,
.menu-drawer-user .user-badge:hover {
  background: var(--c-primary-light);
}

.menu-drawer-user .user-badge {
  color: var(--c-primary);
}

/* برخلاف نسخه فشرده هدر، تو منوی همبرگری همیشه (حتی تو موبایل) اسم کاربر دیده بشه */
.menu-drawer-user .guest-badge span,
.menu-drawer-user .user-badge span {
  display: inline !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.pm-open {
  overflow: hidden;
}

/* product-modal.css — فقط ریسپانسیو مودال محصول */
@media (max-width: 720px) {
  .pm-body {
    flex-direction: column;
    gap: 14px;
    position: relative;
  }

  .pm-gallery {
    flex: none;
    width: 100%;
    flex-direction: column;
  }

  .pm-main-img-wrap {
    height: 260px;
    width: 100%;
  }

  .pm-thumbs {
    flex-direction: row;
  }

  .pm-modal {
    padding: 20px 18px 26px;
  }

  .pm-breadcrumb {
    padding-left: 42px;
  }

  /* علاقه‌مندی در ردیف قیمت، بین قیمت و دکمه +/- */
  .pm-fav-btn {
    position: static;
    width: 42px;
    height: 42px;
    font-size: 18px;
    flex-shrink: 0;
  }

  .pm-fav-btn:hover {
    transform: scale(1.08);
  }

  .pm-fav-btn.active {
    background: #e0245e;
    border-color: #e0245e;
    color: #fff;
  }

  /* ترتیب موبایل:
     عنوان+موجودی → ویژگی‌ها → خرید قسطی → قیمت/تعداد → افزودن */
  .pm-details {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title stock"
      "features features"
      "install install"
      "buy buy"
      "add add";
    gap: 12px;
    align-items: center;
    width: 100%;
  }

  .pm-title {
    grid-area: title;
    margin-bottom: 0;
    font-size: 1.15rem;
    line-height: 1.5;
  }

  .pm-stock {
    grid-area: stock;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  /* ویژگی‌ها بالاتر */
  .pm-features {
    grid-area: features;
    margin-bottom: 0;
    width: 100%;
  }

  /* خرید قسطی پایین‌تر از ویژگی‌ها */
  .pm-installment-hint {
    grid-area: install;
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .pm-buy-row {
    grid-area: buy;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
    width: 100%;
  }

  .pm-price-row {
    justify-content: flex-start;
  }

  .pm-price {
    font-size: 1.3rem;
  }

  .pm-price-unit {
    font-size: .8rem;
  }

  .pm-qty {
    flex-shrink: 0;
    justify-content: space-between;
    padding: 6px 8px;
    gap: 10px;
  }

  .pm-qty-btn {
    width: 28px;
    height: 28px;
    font-size: 20px;
  }

  .pm-qty-value {
    min-width: 28px;
    font-size: 1.05rem;
  }

  /* افزودن به سبد — تمام عرض */
  .pm-add-btn {
    grid-column: 1 / -1;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 2px;
  }

  .pm-out-of-stock-msg {
    grid-column: 1 / -1;
  }

  /* actions-right: fav و qty رو در یک ردیف افقی نگه می‌داره */
  .pm-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
  }
}


/* ===============================
    User icon area (کنار آیکون سبد خرید)
==================================*/
.user-icon-slot {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* حالت مهمان (هنوز عضو نشده): بک‌گراند سفید + بوردر سبز + نوشته «عضویت» */
.header-icons .guest-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  border: 2px solid var(--c-primary-soft);
  border-radius: 30px;
  padding: 7px 16px 7px 12px;
  color: var(--c-primary);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: .25s;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(22, 101, 52, 0.12);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.header-icons .guest-badge i {
  font-size: 18px;
}

.header-icons .guest-badge:hover {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(22, 101, 52, 0.25);
}

/* حالت عضو شده (نام کاربر کنار آیکون) */
.header-icons .user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--c-primary);
  border-radius: 30px;
  padding: 6px 16px 6px 12px;
  color: var(--c-primary);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  background: var(--c-primary-light);
  transition: .2s;
  white-space: nowrap;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.header-icons .user-badge i {
  font-size: 19px;
}

.header-icons .user-badge:hover {
  background: var(--c-primary);
  color: #fff;
}

/* ===============================
    Register / Login Modal
==================================*/
.rm-modal {
  max-width: 440px;
  text-align: center;
  padding-top: 50px;
}

.rm-step {
  animation: rmFadeIn .25s ease;
}

@keyframes rmFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.rm-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.rm-icon-success {
  font-size: 34px;
}

.rm-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--c-text);
  margin-bottom: 10px;
  line-height: 1.7;
}

.rm-sub {
  color: var(--c-text-muted);
  font-size: .9rem;
  margin-bottom: 22px;
  line-height: 1.8;
}

.rm-sub span {
  color: var(--c-primary);
  font-weight: 700;
}

.rm-input {
  width: 100%;
  padding: 13px 16px;
  margin-bottom: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: .95rem;
  outline: none;
  text-align: center;
  transition: .2s;
}

.rm-input:focus {
  border-color: var(--c-primary-soft);
}

.rm-code {
  letter-spacing: 8px;
  font-size: 1.3rem;
  font-weight: 700;
}

.rm-error {
  color: var(--c-danger);
  font-size: .82rem;
  min-height: 18px;
  margin-bottom: 8px;
}

.rm-btn {
  width: 100%;
  padding: 14px;
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  transition: background .2s, transform .2s;
}

.rm-btn:hover {
  background: var(--c-primary-dark);
  transform: translateY(-2px);
}

.rm-btn:disabled {
  opacity: .7;
  cursor: not-allowed;
  transform: none;
}

.rm-link-btn {
  width: 100%;
  background: none;
  border: none;
  color: var(--c-text-muted);
  font-size: .85rem;
  margin-top: 12px;
  cursor: pointer;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.rm-link-btn b {
  color: var(--c-primary);
  font-weight: 800;
  text-decoration: underline;
}

.rm-welcome .rm-title {
  color: var(--c-primary);
}

/* ======================================================================
   ریسپانسیو هدر + آیکون کاربر (این فایل تو همه صفحات لینک شده،
   پس این بخش تضمین می‌کنه هدر تو موبایل تو همه صفحات درست دیده بشه)
   ====================================================================== */
@media (max-width: 640px) {

  .header-content {
    height: 68px;
    padding: 0 14px;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
  }

  .menu-btn {
    font-size: 24px;
  }

  .header-right-buttons {
    display: none;
  }

  .search-box {
    width: auto;
    flex: 1;
    height: 38px;
    margin: 0 10px;
    padding: 0 12px;
  }

  .search-box input {
    font-size: 13px;
  }

  .search-box i {
    font-size: 16px;
  }

  .header-icons {
    gap: 12px;
  }

  .header-icons > a {
    font-size: 22px;
  }

  .user-icon-slot .guest-badge span,
  .user-icon-slot .user-badge span {
    display: none;
  }

  .user-icon-slot .guest-badge,
  .user-icon-slot .user-badge {
    padding: 8px;
    border-radius: 50%;
  }

  .user-icon-slot .guest-badge i,
  .user-icon-slot .user-badge i {
    font-size: 18px;
  }
}

/* ================= مودال ثبت‌نام تو موبایل ================= */
@media (max-width: 480px) {
  .rm-modal {
    padding-top: 40px;
  }

  .rm-icon {
    width: 54px;
    height: 54px;
    font-size: 22px;
    margin-bottom: 14px;
  }

  .rm-title {
    font-size: 1.05rem;
  }

  .rm-sub {
    font-size: .82rem;
  }
}

/* ================= Toast پیام کوچیک بالای صفحه ================= */
/* برای پیام‌هایی مثل «کالا به لیست علاقه‌مندی‌ها اضافه شد» که بعد
   از زدن قلب (چه رو کارت، چه تو جزئیات کالا) نشون داده می‌شه */
.gh-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--c-text);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 700;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  white-space: nowrap;
}

.gh-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 480px) {
  .gh-toast {
    white-space: normal;
    text-align: center;
    max-width: 88%;
    font-size: .85rem;
  }
}

/* ================= لایت‌باکس (نمایش تمام‌صفحه با اسلاید) ================= */
.pm-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .92);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.pm-lightbox.open {
  display: flex;
}

body.pm-lightbox-open {
  overflow: hidden;
}

.pm-lightbox-img {
  max-width: 88vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  user-select: none;
}

.pm-lightbox-close {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-lightbox-close:hover {
  background: rgba(255, 255, 255, .22);
}

.pm-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-lightbox-nav:hover {
  background: rgba(255, 255, 255, .22);
}

.pm-lightbox-prev {
  right: 24px;
}

.pm-lightbox-next {
  left: 24px;
}

.pm-lightbox-dots {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.pm-lightbox-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .4);
  padding: 0;
  cursor: pointer;
}

.pm-lightbox-dot.active {
  background: #fff;
}

@media (max-width: 720px) {
  .pm-lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .pm-lightbox-prev {
    right: 10px;
  }

  .pm-lightbox-next {
    left: 10px;
  }
}
