/* ============================================================
   ASD Soporte – Chat en directo (visitantes)
   ============================================================ */

#asd-lc.asd-lc {
	--lc-color: #3b82f6;
	--lc-text: #0f172a;
	--lc-muted: #64748b;
	--lc-line: #e2e8f0;
	--lc-soft: #f8fafc;
	--lc-ok: #22c55e;
	position: fixed;
	bottom: 22px;
	right: 22px;
	z-index: 2147483000;
	font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: var(--lc-text);
	-webkit-font-smoothing: antialiased;
}

#asd-lc.asd-lc[data-position="left"] { right: auto; left: 22px; }

#asd-lc.asd-lc *,
#asd-lc.asd-lc *::before,
#asd-lc.asd-lc *::after { box-sizing: border-box; }

#asd-lc.asd-lc [hidden] { display: none !important; }

/* Blindaje frente a los estilos del tema (botones y campos) */
#asd-lc button,
#asd-lc input,
#asd-lc textarea {
	min-width: 0;
	min-height: 0;
	max-width: none;
	margin: 0;
	font-family: inherit;
	font-weight: inherit;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	letter-spacing: normal;
	box-shadow: none;
	outline: none;
}

#asd-lc button {
	width: auto;
	height: auto;
	padding: 0;
	font-size: inherit;
	line-height: 1;
	color: inherit;
	background: none;
	border: 0;
	border-radius: 0;
}

#asd-lc input,
#asd-lc textarea {
	height: auto;
	line-height: 1.4;
}

#asd-lc svg { max-width: none; }

#asd-lc button {
	margin: 0;
	font-family: inherit;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	box-shadow: none;
}

#asd-lc input,
#asd-lc textarea {
	margin: 0;
	font-family: inherit;
	box-shadow: none;
}

/* ---------- Botón ---------- */
#asd-lc .asd-lc-launcher {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	padding: 0;
	color: #fff;
	background: var(--lc-color);
	background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.08));
	border: 0;
	border-radius: 50%;
	box-shadow: 0 14px 30px -10px var(--lc-color), 0 3px 8px rgba(15, 23, 42, 0.18);
	transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#asd-lc .asd-lc-launcher:hover { transform: translateY(-2px) scale(1.05); }
#asd-lc .asd-lc-launcher:active { transform: scale(0.94); }
#asd-lc .asd-lc-launcher:focus-visible { outline: 3px solid rgba(59, 130, 246, 0.45); outline-offset: 3px; }
#asd-lc .asd-lc-launcher:focus-visible { outline: 3px solid color-mix(in srgb, var(--lc-color) 45%, transparent); outline-offset: 3px; }

#asd-lc .asd-lc-launcher > span:not(.asd-lc-badge) {
	position: absolute;
	display: inline-flex;
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
}

#asd-lc .asd-lc-ico-close { opacity: 0; transform: rotate(-90deg) scale(0.5); }
#asd-lc.asd-lc.is-open .asd-lc-ico-chat { opacity: 0; transform: rotate(90deg) scale(0.5); }
#asd-lc.asd-lc.is-open .asd-lc-ico-close { opacity: 1; transform: none; }

#asd-lc.asd-lc.has-unread .asd-lc-launcher { animation: asdLcPulse 2s ease-in-out infinite; }

@keyframes asdLcPulse {
	0%, 100% { box-shadow: 0 14px 30px -10px var(--lc-color), 0 0 0 0 rgba(239, 68, 68, 0.45); }
	50% { box-shadow: 0 14px 30px -10px var(--lc-color), 0 0 0 12px rgba(239, 68, 68, 0); }
}

#asd-lc .asd-lc-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	color: #fff;
	background: #ef4444;
	border: 2px solid #fff;
	border-radius: 11px;
}

/* ---------- Vista previa de mensaje ---------- */
#asd-lc .asd-lc-preview {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: 270px;
	padding: 12px 34px 12px 14px;
	background: #fff;
	border: 1px solid var(--lc-line);
	border-radius: 16px 16px 4px 16px;
	box-shadow: 0 18px 40px -16px rgba(15, 23, 42, 0.35);
	cursor: pointer;
}

#asd-lc.asd-lc[data-position="left"] .asd-lc-preview { right: auto; left: 0; border-radius: 16px 16px 16px 4px; }
#asd-lc .asd-lc-preview.show { animation: asdLcIn 0.4s cubic-bezier(0.34, 1.4, 0.64, 1); }

#asd-lc .asd-lc-preview strong { display: block; margin-bottom: 2px; font-size: 13px; color: var(--lc-color); }
#asd-lc .asd-lc-preview p {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	font-size: 13.5px;
	color: var(--lc-text);
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

#asd-lc .asd-lc-preview-x {
	position: absolute;
	top: 8px;
	right: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	color: var(--lc-muted);
	background: #f1f5f9;
	border: 0;
	border-radius: 50%;
}

