/* WeeShare PWA — Standalone / Install / Offline */
@media (display-mode: standalone), (display-mode: fullscreen) {
  body { padding-top: env(safe-area-inset-top); }
  .topbar { padding-top: env(safe-area-inset-top); }
  /* ในโหมดแอป ไม่ต้องโชว์ป้าย "ติดตั้งแอป" ซ้ำ */
  #pwaInstallBanner, #pwaIosSheet { display: none !important; }
  /* Bottom nav ชิดขอบล่างแบบแอปจริง */
  .bottom-nav { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}
@media (display-mode: browser) {
  /* ในเบราว์เซอร์ปกติ เก็บพื้นที่ให้ banner ไม่บัง bottom-nav */
  body.has-install-banner { padding-bottom: 132px; }
}
#pwaInstallBanner {
  position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 1060;
  background: #fff; border-radius: 18px; box-shadow: 0 12px 32px rgba(58,26,94,.22);
  border: 1px solid #E9D9FF; display: none; animation: pwaSlideUp .28s ease;
}
#pwaInstallBanner.show { display: block; }
@keyframes pwaSlideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 768px) {
  #pwaInstallBanner { left: auto; right: 20px; bottom: 20px; width: 380px; }
}
.pwa-icon { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; }
#pwaIosSheet { position: fixed; inset: 0; z-index: 1070; background: rgba(20,8,35,.55); display: none; align-items: flex-end; }
#pwaIosSheet.show { display: flex; }
#pwaIosSheet .sheet { background: #fff; width: 100%; border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
#pwaUpdateToast {
  position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 1060;
  background: #3A1A5E; color: #fff; border-radius: 14px; padding: 12px 14px;
  display: none; align-items: center; justify-content: space-between; gap: 10px;
}
#pwaUpdateToast.show { display: flex; }
#pwaOfflineBadge {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1070; background: #F59E0B; color: #221133;
  text-align: center; font-size: 13px; font-weight: 600; padding: 6px; display: none;
}
#pwaOfflineBadge.show { display: block; }
.pwa-install-card { background: linear-gradient(135deg,#3A1A5E,#7B4BB3 55%,#A97CE0); color: #fff; border-radius: 20px; }
.pwa-step { background: #F3EDFF; border-radius: 14px; padding: 12px; }
@media (prefers-reduced-motion: reduce) { #pwaInstallBanner { animation: none; } }
