/* =============================================================================
 * client/css/client-pwa.css  —  v1.1.0  2026-08-18
 * StaffHub — Client Portal · PWA + push surfaces (install banner, alerts
 * banner, update prompt, offline bar). Loaded AFTER client-portal.css, which
 * owns the :root tokens these rules reuse — no new palette, no new type
 * families, deliberately.
 *
 * All four surfaces are the same object: a dark enamel plate with a hairline
 * rule and a mono eyebrow, the same signage language as the rail. They read
 * as part of the building, not as browser chrome that wandered in.
 *
 * v1.1.0 — .cp-pwa--push variant for the notifications ask; z-index raised
 *          above the v1.3.0 mobile drawer overlay.
 * ========================================================================== */

/* Above the mobile drawer overlay (client-portal.css v1.2.0) so a banner is
   never buried under a dim layer the client can't dismiss it through. */
.cp-pwa,
.cp-pwa-update,
.cp-pwa-offline { z-index: 90; }

/* ---------- install / alerts banner ---------- */
.cp-pwa{
  position:fixed;
  right:20px; left:auto;
  bottom:calc(20px + var(--safe-b));
  width:min(384px, calc(100vw - 40px));
  background:var(--shell);
  color:#DCE7E3;
  border:1px solid rgba(255,255,255,.12);
  border-radius:var(--r);
  box-shadow:0 14px 40px rgba(0,0,0,.34);
  padding:16px 16px 14px;
  opacity:0;
  transform:translateY(14px);
  transition:opacity .26s ease, transform .26s ease;
}
.cp-pwa.is-in{opacity:1;transform:none}
.cp-pwa.is-out{opacity:0;transform:translateY(10px)}

/* The alerts ask is the quieter of the two — green edge instead of a logo,
   so a client who sees both across two visits reads them as related but
   distinct requests rather than the same banner twice. */
.cp-pwa--push{border-left:3px solid var(--on)}

