/*
 * کارت «از تخفیف‌ها و پیشنهادهای ویژه باخبرم کن» — push-optin.js. هم‌خانواده‌ی کارت نصب PWA
 * (pwa.css: شیشه‌ی تیره + طلایی بافت‌دار، نه رنگ تخت)، ولی با پیش‌نمایش یک اعلان واقعی تا
 * مسافر دقیقاً ببیند چه چیزی دریافت می‌کند. موبایل: از پایین بالا می‌آید؛ دسکتاپ: گوشه‌ی پایین.
 * footer.php این فایل را فقط وقتی لود می‌کند که کارت از پنل روشن باشد.
 */
.push-optin {
  position: fixed;
  inset-inline: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 1200;
  display: flex;
  justify-content: center;
  pointer-events: none;
  font-family: inherit;
}

.push-optin__card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 20px 18px 16px;
  border-radius: 26px;
  color: #f4efe3;
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(233, 190, 102, .24), transparent 60%),
    radial-gradient(60% 50% at 0% 100%, rgba(233, 190, 102, .10), transparent 70%),
    linear-gradient(160deg, rgba(38, 36, 31, .97), rgba(18, 18, 16, .97));
  border: 1px solid rgba(226, 183, 94, .34);
  box-shadow: 0 30px 70px -25px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .07);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateY(calc(100% + 40px)) scale(.98);
  opacity: 0;
  transition: transform .55s cubic-bezier(.16, 1, .3, 1), opacity .35s ease;
  pointer-events: auto;
  overflow: hidden;
}

/* خط طلایی بالای کارت — همان بافت فلزی دکمه‌های سایت. */
.push-optin__card::before {
  content: "";
  position: absolute;
  inset: 0 18% auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(241, 207, 131, .85), transparent);
}

.push-optin.is-open .push-optin__card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.push-optin__close {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  z-index: 1;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  color: #bdb5a2;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.push-optin__close:hover {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.push-optin__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-inline-end: 36px;
}

.push-optin__head > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.push-optin__eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  color: #e9c373;
}

.push-optin__head strong {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.55;
}

.push-optin__bell {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  color: #2a2418;
  background: linear-gradient(145deg, #f6dc9c, #d9a846 55%, #b98a2f);
  box-shadow: 0 14px 28px -14px rgba(233, 190, 102, .9), inset 0 1px 0 rgba(255, 255, 255, .45);
}

.push-optin__bell svg {
  width: 26px;
  height: 26px;
  transform-origin: 50% 10%;
  animation: push-optin-ring 3.4s ease-in-out 1s infinite;
}

/* حلقه‌ی موج دور زنگ — حس «یک خبر تازه رسید». */
.push-optin__bell i {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1.5px solid rgba(241, 207, 131, .7);
  animation: push-optin-pulse 2.6s ease-out 1.2s infinite;
}

@keyframes push-optin-ring {
  0%, 72%, 100% { transform: rotate(0); }
  76% { transform: rotate(14deg); }
  82% { transform: rotate(-11deg); }
  88% { transform: rotate(7deg); }
  94% { transform: rotate(-4deg); }
}

@keyframes push-optin-pulse {
  0% { transform: scale(1); opacity: .9; }
  100% { transform: scale(1.45); opacity: 0; }
}

.push-optin__body > p {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.9;
  color: #d9d1bf;
}

/* پیش‌نمایش اعلان — شبیه اعلان سیستمی گوشی. */
.push-optin__preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .92);
  color: #1d1c19;
  box-shadow: 0 16px 30px -18px rgba(0, 0, 0, .9);
  animation: push-optin-drop .7s cubic-bezier(.16, 1, .3, 1) .45s both;
}

.push-optin__preview img {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.push-optin__preview span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.push-optin__preview b {
  font-size: 12px;
  font-weight: 800;
}

.push-optin__preview small {
  font-weight: 500;
  color: #7a7466;
}

.push-optin__preview em {
  overflow: hidden;
  font-size: 12.5px;
  font-style: normal;
  color: #3b3831;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@keyframes push-optin-drop {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.push-optin__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.push-optin__primary,
.push-optin__later {
  min-height: 46px;
  border-radius: 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease, background .2s ease;
}

.push-optin__primary {
  position: relative;
  flex: 1;
  overflow: hidden;
  color: #24231f;
  border: 1px solid #e2b75e;
  background: linear-gradient(135deg, #f1cf83, #d9a846);
  box-shadow: 0 8px 20px rgba(7, 7, 6, .3), inset 0 1px 0 rgba(255, 255, 255, .34);
}

/* نور گذرای روی دکمه‌ی طلایی — keyframes مال pwa.css است (همیشه لود می‌شود). */
.push-optin__primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
  transform: translateX(120%);
  animation: pwa-shine 3.2s ease-in-out 1.4s infinite;
}

.push-optin__primary span {
  position: relative;
  z-index: 1;
}

.push-optin__primary:hover {
  filter: brightness(1.06);
}

.push-optin__primary:active,
.push-optin__later:active {
  transform: scale(.98);
}

.push-optin__primary.is-loading {
  cursor: progress;
  filter: saturate(.8);
}

.push-optin__primary.is-loading::after {
  animation-duration: 1.1s;
  animation-delay: 0s;
}

.push-optin__later {
  padding-inline: 18px;
  color: #d8d0bf;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
}

.push-optin__later:hover {
  background: rgba(255, 255, 255, .09);
}

.push-optin__note {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  text-align: center;
  color: #9d9684;
}

.push-optin__result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 6px;
  text-align: center;
}

.push-optin__result[hidden] {
  display: none;
}

.push-optin__result strong {
  font-size: 16px;
  font-weight: 800;
}

.push-optin__result p {
  margin: 0;
  font-size: 13px;
  line-height: 1.9;
  color: #d9d1bf;
}

.push-optin__done-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: #2a2418;
  background: linear-gradient(145deg, #f6dc9c, #d9a846 55%, #b98a2f);
  box-shadow: 0 0 0 8px rgba(233, 190, 102, .12), 0 16px 30px -14px rgba(233, 190, 102, .9);
  animation: push-optin-pop .5s cubic-bezier(.34, 1.56, .64, 1) both;
}

.push-optin__done-icon svg {
  width: 30px;
  height: 30px;
}

.push-optin__done-icon.is-muted {
  color: #d8d0bf;
  background: rgba(255, 255, 255, .08);
  box-shadow: none;
}

@keyframes push-optin-pop {
  from { transform: scale(.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* دکمه‌ی «باخبرم کن» فوتر — ورود دوباره برای کسی که کارت را قبلاً بسته بود. */
.footer-push-optin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #f1cf83;
  border: 1px solid rgba(226, 183, 94, .38);
  background: rgba(226, 183, 94, .08);
  cursor: pointer;
  transition: background .2s ease;
}

.footer-push-optin:hover {
  background: rgba(226, 183, 94, .16);
}

.footer-push-optin svg {
  width: 16px;
  height: 16px;
}

@media (min-width: 900px) {
  .push-optin {
    inset-inline: auto 24px;
    bottom: 24px;
    justify-content: flex-end;
  }

  .push-optin__card {
    width: 390px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .push-optin__card {
    transform: none;
    transition: opacity .2s ease;
  }

  .push-optin__bell svg,
  .push-optin__bell i,
  .push-optin__primary::after,
  .push-optin__preview,
  .push-optin__done-icon {
    animation: none;
  }
}
