/* Installed-app notices: the update offer and the install offer.
   Two bars that are almost never on screen. Both start hidden and are revealed
   only by `static/js/dadcare_pwa.js` — the update bar when a new worker is
   genuinely waiting, the install bar when the browser has confirmed the app
   can actually be installed.
   Every colour is a token. This file adds no palette of its own. */

/* The bars are flex containers, so the `hidden` attribute has to be told it
   still wins — otherwise `display: flex` would show a bar that JavaScript
   believes it has hidden, which is the one failure mode that would put an
   install button on screen when installation is not available. */
#dadcare-pwa [hidden] { display: none !important; }

.pwa-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.pwa-bar-text {
  flex: 1 1 220px;
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.pwa-bar-warning {
  flex: 1 1 100%;
  margin: 0;
  font-size: 13px;
  color: var(--warn);
}

.pwa-bar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.pwa-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  /* DRD: interactive targets are at least 44x44. */
  min-height: var(--tap);
  min-width: 88px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
}

.pwa-btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.pwa-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (hover: hover) {
  .pwa-btn:hover { background: var(--brand-dark); }
  .pwa-btn.ghost:hover { background: var(--surface-2); color: var(--text); }
}

/* The Mother App shell carries a fixed bottom navigation bar. A notice must
   sit above it rather than over it, or it would cover Home, Apps and Me. */
body.shell .pwa-bar { bottom: calc(var(--tap) + 20px); }

@media (prefers-reduced-motion: no-preference) {
  .pwa-bar { animation: pwa-bar-in 160ms ease-out; }
  @keyframes pwa-bar-in {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
}
