/* Asistente de Productos CEMYA */
.cmyc {
	--cmyc-accent: #010c18;
	--cmyc-bg: #ffffff;
	--cmyc-soft: #f2f5f9;
	--cmyc-line: #dfe5ec;
	--cmyc-text: #1d2733;
	--cmyc-muted: #66727f;
	position: fixed;
	bottom: 20px;
	z-index: 99990;
	font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--cmyc-text);
}
.cmyc--right { right: 20px; }
.cmyc--left { left: 20px; }
.cmyc *, .cmyc *::before, .cmyc *::after { box-sizing: border-box; }
.cmyc svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.cmyc button { font: inherit; cursor: pointer; }
.cmyc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Botón flotante */
.cmyc-launcher {
	display: flex; align-items: center; gap: 8px;
	margin-left: auto;
	padding: 12px 18px;
	border: 0; border-radius: 999px;
	background: var(--cmyc-accent); color: #fff;
	font-weight: 600;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
	transition: transform .15s ease;
}
.cmyc--left .cmyc-launcher { margin-left: 0; }
.cmyc-launcher:hover { transform: translateY(-2px); }
.cmyc-launcher:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--cmyc-accent); }
.cmyc.is-open .cmyc-launcher span { display: none; }

/* Panel */
.cmyc-panel {
	display: flex; flex-direction: column;
	width: 380px; height: min(620px, calc(100vh - 110px));
	margin-bottom: 12px;
	background: var(--cmyc-bg);
	border-radius: 16px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, .25);
	overflow: hidden;
	animation: cmyc-in .2s ease;
}
.cmyc-panel[hidden] { display: none; }
@keyframes cmyc-in { from { opacity: 0; transform: translateY(10px); } }

