/* Inicial Chatbot widget — isolated floating desktop panel and fullscreen mobile app. */

:host {
	all: initial;
	--ic-accent: #2563eb;
	--ic-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	--ic-font-size: 16px;
	position: fixed;
	right: max(20px, env(safe-area-inset-right));
	bottom: max(20px, env(safe-area-inset-bottom));
	z-index: 2147483000;
	color-scheme: light;
	isolation: isolate;
}

#inicial-chatbot-ui {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	color: #1a1a1a;
	font-family: var(--ic-font-family);
	font-size: calc(var(--ic-font-size) - 1px);
	font-style: normal;
	font-weight: 400;
	line-height: 1.45;
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	direction: ltr;
	unicode-bidi: isolate;
}

#inicial-chatbot-ui,
#inicial-chatbot-ui *,
#inicial-chatbot-ui *::before,
#inicial-chatbot-ui *::after {
	box-sizing: border-box;
}

#inicial-chatbot-ui button,
#inicial-chatbot-ui input,
#inicial-chatbot-ui a {
	font-family: var(--ic-font-family);
	font-style: normal;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
}

#inicial-chatbot-ui button,
#inicial-chatbot-ui input {
	-webkit-appearance: none;
	appearance: none;
	min-width: 0;
	margin: 0;
}

#inicial-chatbot-ui button::before,
#inicial-chatbot-ui button::after,
#inicial-chatbot-ui a::before,
#inicial-chatbot-ui a::after {
	content: none;
}

#inicial-chatbot-ui svg {
	display: block;
	flex: none;
	margin: 0;
}

#inicial-chatbot-ui img {
	border: 0;
	box-shadow: none;
}

#inicial-chatbot-ui [hidden] {
	display: none !important;
}

/* Launcher / mobile close control. */
#inicial-chatbot-ui .ic-toggle {
	width: 60px;
	height: 60px;
	min-height: 60px;
	border: 0;
	border-radius: 50%;
	padding: 0;
	background: var(--ic-accent);
	color: #fff;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.24);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	transition: transform 0.15s ease;
}

#inicial-chatbot-ui .ic-toggle:hover {
	transform: scale(1.06);
}

#inicial-chatbot-ui .ic-toggle:focus-visible,
#inicial-chatbot-ui .ic-send:focus-visible,
#inicial-chatbot-ui .ic-suggestions-toggle:focus-visible {
	outline: 3px solid rgba(37, 99, 235, 0.3);
	outline-offset: 2px;
}

#inicial-chatbot-ui .ic-icon-close,
:host(.ic-open) #inicial-chatbot-ui .ic-icon-chat {
	display: none;
}

:host(.ic-open) #inicial-chatbot-ui .ic-icon-close {
	display: block;
}

/* Panel. */
#inicial-chatbot-ui .ic-panel {
	position: relative;
	width: 410px;
	max-width: calc(100vw - 32px);
	height: 700px;
	max-height: calc(100vh - 120px);
	max-height: calc(100dvh - 120px);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	overscroll-behavior: contain;
	color: #1a1a1a;
	font: 400 var(--ic-font-size)/1.5 var(--ic-font-family);
	text-align: left;
}

#inicial-chatbot-ui .ic-header {
	min-height: 72px;
	margin: 0;
	padding: 14px 20px 14px 22px;
	border: 0;
	border-bottom: 1px solid #e4e4e7;
	background: #fff;
	color: #18181b;
	font-size: calc(var(--ic-font-size) + 1px);
	font-weight: 600;
	line-height: 1.3;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}

#inicial-chatbot-ui .ic-header-title {
	min-width: 0;
	flex: 1 1 auto;
	margin: 0;
	padding: 0;
	color: #18181b;
	font: inherit;
}

#inicial-chatbot-ui .ic-header-close {
	display: flex;
	width: 44px;
	height: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: #5f6067;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	flex: 0 0 44px;
	line-height: 0;
}

#inicial-chatbot-ui .ic-header-close:focus-visible {
	outline: 3px solid rgba(37, 99, 235, 0.24);
	outline-offset: -3px;
}

#inicial-chatbot-ui .ic-header-logo {
	display: block;
	width: auto;
	height: auto;
	max-width: 42px;
	max-height: 36px;
	margin: 0;
	padding: 0;
	object-fit: contain;
	flex-shrink: 0;
}