.cp-pwa__x{
  position:absolute;top:6px;right:8px;
  width:32px;height:32px;
  border:0;background:transparent;color:#7C9E95;
  font-size:20px;line-height:1;cursor:pointer;border-radius:var(--r);
}
.cp-pwa__x:hover{color:#fff;background:rgba(255,255,255,.08)}

.cp-pwa__top{display:flex;gap:14px;align-items:flex-start;padding-right:26px}
.cp-pwa__logo{
  width:46px;height:46px;flex:0 0 auto;object-fit:contain;
  background:rgba(255,255,255,.08);border-radius:var(--r);padding:5px;
}
.cp-pwa__bell{
  width:46px;height:46px;flex:0 0 auto;display:grid;place-items:center;
  background:rgba(46,125,91,.18);border:1px solid rgba(46,125,91,.5);
  border-radius:var(--r);color:var(--on);font-size:15px;
}
.cp-pwa__text{min-width:0}
.cp-pwa__eyebrow{
  margin:0 0 3px;font-family:var(--mono);font-size:10px;letter-spacing:.18em;
  text-transform:uppercase;color:var(--on);
}
.cp-pwa__title{
  margin:0;font-family:var(--display);font-weight:600;font-size:19px;line-height:1.12;
  letter-spacing:.02em;text-transform:uppercase;color:#fff;
}
.cp-pwa__sub{margin:6px 0 0;font-size:13px;line-height:1.5;color:#9CBAB2}

.cp-pwa__actions{
  display:flex;gap:8px;flex-wrap:wrap;margin-top:14px;padding-top:13px;
  border-top:1px solid rgba(255,255,255,.1);
}
.cp-pwa__btn{
  font-family:var(--display);font-size:13.5px;letter-spacing:.12em;text-transform:uppercase;
  padding:9px 16px;min-height:42px;cursor:pointer;border-radius:var(--r);
  background:transparent;color:#CFE0DB;border:1px solid rgba(255,255,255,.24);
  transition:background .15s, border-color .15s, color .15s;
}
.cp-pwa__btn:hover{background:rgba(255,255,255,.09);color:#fff;border-color:rgba(255,255,255,.45)}
.cp-pwa__btn:disabled{opacity:.55;cursor:default}
.cp-pwa__btn--primary{background:var(--on);border-color:var(--on);color:#fff}
.cp-pwa__btn--primary:hover{background:#37936B;border-color:#37936B}

.cp-pwa__steps{margin-top:13px;padding-top:12px;border-top:1px solid rgba(255,255,255,.1)}
.cp-pwa__list{margin:0;padding-left:20px;display:grid;gap:8px;font-size:13px;color:#BFD4CE}
.cp-pwa__list li{line-height:1.45}
.cp-pwa__list strong{color:#fff;font-weight:600}
.cp-pwa__glyph{
  display:inline-grid;place-items:center;width:21px;height:21px;vertical-align:-5px;
  border:1px solid rgba(255,255,255,.35);border-radius:4px;font-size:12px;color:#fff;
}

/* ---------- update prompt ---------- */
.cp-pwa-update{
  position:fixed;left:50%;
  bottom:calc(20px + var(--safe-b));
  transform:translate(-50%,14px);
  display:flex;align-items:center;gap:12px;
  width:max-content;max-width:calc(100vw - 32px);
  padding:9px 9px 9px 16px;
  background:var(--ink);color:#fff;
  border:1px solid rgba(255,255,255,.14);border-radius:var(--r);
  box-shadow:0 10px 30px rgba(0,0,0,.3);
  opacity:0;transition:opacity .26s ease, transform .26s ease;
}
.cp-pwa-update.is-in{opacity:1;transform:translate(-50%,0)}
.cp-pwa-update.is-out{opacity:0;transform:translate(-50%,10px)}
.cp-pwa-update__text{font-size:13.5px;line-height:1.35}
.cp-pwa-update__btn{
  font-family:var(--display);font-size:13px;letter-spacing:.12em;text-transform:uppercase;
  padding:8px 14px;min-height:38px;cursor:pointer;
  background:var(--on);color:#fff;border:1px solid var(--on);border-radius:var(--r);
}
.cp-pwa-update__btn:hover{background:#37936B}
.cp-pwa-update__btn:disabled{opacity:.6;cursor:default}
.cp-pwa-update__x{
  width:34px;height:34px;border:0;background:transparent;color:#8FA8A2;
  font-size:19px;line-height:1;cursor:pointer;border-radius:var(--r);
}
.cp-pwa-update__x:hover{color:#fff;background:rgba(255,255,255,.1)}

/* ---------- offline bar ---------- */
.cp-pwa-offline{
  position:fixed;left:0;right:0;bottom:0;
  display:flex;align-items:center;gap:10px;
  padding:10px 16px calc(10px + var(--safe-b));
  background:var(--warn);color:#2A1A05;
  font-size:12.5px;line-height:1.4;
  border-top:1px solid rgba(0,0,0,.18);
  opacity:0;transform:translateY(100%);
  transition:opacity .24s ease, transform .24s ease;
}
.cp-pwa-offline.is-in{opacity:1;transform:none}
.cp-pwa-offline.is-out{opacity:0;transform:translateY(100%)}
.cp-pwa-offline__dot{
  width:9px;height:9px;flex:0 0 auto;border-radius:50%;
  background:#2A1A05;animation:cp-pwa-blink 1.8s ease-in-out infinite;
}
@keyframes cp-pwa-blink{0%,100%{opacity:1}50%{opacity:.25}}

/* Lift everything that lives on the bottom edge clear of the offline bar. */
body.cp-is-offline .cp-pwa,
body.cp-is-offline .cp-pwa-update,
body.cp-is-offline #cpToastHost{bottom:calc(66px + var(--safe-b))}

/* ---------- phones ---------- */
@media (max-width:560px){
  .cp-pwa{left:12px;right:12px;width:auto;bottom:calc(12px + var(--safe-b))}
  .cp-pwa__title{font-size:18px}
  .cp-pwa__actions .cp-pwa__btn{flex:1}
  .cp-pwa-update{left:12px;right:12px;transform:translateY(14px);width:auto}
  .cp-pwa-update.is-in{transform:none}
  .cp-pwa-update.is-out{transform:translateY(10px)}
  .cp-pwa-update__text{flex:1}
  body.cp-is-offline .cp-pwa,
  body.cp-is-offline .cp-pwa-update{bottom:calc(72px + var(--safe-b))}
}

/* Installed, iOS, black-translucent status bar: the rail already pads with
   --safe-t, this just stops the paper background showing through the strip
   behind the clock. */
@media (display-mode: standalone){
  html{background:var(--shell)}
}