/* PWA — بنرِ نصب، راهنمای iOS، تُست، و تنظیماتِ حالتِ standalone */
:root {
  --pwa-green: #275440;
  --pwa-green-2: #1E4233;
  --pwa-ink: #0A2840;
  --pwa-muted: #5B7186;
}

/* بنرِ دعوت به نصب (پایینِ صفحه، اسلاید از پایین) */
.pwa-install-banner {
  position: fixed;
  z-index: 4000;
  inset: auto 12px calc(12px + env(safe-area-inset-bottom)) 12px;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid rgba(17, 40, 63, .10);
  border-radius: 20px;
  box-shadow: 0 22px 50px rgba(17, 40, 63, .22);
  padding: 16px;
  font-family: 'Estedad', 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
  transform: translateY(160%);
  opacity: 0;
  transition: transform .45s cubic-bezier(.2, .9, .3, 1), opacity .35s;
  pointer-events: none;
}
.pwa-install-banner.show { transform: translateY(0); opacity: 1; pointer-events: auto; }

.pwa-banner-top { display: flex; align-items: flex-start; gap: 12px; }
.pwa-banner-logo {
  flex: 0 0 50px; width: 50px; height: 50px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(135deg, rgba(39, 84, 64, .14), rgba(43, 100, 126, .14));
  display: flex; align-items: center; justify-content: center;
}
.pwa-banner-logo img { width: 100%; height: 100%; object-fit: contain; }
.pwa-banner-tx { flex: 1; min-width: 0; }
.pwa-banner-tx h4 { margin: 0 0 3px; font-size: 15px; font-weight: 800; color: var(--pwa-ink); }
.pwa-banner-tx p { margin: 0; font-size: 12px; line-height: 1.75; color: var(--pwa-muted); }
.pwa-banner-close {
  flex: 0 0 auto; border: none; background: transparent; color: var(--pwa-muted);
  font-size: 18px; cursor: pointer; line-height: 1; padding: 2px 4px;
}

.pwa-benefits { display: flex; flex-wrap: wrap; gap: 6px; margin: 11px 0 13px; }
.pwa-benefits span {
  font-size: 11px; font-weight: 700; color: var(--pwa-green);
  background: rgba(39, 84, 64, .08); border: 1px solid rgba(39, 84, 64, .18);
  border-radius: 999px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 5px;
}

.pwa-banner-actions { display: flex; gap: 9px; }
.pwa-btn {
  border: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 14px;
  border-radius: 13px; padding: 12px 16px; flex: 1; transition: transform .12s, box-shadow .2s;
}
.pwa-btn:active { transform: scale(.98); }
.pwa-btn-primary { background: linear-gradient(130deg, var(--pwa-green), var(--pwa-green-2)); color: #fff; }
.pwa-btn-ghost { background: #F1F4F3; color: var(--pwa-ink); flex: 0 0 auto; }

/* راهنمای iOS (با فلش به سمتِ دکمه‌ی share) */
.pwa-ios-steps { margin: 10px 0 0; font-size: 12.5px; color: var(--pwa-ink); line-height: 2; }
.pwa-ios-steps b { color: var(--pwa-green); }

/* تُستِ کوتاه */
.pwa-toast {
  position: fixed; z-index: 4100; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 24px); opacity: 0; transition: .35s;
  background: #0A2840; color: #fff; border-radius: 14px; padding: 12px 18px;
  font-family: 'Estedad', 'Vazirmatn', Tahoma, sans-serif; font-size: 13px; font-weight: 600;
  box-shadow: 0 14px 34px rgba(10, 40, 64, .35); max-width: 90vw; text-align: center; direction: rtl;
}
.pwa-toast.show { transform: translate(-50%, 0); opacity: 1; }

/* راهنمای نصب (overlay + modal) */
.pwa-guide-overlay {
  position: fixed; inset: 0; z-index: 5000; background: rgba(10, 40, 64, .5);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
  opacity: 0; transition: opacity .28s; backdrop-filter: blur(2px);
  /* تا وقتی نمایش داده نشده، این لایهٔ تمام‌صفحه نباید جلوی تاچ/کلیک را بگیرد
     (هم‌رفتار با .pwa-install-banner). در غیرِ این صورت یک overlayِ نامرئی
     می‌تواند کلِ صفحه را غیرقابلِ کلیک کند. */
  pointer-events: none;
}
.pwa-guide-overlay.show { opacity: 1; pointer-events: auto; }
.pwa-guide {
  position: relative; width: 100%; max-width: 460px; background: #fff;
  border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  font-family: 'Estedad', 'Vazirmatn', Tahoma, sans-serif; direction: rtl; color: #0A2840;
  transform: translateY(100%); transition: transform .35s cubic-bezier(.2,.9,.3,1);
  box-shadow: 0 -16px 44px rgba(10,40,64,.28);
}
.pwa-guide-overlay.show .pwa-guide { transform: translateY(0); }
@media (min-width: 520px) {
  .pwa-guide-overlay { align-items: center; padding: 20px; }
  .pwa-guide { border-radius: 22px; transform: translateY(20px) scale(.98); }
}
.pwa-guide-close { position: absolute; inset-block-start: 12px; inset-inline-start: 14px;
  border: none; background: transparent; font-size: 22px; color: #5B7186; cursor: pointer; line-height: 1; }
.pwa-guide-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.pwa-guide-head img { width: 48px; height: 48px; border-radius: 13px; }
.pwa-guide-head h3 { margin: 0 0 2px; font-size: 17px; font-weight: 800; }
.pwa-guide-head p { margin: 0; font-size: 12.5px; color: #5B7186; }
.pwa-guide-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.pwa-guide-step { display: flex; align-items: center; gap: 12px; background: #F6F8F8;
  border: 1px solid #EEF2F1; border-radius: 14px; padding: 12px; position: relative; }
.pwa-guide-ic { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 11px; background: #fff;
  border: 1px solid #E5ECEA; display: flex; align-items: center; justify-content: center; }
.pwa-guide-n { position: absolute; inset-block-start: -8px; inset-inline-end: -6px; width: 22px; height: 22px;
  border-radius: 50%; background: #275440; color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 8px rgba(39,84,64,.3); }
.pwa-guide-tx { font-size: 13px; line-height: 1.85; color: #14324A; }
.pwa-guide-tx b { color: #275440; }
.pwa-guide-note { font-size: 12px; line-height: 1.9; color: #7A5B12; background: #FBF1D9;
  border: 1px solid #EAD9A8; border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.pwa-guide-ok { width: 100%; }

/* حالتِ نصب‌شده (standalone): فضای امنِ پایین برای دستگاه‌های دارای home-indicator */
body.pwa-standalone { padding-bottom: env(safe-area-inset-bottom); }

@media (prefers-reduced-motion: reduce) {
  .pwa-install-banner, .pwa-toast { transition: opacity .2s; }
}
