/* GM AI Compras — chat del asistente de compras */

.gmaic-root,
.gmaic-inline {
	--gmaic-accent: #0b6b63;
	--gmaic-accent-ink: #064a45;
	--gmaic-accent-soft: #dcece8;
	--gmaic-surface: #ffffff;
	--gmaic-surface-2: #f6f9f7;
	--gmaic-ink: #14211f;
	--gmaic-muted: #5c6b68;
	--gmaic-line: #d6dedb;
	--gmaic-good: #2a7a4f;
	--gmaic-good-soft: #dfefe5;
	--gmaic-amber: #a8650f;
	--gmaic-amber-soft: #f7ecd9;
	--gmaic-radius: 14px;
	--gmaic-shadow: 0 2px 6px rgba(20, 33, 31, .1), 0 18px 48px rgba(20, 33, 31, .18);
}

.gmaic-root *,
.gmaic-inline * {
	box-sizing: border-box;
}

/* ---------- burbuja flotante ---------- */
.gmaic-fab {
	position: fixed;
	right: 18px;
	bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	z-index: 99990;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: var(--gmaic-accent);
	color: #fff;
	border: 0;
	cursor: pointer;
	border-radius: 999px;
	padding: 12px 18px 12px 14px;
	font-family: inherit;
	font-weight: 700;
	font-size: 15px;
	letter-spacing: .02em;
	line-height: 1;
	box-shadow: 0 6px 20px rgba(11, 107, 99, .35);
}

.gmaic-fab:hover {
	filter: brightness(1.06);
}

.gmaic-fab .gmaic-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #7ee6d6;
	animation: gmaic-pulse 2.4s infinite;
}

@keyframes gmaic-pulse {
	0% { box-shadow: 0 0 0 0 rgba(126, 230, 214, .6); }
	70% { box-shadow: 0 0 0 9px rgba(126, 230, 214, 0); }
	100% { box-shadow: 0 0 0 0 rgba(126, 230, 214, 0); }
}

/* ---------- panel ---------- */
.gmaic-panel {
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 99991;
	width: 400px;
	max-width: calc(100vw - 32px);
	height: min(680px, 82vh);
	background: var(--gmaic-surface);
	color: var(--gmaic-ink);
	border: 1px solid var(--gmaic-line);
	border-radius: 18px;
	box-shadow: var(--gmaic-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-size: 15px;
	line-height: 1.5;
}

.gmaic-panel[hidden] {
	display: none !important;
}

.gmaic-inline .gmaic-panel {
	position: static;
	width: 100%;
	max-width: none;
	height: 100%;
	border-radius: var(--gmaic-radius);
	box-shadow: none;
}

@media (max-width: 600px) {
	.gmaic-root .gmaic-panel {
		right: 0;
		bottom: 0;
		left: 0;
		top: 0;
		width: 100%;
		max-width: none;
		height: 100%;
		border-radius: 0;
		border: 0;
	}
}

/* ---------- cabecera ---------- */
.gmaic-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 14px;
	padding-top: calc(11px + env(safe-area-inset-top, 0px));
	border-bottom: 1px solid var(--gmaic-line);
	flex: 0 0 auto;
}

.gmaic-avatar {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	background: var(--gmaic-accent);
	color: #fff;
	display: grid;
	place-items: center;
	font-weight: 700;
	font-size: 13px;
	flex: 0 0 auto;
}

.gmaic-who {
	flex: 1;
	min-width: 0;
}

.gmaic-who b {
	display: block;
	font-size: 14px;
	line-height: 1.2;
}

.gmaic-who small {
	color: var(--gmaic-muted);
	font-size: 12px;
}

.gmaic-iconbtn {
	background: transparent;
	border: 0;
	color: var(--gmaic-muted);
	cursor: pointer;
	padding: 7px;
	border-radius: 8px;
	display: grid;
	place-items: center;
	position: relative;
}

.gmaic-iconbtn:hover {
	background: var(--gmaic-surface-2);
	color: var(--gmaic-ink);
}

.gmaic-badge {
	position: absolute;
	top: 0;
	right: 0;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--gmaic-amber);
	color: #fff;
	font-size: 10px;
	line-height: 17px;
	text-align: center;
	font-weight: 600;
}

.gmaic-badge[hidden] {
	display: none !important;
}

/* ---------- mensajes ---------- */
.gmaic-msgs {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 16px 14px 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.gmaic-row {
	display: flex;
	gap: 8px;
}

.gmaic-row.gmaic-me {
	justify-content: flex-end;
}

.gmaic-bubble {
	max-width: 85%;
	padding: 9px 12px;
	border-radius: 14px;
	font-size: 14.5px;
	line-height: 1.5;
	background: var(--gmaic-surface-2);
	border: 1px solid var(--gmaic-line);
	border-bottom-left-radius: 4px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.gmaic-row.gmaic-me .gmaic-bubble {
	background: var(--gmaic-accent);
	color: #fff;
	border-color: transparent;
	border-bottom-left-radius: 14px;
	border-bottom-right-radius: 4px;
	white-space: pre-line;
}

.gmaic-typing {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	padding: 4px 2px;
}

.gmaic-typing i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--gmaic-muted);
	display: block;
	animation: gmaic-bob 1.1s infinite;
}

