/* =========================================================
   PTIS Kluang - Skrin wajib pasang aplikasi (telefon)
   ========================================================= */
html.pwa-wajib, html.pwa-wajib body { overflow: hidden !important; height: 100%; }
html.pwa-wajib body > *:not(#pwa-pagar) { display: none !important; }
html:not(.pwa-wajib) #pwa-pagar { display: none !important; }

#pwa-pagar {
    position: fixed; inset: 0; z-index: 2147483000; overflow-y: auto; -webkit-overflow-scrolling: touch;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding: max(28px, env(safe-area-inset-top)) 20px max(96px, calc(env(safe-area-inset-bottom) + 84px));
    color: #fff; font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    background: linear-gradient(160deg, #4F8BFF 0%, #2F6BEA 40%, #1F4FB8 70%, #0A1430 100%);
}
#pwa-pagar[hidden] { display: flex !important; } /* dipapar segera oleh kelas html.pwa-wajib */

.pw-latar { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.pw-latar i { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .45; animation: pw-apung 9s ease-in-out infinite; }
.pw-latar i:nth-child(1) { width: 260px; height: 260px; background: #E2343B; top: -80px; right: -90px; }
.pw-latar i:nth-child(2) { width: 220px; height: 220px; background: #7FB2FF; bottom: 8%; left: -90px; animation-delay: -3s; }
.pw-latar i:nth-child(3) { width: 160px; height: 160px; background: #fff; top: 40%; right: -60px; opacity: .15; animation-delay: -6s; }
@keyframes pw-apung { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-18px, 22px) scale(1.12); } }

.pw-isi { position: relative; width: 100%; max-width: 420px; display: grid; gap: 14px; text-align: center; animation: pw-naik .6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes pw-naik { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* Telefon mini dengan ikon PTIS jatuh ke skrin utama */
.pw-telefon { justify-self: center; width: 118px; height: 200px; padding: 10px 8px; border-radius: 26px; background: #0A1430;
    border: 3px solid rgba(255,255,255,.85); box-shadow: 0 24px 50px -18px rgba(0,0,0,.6), inset 0 0 0 2px rgba(255,255,255,.08); }
.pw-skrin { position: relative; height: 100%; border-radius: 18px; background: linear-gradient(180deg, #1F4FB8, #0D2A6B);
    display: grid; grid-template-columns: repeat(3, 1fr); align-content: start; gap: 8px; padding: 14px 10px; }
.pw-skrin span { aspect-ratio: 1; border-radius: 8px; background: rgba(255,255,255,.18); }
.pw-ikon { position: absolute; width: 30px; height: 30px; border-radius: 8px; left: calc(50% - 15px); top: 104px;
    box-shadow: 0 6px 14px rgba(0,0,0,.35); animation: pw-masuk 2.8s cubic-bezier(.3,1.4,.5,1) infinite; }
@keyframes pw-masuk {
    0% { transform: translateY(-150px) scale(1.6) rotate(-12deg); opacity: 0; }
    35% { opacity: 1; }
    55%, 85% { transform: none; opacity: 1; }
    100% { transform: none; opacity: 0; }
}

.pw-eyebrow { margin: 6px 0 0; font: 700 11px 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .14em; color: rgba(255,255,255,.75); }
#pwa-pagar h1 { margin: 0; font: 800 26px/1.2 Manrope, system-ui, sans-serif; letter-spacing: -.02em; }
.pw-lead { margin: 0; font-size: 14.5px; line-height: 1.6; color: rgba(255,255,255,.85); }

.pw-os { display: none; gap: 12px; }
#pwa-pagar[data-os="android"] .pw-os[data-untuk="android"],
#pwa-pagar[data-os="ios"] .pw-os[data-untuk="ios"],
#pwa-pagar[data-os="dalamapp"] .pw-os[data-untuk="dalamapp"] { display: grid; }

.pw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 16px 20px; border: 0; border-radius: 16px;
    background: #fff; color: #1F4FB8; font: 800 16px Manrope, system-ui, sans-serif; cursor: pointer;
    box-shadow: 0 16px 30px -14px rgba(0,0,0,.55); animation: pw-denyut 2s ease-in-out infinite; }
.pw-btn-ghost { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.4); animation: none; }
@keyframes pw-denyut { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
/* Butang pasang terus hanya bila Chrome benarkan; jika tidak, langkah manual */
#pwa-pagar:not(.boleh-pasang) #pw-pasang { display: none; }
#pwa-pagar.boleh-pasang .pw-manual { display: none; }

.pw-langkah { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.pw-langkah li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.16); font-size: 14px; line-height: 1.45; transition: background .35s, transform .35s, border-color .35s; }
.pw-langkah li > b { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.2); font: 800 13px Manrope, sans-serif; }
.pw-langkah li.aktif { background: rgba(255,255,255,.95); color: #0A1430; border-color: #fff; transform: scale(1.03); box-shadow: 0 14px 28px -16px rgba(0,0,0,.6); }
.pw-langkah li.aktif > b { background: #E2343B; color: #fff; }
.pw-k { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 8px; background: rgba(10,20,48,.12); font-style: normal; font-weight: 700; white-space: nowrap; }
.pw-langkah li:not(.aktif) .pw-k { background: rgba(255,255,255,.18); }
.pw-k svg { width: 15px; height: 15px; }
.ipad .pw-di { display: none; }
.pw-nota { margin: 0; font-size: 12.5px; color: rgba(255,255,255,.75); }
#pwa-pagar:not(.ios-lain) .pw-nota-lain { display: none; }

.pw-siap { display: none; gap: 6px; justify-items: center; padding: 20px; border-radius: 20px; background: rgba(255,255,255,.95); color: #0A1430; animation: pw-naik .5s both; }
.pw-siap small { color: #475569; font-size: 13px; line-height: 1.5; }
.pw-tick { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: #10B981; color: #fff; font: 800 24px sans-serif; }
#pwa-pagar.siap .pw-siap { display: grid; }
#pwa-pagar.siap .pw-os { display: none !important; }

/* Anak panah ke butang Kongsi di bar bawah Safari iPhone */
.pw-panah { display: none; position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%);
    width: 46px; height: 46px; border-radius: 50%; background: #fff; color: #E2343B; font: 900 24px/46px sans-serif; text-align: center;
    box-shadow: 0 10px 24px rgba(0,0,0,.45); animation: pw-lompat 1.1s ease-in-out infinite; }
#pwa-pagar[data-os="ios"]:not(.ipad):not(.ios-lain):not(.siap) .pw-panah { display: block; }
@keyframes pw-lompat { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 10px); } }

@media (prefers-reduced-motion: reduce) { .pw-ikon, .pw-btn, .pw-panah, .pw-latar i { animation: none; } }
