#ccxv-root{
	--ccxv-accent: #6E51FF;
	--ccxv-accent-deep: #5A3EE0;
	--ccxv-bg: #181420;
	--ccxv-bg-2: #221D33;
	--ccxv-border: #2B2440;
	--ccxv-text: #F1EEFA;
	--ccxv-text-sub: #A79FBA;
	--ccxv-online: #5DCAA5;
	font-family: inherit;
}

/* Bloquea el scroll de la página detrás del panel en móvil, mismo
   criterio que ccx-onboarding (html.ccx-onb-lock). */
html.ccxv-lock{ overflow: hidden; }

/*
 * Reseteo defensivo: algunos temas (Astra incluido) inyectan un estilo
 * global de "Botones" desde el Personalizador dirigido al elemento
 * <button> a secas (padding grande, radio, sombra). Como es un selector
 * de tipo, cualquier propiedad que SÍ declaremos aquí gana por
 * especificidad — pero si no la declaramos, la del tema se cuela.
 * Por eso cada botón del widget fija su propio padding/radio/sombra
 * explícitamente, aunque el valor sea el mismo que ya usábamos.
 */
#ccxv-bubble{
	position: fixed; right: 20px; bottom: var(--ccxv-btn-bottom, 20px); z-index: 999998;
	width: 58px; height: 58px; padding: 0; border-radius: 50%;
	background: var(--ccxv-accent); border: none; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 10px 24px -6px rgba(110,81,255,.6);
	transition: transform .15s ease;
}
#ccxv-bubble:hover{ transform: scale(1.05); }
#ccxv-bubble[aria-expanded="true"]{ display: none; }

#ccxv-bubble-pulse{
	position: absolute; inset: 0; border-radius: 50%;
	border: 2px solid var(--ccxv-accent); opacity: 0; pointer-events: none;
}
#ccxv-bubble-pulse.is-active{ animation: ccxv-pulse 2.2s ease-out infinite; }
@keyframes ccxv-pulse{
	0% { transform: scale(1); opacity: .7; }
	100% { transform: scale(1.7); opacity: 0; }
}
@media (prefers-reduced-motion: reduce){ #ccxv-bubble-pulse.is-active{ animation: none; } }

#ccxv-panel{
	position: fixed; right: 20px; bottom: 20px; z-index: 999999;
	width: 360px; height: min(560px, 78vh);
	background: var(--ccxv-bg); border: 1px solid var(--ccxv-border); border-radius: 18px;
	box-shadow: 0 24px 50px -16px rgba(15,8,40,.55);
	display: flex; flex-direction: column; overflow: hidden;
	animation: ccxv-in .18s ease-out;
}
@keyframes ccxv-in{ from{ opacity:0; transform: translateY(10px); } to{ opacity:1; transform: translateY(0); } }
#ccxv-panel[hidden]{ display: none; }
#ccxv-quick[hidden]{ display: none; }

#ccxv-invite{
	position: fixed; right: 20px; bottom: calc(var(--ccxv-btn-bottom, 20px) + 68px); z-index: 999997;
	max-width: 220px; background: var(--ccxv-bg); border: 1px solid var(--ccxv-border);
	border-radius: 14px; border-bottom-right-radius: 4px;
	padding: 11px 26px 11px 13px; box-shadow: 0 14px 30px -10px rgba(15,8,40,.5);
	font-size: 12.5px; line-height: 1.4; color: var(--ccxv-text);
	animation: ccxv-invite-in .2s ease-out;
}
@keyframes ccxv-invite-in{ from{ opacity:0; transform: translateY(6px); } to{ opacity:1; transform: translateY(0); } }
#ccxv-invite[hidden]{ display: none; }
#ccxv-invite-close{
	position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; padding: 0;
	background: transparent; border: none; box-shadow: none; color: var(--ccxv-text-sub);
	cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#ccxv-invite-close:hover{ color: #fff; }

@media (max-width: 480px){
	#ccxv-bubble{ right: 14px; bottom: var(--ccxv-btn-bottom-mobile, 96px); }
	#ccxv-invite{ right: 14px; bottom: calc(var(--ccxv-btn-bottom-mobile, 96px) + 68px); }
	#ccxv-panel{
		right: 0; left: 0; bottom: 0; top: 0; width: 100%; height: 100%;
		border-radius: 0; border: none;
	}
}

#ccxv-head{
	display: flex; align-items: center; gap: 10px; padding: 14px 14px;
	border-bottom: 1px solid var(--ccxv-border); flex-shrink: 0;
}
#ccxv-avatar{
	width: 32px; height: 32px; border-radius: 10px; background: var(--ccxv-bg-2);
	border: 1px solid var(--ccxv-accent); color: var(--ccxv-accent);
	display: flex; align-items: center; justify-content: center;
	font-weight: 800; font-size: 13px; flex-shrink: 0;
}
#ccxv-head-text{ min-width: 0; }
#ccxv-title{ font-weight: 700; font-size: 13.5px; color: var(--ccxv-text); text-transform: uppercase; letter-spacing: .02em; }
#ccxv-subtitle{ font-size: 11px; color: var(--ccxv-text-sub); }
#ccxv-online{ width: 7px; height: 7px; border-radius: 50%; background: var(--ccxv-online); margin-left: auto; flex-shrink: 0; }
#ccxv-close{
	background: var(--ccxv-bg-2); border: 1px solid var(--ccxv-border); color: var(--ccxv-text-sub);
	width: 26px; height: 26px; padding: 0; border-radius: 8px; cursor: pointer; margin-left: 6px;
	display: flex; align-items: center; justify-content: center; flex-shrink: 0;
	box-shadow: none;
}
#ccxv-close:hover{ color: #fff; }