.gmaic-typing i:nth-child(2) { animation-delay: .15s; }
.gmaic-typing i:nth-child(3) { animation-delay: .3s; }

@keyframes gmaic-bob {
	0%, 60%, 100% { opacity: .3; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
	.gmaic-typing i,
	.gmaic-fab .gmaic-dot {
		animation: none;
	}
}

/* ---------- tarjeta de producto ---------- */
.gmaic-block {
	width: 100%;
	border: 1px solid var(--gmaic-line);
	border-radius: var(--gmaic-radius);
	background: var(--gmaic-surface);
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(20, 33, 31, .06);
}

.gmaic-block-head {
	padding: 8px 10px;
	background: var(--gmaic-surface-2);
	border-bottom: 1px solid var(--gmaic-line);
	display: flex;
	align-items: baseline;
	gap: 6px;
	flex-wrap: wrap;
}

.gmaic-block-head .gmaic-lbl {
	font-weight: 600;
	font-size: 13px;
}

.gmaic-q {
	display: block;
	width: 100%;
	font-size: 10.5px;
	color: var(--gmaic-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.gmaic-tag {
	font-size: 10px;
	letter-spacing: .06em;
	text-transform: uppercase;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 999px;
	background: var(--gmaic-accent-soft);
	color: var(--gmaic-accent-ink);
}

.gmaic-tag.gmaic-warn {
	background: var(--gmaic-amber-soft);
	color: var(--gmaic-amber);
}

/* ---------- lista numerada ---------- */
.gmaic-li {
	display: flex;
	width: 100%;
	gap: 9px;
	align-items: flex-start;
	padding: 9px 10px;
	border: 0;
	border-bottom: 1px solid var(--gmaic-line);
	background: var(--gmaic-surface);
	color: var(--gmaic-ink);
	font-family: inherit;
	text-align: left;
	cursor: pointer;
}

.gmaic-li:last-of-type {
	border-bottom: 0;
}

.gmaic-li:hover,
.gmaic-li:focus-visible {
	background: var(--gmaic-accent-soft);
}

.gmaic-li.gmaic-best {
	border-left: 3px solid var(--gmaic-accent);
}

.gmaic-num {
	width: 23px;
	height: 23px;
	margin-top: 2px;
	border-radius: 6px;
	background: var(--gmaic-accent-soft);
	color: var(--gmaic-accent-ink);
	font-size: 11.5px;
	font-weight: 700;
	display: grid;
	place-items: center;
	flex: 0 0 auto;
}

.gmaic-li:hover .gmaic-num {
	background: var(--gmaic-accent);
	color: #fff;
}

.gmaic-thumb {
	width: 38px;
	height: 38px;
	border-radius: 7px;
	background: var(--gmaic-surface-2);
	flex: 0 0 auto;
	object-fit: cover;
}

.gmaic-info {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.gmaic-name {
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.32;
	/* El tono va al final del título: no se recorta. */
	overflow-wrap: anywhere;
}

.gmaic-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 1px 8px;
	font-size: 10.5px;
	color: var(--gmaic-muted);
	line-height: 1.4;
}

.gmaic-meta .gmaic-stock-ok { color: var(--gmaic-good); }
.gmaic-meta .gmaic-stock-low { color: var(--gmaic-amber); }

.gmaic-note {
	font-style: italic;
}

.gmaic-price {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	padding-top: 1px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	max-width: 34%;
}

.gmaic-price .gmaic-bs {
	font-size: 10px;
	font-weight: 400;
	color: var(--gmaic-muted);
}

.gmaic-hint {
	padding: 7px 10px;
	font-size: 11px;
	color: var(--gmaic-muted);
	background: var(--gmaic-surface-2);
	border-top: 1px solid var(--gmaic-line);
}

/* lista ya resuelta */
.gmaic-block.gmaic-done {
	opacity: .55;
}

.gmaic-block.gmaic-done .gmaic-li {
	pointer-events: none;
	cursor: default;
}

.gmaic-block.gmaic-done .gmaic-hint {
	display: none;
}

/* ---------- botones ---------- */
.gmaic-btn {
	border: 0;
	border-radius: 8px;
	padding: 9px 14px;
	font-family: inherit;
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
	background: var(--gmaic-accent);
	color: #fff;
	line-height: 1.2;
	text-decoration: none;
	display: inline-block;
	text-align: center;
	white-space: nowrap;
}

.gmaic-btn:hover {
	filter: brightness(1.06);
	color: #fff;
}

.gmaic-btn.gmaic-ghost {
	background: transparent;
	color: var(--gmaic-accent);
	border: 1px solid var(--gmaic-line);
}

.gmaic-btn.gmaic-ghost:hover {
	background: var(--gmaic-accent-soft);
	color: var(--gmaic-accent-ink);
	filter: none;
}

.gmaic-confirm {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	font-size: 13px;
	color: var(--gmaic-good);
	background: var(--gmaic-good-soft);
	border: 1px solid var(--gmaic-line);
	border-radius: 10px;
	padding: 8px 11px;
}

.gmaic-confirm b {
	color: var(--gmaic-ink);
}

.gmaic-error {
	width: 100%;
	font-size: 13px;
	color: #a63c2e;
	background: #fbecea;
	border: 1px solid #f0cfc9;
	border-radius: 10px;
	padding: 8px 11px;
}

/* ---------- resumen ---------- */
.gmaic-summary {
	width: 100%;
	border: 1px solid var(--gmaic-line);
	border-radius: var(--gmaic-radius);
	overflow: hidden;
	background: var(--gmaic-surface);
}

.gmaic-summary h4 {
	margin: 0;
	padding: 10px 12px;
	font-size: 13px;
	background: var(--gmaic-surface-2);
	border-bottom: 1px solid var(--gmaic-line);
}

.gmaic-sline {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 10px;
	padding: 7px 12px;
	font-size: 13px;
	border-bottom: 1px dashed var(--gmaic-line);
}

.gmaic-sname {
	min-width: 0;
	overflow-wrap: anywhere;
}

.gmaic-sright {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
	white-space: nowrap;
}

.gmaic-x {
	width: 22px;
	height: 22px;
	border: 1px solid var(--gmaic-line);
	background: var(--gmaic-surface);
	color: var(--gmaic-muted);
	border-radius: 6px;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	display: grid;
	place-items: center;
}

.gmaic-x:hover {
	background: #fbecea;
	border-color: #f0cfc9;
	color: #a63c2e;
}

.gmaic-x[disabled] {
	opacity: .4;
	cursor: default;
}

.gmaic-removed {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	font-size: 12.5px;
	color: var(--gmaic-muted);
	background: var(--gmaic-surface-2);
	border: 1px solid var(--gmaic-line);
	border-radius: 10px;
	padding: 7px 11px;
}

.gmaic-stotal {
	display: flex;
	justify-content: space-between;
	padding: 10px 12px;
	font-weight: 700;
	font-size: 14.5px;
}

.gmaic-summary .gmaic-cta {
	padding: 0 12px 12px;
	display: flex;
	gap: 8px;
}

.gmaic-summary .gmaic-cta .gmaic-btn {
	flex: 1;
	text-align: center;
	padding: 10px;
}

/* ---------- conversación reanudada ---------- */
.gmaic-resumed {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 10.5px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--gmaic-muted);
	margin: 2px 0 4px;
}

.gmaic-resumed::before,
.gmaic-resumed::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--gmaic-line);
}

