/* ═══════════════════════════════════════════════════════════════════════════
   پاپ‌آپ نصب برنامه روی گوشی/تبلت — my.irankarsaz.ir
   ───────────────────────────────────────────────────────────────────────────
   فقط موبایل و تبلت (کد `install.js` روی دسکتاپ چیزی نشان نمی‌دهد).
   سبک‌ها هم‌خانوادهٔ `.promo-*` در app.css هستند تا ظاهر اپ یکدست بماند.
   ═══════════════════════════════════════════════════════════════════════════ */

.pwa-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;               /* بالاتر از پاپ‌آپ تبلیغ (۱۲۰) تا هیچ‌وقت زیرش نماند */
  background: rgb(8 25 42 / 0.45);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 18px;
  animation: pwa-fade 0.18s ease;
}
.pwa-overlay.pwa-closing { opacity: 0; transition: opacity 0.18s ease; }
@keyframes pwa-fade { from { opacity: 0; } }

.pwa-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 34px 80px -30px rgb(11 59 114 / 0.5);
  padding: 20px 18px 16px;
  animation: pwa-rise 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes pwa-rise {
  from { transform: translateY(14px) scale(0.98); opacity: 0; }
}

.pwa-close {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 9px;
  background: var(--bg-soft, #f2f5fc);
  color: var(--ink-3, #7b8698);
  font-size: 0.95rem;
  cursor: pointer;
}
.pwa-close:hover { background: #e6ebf6; color: var(--ink, #1b2430); }

/* ── سربرگ: آیکن برنامه + نشان «نصب روی گوشی» */
.pwa-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.pwa-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e3e9f7;
  box-shadow: 0 8px 18px -12px rgb(11 59 114 / 0.45);
  flex: 0 0 auto;
}
.pwa-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pwa-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: #fff;
  background: var(--grad, linear-gradient(135deg, #0b3b72, #1667c8));
  padding: 4px 12px;
  border-radius: 999px;
}

.pwa-card h2 {
  font-size: 1.08rem;
  margin: 0 0 6px;
  color: var(--navy-1, #0b3b72);
  line-height: 1.6;
}
.pwa-lead {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-2, #46505f);
  line-height: 1.95;
}

/* ── گام‌های نصب دستی (iOS / مرورگر بدون پنجرهٔ نصب) */
.pwa-steps {
  list-style: none;
  counter-reset: pwa-step;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.pwa-steps[hidden] { display: none; }   /* CSS بالا `hidden` را بی‌اثر می‌کند */
.pwa-steps li {
  counter-increment: pwa-step;
  position: relative;
  padding: 9px 12px 9px 40px;
  background: #f7f9ff;
  border: 1px solid #e8eeff;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.85;
  color: var(--ink, #1b2430);
}
.pwa-steps li::before {
  content: counter(pwa-step);
  position: absolute;
  inset-inline-start: 11px;
  top: 9px;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary, #1667c8);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}

.pwa-note {
  margin: 12px 0 0;
  font-size: 0.78rem;
  color: var(--ink-3, #7b8698);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 8px 11px;
  line-height: 1.85;
}
.pwa-note[hidden] { display: none; }

/* ── دکمه‌ها */
.pwa-actions { margin-top: 14px; display: grid; gap: 8px; }
.pwa-install-btn {
  font: inherit;
  font-weight: 500;
  font-size: 0.94rem;
  color: #fff;
  background: var(--primary, #1667c8);
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  cursor: pointer;
  box-shadow: 0 14px 28px -16px #1667c8;
}
.pwa-install-btn:hover { background: #1257a8; }
.pwa-install-btn:focus-visible,
.pwa-later:focus-visible,
.pwa-close:focus-visible {
  outline: 2px solid var(--primary, #1667c8);
  outline-offset: 2px;
}
.pwa-later {
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink-3, #7b8698);
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
}
.pwa-later:hover { color: var(--ink-2, #46505f); text-decoration: underline; }

/* ── روی گوشی: شیت پایین صفحه، نزدیک انگشت و با احترام به ناحیهٔ ایمن iOS */
@media (max-width: 820px) {
  .pwa-overlay { place-items: end center; padding: 0; }
  .pwa-card {
    max-width: none;
    border-radius: 20px 20px 0 0;
    padding: 18px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    max-height: 86vh;
    animation: pwa-sheet 0.24s cubic-bezier(0.2, 0.8, 0.3, 1);
  }
  .pwa-card h2 { font-size: 1rem; }
  .pwa-lead { font-size: 0.83rem; }
  .pwa-install-btn { padding: 14px 16px; font-size: 0.96rem; }
}
@keyframes pwa-sheet { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  .pwa-overlay, .pwa-card { animation: none; }
}