#inicial-chatbot-ui .ic-messages {
	min-height: 0;
	margin: 0;
	padding: 20px;
	background: #fff;
	color: #1a1a1a;
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	display: flex;
	flex-direction: column;
	gap: 18px;
	scrollbar-color: #8a8a8f transparent;
	scrollbar-width: thin;
}

#inicial-chatbot-ui .ic-messages::-webkit-scrollbar {
	width: 8px;
}

#inicial-chatbot-ui .ic-messages::-webkit-scrollbar-track {
	background: transparent;
}

#inicial-chatbot-ui .ic-messages::-webkit-scrollbar-thumb {
	border: 2px solid #fff;
	border-radius: 999px;
	background: #8a8a8f;
}

#inicial-chatbot-ui .ic-msg {
	max-width: 90%;
	margin: 0;
	padding: 14px 18px;
	border: 0;
	border-radius: 24px;
	background-image: none;
	box-shadow: none;
	color: #1a1a1a;
	font: 400 var(--ic-font-size)/1.5 var(--ic-font-family);
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	overflow-wrap: anywhere;
}

#inicial-chatbot-ui .ic-msg-user {
	max-width: 85%;
	align-self: flex-end;
	border-radius: 999px;
	background: var(--ic-accent);
	color: #fff;
	white-space: pre-wrap;
}

#inicial-chatbot-ui .ic-msg-assistant {
	align-self: flex-start;
	border: 0;
	background: #f4f4f5;
	color: #1a1a1a;
}

#inicial-chatbot-ui .ic-msg-assistant p,
#inicial-chatbot-ui .ic-msg-assistant h3,
#inicial-chatbot-ui .ic-msg-assistant h4,
#inicial-chatbot-ui .ic-msg-assistant ul,
#inicial-chatbot-ui .ic-msg-assistant ol {
	color: #1a1a1a;
	font-family: inherit;
	line-height: 1.5;
	margin: 0 0 14px;
}

#inicial-chatbot-ui .ic-msg-assistant > :last-child {
	margin-bottom: 0;
}

#inicial-chatbot-ui .ic-msg-assistant h3,
#inicial-chatbot-ui .ic-msg-assistant h4 {
	font-size: var(--ic-font-size);
	font-weight: 700;
	line-height: 1.4;
}

#inicial-chatbot-ui .ic-msg-assistant ul,
#inicial-chatbot-ui .ic-msg-assistant ol {
	padding-left: 22px;
}

#inicial-chatbot-ui .ic-msg-assistant li {
	color: #1a1a1a;
	font: inherit;
	margin: 0;
	padding: 0;
}

#inicial-chatbot-ui .ic-msg-assistant li + li {
	margin-top: 10px;
}

#inicial-chatbot-ui .ic-msg-assistant li::marker {
	color: #c9c9cf;
}

#inicial-chatbot-ui .ic-msg-assistant code {
	padding: 1px 4px;
	border-radius: 4px;
	background: #f1f1f3;
	color: #1a1a1a;
	font-size: 0.92em;
}

#inicial-chatbot-ui .ic-msg-assistant a {
	color: var(--ic-accent);
	font: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

#inicial-chatbot-ui .ic-msg-error {
	border-color: #f3c2c2;
	background: #fdf0f0;
	color: #8a1f1f;
}

/* Suggested questions: initial inline state, then a modal-style card. */
#inicial-chatbot-ui .ic-suggestions-backdrop {
	position: absolute;
	inset: 76px 0 0;
	z-index: 3;
	border: 0;
	background: rgba(24, 24, 27, 0.16);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	cursor: pointer;
}

#inicial-chatbot-ui .ic-suggestions {
	margin: 0;
	padding: 10px 14px 12px;
	background: #fff;
	color: #1a1a1a;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	flex-shrink: 0;
	max-height: min(44%, 300px);
	overflow-y: auto;
	scrollbar-width: thin;
}

#inicial-chatbot-ui .ic-suggestions-heading {
	display: none;
}

