/* PDGT Hub · PWA install prompts (login / home / profile) */

@keyframes pwaSlideUpCenter {
  from { opacity: 0; transform: translateX(-50%) translateY(18px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes pwaSlideUpSheet {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

#pwa-root { pointer-events: none; }
#pwa-root > * { pointer-events: auto; }

#pwa-banner {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  background: var(--card, #fff);
  border: 1px solid var(--card-bdr, rgba(0, 0, 0, 0.08));
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  max-width: min(400px, calc(100vw - 24px));
  width: calc(100vw - 24px);
  align-items: center;
  gap: 12px;
  animation: pwaSlideUpCenter 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

#pwa-banner.visible { display: flex; }

#pwa-banner.pwa-banner--app {
  bottom: max(calc(var(--mobile-nav-h, 56px) + 16px), calc(env(safe-area-inset-bottom) + var(--mobile-nav-h, 56px) + 8px));
}

#pwa-banner.pwa-banner--login {
  bottom: max(20px, env(safe-area-inset-bottom));
}

.pwa-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  overflow: hidden;
  background: transparent;
}

.pwa-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.pwa-text { flex: 1; min-width: 0; }

.pwa-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--t1, #111);
  margin-bottom: 2px;
}

.pwa-text span {
  display: block;
  font-size: 12px;
  color: var(--t3, #666);
  line-height: 1.45;
}

.pwa-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.pwa-install-btn {
  background: var(--purple, #6C47D0);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
  font-family: var(--font, system-ui, sans-serif);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}

.pwa-install-btn:active { filter: brightness(0.92); }

.pwa-dismiss-btn {
  background: none;
  border: none;
  color: var(--t3, #666);
  font-family: var(--font, system-ui, sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  touch-action: manipulation;
  min-height: 44px;
  padding: 8px 4px;
}

#pwa-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

#pwa-sheet.visible { display: flex; }

.pwa-sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.pwa-sheet-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 0 max(8px, env(safe-area-inset-bottom));
  background: var(--card, #fff);
  border: 1px solid var(--card-bdr, rgba(0, 0, 0, 0.08));
  border-radius: 20px;
  padding: 22px 20px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  animation: pwaSlideUpSheet 0.32s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

.pwa-sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  min-width: 0;
}

.pwa-sheet-head > div:last-child {
  flex: 1;
  min-width: 0;
}

.pwa-sheet-head strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--t1, #111);
  margin-bottom: 4px;
}

.pwa-sheet-head span {
  display: block;
  font-size: 13px;
  color: var(--t3, #666);
  line-height: 1.5;
}

.pwa-sheet-steps {
  background: var(--panel2, rgba(0, 0, 0, 0.04));
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--t2, #333);
  line-height: 1.65;
  margin-bottom: 14px;
}

.pwa-sheet-steps ol {
  margin: 8px 0 0 18px;
  padding: 0;
}

.pwa-sheet-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pwa-sheet-close {
  flex: 1;
  min-width: 100px;
  min-height: 44px;
  background: none;
  border: 1px solid var(--card-bdr, rgba(0, 0, 0, 0.1));
  color: var(--t2, #333);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pwa-login-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 14px;
  padding: 10px 14px;
  background: none;
  border: 1px dashed var(--card-bdr, rgba(0, 0, 0, 0.12));
  border-radius: 12px;
  color: var(--purple, #6C47D0);
  font-family: var(--font, system-ui, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.pwa-login-link .material-symbols-rounded { font-size: 18px; }

.pwa-login-link:hover { background: var(--purple-l, rgba(108, 71, 208, 0.08)); }

.pwa-profile-card { margin-bottom: 20px; }

.pwa-profile-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.pwa-profile-ic {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--purple-l, rgba(108, 71, 208, 0.12));
  color: var(--purple, #6C47D0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-profile-text { flex: 1; min-width: 0; }

.pwa-profile-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--t1, #111);
}

.pwa-profile-text span {
  display: block;
  font-size: 12px;
  color: var(--t3, #666);
  margin-top: 2px;
  line-height: 1.4;
}

.pwa-profile-btn {
  flex-shrink: 0;
  background: var(--purple, #6C47D0);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.pwa-profile-btn.is-done {
  background: var(--green-l, #ecfdf5);
  color: var(--green, #059669);
  cursor: default;
}

[data-theme="dark"] #pwa-banner,
[data-theme="dark"] .pwa-sheet-panel {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
