/* EB, asistente virtual: paleta de Editorial Benemérita */
.bnm-eb {
	--eb-negro: #171918;
	--eb-verde: #344F27;
	--eb-amarillo: #F2BB43;
	--eb-gris: #6B6B6B;
	--eb-calido: #F7F7F3;
	--eb-blanco: #FFFFFF;
	--eb-borde: rgba(107, 107, 107, .22);
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--eb-negro);
}
.bnm-eb *, .bnm-eb *::before, .bnm-eb *::after { box-sizing: border-box; }

.bnm-eb__lanzador {
	display: flex; align-items: center; justify-content: center;
	width: 124px; height: 124px; margin-left: auto; padding: 0;
	border: 3px solid var(--eb-amarillo); border-radius: 50%;
	background: var(--eb-negro); color: var(--eb-amarillo);
	box-shadow: 0 8px 26px rgba(0, 0, 0, .26);
	cursor: pointer;
	transition: scale .25s ease, box-shadow .25s ease;
	/* Rebote suave y ocasional: un salto y un pequeño eco cada 7 s */
	animation: bnm-eb-bote 7s cubic-bezier(.3, .6, .4, 1) 2.5s infinite;
	will-change: transform;
}
@keyframes bnm-eb-bote {
	0%, 86%, 100% { transform: translateY(0); }
	90% { transform: translateY(-16px); }
	94% { transform: translateY(0); }
	96.5% { transform: translateY(-5px); }
	99% { transform: translateY(0); }
}
/* Hover: crece un poco y el borde dorado brilla, invitando a pulsar */
.bnm-eb__lanzador:hover { scale: 1.06; box-shadow: 0 10px 30px rgba(0, 0, 0, .3), 0 0 0 6px rgba(242, 187, 67, .28); }
.bnm-eb__lanzador:focus-visible { outline: 3px solid var(--eb-verde); outline-offset: 4px; }
.bnm-eb__sigla { font-weight: 800; font-size: 18px; letter-spacing: .02em; }
/* Logo de la editorial dentro del círculo */
.bnm-eb__lanzador:has(.bnm-eb__logo) { background: var(--eb-blanco); overflow: hidden; }
.bnm-eb__logo { display: block; width: 100%; height: 100%; object-fit: contain; padding: 2px; border-radius: 50%; transform: scale(1.12); }
.bnm-eb__avatar img { display: block; width: 100%; height: 100%; object-fit: contain; padding: 3px; border-radius: 50%; background: var(--eb-blanco); }
.bnm-eb--abierto .bnm-eb__lanzador { display: none; }

.bnm-eb__panel {
	display: flex; flex-direction: column;
	width: 370px; height: min(580px, calc(100vh - 40px));
	background: var(--eb-blanco);
	border: 1px solid var(--eb-borde);
	box-shadow: 0 16px 48px rgba(0, 0, 0, .22);
	overflow: hidden;
}
.bnm-eb__panel[hidden] { display: none; }