.cmyc-head {
	display: flex; align-items: center; gap: 10px;
	padding: 12px 10px 12px 14px;
	background: var(--cmyc-accent); color: #fff;
}
.cmyc-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; }
.cmyc-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cmyc-titles strong { font-size: 15px; }
.cmyc-titles span { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmyc-icon { border: 0; background: transparent; color: #fff; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.cmyc-icon:hover, .cmyc-icon:focus-visible { background: rgba(255,255,255,.18); outline: none; }

.cmyc-log {
	flex: 1; overflow-y: auto;
	padding: 14px 12px;
	background: var(--cmyc-soft);
	display: flex; flex-direction: column; gap: 8px;
	scroll-behavior: smooth;
}
.cmyc-msg { max-width: 86%; padding: 9px 12px; border-radius: 14px; word-wrap: break-word; }
.cmyc-bot { align-self: flex-start; background: #fff; border: 1px solid var(--cmyc-line); border-bottom-left-radius: 4px; }
.cmyc-user { align-self: flex-end; background: var(--cmyc-accent); color: #fff; border-bottom-right-radius: 4px; }
.cmyc-muted { color: var(--cmyc-muted); }
.cmyc-typing { display: flex; gap: 4px; padding: 12px 14px; }
.cmyc-typing i { width: 6px; height: 6px; border-radius: 50%; background: #9aa6b2; animation: cmyc-dot 1s infinite; }
.cmyc-typing i:nth-child(2) { animation-delay: .15s; }
.cmyc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cmyc-dot { 50% { opacity: .3; transform: translateY(-2px); } }

/* Opciones */
.cmyc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cmyc-chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 7px 12px;
	border: 1.5px solid var(--cmyc-accent); border-radius: 999px;
	background: #fff; color: var(--cmyc-accent);
	font-weight: 600; font-size: 13px; text-align: left;
}
.cmyc-chip small { font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: var(--cmyc-soft); color: var(--cmyc-muted); }
.cmyc-chip:hover:not(:disabled) { background: var(--cmyc-accent); color: #fff; }
.cmyc-chip:hover:not(:disabled) small { background: rgba(255,255,255,.25); color: #fff; }
.cmyc-chip.is-primary { background: var(--cmyc-accent); color: #fff; }
.cmyc-chip.is-primary small { background: rgba(255,255,255,.25); color: #fff; }
.cmyc-chip.is-ghost { border-color: var(--cmyc-line); color: var(--cmyc-text); font-weight: 500; }
.cmyc-chip.is-ghost:hover:not(:disabled) { background: var(--cmyc-text); border-color: var(--cmyc-text); color: #fff; }
.cmyc-chip:focus-visible { outline: 2px solid var(--cmyc-accent); outline-offset: 2px; }
.cmyc-chips.is-done .cmyc-chip { opacity: .45; cursor: default; }
.cmyc-chips.is-done .cmyc-chip:not(.is-picked) { display: none; }
.cmyc-chips.is-done { display: none; }

/* Tarjetas de producto */
.cmyc-cards { display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 8px; }
.cmyc-card {
	display: flex; gap: 10px;
	padding: 10px;
	background: #fff; border: 1px solid var(--cmyc-line); border-radius: 12px;
}
.cmyc-card-img { flex: none; width: 72px; height: 72px; border-radius: 8px; background: var(--cmyc-soft); overflow: hidden; display: block; }
.cmyc-card-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cmyc-card-body { flex: 1; min-width: 0; }
.cmyc-card-title { display: block; color: var(--cmyc-text); font-weight: 700; text-decoration: none; line-height: 1.3; }
.cmyc-card-title:hover { color: var(--cmyc-accent); text-decoration: underline; }
.cmyc-card ul { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12px; color: var(--cmyc-muted); }
.cmyc-card li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.cmyc-card li span { color: var(--cmyc-text); font-weight: 600; }
.cmyc-card li span::after { content: ":"; }
.cmyc-card-actions { display: flex; gap: 6px; margin-top: 8px; }

.cmyc-btn {
	display: inline-block;
	padding: 6px 12px;
	border: 1.5px solid var(--cmyc-accent); border-radius: 8px;
	background: var(--cmyc-accent); color: #fff !important;
	font-size: 13px; font-weight: 600; text-decoration: none !important; line-height: 1.3;
}
.cmyc-btn.is-ghost { background: #fff; color: var(--cmyc-accent) !important; }
.cmyc-btn:hover { filter: brightness(1.1); }
.cmyc-btn:disabled { opacity: .6; cursor: default; }

/* Formulario */
.cmyc-form {
	display: flex; flex-direction: column; gap: 8px;
	padding: 12px;
	background: #fff; border: 1px solid var(--cmyc-line); border-radius: 12px;
}
.cmyc-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; margin: 0; }
.cmyc-form em { font-weight: 400; color: var(--cmyc-muted); font-style: normal; }
.cmyc-form input:not([type=checkbox]), .cmyc-form textarea {
	width: 100%; margin: 0;
	padding: 8px 10px;
	border: 1px solid var(--cmyc-line); border-radius: 8px;
	font: inherit; font-weight: 400; color: var(--cmyc-text); background: #fff;
}
.cmyc-form input:focus, .cmyc-form textarea:focus { outline: 2px solid var(--cmyc-accent); outline-offset: -1px; border-color: transparent; }
.cmyc-form textarea { resize: vertical; min-height: 64px; }
.cmyc-form .cmyc-check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
.cmyc-form .cmyc-check input { margin-top: 2px; }
.cmyc-form .cmyc-check a { color: var(--cmyc-accent); }
.cmyc-form .cmyc-btn { align-self: flex-start; padding: 8px 16px; }
.cmyc-form.is-sent { opacity: .6; }
.cmyc-hp { position: absolute !important; left: -9999px !important; }
.cmyc-error { margin: 0; color: #b42318; font-size: 12px; }

/* Entrada de texto */
.cmyc-input { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--cmyc-line); background: #fff; margin: 0; }
.cmyc-input input {
	flex: 1; min-width: 0; margin: 0;
	padding: 10px 12px;
	border: 1px solid var(--cmyc-line); border-radius: 999px;
	font: inherit; font-size: 16px; color: var(--cmyc-text); background: #fff;
}
@media (min-width: 521px) { .cmyc-input input { font-size: 14px; } }
.cmyc-input input:focus { outline: 2px solid var(--cmyc-accent); outline-offset: -1px; border-color: transparent; }
.cmyc-input button { flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--cmyc-accent); color: #fff; display: grid; place-items: center; padding: 0; }

/* Móvil: pantalla completa */
@media (max-width: 520px) {
	.cmyc { bottom: 14px; }
	.cmyc--right { right: 14px; }
	.cmyc--left { left: 14px; }
	.cmyc.is-open { inset: 0; }
	.cmyc.is-open .cmyc-panel { position: fixed; inset: 0; width: 100%; height: 100%; margin: 0; border-radius: 0; }
	.cmyc.is-open .cmyc-launcher { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.cmyc-panel, .cmyc-typing i { animation: none; }
	.cmyc-log { scroll-behavior: auto; }
}