#asd-lc .asd-lc-preview-x svg { width: 12px; height: 12px; }

/* ---------- Ventana ---------- */
#asd-lc .asd-lc-window {
	position: absolute;
	right: 0;
	bottom: 76px;
	display: flex;
	flex-direction: column;
	width: 370px;
	height: auto;
	max-height: min(600px, calc(100vh - 120px));
	overflow: hidden;
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 30px 70px -20px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(15, 23, 42, 0.06);
	opacity: 0;
	transform: translateY(16px) scale(0.96);
	transform-origin: bottom right;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

#asd-lc.asd-lc[data-position="left"] .asd-lc-window { right: auto; left: 0; transform-origin: bottom left; }

#asd-lc .asd-lc-window.show {
	opacity: 1;
	transform: none;
	transition: opacity 0.25s ease, transform 0.42s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes asdLcIn {
	from { opacity: 0; transform: translateY(10px) scale(0.95); }
	to { opacity: 1; transform: none; }
}

#asd-lc .asd-lc-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 12px 16px 16px;
	color: #fff;
	background: var(--lc-color);
	background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.12));
}

#asd-lc .asd-lc-head-ico {
	position: relative;
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	background: rgba(255, 255, 255, 0.18);
	border-radius: 50%;
}

#asd-lc .asd-lc-head-ico svg { width: 22px; height: 22px; }

#asd-lc .asd-lc-head-ico i {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 12px;
	height: 12px;
	background: #94a3b8;
	border: 2px solid #fff;
	border-radius: 50%;
	transition: background 0.2s;
}

#asd-lc.asd-lc.is-online .asd-lc-head-ico i { background: var(--lc-ok); }

#asd-lc .asd-lc-head-text {
	display: flex;
	flex: 1;
	min-width: 0;
	flex-direction: column;
}

#asd-lc .asd-lc-head-text strong { font-size: 16px; font-weight: 700; }
#asd-lc .asd-lc-head-text span { font-size: 12.5px; opacity: 0.88; }
#asd-lc .asd-lc-head-text span.is-typing { font-style: italic; }

#asd-lc .asd-lc-hbtn {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	color: #fff;
	background: transparent;
	border: 0;
	border-radius: 9px;
	opacity: 0.9;
	transition: background 0.15s;
}

#asd-lc .asd-lc-hbtn:hover { background: rgba(255, 255, 255, 0.18); opacity: 1; }

#asd-lc .asd-lc-confirm {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	font-size: 13px;
	background: #fffbeb;
	border-bottom: 1px solid #fde68a;
}

#asd-lc .asd-lc-confirm span { margin-right: auto; font-weight: 600; }

#asd-lc .asd-lc-confirm button {
	height: 30px;
	padding: 0 12px;
	font-size: 12.5px;
	font-weight: 600;
	color: #334155;
	background: #fff;
	border: 1px solid var(--lc-line);
	border-radius: 8px;
}

#asd-lc .asd-lc-confirm button.primary { color: #fff; background: var(--lc-color); border-color: transparent; }

#asd-lc .asd-lc-body {
	flex: 1 1 auto;
	min-height: 190px;
	overflow-y: auto;
	padding: 16px 14px 8px;
	background: var(--lc-soft);
	overscroll-behavior: contain;
}

#asd-lc .asd-lc-msgs {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

#asd-lc .asd-lc-msg {
	max-width: 82%;
	padding: 9px 12px 6px;
	border-radius: 16px;
	word-break: break-word;
}

#asd-lc .asd-lc-msg.new { animation: asdLcIn 0.3s cubic-bezier(0.22, 1, 0.36, 1); }

#asd-lc .asd-lc-msg.them {
	align-self: flex-start;
	background: #fff;
	border: 1px solid var(--lc-line);
	border-bottom-left-radius: 5px;
}

#asd-lc .asd-lc-msg.own {
	align-self: flex-end;
	color: #fff;
	background: var(--lc-color);
	border-bottom-right-radius: 5px;
}

#asd-lc .asd-lc-msg-body { font-size: 14px; }

#asd-lc .asd-lc-msg-meta {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-top: 3px;
	font-size: 10.5px;
	opacity: 0.72;
}

#asd-lc .asd-lc-msg[data-welcome] .asd-lc-msg-body { padding-bottom: 3px; }

#asd-lc .asd-lc-time { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }

#asd-lc .asd-lc-ticks { display: inline-flex; line-height: 0; }
#asd-lc .asd-lc-ticks svg { display: block; }
#asd-lc .asd-lc-ticks .t2 { display: none; }
#asd-lc .asd-lc-ticks[data-read="1"] { color: #86efac; }
#asd-lc .asd-lc-ticks[data-read="1"] .t2 { display: inline; }

