/* Blu – Asistente IA de Blue Social Media */
#bsm-chat {
	--bsm-primary: #1E73BE;
	--bsm-accent: #F9B82A;
	--bsm-ink: #111111;
	--bsm-soft: #EEEEEE;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 1000000; /* por encima de la cabecera fija de Divi (99999-100000) */
	font-family: Manrope, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--bsm-ink);
	-webkit-font-smoothing: antialiased;
}
#bsm-chat *, #bsm-chat *::before, #bsm-chat *::after { box-sizing: border-box; }
#bsm-chat [hidden] { display: none !important; }
#bsm-chat button { font-family: inherit; cursor: pointer; }

/* Botón flotante: forma del isotipo de Blue (círculo con esquina recta abajo a la izquierda) */
#bsm-chat .bsm-launcher {
	width: 62px;
	height: 62px;
	border: 0;
	padding: 0;
	border-radius: 50% 50% 50% 0;
	background: var(--bsm-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 10px 30px rgba(17, 17, 17, .22);
	transition: transform .25s ease, box-shadow .25s ease, border-radius .3s ease;
	position: relative;
	margin-left: auto;
}
#bsm-chat .bsm-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(17, 17, 17, .28); }
#bsm-chat .bsm-launcher:focus-visible { outline: 3px solid var(--bsm-accent); outline-offset: 3px; }
#bsm-chat .bsm-launcher::after {
	content: "";
	position: absolute;
	top: 4px;
	right: 4px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: var(--bsm-accent);
	border: 2px solid #fff;
}
#bsm-chat.bsm-open .bsm-launcher { border-radius: 50%; }
#bsm-chat.bsm-open .bsm-launcher::after { display: none; }

/* Tres puntos de chat */
#bsm-chat .bsm-mark {
	position: relative;
	display: block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
	box-shadow: -11px 0 0 currentColor, 11px 0 0 currentColor;
}
#bsm-chat .bsm-ico-close { width: 24px; height: 24px; display: none; }
#bsm-chat.bsm-open .bsm-launcher .bsm-mark { display: none; }
#bsm-chat.bsm-open .bsm-ico-close { display: block; }

/* Mensaje flotante */
#bsm-chat .bsm-teaser {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: max-content;
	max-width: 270px;
	background: #fff;
	color: var(--bsm-ink);
	padding: 14px 34px 14px 16px;
	border-radius: 16px 16px 4px 16px;
	box-shadow: 0 12px 34px rgba(17, 17, 17, .18);
	font-size: 14.5px;
	font-weight: 600;
	cursor: pointer;
	animation: bsm-pop .35s ease both;
}
#bsm-chat .bsm-teaser-close {
	position: absolute;
	top: 6px;
	right: 8px;
	border: 0;
	background: none;
	font-size: 18px;
	line-height: 1;
	color: #999;
	padding: 2px;
}

/* Panel */
#bsm-chat .bsm-panel {
	position: absolute;
	right: 0;
	bottom: 78px;
	width: 380px;
	padding: 0;
	margin: 0;
	height: min(600px, calc(100vh - 120px));
	background: #fff;
	border-radius: 22px;
	box-shadow: 0 24px 60px rgba(17, 17, 17, .25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: bsm-pop .28s ease both;
}
#bsm-chat .bsm-head {
	background: var(--bsm-primary);
	color: #fff;
	padding: 16px 16px 16px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
}
#bsm-chat .bsm-avatar {
	width: 42px;
	height: 42px;
	flex: none;
	border-radius: 50% 50% 50% 0;
	background: var(--bsm-accent);
	color: var(--bsm-ink);
	display: flex;
	align-items: center;
	justify-content: center;
}
#bsm-chat .bsm-avatar .bsm-mark { width: 5px; height: 5px; box-shadow: -9px 0 0 currentColor, 9px 0 0 currentColor; }
#bsm-chat .bsm-head-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#bsm-chat .bsm-head-txt strong { font-size: 17px; font-weight: 800; line-height: 1.2; color: #fff; }
#bsm-chat .bsm-head-txt span { font-size: 12.5px; opacity: .9; color: #fff; }
#bsm-chat .bsm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; margin-right: 6px; vertical-align: 1px; }
#bsm-chat .bsm-close { border: 0; background: rgba(255, 255, 255, .14); color: #fff; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0; }
#bsm-chat .bsm-close svg { width: 18px; height: 18px; }
#bsm-chat .bsm-close:hover { background: rgba(255, 255, 255, .26); }
#bsm-chat .bsm-test { background: var(--bsm-accent); color: var(--bsm-ink); font-size: 12px; font-weight: 700; text-align: center; padding: 5px 10px; }

