/**
 * Valentina Bot · estilos del frontend
 *
 * La tipografía se hereda del tema para que el chat no desentone con el sitio.
 * Los colores salen de estas variables: cambiándolas acá cambia todo.
 */

.vb-chat,
.vb-wrap {
	--vb-verde: #2E9E8F;
	--vb-verde-osc: #1F7B6E;
	--vb-verde-suave: #E7F5F2;
	--vb-coral: #F0857D;
	--vb-texto: #5C6B72;
	--vb-titulo: #1F3B36;
	--vb-borde: #EAF0EF;
	--vb-suave: #93A3A8;
	--vb-fondo: #F7FAF9;
	font-family: inherit;
	color: var(--vb-texto);
}

.vb-chat *,
.vb-chat *::before,
.vb-chat *::after,
.vb-wrap *,
.vb-wrap *::before,
.vb-wrap *::after { box-sizing: border-box; }

/* -------------------------------------------------------------------------
 * Burbuja flotante
 * ---------------------------------------------------------------------- */

.vb-chat--flotante { position: fixed; bottom: 22px; z-index: 99990; }
.vb-chat--flotante.vb-chat--derecha { right: 22px; }
.vb-chat--flotante.vb-chat--izquierda { left: 22px; }

.vb-burbuja {
	position: relative;
	width: 68px; height: 68px;
	padding: 0; border: none; border-radius: 50%;
	background: linear-gradient(145deg, #fff, #EFF7F5);
	box-shadow: 0 10px 26px rgba(31, 59, 54, .22);
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	transition: transform .18s ease;
}
.vb-burbuja:hover { transform: translateY(-3px) scale(1.04); }
.vb-burbuja:focus-visible { outline: 3px solid rgba(46, 158, 143, .45); outline-offset: 3px; }

.vb-burbuja-halo {
	position: absolute; inset: -4px;
	border: 2px solid var(--vb-verde); border-radius: 50%;
	opacity: .5; pointer-events: none;
	animation: vb-pulso 2.4s ease-out infinite;
}
@keyframes vb-pulso {
	0%   { transform: scale(.92); opacity: .55; }
	70%  { transform: scale(1.18); opacity: 0; }
	100% { opacity: 0; }
}

.vb-cara { display: block; width: 46px; height: 46px; object-fit: contain; }
.vb-cara--burbuja { width: 54px; height: 54px; border-radius: 50%; }
.vb-cara--grande { width: 96px; height: 96px; }

.vb-globo {
	position: absolute; right: 0; bottom: calc(100% + 10px);
	white-space: nowrap;
	background: var(--vb-titulo); color: #fff;
	font-size: 12.5px; padding: 7px 12px; border-radius: 12px;
	box-shadow: 0 6px 16px rgba(31, 59, 54, .2);
}
.vb-chat--izquierda .vb-globo { right: auto; left: 0; }
.vb-chat[data-abierto="1"] .vb-globo { display: none; }

/* -------------------------------------------------------------------------
 * Panel
 * ---------------------------------------------------------------------- */

.vb-panel {
	width: 370px; max-width: calc(100vw - 32px);
	height: 540px; max-height: calc(100vh - 120px);
	background: #fff;
	border: 1px solid var(--vb-borde); border-radius: 20px;
	box-shadow: 0 20px 50px rgba(31, 59, 54, .18);
	display: flex; flex-direction: column;
	overflow: hidden;
}

.vb-chat--flotante .vb-panel {
	position: absolute; right: 0; bottom: 84px;
	transform-origin: bottom right;
	opacity: 0; visibility: hidden;
	transform: translateY(12px) scale(.96);
	transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.vb-chat--flotante.vb-chat--izquierda .vb-panel { right: auto; left: 0; transform-origin: bottom left; }
.vb-chat--flotante[data-abierto="1"] .vb-panel { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.vb-chat--flotante[data-abierto="1"] .vb-burbuja-halo { display: none; }

/* Sin burbuja: no ocupa nada hasta que lo abre un botón de la página. */
.vb-chat--sin-burbuja { width: 0; height: 0; }
.vb-chat--sin-burbuja .vb-burbuja { display: none; }
.vb-chat--sin-burbuja .vb-panel { bottom: 0; }
.vb-chat--sin-burbuja[data-abierto="0"] { pointer-events: none; }

/* Un solo bot por pantalla: si la página ya tiene un botón que abre el chat
   (la tarjeta, por ejemplo), la burbuja sobra. Se resuelve en CSS para que no
   llegue a verse ni un parpadeo; el JS repite la regla por si el navegador no
   entiende :has. */
body:has(.vb-abrir) .vb-chat--flotante,
body:has(a[href="#valentina-bot"]) .vb-chat--flotante { width: 0; height: 0; }
body:has(.vb-abrir) .vb-chat--flotante .vb-burbuja,
body:has(a[href="#valentina-bot"]) .vb-chat--flotante .vb-burbuja { display: none; }
body:has(.vb-abrir) .vb-chat--flotante .vb-panel,
body:has(a[href="#valentina-bot"]) .vb-chat--flotante .vb-panel { bottom: 0; }

.vb-embed { width: 100%; }
.vb-chat--fijo .vb-panel { width: 100%; max-width: 100%; height: var(--vb-alto, 520px); }

.vb-chat--plegado { display: none; }
.vb-chat--plegado[data-abierto="1"] { display: block; animation: vb-entra .2s ease; }

/* -------------------------------------------------------------------------
 * Encabezado
 * ---------------------------------------------------------------------- */

.vb-head {
	display: flex; align-items: center; gap: 11px;
	padding: 14px 16px;
	background: linear-gradient(120deg, var(--vb-verde-osc), var(--vb-verde));
	color: #fff;
}
.vb-avatar {
	flex: 0 0 42px; width: 42px; height: 42px;
	border-radius: 50%; background: rgba(255, 255, 255, .92);
	display: flex; align-items: center; justify-content: center;
	overflow: hidden;
}
.vb-avatar .vb-cara { width: 42px; height: 42px; }
.vb-head-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.vb-head-txt strong { font-size: 15px; font-weight: 600; }
.vb-head-txt span { font-size: 12px; opacity: .9; }
.vb-cerrar {
	background: none; border: none; color: #fff;
	font-size: 26px; line-height: 1; padding: 0 2px;
	cursor: pointer; opacity: .85;
}
.vb-cerrar:hover { opacity: 1; }

/* -------------------------------------------------------------------------
 * Mensajes
 * ---------------------------------------------------------------------- */

.vb-mensajes {
	flex: 1; overflow-y: auto; padding: 16px;
	background: var(--vb-fondo);
	display: flex; flex-direction: column; gap: 10px;
}
.vb-msg {
	max-width: 88%; padding: 11px 14px; border-radius: 16px;
	font-size: 14px; line-height: 1.55;
	animation: vb-entra .22s ease;
}
@keyframes vb-entra {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}
.vb-msg--bot {
	align-self: flex-start;
	background: #fff; border: 1px solid var(--vb-borde);
	border-bottom-left-radius: 5px; color: var(--vb-texto);
}
.vb-msg--yo {
	align-self: flex-end;
	background: var(--vb-verde); color: #fff;
	border-bottom-right-radius: 5px;
}
.vb-msg p { margin: 0 0 8px; }
.vb-msg p:last-child { margin: 0; }
.vb-msg a { color: var(--vb-verde-osc); font-weight: 600; text-decoration: underline; }
.vb-msg--yo a { color: #fff; }

.vb-lista { margin: 8px 0 0; padding-left: 18px; }
.vb-lista li { margin: 0 0 5px; }
.vb-ok { color: var(--vb-verde-osc); font-weight: 600; font-size: 12.5px; }
.vb-pct {
	background: var(--vb-verde-suave); color: var(--vb-verde-osc);
	font-weight: 600; font-size: 11.5px;
	border-radius: 999px; padding: 1px 8px;
}

/* Escribiendo… */
.vb-typing { display: flex; align-items: center; gap: 4px; }
.vb-typing i {
	display: block; width: 7px; height: 7px;
	border-radius: 50%; background: #BCCBC8;
	animation: vb-punto 1.1s infinite;
}
.vb-typing i:nth-child(2) { animation-delay: .15s; }
.vb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes vb-punto {
	0%, 60%, 100% { opacity: .3; transform: translateY(0); }
	30%           { opacity: 1; transform: translateY(-3px); }
}

/* Preguntas sugeridas */
.vb-chips { display: flex; flex-wrap: wrap; gap: 7px; align-self: flex-start; max-width: 100%; }
.vb-chip {
	background: #fff; border: 1px solid var(--vb-borde); color: var(--vb-verde-osc);
	font-family: inherit; font-size: 12.5px; line-height: 1.35;
	border-radius: 999px; padding: 7px 13px;
	text-align: left; cursor: pointer;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.vb-chip:hover { background: var(--vb-verde); border-color: var(--vb-verde); color: #fff; }

/* WhatsApp */
.vb-wa {
	display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
	background: #25D366; color: #fff !important; text-decoration: none !important;
	font-size: 13.5px; font-weight: 600;
	border-radius: 20px; padding: 9px 16px;
	box-shadow: 0 4px 12px rgba(37, 211, 102, .3);
}
.vb-wa:hover { background: #1FB855; }
.vb-wa svg { width: 17px; height: 17px; fill: currentColor; }

/* ¿Te sirvió? */
.vb-voto {
	display: flex; align-items: center; gap: 7px; align-self: flex-start;
	font-size: 12px; color: var(--vb-suave); padding-left: 4px;
}
.vb-voto button {
	width: 27px; height: 27px;
	background: #fff; border: 1px solid var(--vb-borde); border-radius: 50%;
	font-size: 13px; line-height: 1; cursor: pointer;
}
.vb-voto button:hover { border-color: var(--vb-verde); }

/* -------------------------------------------------------------------------
 * Formulario
 * ---------------------------------------------------------------------- */

.vb-form {
	display: flex; align-items: center; gap: 8px;
	padding: 10px 12px; background: #fff;
	border-top: 1px solid var(--vb-borde);
}
.vb-input {
	flex: 1; min-width: 0; height: 38px;
	padding: 0 14px;
	border: 1px solid var(--vb-borde); border-radius: 999px;
	background: var(--vb-fondo); color: var(--vb-titulo);
	font-family: inherit; font-size: 13.5px;
	outline: none;
}
.vb-input:focus { border-color: var(--vb-verde); background: #fff; box-shadow: 0 0 0 3px rgba(46, 158, 143, .12); }
.vb-enviar {
	flex: 0 0 34px; width: 34px; height: 34px; padding: 0;
	border: none; border-radius: 50%;
	background: var(--vb-verde); color: #fff;
	display: flex; align-items: center; justify-content: center;
	cursor: pointer; transition: background .15s ease;
}
.vb-enviar:hover { background: var(--vb-verde-osc); }
.vb-enviar svg { width: 15px; height: 15px; }

/* -------------------------------------------------------------------------
 * Tarjeta
 * ---------------------------------------------------------------------- */

.vb-wrap { width: 100%; }

.vb-card {
	position: relative; overflow: hidden;
	background: #fff;
	border: 1px solid var(--vb-borde); border-radius: 20px;
	padding: 20px 18px 22px;
	text-align: center;
	box-shadow: 0 8px 26px rgba(46, 158, 143, .10);
}
/* Los velos pastel de las esquinas. */
.vb-card::before,
.vb-card::after {
	content: ""; position: absolute;
	width: 150px; height: 150px; border-radius: 50%;
	pointer-events: none;
}
.vb-card::before { top: -70px; left: -60px; background: radial-gradient(circle, #FDEDE6 0%, rgba(253, 237, 230, 0) 70%); }
.vb-card::after { right: -60px; bottom: -80px; background: radial-gradient(circle, #E7F5F2 0%, rgba(231, 245, 242, 0) 70%); }

.vb-card-head {
	position: relative;
	display: flex; align-items: center; justify-content: center; gap: 7px;
	margin: 0 0 14px;
}
.vb-chispa { flex: 0 0 18px; width: 18px; height: 18px; fill: var(--vb-coral); opacity: .9; }
.vb-card-titulo {
	margin: 0;
	font-size: 19px; font-weight: 700; line-height: 1.2; letter-spacing: .2px;
	color: var(--vb-verde);
}

.vb-foto {
	position: relative;
	max-width: 230px; margin: 0 auto 16px;
	min-height: 170px;
	border-radius: 16px; overflow: hidden;
	background: var(--vb-verde-suave);
}
.vb-foto img { display: block; width: 100%; height: auto; }
.vb-foto--vacia {
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: 8px; padding: 26px 14px;
}
.vb-aviso { font-size: 11.5px; line-height: 1.4; color: var(--vb-verde-osc); opacity: .8; }

.vb-card-texto {
	position: relative; margin: 0 0 18px;
	font-size: 14px; line-height: 1.6; color: var(--vb-texto);
}

.vb-btn {
	position: relative; display: inline-block;
	padding: 11px 26px;
	background: var(--vb-verde-suave); color: var(--vb-verde-osc);
	border: 1px solid rgba(46, 158, 143, .28); border-radius: 999px;
	font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
	cursor: pointer;
	transition: background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.vb-btn:hover {
	background: var(--vb-verde); border-color: var(--vb-verde); color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 8px 18px rgba(46, 158, 143, .28);
}
.vb-btn:focus-visible { outline: 3px solid rgba(46, 158, 143, .35); outline-offset: 2px; }

.vb-wrap .vb-embed--plegado .vb-panel { border-radius: 20px; }

/* -------------------------------------------------------------------------
 * Pantallas chicas y accesibilidad
 * ---------------------------------------------------------------------- */

@media (max-width: 480px) {
	.vb-chat--flotante { bottom: 16px; }
	.vb-chat--flotante.vb-chat--derecha { right: 16px; }
	.vb-chat--flotante.vb-chat--izquierda { left: 16px; }
	.vb-panel { width: calc(100vw - 24px); height: min(560px, calc(100vh - 110px)); }
	.vb-chat--flotante .vb-panel { right: -4px; }
	.vb-chat--flotante.vb-chat--izquierda .vb-panel { left: -4px; right: auto; }
	.vb-card { padding: 18px 14px 20px; }
	.vb-foto { max-width: 190px; }
	.vb-card-titulo { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
	.vb-burbuja-halo,
	.vb-msg,
	.vb-chat--plegado[data-abierto="1"] { animation: none; }
	.vb-btn, .vb-burbuja { transition: none; }
}