#asd-lc .asd-lc-sys {
	align-self: center;
	max-width: 92%;
	padding: 5px 12px;
	font-size: 12px;
	color: var(--lc-muted);
	text-align: center;
	background: #eef2f7;
	border-radius: 999px;
}

#asd-lc .asd-lc-sys.ok { color: #15803d; background: rgba(34, 197, 94, 0.12); border-radius: 12px; }

#asd-lc .asd-lc-media {
	margin: -3px -6px 6px;
	overflow: hidden;
	border-radius: 11px;
	line-height: 0;
}

#asd-lc .asd-lc-media img { display: block; width: 100%; max-width: 240px; max-height: 240px; object-fit: cover; }

#asd-lc .asd-lc-media.multi {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 3px;
	width: 220px;
	max-width: 100%;
}

#asd-lc .asd-lc-media.multi img { aspect-ratio: 1 / 1; height: 100%; }

#asd-lc .asd-lc-video {
	margin: -3px -6px 6px;
	overflow: hidden;
	border-radius: 11px;
	background: #000;
	line-height: 0;
}

#asd-lc .asd-lc-video video { display: block; width: 240px; max-width: 100%; max-height: 280px; }

#asd-lc .asd-lc-typing {
	display: inline-flex;
	gap: 4px;
	margin-top: 8px;
	padding: 11px 14px;
	background: #fff;
	border: 1px solid var(--lc-line);
	border-radius: 16px;
	border-bottom-left-radius: 5px;
}

#asd-lc .asd-lc-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #94a3b8;
	animation: asdLcDots 1.2s infinite ease-in-out;
}

#asd-lc .asd-lc-typing span:nth-child(2) { animation-delay: 0.15s; }
#asd-lc .asd-lc-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes asdLcDots {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Redactar ---------- */
#asd-lc .asd-lc-compose {
	position: relative;
	padding: 10px 10px 12px;
	background: #fff;
	border-top: 1px solid var(--lc-line);
}

#asd-lc .asd-lc-bar {
	display: flex;
	align-items: flex-end;
	gap: 4px;
}

#asd-lc .asd-lc-bar textarea {
	flex: 1;
	min-height: 40px;
	max-height: 120px;
	padding: 9px 12px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--lc-text);
	background: var(--lc-soft);
	border: 1px solid var(--lc-line);
	border-radius: 12px;
	resize: none;
	outline: none;
	transition: border-color 0.15s, background 0.15s;
}

#asd-lc .asd-lc-bar textarea:focus { background: #fff; border-color: var(--lc-color); }

#asd-lc .asd-lc-tool {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 40px;
	padding: 0;
	color: var(--lc-muted);
	background: transparent;
	border: 0;
	border-radius: 10px;
	transition: color 0.15s, background 0.15s;
}

#asd-lc .asd-lc-tool:hover { color: var(--lc-color); background: #f1f5f9; }

#asd-lc .asd-lc-send {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 40px;
	padding: 0;
	color: #fff;
	background: var(--lc-color);
	border: 0;
	border-radius: 12px;
	transition: transform 0.15s, opacity 0.15s;
}

#asd-lc .asd-lc-send:hover { transform: translateY(-1px); }
#asd-lc .asd-lc-send:disabled { opacity: 0.5; }

#asd-lc .asd-lc-emoji {
	position: absolute;
	bottom: calc(100% - 4px);
	left: 10px;
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	gap: 2px;
	width: 290px;
	max-width: calc(100% - 20px);
	padding: 8px;
	background: #fff;
	border: 1px solid var(--lc-line);
	border-radius: 14px;
	box-shadow: 0 18px 40px -16px rgba(15, 23, 42, 0.35);
	animation: asdLcIn 0.18s ease-out;
}

#asd-lc .asd-lc-emoji button {
	height: 32px;
	padding: 0;
	font-size: 19px;
	background: transparent;
	border: 0;
	border-radius: 8px;
}

#asd-lc .asd-lc-emoji button:hover { background: #f1f5f9; }

#asd-lc .asd-lc-preview-files {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 6px 2px 10px;
}

#asd-lc .asd-lc-thumb { position: relative; }

#asd-lc .asd-lc-thumb img,
#asd-lc .asd-lc-thumb video {
	display: block;
	width: 58px;
	height: 58px;
	object-fit: cover;
	background: #0f172a;
	border: 1px solid var(--lc-line);
	border-radius: 10px;
}

#asd-lc .asd-lc-thumb button {
	position: absolute;
	top: -7px;
	right: -7px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	color: #fff;
	background: #0f172a;
	border: 2px solid #fff;
	border-radius: 50%;
}

#asd-lc .asd-lc-thumb button svg { width: 11px; height: 11px; }

#asd-lc .asd-lc-play {
	position: absolute;
	top: 50%;
	left: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	margin: -13px 0 0 -13px;
	color: #fff;
	background: rgba(15, 23, 42, 0.6);
	border-radius: 50%;
	pointer-events: none;
}