.bnm-eb__cabecera {
	display: flex; align-items: center; gap: .65rem;
	padding: .8rem .75rem .8rem 1rem;
	background: var(--eb-negro); color: var(--eb-calido);
}
.bnm-eb__avatar {
	flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
	width: 36px; height: 36px; border-radius: 50%;
	border: 1.5px solid var(--eb-amarillo); color: var(--eb-amarillo);
	font-weight: 800; font-size: 13px; overflow: hidden;
}
.bnm-eb__nombre { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.bnm-eb__nombre strong { font-size: 15px; color: var(--eb-blanco); }
.bnm-eb__nombre span { font-size: 12px; color: rgba(247, 247, 243, .7); }
.bnm-eb__icono {
	flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
	width: 34px; height: 34px; padding: 0; border: 0; border-radius: 4px;
	background: transparent; color: var(--eb-calido); cursor: pointer;
}
.bnm-eb__icono:hover, .bnm-eb__icono:focus-visible { background: rgba(247, 247, 243, .12); outline: none; }

.bnm-eb__mensajes {
	flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
	display: flex; flex-direction: column; gap: .6rem;
	padding: 1rem; background: var(--eb-calido);
}
.bnm-eb__msg {
	max-width: 88%; padding: .6rem .8rem;
	word-wrap: break-word; overflow-wrap: anywhere;
}
.bnm-eb__msg p { margin: 0 0 .5em; }
.bnm-eb__msg p:last-child { margin-bottom: 0; }
.bnm-eb__msg ul { margin: .25em 0 .5em; padding-left: 1.2em; }
.bnm-eb__msg li { margin: .15em 0; }
.bnm-eb__msg a { color: var(--eb-verde); text-decoration: underline; text-underline-offset: 2px; }
.bnm-eb__msg--eb {
	align-self: flex-start;
	background: var(--eb-blanco); border: 1px solid var(--eb-borde);
	border-left: 3px solid var(--eb-amarillo);
}
.bnm-eb__msg--yo {
	align-self: flex-end; white-space: pre-wrap;
	background: var(--eb-verde); color: var(--eb-blanco);
}
.bnm-eb__msg--error { border-left-color: var(--eb-gris); color: var(--eb-gris); }
.bnm-eb__msg--yo.bnm-eb__msg--error { background: var(--eb-gris); color: var(--eb-blanco); opacity: .8; }

.bnm-eb__escribiendo { display: flex; gap: 5px; padding: .8rem .9rem; }
.bnm-eb__escribiendo span {
	width: 7px; height: 7px; border-radius: 50%; background: var(--eb-gris);
	animation: bnm-eb-punto 1.2s infinite ease-in-out;
}
.bnm-eb__escribiendo span:nth-child(2) { animation-delay: .15s; }
.bnm-eb__escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes bnm-eb-punto { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.bnm-eb__formulario {
	display: flex; align-items: flex-end; gap: .5rem;
	padding: .65rem .75rem; border-top: 1px solid var(--eb-borde); background: var(--eb-blanco);
}
.bnm-eb__formulario textarea {
	flex: 1 1 auto; min-height: 40px; max-height: 120px; resize: none;
	padding: .55rem .7rem; border: 1px solid var(--eb-borde); border-radius: 0;
	font: inherit; font-size: 16px; line-height: 1.4; color: var(--eb-negro); background: var(--eb-blanco);
}
.bnm-eb__formulario textarea:focus { outline: 2px solid var(--eb-verde); outline-offset: -1px; border-color: transparent; }
.bnm-eb__enviar {
	flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
	width: 40px; height: 40px; padding: 0; border: 0;
	background: var(--eb-verde); color: var(--eb-blanco); cursor: pointer;
}
.bnm-eb__enviar:hover { background: var(--eb-negro); }
.bnm-eb__enviar:disabled { opacity: .5; cursor: wait; }
.bnm-eb__enviar:focus-visible { outline: 3px solid var(--eb-amarillo); outline-offset: 2px; }

.bnm-eb__aviso {
	margin: 0; padding: .1rem .9rem .7rem; background: var(--eb-blanco);
	font-size: 11.5px; line-height: 1.4; color: var(--eb-gris);
}
.bnm-eb__aviso a { color: var(--eb-gris); text-decoration: underline; }

.bnm-eb .screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}

@media (min-width: 601px) and (max-width: 1024px) {
	.bnm-eb__lanzador { width: 100px; height: 100px; }
}
@media (max-width: 600px) {
	.bnm-eb { right: 12px; bottom: 12px; }
	.bnm-eb__lanzador { width: 76px; height: 76px; border-width: 2px; }
	.bnm-eb--abierto { inset: 0; }
	.bnm-eb--abierto .bnm-eb__panel { width: 100%; height: 100%; height: 100dvh; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.bnm-eb__lanzador { transition: none; animation: none; }
	.bnm-eb__lanzador:hover { scale: 1; }
	.bnm-eb__escribiendo span { animation: none; opacity: .6; }
}

@media print { .bnm-eb { display: none !important; } }

/* Memoria del alumno */
.bnm-eb__permiso-botones { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.bnm-eb__permiso-botones button { padding: .45em .9em; border: 0; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 700; }
.bnm-eb__permiso-botones button[data-memoria="si"] { background: var(--eb-amarillo, #F2BB43); color: #171918; }
.bnm-eb__permiso-botones button[data-memoria="no"] { background: transparent; color: #6B6B6B; box-shadow: inset 0 0 0 1px rgba(107, 107, 107, .4); }
.bnm-eb__nota-memoria { margin: -.25rem 0 .75rem; font-size: .78rem; color: #6B6B6B; }
.bnm-eb__nota-memoria a { color: #344F27; font-weight: 700; }
