/* Asistente de IA del portal. Toma los colores del tenant desde las variables
   que define el layout (--primary-color / --secondary-color), asi que no hay
   estilos por cliente que mantener. */
.ia-launcher {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 1040;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 18px 12px 14px;
	border: 0;
	border-radius: 999px;
	background: var(--primary-color, #0f766e);
	color: var(--ia-primary-ink, #fff);
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ia-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 34px rgba(15, 23, 42, 0.34);
}

.ia-launcher:focus-visible {
	outline: 3px solid var(--secondary-color, #111827);
	outline-offset: 2px;
}

.ia-launcher svg {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
}

.ia-launcher[hidden],
.ia-panel[hidden] {
	display: none !important;
}

.ia-panel {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 1041;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 620px;
	max-height: calc(100vh - 40px);
	overflow: hidden;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.32);
	font-family: inherit;
	color: var(--text-color, #383a3e);
}

.ia-panel__header {
	border-bottom: 3px solid var(--secondary-color, #111827);
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	background: var(--primary-color, #0f766e);
	color: var(--ia-primary-ink, #fff);
}

.ia-panel__avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	flex: 0 0 auto;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
}

.ia-panel__avatar svg {
	width: 20px;
	height: 20px;
}

.ia-panel__titles {
	flex: 1 1 auto;
	min-width: 0;
}

.ia-panel__title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ia-panel__subtitle {
	margin: 2px 0 0;
	font-size: 11.5px;
	opacity: 0.85;
	line-height: 1.3;
}

.ia-panel__close {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: var(--ia-primary-ink, #fff);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.ia-panel__close:hover {
	background: rgba(255, 255, 255, 0.26);
}

.ia-messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 18px;
	background: #f6f7f9;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.ia-msg {
	display: flex;
	max-width: 100%;
}

.ia-msg--user {
	justify-content: flex-end;
}

.ia-bubble {
	max-width: 88%;
	padding: 11px 14px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.55;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.ia-msg--bot .ia-bubble {
	background: #fff;
	border: 1px solid #e6e8ec;
	border-bottom-left-radius: 4px;
}

.ia-msg--user .ia-bubble {
	background: var(--primary-color, #0f766e);
	color: var(--ia-primary-ink, #fff);
	border-bottom-right-radius: 4px;
}

.ia-msg--error .ia-bubble {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.ia-bubble p {
	margin: 0 0 8px;
}

.ia-bubble p:last-child {
	margin-bottom: 0;
}

.ia-bubble ul,
.ia-bubble ol {
	margin: 0 0 8px;
	padding-left: 18px;
}

.ia-bubble li {
	margin-bottom: 4px;
}

.ia-bubble code {
	padding: 1px 4px;
	border-radius: 4px;
	background: rgba(15, 23, 42, 0.07);
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12.5px;
}

.ia-bubble a {
	color: var(--primary-color, #0f766e);
	font-weight: 600;
	text-decoration: underline;
}

.ia-msg--user .ia-bubble a {
	color: var(--ia-primary-ink, #fff);
}

.ia-typing {
	display: flex;
	gap: 5px;
	padding: 4px 2px;
}

.ia-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--secondary-color, #111827);
	opacity: 0.45;
	animation: ia-bounce 1.1s infinite ease-in-out;
}

.ia-typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.ia-typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes ia-bounce {
	0%,
	60%,
	100% {
		transform: translateY(0);
		opacity: 0.35;
	}
	30% {
		transform: translateY(-5px);
		opacity: 0.9;
	}
}

.ia-suggestions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 18px 12px;
	background: #f6f7f9;
}

.ia-suggestions:empty {
	display: none;
}

.ia-chip {
	padding: 8px 12px;
	border: 1px solid var(--primary-color, #0f766e);
	border-radius: 999px;
	background: #fff;
	color: var(--primary-color, #0f766e);
	font-family: inherit;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	text-align: left;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.ia-chip:hover {
	background: var(--primary-color, #0f766e);
	color: var(--ia-primary-ink, #fff);
}

.ia-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px 14px;
	border-top: 1px solid #e6e8ec;
	background: #fff;
}

.ia-form textarea {
	flex: 1 1 auto;
	max-height: 110px;
	min-height: 42px;
	padding: 11px 12px;
	border: 1px solid #d8dbe0;
	border-radius: 12px;
	background: #fff;
	color: inherit;
	font-family: inherit;
	font-size: 13.5px;
	line-height: 1.4;
	resize: none;
}

.ia-form textarea:focus {
	border-color: var(--primary-color, #0f766e);
	outline: none;
}

.ia-form button {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 12px;
	background: var(--primary-color, #0f766e);
	color: var(--ia-primary-ink, #fff);
	cursor: pointer;
}

.ia-form button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.ia-form button svg {
	width: 18px;
	height: 18px;
}

.ia-footnote {
	padding: 0 14px 10px;
	background: #fff;
	color: #8b9099;
	font-size: 10.5px;
	line-height: 1.4;
	text-align: center;
}

@media (max-width: 575.98px) {
	.ia-launcher {
		right: 14px;
		bottom: 14px;
		padding: 12px;
	}

	.ia-launcher__label {
		display: none;
	}

	.ia-panel {
		right: 0;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}
}

.ia-chip:focus-visible,
.ia-panel__close:focus-visible,
.ia-form button:focus-visible {
	outline: 3px solid var(--secondary-color, #111827);
	outline-offset: 2px;
}
