/* Budetta Consigliere: tutti gli stili sono sotto .bfc e usano le variabili del tema con valori di riserva. */
.bfc {
	--bfc-testo: var(--wp--preset--color--inchiostro, #16282c);
	--bfc-tiffany: var(--wp--preset--color--tiffany-chiaro, #e8f5f4);
	--bfc-accento: #127a74;
	--bfc-accento-scuro: #0d5c57;
	--bfc-bordo: #c9dedd;
	--bfc-medico-sfondo: #fff4e0;
	--bfc-medico-bordo: #a85a00;
	color: var(--bfc-testo);
	max-width: 880px;
	margin: 0 auto;
}
.bfc *, .bfc *::before, .bfc *::after { box-sizing: border-box; }
.bfc__cornice { display: block; }
.bfc__barra {
	margin: 0 0 1.25rem;
	padding: .55rem .9rem;
	border-radius: 999px;
	background: var(--bfc-tiffany);
	font-size: .875rem;
	font-weight: 600;
	text-align: center;
}
.bfc__testa { display: flex; align-items: center; gap: 1.25rem; margin: 0 0 1rem; }
.bfc__testa-testo { flex: 1; min-width: 0; }
.bfc__testa .bfc__titolo { margin-bottom: .5rem; }
.bfc__mascotte { flex: none; width: clamp(84px, 14vw, 128px); height: auto; }
.bfc__passo { margin: 0 0 .25rem; font-size: .875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bfc-accento-scuro); }
.bfc__argomento { margin: 0 0 .25rem; font-weight: 600; color: var(--bfc-accento-scuro); }
.bfc__titolo { margin: 0 0 1rem; font-size: clamp(1.5rem, 3.2vw, 2.1rem); line-height: 1.2; }
.bfc__titolo:focus { outline: 2px solid var(--bfc-accento); outline-offset: 4px; }
.bfc__testo { margin: 0 0 1.25rem; font-size: 1.05rem; line-height: 1.6; }
.bfc__scelta { margin: 1.25rem 0 .75rem; font-weight: 600; }

.bfc__opzioni { display: grid; gap: .75rem; margin: 0 0 1.5rem; }
.bfc__opzione {
	display: block;
	width: 100%;
	padding: 1rem 1.15rem;
	border: 2px solid var(--bfc-bordo);
	border-radius: 16px;
	background: #fff;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}
.bfc__opzione:hover { border-color: var(--bfc-accento); background: var(--bfc-tiffany); }
.bfc__opzione:focus-visible { outline: 3px solid var(--bfc-accento); outline-offset: 2px; }
.bfc__opzione-titolo { display: block; font-size: 1.05rem; font-weight: 600; }
.bfc__opzione-testo { display: block; margin-top: .2rem; font-size: .925rem; opacity: .8; }

.bfc__primario, .bfc__secondario {
	display: inline-block;
	padding: .85rem 1.5rem;
	border: 2px solid var(--bfc-accento-scuro);
	border-radius: 12px;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
.bfc__primario { background: var(--bfc-accento-scuro); color: #fff; }
.bfc__primario:hover { background: var(--bfc-testo); border-color: var(--bfc-testo); }
.bfc__secondario { background: #fff; color: var(--bfc-accento-scuro); }
.bfc__secondario:hover { background: var(--bfc-tiffany); }
.bfc__primario:focus-visible, .bfc__secondario:focus-visible, .bfc__indietro:focus-visible, .bfc__link:focus-visible { outline: 3px solid var(--bfc-accento); outline-offset: 3px; }
.bfc__indietro { padding: .5rem 0; border: 0; background: none; color: var(--bfc-accento-scuro); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.bfc__azioni { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-top: 1.5rem; }

.bfc__avviso {
	margin: 0 0 1.25rem;
	padding: 1rem 1.15rem;
	border: 2px solid var(--bfc-bordo);
	border-left-width: 8px;
	border-radius: 12px;
	background: #fff;
	line-height: 1.55;
}
.bfc__avviso p { margin: 0 0 .5rem; }
.bfc__avviso p:last-child { margin-bottom: 0; }
.bfc__avviso--fisso { background: var(--bfc-tiffany); border-color: var(--bfc-accento); }
.bfc__avviso--medico { background: var(--bfc-medico-sfondo); border-color: var(--bfc-medico-bordo); }
.bfc__medico { font-size: 1.15rem; font-weight: 800; color: #6b3900; }
.bfc__emergenza { font-weight: 700; }

.bfc__prodotti { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin: 0 0 1.5rem; }
.bfc__prodotto { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--bfc-bordo); border-radius: 16px; background: #fff; }
.bfc__img { display: block; width: 100%; height: 190px; object-fit: contain; background: var(--bfc-tiffany); padding: .75rem; }
.bfc__prodotto-corpo { display: flex; flex: 1; flex-direction: column; gap: .4rem; padding: 1rem; }
.bfc__prodotto-titolo { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.bfc__prodotto-testo { margin: 0; font-size: .925rem; line-height: 1.5; }
.bfc__link { margin-top: auto; color: var(--bfc-accento-scuro); font-weight: 700; text-decoration: underline; }
.bfc__guide { margin: 0 0 1.5rem; }
.bfc__guide-titolo { margin: 0 0 .5rem; font-size: 1.1rem; }
.bfc__guide-lista { margin: 0; padding-left: 1.2rem; }
.bfc__guide-lista li { margin: .25rem 0; }
.bfc__noscript { padding: 1rem; border: 2px solid var(--bfc-bordo); border-radius: 12px; }

@media (prefers-reduced-motion: reduce) {
	.bfc__opzione { transition: none; }
}
@media (max-width: 520px) {
	.bfc__mascotte { width: 72px; }
	.bfc__azioni { flex-direction: column; align-items: stretch; }
	.bfc__secondario { text-align: center; }
}

/* ---------------------------------------------------------------
 * Fumetto accanto alla mascotte chiusa.
 * ------------------------------------------------------------- */
/* (stili in coda al file) */

/* ---------------------------------------------------------------
 * Chat fissa in basso a destra. Da chiusa: SOLO la mascotte.
 * ------------------------------------------------------------- */
.bfc-widget { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 99990; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; font-size: 16px; }
.bfc-widget *, .bfc-widget *::before, .bfc-widget *::after { box-sizing: border-box; }
.bfc-widget__apri { display: block; width: 104px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; cursor: pointer; line-height: 0; -webkit-tap-highlight-color: transparent; }
.bfc-widget__apri img { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 14px rgba(22, 40, 44, .28)); transition: transform .25s ease; transform-origin: 50% 100%; }
.bfc-widget__apri:hover img { transform: translateY(-4px) rotate(-3deg); }
.bfc-widget__apri:focus-visible { outline: 3px solid #127a74; outline-offset: 4px; border-radius: 12px; }
.bfc-widget:not(.bfc-widget--aperto) .bfc-widget__apri img { animation: bfc-ondeggia 4.5s ease-in-out 2s infinite; }
@keyframes bfc-ondeggia { 0%, 86%, 100% { transform: translateY(0); } 90% { transform: translateY(-9px); } 95% { transform: translateY(0); } }

.bfc-widget__pannello { width: min(390px, calc(100vw - 32px)); max-height: min(660px, calc(100vh - 150px)); max-height: min(660px, calc(100dvh - 150px)); display: flex; flex-direction: column; overflow: hidden; border: 1px solid #c9dedd; border-radius: 22px; background: #fff; box-shadow: 0 18px 48px rgba(22, 40, 44, .28); }
.bfc-widget__pannello[hidden] { display: none; }
.bfc-widget__pannello:focus { outline: none; }
.bfc-widget__testa { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: .8rem 1rem; background: #2d498b; color: #fff; }
.bfc-widget__titolo { font-weight: 700; }
.bfc-widget__chiudi { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.bfc-widget__chiudi:hover { background: rgba(255, 255, 255, .32); }
.bfc-widget__chiudi:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.bfc-widget__corpo { flex: 1; overflow-y: auto; padding: 1rem; -webkit-overflow-scrolling: touch; }
.bfc-widget .bfc { max-width: none; margin: 0; }
.bfc-widget .bfc__barra { margin-bottom: .9rem; font-size: .8rem; border-radius: 12px; }
.bfc-widget .bfc__testa { gap: .75rem; }
.bfc-widget .bfc__mascotte { width: 64px; }
.bfc-widget .bfc__titolo { font-size: 1.2rem; }
.bfc-widget .bfc__testo { font-size: .95rem; }
.bfc-widget .bfc__opzione { padding: .8rem .9rem; border-radius: 14px; }
.bfc-widget .bfc__opzione-titolo { font-size: .98rem; }
.bfc-widget .bfc__prodotti { grid-template-columns: 1fr; }
.bfc-widget .bfc__img { height: 150px; }
.bfc-widget .bfc__avviso { font-size: .92rem; }
.bfc-widget .bfc__medico { font-size: 1.02rem; }
.bfc-widget .bfc__azioni { flex-direction: column; align-items: stretch; }
.bfc-widget .bfc__secondario { text-align: center; }

@media (max-width: 520px) {
	.bfc-widget__apri { width: 76px; }
	.bfc-widget__pannello { width: calc(100vw - 32px); max-height: calc(100vh - 130px); max-height: calc(100dvh - 130px); }
}
@media (prefers-reduced-motion: reduce) {
	.bfc-widget:not(.bfc-widget--aperto) .bfc-widget__apri img { animation: none; }
	.bfc-widget__apri img { transition: none; }
}
@media print { .bfc-widget { display: none !important; } }

.bfc-widget__fumetto { position: absolute; right: 100px; bottom: 40px; width: max-content; max-width: 220px; padding: .65rem .9rem; border: 2px solid #2d498b; border-radius: 16px 16px 4px 16px; background: #fff; color: #16282c; font-family: inherit; font-weight: 600; font-size: .95rem; line-height: 1.3; text-align: left; box-shadow: 0 8px 22px rgba(22, 40, 44, .2); cursor: pointer; opacity: 0; transform: translateY(6px) scale(.96); pointer-events: none; transition: opacity .3s ease, transform .3s ease; }
.bfc-widget__fumetto--visibile { opacity: 1; transform: none; pointer-events: auto; }
.bfc-widget--aperto .bfc-widget__fumetto { display: none; }
@media (max-width: 520px) { .bfc-widget__fumetto { right: 84px; bottom: 28px; max-width: 180px; font-size: .88rem; } }
@media (prefers-reduced-motion: reduce) { .bfc-widget__fumetto { transition: none; } }

/* Pulsante "torna su": sopra la mascotte (centrato), nascosto quando la chat e' aperta. */
.bfc-su { position: fixed; z-index: 99989; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: #2d498b; color: #fff; box-shadow: 0 6px 16px rgba(22, 40, 44, .3); cursor: pointer; transition: background .2s ease, transform .2s ease; }
.bfc-su[hidden] { display: none; }
.bfc-su:hover { background: #127a74; transform: translateY(-2px); }
.bfc-su:focus-visible { outline: 3px solid #127a74; outline-offset: 3px; }
.bfc-widget ~ .bfc-su { right: calc(max(16px, env(safe-area-inset-right)) + 30px); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 98px); }
.bfc-widget--aperto ~ .bfc-su { display: none; }
@media (max-width: 520px) { .bfc-widget ~ .bfc-su { right: calc(max(16px, env(safe-area-inset-right)) + 16px); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 76px); } }
@media (prefers-reduced-motion: reduce) { .bfc-su { transition: none; } }
@media print { .bfc-su { display: none !important; } }

/* ---------------------------------------------------------------------
 * Chat: bolle, risposte rapide e campo di testo.
 * ------------------------------------------------------------------- */
.bfc-chat { display: flex; flex-direction: column; height: min(700px, 84vh); border: 1px solid var(--bfc-bordo); border-radius: 20px; background: #fff; overflow: hidden; }
.bfc-chat__barra { flex: none; margin: 0; padding: .45rem .8rem; border-radius: 0; font-size: .8rem; }
.bfc-chat__log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .75rem; padding: 1rem; background: #f4fafa; -webkit-overflow-scrolling: touch; }
.bfc-chat__log:focus-visible { outline: 3px solid var(--bfc-accento); outline-offset: -3px; }
.bfc-chat__msg { display: flex; align-items: flex-end; gap: .5rem; max-width: 100%; }
.bfc-chat__msg--utente { justify-content: flex-end; }
.bfc-chat__avatar { flex: none; display: flex; width: 36px; height: 36px; overflow: hidden; border: 1px solid var(--bfc-bordo); border-radius: 50%; background: #fff; }
.bfc-chat__avatar img { width: 100%; height: 100%; object-fit: contain; }
.bfc-chat__bolla { max-width: min(100%, 540px); padding: .65rem .9rem; border: 1px solid var(--bfc-bordo); border-radius: 16px; background: #fff; font-size: .95rem; line-height: 1.5; overflow-wrap: anywhere; }
.bfc-chat__msg--bot .bfc-chat__bolla { border-bottom-left-radius: 4px; }
.bfc-chat__msg--utente .bfc-chat__bolla { border-color: #2d498b; border-bottom-right-radius: 4px; background: #2d498b; color: #fff; }
.bfc-chat__bolla p { margin: 0 0 .5rem; }
.bfc-chat__bolla p:last-child { margin-bottom: 0; }
.bfc-chat__bolla--larga { flex: 1; min-width: 0; max-width: 100%; }
.bfc-chat__bolla--larga > .bfc__avviso { margin: 0; }
.bfc-chat__bolla .bfc__avviso { margin: .5rem 0; font-size: .92rem; }
.bfc-chat__bolla .bfc__medico { font-size: 1.02rem; }
.bfc-chat__bolla .bfc__prodotti { margin: .5rem 0 .75rem; }
.bfc-chat__titoletto { font-weight: 700; }
.bfc-chat__chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.bfc-chat__chip { padding: .45rem .8rem; border: 2px solid var(--bfc-accento); border-radius: 18px; background: #fff; color: var(--bfc-accento-scuro); font: inherit; font-size: .88rem; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer; }
.bfc-chat__chip:hover { background: var(--bfc-tiffany); }
.bfc-chat__chip:focus-visible { outline: 3px solid var(--bfc-accento); outline-offset: 2px; }
.bfc-chat__scrive .bfc-chat__bolla { padding: .3rem .9rem; }
.bfc-chat__punti { display: inline-block; font-size: 1.4rem; line-height: 1; letter-spacing: 2px; animation: bfc-lampeggia 1s ease-in-out infinite; }
@keyframes bfc-lampeggia { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.bfc-chat__form { flex: none; padding: .7rem .8rem .6rem; border-top: 1px solid var(--bfc-bordo); background: #fff; }
.bfc-chat__riga { display: flex; gap: .5rem; }
.bfc-chat__campo { flex: 1; min-width: 0; padding: .7rem .95rem; border: 2px solid var(--bfc-bordo); border-radius: 999px; background: #fff; color: inherit; font: inherit; font-size: 16px; }
.bfc-chat__campo:focus { outline: none; border-color: var(--bfc-accento); box-shadow: 0 0 0 3px rgba(18, 122, 116, .2); }
.bfc-chat__invia { flex: none; padding: .7rem 1.15rem; border: 0; border-radius: 999px; background: var(--bfc-accento-scuro); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.bfc-chat__invia:hover { background: var(--bfc-testo); }
.bfc-chat__invia:focus-visible { outline: 3px solid var(--bfc-accento); outline-offset: 2px; }
.bfc-chat__invia:disabled, .bfc-chat__campo:disabled { opacity: .5; cursor: not-allowed; }
.bfc-chat__privacy { margin: .45rem 0 0; font-size: .75rem; line-height: 1.35; opacity: .75; }
.bfc-chat__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .bfc-chat__punti { animation: none; } .bfc-chat__log { scroll-behavior: auto; } }

/* Nel riquadro in basso a destra la chat riempie il pannello. */
.bfc-widget__pannello { height: min(620px, calc(100vh - 150px)); height: min(620px, calc(100dvh - 150px)); }
.bfc-widget__corpo { display: flex; padding: 0; overflow: hidden; }
.bfc-widget .bfc { display: flex; flex: 1; min-width: 0; min-height: 0; }
.bfc-widget .bfc-chat { flex: 1; height: auto; border: 0; border-radius: 0; }
@media (max-width: 520px) { .bfc-widget__pannello { height: calc(100vh - 130px); height: calc(100dvh - 130px); } }

/* Risposte compatte: i prodotti restano tutti nella finestra, senza scorrere a lungo. */
.bfc-chat__bolla .bfc__prodotti { grid-template-columns: 1fr; gap: .5rem; }
.bfc-chat__bolla .bfc__prodotto { flex-direction: row; align-items: center; border-radius: 12px; }
.bfc-chat__bolla .bfc__img { flex: none; width: 64px; height: 64px; padding: .25rem; margin: .4rem 0 .4rem .4rem; border-radius: 8px; }
.bfc-chat__bolla .bfc__prodotto-corpo { gap: .15rem; padding: .5rem .65rem; min-width: 0; }
.bfc-chat__bolla .bfc__prodotto-titolo { font-size: .95rem; }
.bfc-chat__bolla .bfc__prodotto-testo { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .82rem; line-height: 1.35; }
.bfc-chat__bolla .bfc__link { margin-top: .1rem; font-size: .85rem; }
.bfc-chat__bolla .bfc__avviso { padding: .6rem .75rem; font-size: .85rem; line-height: 1.4; margin: .35rem 0; }
.bfc-chat__bolla .bfc__medico { font-size: .95rem; }
.bfc-chat__bolla .bfc__guide { margin: 0 0 .5rem; }
.bfc-chat__bolla .bfc__guide-titolo { font-size: .95rem; }
.bfc-chat__bolla .bfc__guide-lista { font-size: .88rem; }

/* Finestra piu' alta: usa quasi tutta l'altezza dello schermo, cosi' si vedono piu' prodotti insieme. */
.bfc-widget__pannello { height: min(740px, calc(100vh - 120px)); height: min(740px, calc(100dvh - 120px)); max-height: none; }
.bfc-widget .bfc-chat__privacy { font-size: .7rem; margin-top: .3rem; }
.bfc-widget .bfc-chat__titoletto { margin-bottom: .2rem; }
@media (max-width: 520px) { .bfc-widget__pannello { height: calc(100vh - 100px); height: calc(100dvh - 100px); max-height: none; } }
.bfc-chat__bolla .bfc__medico { font-size: .9rem; }
.bfc-widget .bfc-chat__bolla .bfc__medico { font-size: .9rem; }