#inicial-chatbot-ui .ic-suggestions-popup {
	position: absolute;
	right: 18px;
	bottom: 94px;
	z-index: 4;
	width: min(360px, calc(100% - 36px));
	max-height: min(58%, 380px);
	padding: 14px;
	border: 1px solid #e1e2e6;
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.98);
	box-shadow: 0 20px 50px rgba(15, 23, 42, 0.24);
	overflow-y: auto;
	scrollbar-width: thin;
	align-items: stretch;
}

#inicial-chatbot-ui .ic-suggestions-popup .ic-suggestions-heading {
	position: sticky;
	top: -14px;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: -14px -14px 2px;
	padding: 14px 14px 10px;
	background: rgba(255, 255, 255, 0.98);
	font-size: var(--ic-font-size);
	font-weight: 600;
	line-height: 1.3;
}

#inicial-chatbot-ui .ic-suggestions-close {
	display: grid;
	width: 36px;
	height: 36px;
	min-height: 36px;
	place-items: center;
	flex: 0 0 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #f1f2f4;
	color: #606269;
	cursor: pointer;
	line-height: 0;
}

#inicial-chatbot-ui .ic-suggestion {
	width: auto;
	max-width: 100%;
	min-height: 40px;
	margin: 0;
	padding: 8px 15px;
	border: 1px solid #d9dbe1;
	border-radius: 999px;
	background: #fff;
	box-shadow: none;
	color: #1a1a1a;
	cursor: pointer;
	font-size: var(--ic-font-size);
	font-weight: 400;
	line-height: 1.3;
	text-align: left;
}

#inicial-chatbot-ui .ic-suggestions-popup .ic-suggestion {
	width: 100%;
	border-radius: 12px;
}

#inicial-chatbot-ui .ic-suggestion:hover,
#inicial-chatbot-ui .ic-suggestion:focus-visible {
	border-color: var(--ic-accent);
	outline: none;
}

#inicial-chatbot-ui .ic-cta {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	margin: 2px 0 0;
	padding: 9px 14px;
	border: 0;
	border-radius: 999px;
	background: var(--ic-accent);
	box-shadow: none;
	color: #fff;
	font-size: max(12px, calc(var(--ic-font-size) - 1px));
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
}

#inicial-chatbot-ui .ic-contact {
	align-self: flex-start;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: -2px 0 0;
	padding: 0;
}

#inicial-chatbot-ui .ic-contact a {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	margin: 0;
	padding: 6px 10px;
	border: 1px solid #e3e3e6;
	border-radius: 999px;
	background: #fff;
	box-shadow: none;
	color: #55565c;
	font-size: max(11px, calc(var(--ic-font-size) - 3px));
	font-weight: 400;
	line-height: 1.2;
	text-decoration: none;
}

#inicial-chatbot-ui .ic-contact a:hover,
#inicial-chatbot-ui .ic-contact a:focus-visible {
	border-color: var(--ic-accent);
	color: var(--ic-accent);
	outline: none;
}

/* Typing indicator. */
#inicial-chatbot-ui .ic-typing {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 13px;
}

#inicial-chatbot-ui .ic-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b0b0b6;
	animation: ic-bounce 1.2s infinite ease-in-out;
}

#inicial-chatbot-ui .ic-typing span:nth-child(2) { animation-delay: 0.15s; }
#inicial-chatbot-ui .ic-typing span:nth-child(3) { animation-delay: 0.3s; }

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

/* Composer. */
#inicial-chatbot-ui .ic-form {
	position: relative;
	min-height: 68px;
	margin: 0;
	padding: 12px;
	border: 0;
	border-top: 1px solid #e3e3e6;
	border-radius: 0;
	background: #fff;
	box-shadow: none;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

#inicial-chatbot-ui .ic-input {
	min-width: 0;
	height: 42px;
	flex: 1 1 auto;
	margin: 0;
	padding: 9px 16px;
	border: 1px solid #d4d4d8;
	border-radius: 999px;
	background: #fff;
	box-shadow: none;
	color: #1a1a1a;
	caret-color: var(--ic-accent);
	font-size: max(12px, calc(var(--ic-font-size) - 1px));
	font-weight: 400;
	line-height: 1.2;
	text-align: left;
	outline: none;
}

#inicial-chatbot-ui .ic-input::placeholder {
	color: #777981;
	opacity: 1;
}

#inicial-chatbot-ui .ic-input:focus {
	border-color: var(--ic-accent);
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