#ccxv-body{
	flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
#ccxv-body::-webkit-scrollbar{ width: 6px; }
#ccxv-body::-webkit-scrollbar-thumb{ background: var(--ccxv-border); border-radius: 999px; }

.ccxv-msg{ display: flex; max-width: 88%; animation: ccxv-msg-drop .32s cubic-bezier(.16,1,.3,1) both; }
@keyframes ccxv-msg-drop{
	0% { opacity: 0; transform: translateY(-12px) scale(.98); }
	100% { opacity: 1; transform: translateY(0) scale(1); }
}
.ccxv-msg.bot{ align-self: flex-start; }
.ccxv-msg.user{ align-self: flex-end; }
.ccxv-bubble-el{
	padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.55;
}
.ccxv-msg.bot .ccxv-bubble-el{
	background: var(--ccxv-bg-2); border: 1px solid var(--ccxv-border); border-top-left-radius: 2px; color: #ddd6f2;
}
.ccxv-msg.user .ccxv-bubble-el{
	background: var(--ccxv-accent); border-top-right-radius: 2px; color: #fff;
}
.ccxv-bubble-el a{ color: #fff; font-weight: 700; text-decoration: underline; }
.ccxv-msg.bot .ccxv-bubble-el a{ color: var(--ccxv-accent); }
.ccxv-bubble-el b{ font-weight: 700; color: #fff; }
.ccxv-msg.bot .ccxv-bubble-el b{ color: #fff; }
.ccxv-bubble-el p{ margin: 0 0 8px; }
.ccxv-bubble-el p:last-child{ margin-bottom: 0; }

.ccxv-bubble-error{ border-color: #7A4A3A; }
.ccxv-retry-btn{
	display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 7px 13px;
	border: 1px solid var(--ccxv-accent); border-radius: 999px; background: transparent;
	color: var(--ccxv-accent); font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: none;
}
.ccxv-retry-btn:hover{ background: rgba(110,81,255,.12); }

.ccxv-typing{ display: flex; gap: 4px; padding: 4px 2px; }
.ccxv-typing span{
	width: 6px; height: 6px; border-radius: 50%; background: var(--ccxv-accent);
	animation: ccxv-dot 1.2s infinite ease-in-out;
}
.ccxv-typing span:nth-child(2){ animation-delay: .15s; }
.ccxv-typing span:nth-child(3){ animation-delay: .3s; }
@keyframes ccxv-dot{ 0%,80%,100%{ transform: scale(.6); opacity: .4; } 40%{ transform: scale(1); opacity: 1; } }

.ccxv-cursor{
	display: inline-block;
	width: 2.5px;
	height: 14px;
	vertical-align: -1.5px;
	margin-left: 2px;
	background: var(--ccxv-accent);
	border-radius: 1px;
	animation: ccxv-blink .75s infinite ease-in-out;
}
@keyframes ccxv-blink{
	0%, 100%{ opacity: 1; }
	50%{ opacity: 0; }
}

.ccxv-cta{
	display: inline-flex; margin-top: 6px; padding: 8px 14px; border-radius: 999px;
	background: #fff; color: var(--ccxv-accent-deep); font-weight: 700; font-size: 12.5px;
	text-decoration: none;
}

#ccxv-quick{
	display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; flex-shrink: 0;
}
#ccxv-quick::-webkit-scrollbar{ display: none; }
.ccxv-chip{
	white-space: nowrap; background: var(--ccxv-bg-2); border: 1px solid var(--ccxv-border);
	color: #c8bff0; border-radius: 999px; padding: 7px 12px; font-size: 12px; cursor: pointer;
	box-shadow: none; line-height: normal;
	animation: ccxv-chip-drop .28s cubic-bezier(.16,1,.3,1) both;
}
.ccxv-chip:nth-child(1){ animation-delay: .06s; }
.ccxv-chip:nth-child(2){ animation-delay: .14s; }
.ccxv-chip:nth-child(3){ animation-delay: .22s; }
@keyframes ccxv-chip-drop{
	0% { opacity: 0; transform: translateY(-8px); }
	100% { opacity: 1; transform: translateY(0); }
}
.ccxv-chip:hover{ border-color: var(--ccxv-accent); }

#ccxv-form{
	display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--ccxv-border); flex-shrink: 0;
}
#ccxv-input{
	flex: 1; background: var(--ccxv-bg-2); border: 1px solid var(--ccxv-border); border-radius: 10px;
	color: var(--ccxv-text); font-size: 13px; padding: 0 12px; height: 38px;
}
#ccxv-input:focus{ outline: none; border-color: var(--ccxv-accent); }
#ccxv-input::placeholder{ color: var(--ccxv-text-sub); }
#ccxv-send{
	width: 38px; height: 38px; padding: 0; border-radius: 10px; background: var(--ccxv-accent); border: none;
	color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
	box-shadow: none;
}
#ccxv-send:disabled{ opacity: .5; cursor: not-allowed; }
