/* MedhyaShield PWA UI: install banner, update toast, offline page, standalone tweaks */
:root { --pwa-ease: cubic-bezier(.22,1,.36,1); --pwa-grad: linear-gradient(135deg, #2563eb, #06b6d4 55%, #16a34a); }

.pwa-banner {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 1085;
  display: flex; align-items: center; gap: 14px; width: min(560px, calc(100vw - 24px));
  padding: 12px 14px; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, #0b1220, #1e1b4b 60%, #1e40af);
  border: 1px solid rgba(125,211,252,.28);
  box-shadow: 0 30px 60px -28px rgba(30,64,175,.85), 0 0 0 1px rgba(255,255,255,.04) inset;
  transform: translate(-50%, 24px); opacity: 0;
  transition: transform .45s var(--pwa-ease), opacity .35s, visibility .35s;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.pwa-banner { pointer-events: none; visibility: hidden; }
.pwa-banner.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; visibility: visible; }
body:has(#msChat.open) .pwa-banner.show, body.ms-copilot-open .pwa-banner.show { opacity: 0; pointer-events: none; visibility: hidden; transform: translate(-50%, 24px); transition: transform .45s var(--pwa-ease), opacity .35s, visibility 0s; }
@media (max-width: 767.98px) {
  .pwa-banner { left: 12px; right: 80px; width: auto; transform: translate(0, 24px); }
  .pwa-banner.show { transform: translate(0, 0); }
  body:has(#msChat.open) .pwa-banner.show, body.ms-copilot-open .pwa-banner.show { transform: translate(0, 24px); }
}
.pwa-banner::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: var(--pwa-grad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: .55; animation: pwa-glow 3.2s ease-in-out infinite; pointer-events: none; }
@keyframes pwa-glow { 0%, 100% { opacity: .35; } 50% { opacity: .85; } }
.pwa-banner .pwa-ic { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.08); padding: 4px; box-shadow: 0 10px 20px -12px #06b6d4; }
.pwa-banner .pwa-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pwa-banner .pwa-txt b { font-size: .92rem; font-weight: 800; letter-spacing: -.01em; }
.pwa-banner .pwa-txt span { font-size: .78rem; color: #c7d2fe; line-height: 1.35; }
.pwa-banner .pwa-txt span i { color: #7dd3fc; }
.pwa-banner .pwa-acts { display: flex; gap: 8px; flex: 0 0 auto; }

.pwa-btn { border: 0; border-radius: 999px; font-weight: 700; font-size: .8rem; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: transform .25s var(--pwa-ease), box-shadow .25s, background .25s; white-space: nowrap; }
.pwa-btn.pwa-install { background: var(--pwa-grad); color: #fff; box-shadow: 0 12px 24px -12px #06b6d4; }
.pwa-btn.pwa-install:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -12px #06b6d4; }
.pwa-btn.pwa-later { background: rgba(255,255,255,.1); color: #e2e8f0; border: 1px solid rgba(255,255,255,.16); }
.pwa-btn.pwa-later:hover { background: rgba(255,255,255,.18); }

.pwa-toast {
  position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); z-index: 1086;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px);
  padding: 10px 16px; border-radius: 999px; color: #fff; font-size: .84rem; font-weight: 600;
  background: #0b1220; border: 1px solid rgba(125,211,252,.28); box-shadow: 0 20px 40px -20px rgba(2,6,23,.8);
  transform: translate(-50%, -20px); opacity: 0; transition: transform .4s var(--pwa-ease), opacity .3s;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.pwa-toast.show { transform: translate(-50%, 0); opacity: 1; }
.pwa-toast > i { color: #7dd3fc; font-size: 1rem; }
.pwa-toast .pwa-btn { padding: 6px 12px; font-size: .76rem; }

/* Offline page */
body.s-offline-page { margin: 0; min-height: 100vh; min-height: 100dvh; background: radial-gradient(1200px 600px at 20% -10%, rgba(37,99,235,.35), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(22,163,74,.28), transparent 60%), #0b1220; color: #fff; }
.s-offline { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; overflow: hidden; }
.s-offline-orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; pointer-events: none; animation: pwa-float 9s ease-in-out infinite alternate; }
.s-offline-orb.o1 { width: 380px; height: 380px; left: -120px; top: -80px; background: #2563eb; }
.s-offline-orb.o2 { width: 320px; height: 320px; right: -100px; bottom: -80px; background: #06b6d4; animation-delay: -4s; }
@keyframes pwa-float { to { transform: translateY(40px) scale(1.08); } }
.s-offline-card { position: relative; width: min(560px, 100%); text-align: center; padding: clamp(28px, 5vw, 48px) clamp(20px, 4vw, 40px); border-radius: 28px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(12px); box-shadow: 0 40px 80px -40px rgba(2,6,23,.9); }
.s-offline-logo { display: block; margin: 0 auto 14px; filter: drop-shadow(0 12px 24px rgba(6,182,212,.45)); }
.s-offline-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #fecaca; background: rgba(220,38,38,.16); border: 1px solid rgba(248,113,113,.35); margin-bottom: 14px; }
.ms-site .s-offline-card h1 { color: #fff; font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 10px; }
.ms-site .s-offline-card p { color: #c7d2fe; font-size: .95rem; line-height: 1.6; margin: 0 auto 20px; max-width: 42ch; }
.s-offline-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.s-offline-acts .btn { border-radius: 999px; font-weight: 700; padding: 11px 20px; }
.s-offline-note { margin: 22px 0 0 !important; font-size: .82rem !important; color: #94a3b8 !important; }
.s-offline-note b { color: #e2e8f0; }

/* Standalone (installed) mode */
html.pwa-standalone body { padding-top: env(safe-area-inset-top); }
html.pwa-standalone .s-nav, html.pwa-standalone .ms-topbar { padding-left: max(0px, env(safe-area-inset-left)); padding-right: max(0px, env(safe-area-inset-right)); }
html.pwa-offline .s-nav::after, html.pwa-offline .ms-topbar::after { content: "Offline"; position: fixed; top: 6px; right: 12px; z-index: 1090; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: #dc2626; padding: 3px 9px; border-radius: 999px; }

@media (max-width: 575.98px) {
  .pwa-banner { flex-wrap: wrap; border-radius: 18px; }
  .pwa-banner .pwa-acts { width: 100%; }
  .pwa-banner .pwa-acts .pwa-btn { flex: 1 1 auto; justify-content: center; }
}
