/* Chat de Beepy en la web de V5ion Tech: botón flotante + ventana que se minimiza o se amplía.
   Colores de V5ion (índigo, violeta, lavanda) con el verde de Last Park, que es el de Beepy. */
.bpy {
	--bpy-indigo: #1E1B4B;
	--bpy-violeta: #6D4AFF;
	--bpy-lavanda: #EEEBFF;
	--bpy-niebla: #F7F6FB;
	--bpy-gris: #5B5876;
	--bpy-borde: #E3E0F2;
	--bpy-verde: #12B76A;
	--bpy-verde-osc: #0B7A47;
	--bpy-sombra: 0 24px 60px rgba(30, 27, 75, .28);
	position: fixed;
	right: max(16px, env(safe-area-inset-right));
	bottom: max(16px, env(safe-area-inset-bottom));
	z-index: 9990;
	font-family: 'Outfit', system-ui, sans-serif;
	color: var(--bpy-indigo);
}
.bpy *, .bpy *::before, .bpy *::after { box-sizing: border-box; }
.bpy [hidden] { display: none !important; }
.bpy .bpy-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Botón flotante ---------- */
.bpy-launcher {
	position: relative; display: grid; place-items: center; width: 68px; height: 68px; padding: 0;
	border: 0; border-radius: 50%; cursor: pointer;
	background: radial-gradient(circle at 50% 40%, #fff 0 58%, var(--bpy-lavanda) 100%);
	box-shadow: 0 0 0 3px var(--bpy-indigo), 0 14px 30px rgba(30, 27, 75, .3);
	transition: transform .2s, box-shadow .2s;
}
.bpy-launcher:hover { transform: translateY(-3px); box-shadow: 0 0 0 3px var(--bpy-violeta), 0 18px 34px rgba(30, 27, 75, .34); }
.bpy-launcher:focus-visible { outline: 3px solid var(--bpy-violeta); outline-offset: 4px; }
.bpy-launcher img { width: 50px; height: auto; transform: translateY(3px); }
.bpy-launcher__dot { position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--bpy-verde); border: 2px solid #fff; animation: bpy-pulse 2s infinite; }
@keyframes bpy-pulse { 0% { box-shadow: 0 0 0 0 rgba(18, 183, 106, .55); } 70% { box-shadow: 0 0 0 9px rgba(18, 183, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(18, 183, 106, 0); } }
.bpy-teaser {
	position: absolute; right: 80px; bottom: 14px; width: max-content; max-width: 220px;
	padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: #fff; box-shadow: var(--bpy-sombra);
	font-size: .92rem; line-height: 1.35; cursor: pointer; animation: bpy-in .35s ease-out;
}
.bpy-teaser strong { color: var(--bpy-violeta); }

/* ---------- Ventana ---------- */
.bpy-panel {
	position: absolute; right: 0; bottom: 84px;
	display: flex; flex-direction: column;
	width: 384px; height: min(580px, calc(100dvh - 120px));
	border-radius: 22px; overflow: hidden; background: var(--bpy-niebla); box-shadow: var(--bpy-sombra);
	border: 1px solid var(--bpy-borde);
	transform-origin: bottom right; animation: bpy-in .25s ease-out;
	transition: width .25s ease, height .25s ease;
}
.bpy.is-expanded .bpy-panel { width: min(760px, calc(100vw - 32px)); height: min(860px, calc(100dvh - 120px)); }
@keyframes bpy-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

.bpy-head {
	display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px;
	background: linear-gradient(135deg, var(--bpy-indigo) 0%, #2D2580 100%); color: #fff;
}
.bpy-head__avatar { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); }
.bpy-head__avatar img { width: 36px; height: auto; transform: translateY(2px); }
.bpy-head__text { flex: 1; min-width: 0; }
.bpy-head__name { margin: 0; font: 700 1.08rem/1.15 'Space Grotesk', system-ui, sans-serif; letter-spacing: -.01em; }
.bpy-head__status { display: flex; align-items: center; gap: 6px; margin: 3px 0 0; font-size: .8rem; color: #CFCBEA; }
.bpy-head__status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bpy-verde); }
.bpy-head__btn {
	display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 12px;
	background: transparent; color: #fff; cursor: pointer; transition: background .15s;
}
.bpy-head__btn:hover { background: rgba(255, 255, 255, .12); }
.bpy-head__btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.bpy-head__btn svg { width: 20px; height: 20px; }

.bpy-notice { margin: 0; padding: 8px 16px; background: #FFF4D6; color: #7A4B00; font-size: .78rem; line-height: 1.35; border-bottom: 1px solid #F5E2AE; }
.bpy-notice strong { font-weight: 700; }

/* ---------- Conversación ---------- */
.bpy-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.bpy-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; animation: bpy-in .2s ease-out; }
.bpy-msg__avatar { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 1px solid var(--bpy-borde); }
.bpy-msg__avatar img { width: 23px; height: auto; transform: translateY(1px); }
.bpy-msg__bubble { padding: 10px 14px; border-radius: 18px; line-height: 1.45; font-size: .95rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.bpy-msg--beepy .bpy-msg__bubble { background: #fff; border: 1px solid var(--bpy-borde); border-bottom-left-radius: 6px; }
.bpy-msg--user { align-self: flex-end; }
.bpy-msg--user .bpy-msg__bubble { background: var(--bpy-violeta); color: #fff; border-bottom-right-radius: 6px; }
.bpy-msg--error .bpy-msg__bubble { background: #FDECEC; border-color: #F6C9C5; color: #A1281F; }
.bpy-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.bpy-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--bpy-gris); opacity: .4; animation: bpy-dot 1.2s infinite; }
.bpy-typing span:nth-child(2) { animation-delay: .15s; }
.bpy-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bpy-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.bpy-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 16px 10px 54px; }
.bpy-chip {
	padding: 7px 12px; border: 1.5px solid var(--bpy-violeta); border-radius: 999px; background: #fff;
	color: var(--bpy-violeta); font: 600 .84rem/1.2 'Outfit', system-ui, sans-serif; cursor: pointer; transition: background .15s, color .15s;
}
.bpy-chip:hover { background: var(--bpy-violeta); color: #fff; }
.bpy-chip:focus-visible { outline: 2px solid var(--bpy-indigo); outline-offset: 2px; }

/* ---------- Caja de texto ---------- */
.bpy-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 8px; background: #fff; border-top: 1px solid var(--bpy-borde); }
.bpy-input {
	flex: 1; min-height: 44px; max-height: 120px; padding: 11px 14px; resize: none;
	border: 1.5px solid var(--bpy-borde); border-radius: 14px; background: var(--bpy-niebla);
	font: 400 .95rem/1.4 'Outfit', system-ui, sans-serif; color: var(--bpy-indigo);
}
.bpy-input:focus { outline: none; border-color: var(--bpy-violeta); background: #fff; box-shadow: 0 0 0 3px rgba(109, 74, 255, .18); }
.bpy-send {
	flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 14px;
	background: var(--bpy-verde-osc); color: #fff; cursor: pointer; transition: background .15s;
}
.bpy-send:hover { background: var(--bpy-indigo); }
.bpy-send:disabled { background: #B7B3CF; cursor: default; }
.bpy-send:focus-visible { outline: 3px solid var(--bpy-violeta); outline-offset: 2px; }
.bpy-send svg { width: 20px; height: 20px; }
.bpy-foot { display: flex; justify-content: space-between; gap: 8px; padding: 0 14px 10px; background: #fff; font-size: .74rem; color: var(--bpy-gris); }
.bpy-foot button { padding: 0; border: 0; background: none; color: var(--bpy-violeta); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

/* ---------- Móvil: la ventana ocupa la pantalla ---------- */
@media (max-width: 600px) {
	.bpy.is-open .bpy-panel, .bpy.is-open.is-expanded .bpy-panel {
		position: fixed; inset: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0;
	}
	.bpy-head { padding-top: max(14px, env(safe-area-inset-top)); }
	.bpy-head__btn--expand { display: none; }
	.bpy.is-open .bpy-launcher { display: none; }
	.bpy-teaser { max-width: 180px; }
}
@media (prefers-reduced-motion: reduce) {
	.bpy-panel, .bpy-msg, .bpy-teaser { animation: none; }
	.bpy-launcher__dot, .bpy-typing span { animation: none; }
	.bpy-panel { transition: none; }
}