.gmaic-fab-note {
	font-size: 10px;
	font-weight: 600;
	background: rgba(255, 255, 255, .22);
	padding: 2px 7px;
	border-radius: 999px;
	margin-left: 3px;
	letter-spacing: .02em;
}

/* ---------- sugerencias y composer ---------- */
.gmaic-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	padding: 0 14px 10px;
	flex: 0 0 auto;
}

.gmaic-chip {
	border: 1px solid var(--gmaic-line);
	background: var(--gmaic-surface-2);
	color: var(--gmaic-ink);
	border-radius: 999px;
	padding: 7px 12px;
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
}

.gmaic-chip-num {
	min-width: 40px;
	text-align: center;
	font-weight: 700;
	font-size: 14px;
	padding: 7px 10px;
}

.gmaic-chip:hover {
	border-color: var(--gmaic-accent);
	color: var(--gmaic-accent-ink);
	background: var(--gmaic-accent-soft);
}

.gmaic-composer {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	padding: 10px 12px;
	padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--gmaic-line);
	flex: 0 0 auto;
}

.gmaic-composer textarea {
	flex: 1;
	min-width: 0;
	resize: none;
	border: 1px solid var(--gmaic-line);
	border-radius: 12px;
	padding: 10px 12px;
	font-family: inherit;
	font-size: 14.5px;
	line-height: 1.4;
	max-height: 110px;
	background: var(--gmaic-surface-2);
	color: var(--gmaic-ink);
	outline: none;
}

.gmaic-composer textarea:focus {
	border-color: var(--gmaic-accent);
}

.gmaic-send {
	width: 40px;
	height: 40px;
	border-radius: 12px;
	border: 0;
	background: var(--gmaic-accent);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	flex: 0 0 auto;
}

.gmaic-send[disabled] {
	opacity: .5;
	cursor: default;
}

/* ---------- sugerencia en el buscador ---------- */
.gmaic-search-cta {
	position: absolute;
	z-index: 99989;
	background: var(--gmaic-accent-soft);
	color: var(--gmaic-accent-ink);
	border: 1px solid var(--gmaic-accent);
	border-radius: 10px;
	padding: 9px 13px;
	font-size: 13.5px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 8px;
	box-shadow: 0 8px 24px rgba(20, 33, 31, .12);
	text-align: left;
	line-height: 1.3;
}

.gmaic-search-cta[hidden] {
	display: none !important;
}

.gmaic-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
