/* XPanel Live Chat – widget frontend (estilo Tidio) */

#xlc-root {
	--xlc-color: #f36f21;
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
}

#xlc-root *,
#xlc-root *::before,
#xlc-root *::after {
	box-sizing: border-box;
}

/* Burbuja flotante */
.xlc-bubble {
	width: 60px;
	height: 60px;
	border: none;
	border-radius: 50%;
	background: var(--xlc-color);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.xlc-bubble:hover {
	transform: scale(1.06);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.xlc-bubble svg {
	width: 28px;
	height: 28px;
	fill: #fff;
}

/* Ventana de chat */
.xlc-window {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 540px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.xlc-window.xlc-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* Cabecera */
.xlc-header {
	background: var(--xlc-color);
	background: linear-gradient(135deg, var(--xlc-color), color-mix(in srgb, var(--xlc-color) 70%, #000));
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.xlc-header-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.22);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.xlc-header-avatar svg {
	width: 20px;
	height: 20px;
	fill: #fff;
}

.xlc-header-info {
	flex: 1;
	min-width: 0;
}

.xlc-header-title {
	font-weight: 700;
	font-size: 15px;
	margin: 0;
}

.xlc-header-status {
	font-size: 12px;
	opacity: 0.9;
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
}

.xlc-status-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #4ade80;
	display: inline-block;
}

.xlc-header-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 6px;
	opacity: 0.85;
}

.xlc-header-close:hover {
	opacity: 1;
}

/* Cuerpo */
.xlc-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #f5f7f9;
}

/* Formulario pre-chat */
.xlc-prechat p.xlc-intro {
	margin: 0 0 12px;
	color: #444;
	font-size: 14px;
}

.xlc-prechat label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: #555;
	margin: 10px 0 4px;
}

.xlc-prechat input,
.xlc-prechat textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #d8dee4;
	border-radius: 10px;
	font-size: 14px;
	font-family: inherit;
	background: #fff;
	color: #222;
}

.xlc-prechat input:focus,
.xlc-prechat textarea:focus {
	outline: none;
	border-color: var(--xlc-color);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--xlc-color) 18%, transparent);
}

.xlc-prechat textarea {
	resize: none;
	min-height: 72px;
}

.xlc-error {
	color: #d9534f;
	font-size: 13px;
	margin: 8px 0 0;
	display: none;
}

.xlc-btn-primary {
	width: 100%;
	margin-top: 14px;
	padding: 12px;
	background: var(--xlc-color);
	color: #fff;
	border: none;
	border-radius: 10px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.xlc-btn-primary:hover {
	filter: brightness(1.08);
}

.xlc-btn-primary:disabled {
	opacity: 0.6;
	cursor: default;
}

/* Mensajes */
.xlc-message {
	max-width: 82%;
	margin-bottom: 10px;
	padding: 10px 14px;
	border-radius: 16px;
	white-space: pre-wrap;
	word-wrap: break-word;
	font-size: 14px;
	animation: xlc-pop 0.15s ease;
}

@keyframes xlc-pop {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.xlc-message-agent {
	background: #fff;
	color: #222;
	border: 1px solid #e6eaee;
	border-bottom-left-radius: 4px;
	margin-right: auto;
}

.xlc-message-visitor {
	background: var(--xlc-color);
	color: #fff;
	border-bottom-right-radius: 4px;
	margin-left: auto;
}

.xlc-message-time {
	display: block;
	font-size: 10px;
	opacity: 0.6;
	margin-top: 4px;
}

.xlc-system-msg {
	text-align: center;
	font-size: 12.5px;
	color: #777;
	background: #eceff2;
	border-radius: 10px;
	padding: 8px 12px;
	margin: 10px 0;
}

/* Indicador escribiendo */
.xlc-typing {
	display: inline-flex;
	gap: 4px;
	background: #fff;
	border: 1px solid #e6eaee;
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	padding: 12px 16px;
	margin-bottom: 10px;
}

.xlc-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b6bec7;
	animation: xlc-blink 1.2s infinite;
}

.xlc-typing span:nth-child(2) { animation-delay: 0.2s; }
.xlc-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes xlc-blink {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40%           { opacity: 1;   transform: translateY(-3px); }
}

/* Pie: entrada de mensaje */
.xlc-footer {
	border-top: 1px solid #e6eaee;
	background: #fff;
	padding: 10px 12px;
}

.xlc-input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.xlc-input {
	flex: 1;
	border: none;
	resize: none;
	font-size: 14px;
	font-family: inherit;
	padding: 8px 6px;
	max-height: 90px;
	background: transparent;
	color: #222;
}

.xlc-input:focus {
	outline: none;
}

.xlc-send {
	background: var(--xlc-color);
	border: none;
	border-radius: 50%;
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: filter 0.15s ease;
}

.xlc-send:hover { filter: brightness(1.08); }
.xlc-send:disabled { opacity: 0.5; cursor: default; }

.xlc-send svg {
	width: 18px;
	height: 18px;
	fill: #fff;
}

.xlc-end-link {
	display: block;
	width: 100%;
	background: none;
	border: none;
	color: #98a2ad;
	font-size: 12px;
	text-align: center;
	cursor: pointer;
	padding: 6px 0 0;
}

.xlc-end-link:hover {
	color: #d9534f;
	text-decoration: underline;
}

/* Móvil */
@media (max-width: 480px) {
	#xlc-root { right: 12px; bottom: 12px; }
	.xlc-window {
		width: calc(100vw - 24px);
		height: 70vh;
		bottom: 72px;
	}
}


/* v1.1 – blindatge contra el CSS del tema: les icones sempre visibles */
#xlc-root .xlc-bubble,
#xlc-root .xlc-send,
#xlc-root .xlc-header-close {
	padding: 0 !important;
	margin: 0;
	line-height: 1 !important;
	box-shadow: none;
}
#xlc-root .xlc-bubble { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
#xlc-root .xlc-bubble svg,
#xlc-root .xlc-send svg,
#xlc-root .xlc-header-avatar svg {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: none;
}
#xlc-root .xlc-bubble svg { width: 28px !important; height: 28px !important; }
#xlc-root .xlc-send { width: 38px !important; min-width: 38px; height: 38px !important; border-radius: 50% !important; }
#xlc-root .xlc-send svg { width: 18px !important; height: 18px !important; }
#xlc-root svg path { fill: #ffffff !important; }