#asd-lc .asd-lc-error {
	margin: 0 0 8px;
	padding: 7px 10px;
	font-size: 12.5px;
	color: #b91c1c;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
}

/* ---------- Formulario fuera de línea ---------- */
#asd-lc .asd-lc-offline {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	padding: 18px 16px;
	overflow-y: auto;
	background: var(--lc-soft);
}

#asd-lc .asd-lc-offline-text {
	margin: 0 0 4px;
	padding: 12px 14px;
	font-size: 13.5px;
	color: #334155;
	background: #fff;
	border: 1px solid var(--lc-line);
	border-radius: 14px;
}

#asd-lc .asd-lc-offline input,
#asd-lc .asd-lc-offline textarea,
#asd-lc .asd-lc-transcript input {
	width: 100%;
	padding: 11px 12px;
	font-size: 14px;
	color: var(--lc-text);
	background: #fff;
	border: 1px solid var(--lc-line);
	border-radius: 11px;
	outline: none;
	transition: border-color 0.15s, box-shadow 0.15s;
}

#asd-lc .asd-lc-offline textarea { resize: vertical; }

#asd-lc .asd-lc-offline input:focus,
#asd-lc .asd-lc-offline textarea:focus,
#asd-lc .asd-lc-transcript input:focus { border-color: var(--lc-color); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }
#asd-lc .asd-lc-transcript input:focus { border-color: var(--lc-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lc-color) 12%, transparent); }

#asd-lc .asd-lc-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0; }

#asd-lc .asd-lc-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 44px;
	padding: 0 18px;
	font-size: 14.5px;
	font-weight: 600;
	color: #fff;
	background: var(--lc-color);
	border: 0;
	border-radius: 12px;
	transition: transform 0.15s, opacity 0.15s;
}

#asd-lc .asd-lc-submit:hover { transform: translateY(-1px); }
#asd-lc .asd-lc-submit:disabled { opacity: 0.6; }

/* ---------- Chat finalizado ---------- */
#asd-lc .asd-lc-ended {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
	padding: 16px;
	text-align: center;
	background: #fff;
	border-top: 1px solid var(--lc-line);
}

#asd-lc .asd-lc-ended-title { margin: 0; font-size: 15px; font-weight: 700; }
#asd-lc .asd-lc-ended-sub { margin: 0; font-size: 13px; color: var(--lc-muted); }

#asd-lc .asd-lc-stars {
	display: flex;
	justify-content: center;
	gap: 4px;
}

#asd-lc .asd-lc-stars button {
	padding: 2px;
	color: #e2e8f0;
	background: transparent;
	border: 0;
	transition: transform 0.15s, color 0.15s;
}

#asd-lc .asd-lc-stars button:hover,
#asd-lc .asd-lc-stars button.on { color: #f59e0b; transform: scale(1.12); }
#asd-lc .asd-lc-stars:hover button { color: #f59e0b; }
#asd-lc .asd-lc-stars button:hover ~ button { color: #e2e8f0; }

#asd-lc .asd-lc-transcript {
	display: flex;
	gap: 6px;
}

#asd-lc .asd-lc-transcript input { flex: 1; min-width: 0; padding: 9px 11px; font-size: 13px; }

#asd-lc .asd-lc-transcript button {
	flex-shrink: 0;
	padding: 0 12px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--lc-color);
	background: #fff;
	border: 1px solid var(--lc-line);
	border-radius: 11px;
}

#asd-lc .asd-lc-note { font-size: 12.5px; color: #15803d; }

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
	#asd-lc.asd-lc { right: 16px; bottom: 16px; }
	#asd-lc.asd-lc[data-position="left"] { left: 16px; }
	#asd-lc.asd-lc.asd-lc-no-mobile { display: none !important; }

	#asd-lc.asd-lc.is-open .asd-lc-window {
		position: fixed;
		inset: 0;
		width: 100%;
		height: 100%;
		height: 100dvh;
		max-height: none;
		border-radius: 0;
	}

	#asd-lc.asd-lc.is-open .asd-lc-launcher { display: none; }
	#asd-lc .asd-lc-preview { width: calc(100vw - 32px); max-width: 300px; }
	#asd-lc .asd-lc-bar textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	#asd-lc.asd-lc *,
	#asd-lc .asd-lc-window,
	#asd-lc .asd-lc-window.show { animation: none !important; transition: none !important; }
}

/* Imagen propia en la cabecera (p. ej. el logo) */
#asd-lc .asd-lc-head-ico.has-img { background: #fff; }

#asd-lc .asd-lc-head-ico.has-img img {
	display: block;
	width: 100%;
	height: 100%;
	padding: 5px;
	object-fit: contain;
	border-radius: 50%;
}