/* Mensajes */
#bsm-chat .bsm-msgs {
	flex: 1;
	overflow-y: auto;
	padding: 18px 16px 8px;
	background: #F6F7F9;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overscroll-behavior: contain;
}
#bsm-chat .bsm-msg { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: 14.5px; word-wrap: break-word; animation: bsm-in .25s ease both; }
#bsm-chat .bsm-msg p { margin: 0 0 6px; padding: 0; font-size: inherit; line-height: 1.5; color: inherit; }
#bsm-chat .bsm-msg p:last-child { margin-bottom: 0; }
#bsm-chat .bsm-msg ul { margin: 4px 0 6px; padding: 0 0 0 18px; list-style: disc; }
#bsm-chat .bsm-msg li { margin: 2px 0; padding: 0; }
#bsm-chat .bsm-assistant { align-self: flex-start; background: #fff; color: var(--bsm-ink); border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(17, 17, 17, .06); }
#bsm-chat .bsm-user { align-self: flex-end; background: var(--bsm-primary); color: #fff; border-bottom-right-radius: 4px; }
#bsm-chat .bsm-assistant a { color: var(--bsm-primary); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
#bsm-chat .bsm-typing { display: flex; gap: 4px; padding: 14px 16px; }
#bsm-chat .bsm-typing span { width: 7px; height: 7px; border-radius: 50%; background: #B8C2CC; animation: bsm-blink 1.2s infinite ease-in-out; }
#bsm-chat .bsm-typing span:nth-child(2) { animation-delay: .15s; }
#bsm-chat .bsm-typing span:nth-child(3) { animation-delay: .3s; }

/* Respuestas rápidas */
#bsm-chat .bsm-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px; background: #F6F7F9; }
#bsm-chat .bsm-quick:not(:empty) { padding-bottom: 12px; }
#bsm-chat .bsm-chip {
	border: 1.5px solid var(--bsm-primary);
	background: #fff;
	color: var(--bsm-primary);
	border-radius: 999px;
	padding: 7px 13px;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.2;
	transition: background .2s, color .2s;
}
#bsm-chat .bsm-chip:hover { background: var(--bsm-primary); color: #fff; }

/* Formulario */
#bsm-chat .bsm-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px 12px 8px; border-top: 1px solid #ECEEF1; background: #fff; margin: 0; }
#bsm-chat .bsm-form textarea {
	flex: 1;
	resize: none;
	border: 1.5px solid #E1E5EA;
	border-radius: 14px;
	padding: 10px 12px;
	font: inherit;
	font-size: 15px;
	line-height: 1.4;
	color: var(--bsm-ink);
	background: #fff;
	max-height: 120px;
	min-height: 44px;
	outline: none;
	margin: 0;
	box-shadow: none;
}
#bsm-chat .bsm-form textarea:focus { border-color: var(--bsm-primary); }
#bsm-chat .bsm-form button {
	width: 44px;
	height: 44px;
	flex: none;
	border: 0;
	border-radius: 50%;
	background: var(--bsm-accent);
	color: var(--bsm-ink);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: transform .2s;
}
#bsm-chat .bsm-form button:hover { transform: scale(1.06); }
#bsm-chat .bsm-form button svg { width: 20px; height: 20px; }
#bsm-chat .bsm-legal { font-size: 11px; color: #8A929B; text-align: center; padding: 0 14px 10px; background: #fff; line-height: 1.4; }
#bsm-chat .bsm-legal a { color: #8A929B; text-decoration: underline; }

@keyframes bsm-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes bsm-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes bsm-blink { 0%, 80%, 100% { opacity: .3; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }

/* Botón "volver arriba" de Divi: se sube para no tapar el chat */
.et_pb_scroll_top.et-pb-icon { bottom: 96px !important; }

/* Móvil: pantalla completa */
@media (max-width: 640px) {
	#bsm-chat { right: 14px; bottom: 14px; }
	#bsm-chat .bsm-launcher { width: 56px; height: 56px; }
	#bsm-chat .bsm-panel { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; bottom: 0; }
	#bsm-chat .bsm-head { padding-top: calc(16px + env(safe-area-inset-top)); }
	#bsm-chat .bsm-legal { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
	html.bsm-lock, html.bsm-lock body { overflow: hidden !important; }
	#bsm-chat.bsm-open .bsm-launcher { display: none; }
	#bsm-chat .bsm-teaser { bottom: 70px; max-width: calc(100vw - 40px); }
	#bsm-chat .bsm-form textarea { font-size: 16px; } /* evita zoom en iOS */
}
@media (prefers-reduced-motion: reduce) {
	#bsm-chat * { animation: none !important; transition: none !important; }
}