#inicial-chatbot-ui .ic-suggestions-toggle,
#inicial-chatbot-ui .ic-send {
	width: 44px;
	height: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-image: none;
	box-shadow: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 44px;
	line-height: 0;
}

#inicial-chatbot-ui .ic-suggestions-toggle {
	background: #f1f2f4;
	color: #6b6d74;
}

#inicial-chatbot-ui .ic-suggestions-toggle[aria-expanded="true"] svg {
	transform: rotate(180deg);
}

#inicial-chatbot-ui .ic-send {
	background: var(--ic-accent);
	color: #fff;
}

#inicial-chatbot-ui .ic-send svg,
#inicial-chatbot-ui .ic-suggestions-toggle svg {
	width: 20px;
	height: 20px;
	margin: 0;
	transform-origin: 50% 50%;
}

#inicial-chatbot-ui .ic-suggestions-toggle svg {
	width: 18px;
	height: 18px;
}

#inicial-chatbot-ui .ic-send:disabled {
	opacity: 0.5;
	cursor: default;
}

#inicial-chatbot-ui .ic-suggestions-toggle:disabled,
#inicial-chatbot-ui .ic-suggestion:disabled {
	opacity: 0.5;
	cursor: default;
}

#inicial-chatbot-ui .ic-signature {
	align-self: stretch;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	margin: 0;
	padding: 0 12px 10px;
	border: 0;
	background: #fff;
	box-shadow: none;
	color: #8a8a91;
	font-size: 10px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	flex-shrink: 0;
}

#inicial-chatbot-ui .ic-signature:hover,
#inicial-chatbot-ui .ic-signature:focus-visible {
	color: #4f4f55;
}

#inicial-chatbot-ui .ic-signature img {
	display: block;
	width: 11px;
	height: 11px;
	margin: 0;
	object-fit: contain;
	opacity: 0.65;
}

#inicial-chatbot-ui .ic-signature span {
	color: inherit;
	font: inherit;
}

/* Live visual viewport sizing keeps the composer above mobile software keyboards. */
@media (max-width: 768px), (max-height: 540px) and (pointer: coarse) {
	:host(.ic-mobile-open) {
		position: fixed;
		left: var(--ic-viewport-left, 0);
		top: var(--ic-viewport-top, 0);
		right: auto;
		bottom: auto;
		width: var(--ic-viewport-width, 100vw);
		height: var(--ic-viewport-height, 100dvh);
		max-width: none;
		max-height: none;
		margin: 0;
		padding: 0;
		display: block;
		overflow: hidden;
		overscroll-behavior: none;
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui {
		width: 100%;
		height: 100%;
		display: block;
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-panel {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
		max-width: none;
		max-height: none;
		border-radius: 0;
		box-shadow: none;
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-header {
		min-height: calc(58px + env(safe-area-inset-top));
		padding: calc(7px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 7px max(18px, env(safe-area-inset-left));
		font-size: calc(var(--ic-font-size) + 1px);
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-toggle {
		display: none;
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-header-close {
		display: flex;
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-messages {
		padding: 14px max(14px, env(safe-area-inset-right)) 14px max(14px, env(safe-area-inset-left));
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-suggestions-initial {
		padding-right: max(14px, env(safe-area-inset-right));
		padding-left: max(14px, env(safe-area-inset-left));
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-suggestions-popup {
		right: max(18px, env(safe-area-inset-right));
		bottom: calc(94px + env(safe-area-inset-bottom));
		width: min(420px, calc(100% - 36px));
		max-height: min(60%, 420px);
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-suggestions-backdrop {
		inset: calc(62px + env(safe-area-inset-top)) 0 0;
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-form {
		padding-right: max(12px, env(safe-area-inset-right));
		padding-left: max(12px, env(safe-area-inset-left));
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-input {
		font-size: max(16px, calc(var(--ic-font-size) - 1px)); /* Prevent iOS focus zoom. */
	}

	:host(.ic-mobile-open) #inicial-chatbot-ui .ic-signature {
		padding-bottom: max(10px, env(safe-area-inset-bottom));
	}
}

@media (prefers-reduced-motion: reduce) {
	#inicial-chatbot-ui .ic-toggle {
		transition: none;
	}
}
