/* ─── L'APP DENTRO IL SITO ────────────────────────────────────────────────────
   - riquadro "segui l'ordine" nella pagina di conferma (parti/app_invito.php)
   - barra dell'app in basso quando il sito è aperto dall'app installata
     (parti/app_barra.php aggiunge al body la classe tr-app-installata)
   - proposta notifiche dopo il cuore sui prodotti e avvisi a comparsa
   ─────────────────────────────────────────────────────────────────────────── */

.tr-invito {
  max-width: 640px; margin: 24px auto; padding: 22px; border-radius: 18px; position: relative; overflow: hidden;
  background: radial-gradient(120% 90% at 100% 0%, #0E5A72 0%, #042F3F 60%) #042F3F;
  color: #fff; font-family: "DM Sans", system-ui, sans-serif; text-align: left; box-sizing: border-box;
}
.tr-invito h3 { font: 400 1.55rem/1.2 "DM Serif Display", Georgia, serif; margin: 0 0 8px; color: #fff; padding-right: 64px; text-transform: none; }
.tr-invito p { margin: 0 0 16px; color: rgba(255, 255, 255, .82); line-height: 1.5; font-size: .98rem; }
.tr-invito .tr-regalo {
  position: absolute; top: 18px; right: 18px; width: 52px; height: 52px; border-radius: 15px; background: #AB3940;
  display: grid; place-items: center; transform: rotate(8deg); box-shadow: 0 8px 18px rgba(0, 0, 0, .25);
}
.tr-invito .tr-regalo svg { width: 27px; height: 27px; color: #fff; }
.tr-invito .tr-bonus {
  display: block; margin: -4px 0 16px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .1); font-size: .92rem;
}
.tr-invito button, .tr-invito a.tr-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px; border-radius: 999px;
  border: 0; background: #AB3940; color: #fff; font: 600 1rem "DM Sans", sans-serif; cursor: pointer; text-decoration: none;
}
.tr-invito a.tr-btn.tr-chiaro { background: rgba(255, 255, 255, .14); }
.tr-invito .tr-azioni { display: flex; flex-wrap: wrap; gap: 10px; }
.tr-invito .tr-esito { margin-top: 12px; font-size: .92rem; color: #9FE3C9; min-height: 1.2em; }
.tr-invito .tr-ios { margin-top: 4px; font-size: .94rem; line-height: 1.7; color: rgba(255, 255, 255, .88); }
.tr-invito .tr-ios b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #042F3F; font-size: .75rem; margin-right: 6px; }

/* ── barra in basso ─────────────────────────────────────────────────────────
   - telefono (≤1000px): versione "web" (Home, Cerca, Preferiti, Carrello, Account),
     tranne dove c'è già la barra di acquisto (pwa/js/sito.js mette tr-barra-on)
   - app installata: versione "app" (Indietro, La mia app, Negozio, Cerca, Carrello) ovunque */
.tr-barra { display: none; }
.tr-barra {
  grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990;
  height: calc(62px + env(safe-area-inset-bottom, 0px)); padding: 0 4px env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid rgba(4, 47, 63, .1); font-family: "DM Sans", system-ui, sans-serif; box-sizing: border-box;
  box-shadow: 0 -6px 24px rgba(4, 47, 63, .06);
}
@media (max-width: 1000px) {
  body.tr-barra-on:not(.tr-app-installata) .tr-barra-web { display: grid; }
}
body.tr-app-installata .tr-barra-app { display: grid; }
body.tr-barra-on, body.tr-app-installata { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1001px) { body.tr-barra-on:not(.tr-app-installata) { padding-bottom: 0; } }
body.tr-barra-on .cerca-fab, body.tr-app-installata .cerca-fab,
body.tr-app-installata #pwa-install-banner { display: none !important; }
@media (max-width: 1000px) {
  body.tr-barra-on #whatsapp-widget { bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important; }
  body.tr-barra-on #buttoncookie { bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }
}
body.tr-app-installata #whatsapp-widget { bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important; }

.tr-barra a, .tr-barra button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none;
  color: #5B6B72; font: 600 10.5px/1.1 "DM Sans", sans-serif; text-decoration: none; position: relative; cursor: pointer; padding: 0;
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.tr-barra a:active, .tr-barra button:active { color: #042F3F; }
.tr-barra svg { width: 24px; height: 24px; transition: transform .2s; }
.tr-barra .tr-app, .tr-barra .tr-on { color: #042F3F; }
.tr-barra .tr-on::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 24px; height: 3px; margin-left: -12px; border-radius: 0 0 3px 3px; background: #AB3940;
}
.tr-barra .tr-n {
  position: absolute; top: 7px; left: calc(50% + 5px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; box-sizing: border-box;
  background: #AB3940; color: #fff; font: 700 10px/17px "DM Sans", sans-serif; text-align: center; border: 2px solid #fff;
}
/* app installata: nella scheda prodotto la barra di acquisto sta sopra la barra */
body.tr-app-installata #prodotto .boxagg { bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important; }

/* proposta "attiva le notifiche" (dopo il cuore su un prodotto) */
.tr-proposta {
  position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 9995;
  max-width: 460px; margin: 0 auto; padding: 16px 16px 14px; border-radius: 18px; box-sizing: border-box;
  background: #042F3F; color: #fff; font-family: "DM Sans", system-ui, sans-serif; box-shadow: 0 16px 50px rgba(4, 47, 63, .35);
  transform: translateY(140%); transition: transform .35s cubic-bezier(.2, .9, .3, 1);
}
body.tr-app-installata .tr-proposta { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
.tr-proposta.su { transform: none; }
.tr-proposta strong { display: block; font-size: 1.02rem; margin-bottom: 4px; }
.tr-proposta p { margin: 0 0 12px; color: rgba(255, 255, 255, .8); font-size: .9rem; line-height: 1.45; }
.tr-proposta .tr-azioni { display: flex; gap: 8px; }
.tr-proposta button {
  flex: 1; min-height: 42px; border-radius: 999px; border: 0; font: 600 .92rem "DM Sans", sans-serif; cursor: pointer;
  background: #AB3940; color: #fff;
}
.tr-proposta button.tr-no { background: rgba(255, 255, 255, .12); }

.tr-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 9999; transform: translateX(-50%);
  background: #0A2530; color: #fff; padding: 12px 18px; border-radius: 14px; font: 500 .92rem "DM Sans", sans-serif;
  box-shadow: 0 10px 40px rgba(4, 47, 63, .25); max-width: calc(100% - 32px); text-align: center; box-sizing: border-box;
}
body.tr-app-installata .tr-toast, body.tr-barra-on .tr-toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
body.tr-barra-on .tr-proposta { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
