/* Modulo WhatsApp — Pluma CMS · © Pluma Studio srl — plumastudio.com
   Namespace pwa__*. Colori: #157F4B con testo bianco (5,0:1), #0F6B3E al passaggio (6,6:1). */
.pwa {
  --pwa-bg: #157F4B;
  --pwa-bg-hover: #0F6B3E;
  --pwa-fg: #fff;
  --pwa-panel: #fff;
  --pwa-ink: #1d1b22;
  --pwa-muted: #5c5866;
  --pwa-gap: 20px;
  --pwa-lift: 0px;
  position: fixed;
  z-index: 90;
  bottom: calc(var(--pwa-gap) + env(safe-area-inset-bottom, 0px) + var(--pwa-lift));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: normal;
  text-transform: none;
  transition: bottom .25s ease;
}
.pwa--right { right: calc(var(--pwa-gap) + env(safe-area-inset-right, 0px)); }
.pwa--left { left: calc(var(--pwa-gap) + env(safe-area-inset-left, 0px)); align-items: flex-start; }
.pwa *, .pwa *::before, .pwa *::after { box-sizing: border-box; }

.pwa__btn {
  display: grid; place-items: center;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--pwa-bg); color: var(--pwa-fg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
  text-decoration: none;
  transition: background-color .15s ease, transform .15s ease;
}
.pwa__btn:hover { background: var(--pwa-bg-hover); transform: translateY(-1px); }
.pwa__btn:focus-visible, .pwa__cta:focus-visible, .pwa__close:focus-visible,
.pwa__invite-text:focus-visible, .pwa__invite-x:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--pwa-bg); }
.pwa__ico { display: block; flex: none; }

.pwa__sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.pwa__panel {
  width: min(340px, calc(100vw - 2 * var(--pwa-gap)));
  max-height: calc(100vh - 120px - var(--pwa-lift));
  overflow: auto;
  background: var(--pwa-panel); color: var(--pwa-ink);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .35);
  animation: pwa-in .2s ease both;
}
.pwa__panel[hidden], .pwa__invite[hidden] { display: none; }
.pwa__head { display: flex; align-items: center; gap: 12px; padding: 16px 12px 14px 16px; background: var(--pwa-bg); color: var(--pwa-fg); border-radius: 16px 16px 0 0; }
.pwa__avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .16); flex: none; }
.pwa__who { flex: 1; min-width: 0; }
.pwa__title { margin: 0; font-weight: 700; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; color: inherit; }
.pwa__status { margin: 2px 0 0; font-size: 13px; line-height: 1.35; color: inherit; opacity: .95; display: flex; gap: 6px; align-items: baseline; }
.pwa--open .pwa__status::before, .pwa--closed .pwa__status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; transform: translateY(-1px); }
.pwa--open .pwa__status::before { background: #9ff0bf; }
.pwa--closed .pwa__status::before { background: #ffd28a; }
.pwa__close { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 24px; line-height: 1; cursor: pointer; }
.pwa__close:hover { background: rgba(255, 255, 255, .16); }
.pwa__welcome { margin: 16px 16px 0; padding: 12px 14px; background: #f1f0f4; border-radius: 4px 14px 14px 14px; color: var(--pwa-ink); overflow-wrap: anywhere; }
.pwa__cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 16px; padding: 12px 16px; border-radius: 999px;
  background: var(--pwa-bg); color: var(--pwa-fg); font-weight: 700; text-decoration: none; text-align: center;
  transition: background-color .15s ease;
}
.pwa__cta:hover { background: var(--pwa-bg-hover); color: var(--pwa-fg); }

.pwa__invite { display: flex; align-items: flex-start; max-width: min(280px, calc(100vw - 2 * var(--pwa-gap))); background: var(--pwa-panel); color: var(--pwa-ink); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: pwa-in .25s ease both; }
.pwa__invite-text { flex: 1; padding: 12px 4px 12px 14px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pwa__invite-x { flex: none; width: 34px; height: 34px; margin: 4px; border: 0; border-radius: 50%; background: none; color: var(--pwa-muted); font-size: 20px; line-height: 1; cursor: pointer; }
.pwa__invite-x:hover { background: #f1f0f4; }

@keyframes pwa-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Menu a tutto schermo del sito aperto (html.menu-open) o elemento con data-pwa-hide: il fumetto si toglie di mezzo */
html.menu-open .pwa, html[data-pwa-hide] .pwa { display: none; }

@media (max-width: 480px) {
  .pwa { --pwa-gap: 16px; }
  .pwa__btn { width: 54px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  .pwa, .pwa__btn, .pwa__cta { transition: none; }
  .pwa__panel, .pwa__invite { animation: none; }
  .pwa__btn:hover { transform: none; }
}
@media print { .pwa { display: none !important; } }
