/**
 * Chat IA modal — Figma 2305:5621
 */

.gl-chat {
	position: fixed;
	inset: 0;
	z-index: 300000;
	display: flex;
	align-items: stretch;
	justify-content: stretch;
}

.gl-chat__backdrop {
	display: none;
}

.gl-chat__panel {
	position: relative;
	z-index: 1;
	display: flex;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	background: var(--color-white);
	box-shadow: none;
	overflow: hidden;
}

/* ---- Sidebar ---- */
.gl-chat__sidebar {
	width: 315px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	border-right: none;
	background: var(--color-white);
	padding: 0 0 var(--spacing-md);
	box-sizing: border-box;
}

.gl-chat__sidebar-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--spacing-sm);
	min-height: 86px;
	padding: 16px 24px 16px 16px;
	box-sizing: border-box;
}

.gl-chat__icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 2px solid var(--color-neutral-04);
	border-radius: 0;
	background: transparent;
	color: var(--color-black);
	cursor: pointer;
	flex-shrink: 0;
}

.gl-chat__icon-btn:hover {
	border-color: var(--color-brand);
	color: var(--color-brand);
}

.gl-chat__sidebar-brand {
	margin: 0;
	font-family: var(--font-family-base);
	font-size: 21px;
	font-weight: var(--font-weight-bold);
	color: var(--color-black);
	display: flex;
	align-items: center;
	gap: 4px;
	line-height: 1.1;
	white-space: nowrap;
}

.gl-chat__sidebar-brand-sigla {
	color: var(--color-brand);
}

.gl-chat__sidebar-brand-sep {
	color: var(--color-neutral-03);
	font-weight: var(--font-weight-bold);
}

.gl-chat__new {
	margin: 22px 16px 16px;
	width: calc(100% - 32px);
	max-width: 281px;
	justify-content: space-between;
	border-radius: var(--border-radius-pill);
	min-height: 40px;
	padding: 8px 16px 8px 24px;
}

.gl-chat__history-label {
	margin: 8px 21px 0;
	padding: 22px 8px;
	font-size: var(--font-size-xs);
	font-weight: var(--font-weight-semibold);
	letter-spacing: var(--letter-spacing-button);
	text-transform: uppercase;
	color: var(--color-brand);
	line-height: var(--line-height-normal);
}

.gl-chat__history {
	list-style: none;
	margin: 0;
	padding: 0 21px;
	overflow: auto;
	flex: 1;
}

.gl-chat__history-item {
	display: block;
	width: 100%;
	text-align: left;
	padding: 12px;
	margin: 0;
	border: none;
	border-right: 3px solid transparent;
	border-radius: var(--border-radius-lg) 0 0 var(--border-radius-lg);
	background: transparent;
	font-family: var(--font-family-base);
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-regular);
	line-height: var(--line-height-body);
	color: var(--color-neutral-05);
	cursor: pointer;
	position: relative;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	box-sizing: border-box;
}

.gl-chat__history-item:hover {
	background: var(--color-neutral-01);
}

.gl-chat__history-item.is-active {
	background: var(--color-neutral-01);
	border-right-color: var(--color-brand);
	font-weight: var(--font-weight-regular);
	color: var(--color-neutral-05);
}

.gl-chat__history-item.is-active::after {
	display: none;
}

.gl-chat__history-empty {
	margin: 0;
	padding: 12px;
	font-size: var(--font-size-sm);
	line-height: var(--line-height-body);
	color: var(--color-neutral-05);
	opacity: 0.85;
}

/* ---- Main ---- */
.gl-chat__main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	background: var(--color-white);
	border-left: 1px solid var(--color-neutral-02);
}

.gl-chat__main-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--spacing-md);
	padding: 16px 24px;
	background: var(--color-neutral-01);
	border-bottom: none;
	min-height: 86px;
	box-sizing: border-box;
}

.gl-chat__main-heading {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.gl-chat__title {
	margin: 0;
	font-family: var(--font-family-base);
	font-size: 24px;
	font-weight: var(--font-weight-bold);
	line-height: var(--line-height-tight);
	color: var(--color-black);
}

.gl-chat__subtitle {
	margin: 0;
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-regular);
	color: var(--color-neutral-05);
	line-height: var(--line-height-body);
}

.gl-chat__sparkles {
	width: 54px;
	height: 54px;
	flex-shrink: 0;
}

.gl-chat__thread {
	flex: 1;
	overflow: auto;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
	background: var(--color-white);
	scroll-behavior: smooth;
}

.gl-chat__empty {
	margin: auto;
	max-width: 80%;
	padding: 24px;
	text-align: center;
	color: var(--color-neutral-05);
	font-size: var(--font-size-sm);
	line-height: var(--line-height-body);
}

.gl-chat__msg {
	display: flex;
	align-items: flex-start;
	gap: 17px;
	width: 100%;
	max-width: none;
	padding: 24px 16px;
	box-sizing: border-box;
}

.gl-chat__msg--user {
	align-self: stretch;
	flex-direction: row-reverse;
	justify-content: flex-start;
	padding-left: clamp(48px, 19%, 200px);
}

.gl-chat__msg--ai {
	align-self: stretch;
	padding-right: clamp(48px, 19%, 200px);
}

.gl-chat__avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--color-brand);
	color: var(--color-white);
	margin-top: 2px;
}

.gl-chat__avatar--ai {
	background: transparent;
	color: var(--color-neutral-03);
	border-radius: 0;
}

.gl-chat__avatar--ai svg {
	display: block;
	width: 24px;
	height: 24px;
}

.gl-chat__bubble {
	flex: 1;
	min-width: 0;
	font-size: var(--font-size-sm);
	line-height: var(--line-height-body);
	color: var(--color-neutral-05);
}

.gl-chat__msg--user .gl-chat__bubble {
	background: transparent;
	padding: 0;
	border-radius: 0;
	text-align: right;
}

.gl-chat__bubble p {
	margin: 0 0 12px;
}

.gl-chat__bubble p:last-child {
	margin-bottom: 0;
}

.gl-chat__docs-intro {
	margin: 12px 0 0 !important;
	font-weight: var(--font-weight-regular);
}

.gl-chat__bubble--docs .gl-chat__docs {
	margin-top: 0;
}

.gl-chat__bubble--docs {
	width: 100%;
}

.gl-chat__msg--docs {
	padding-top: 0;
}

.gl-chat__docs-label {
	margin: 0 0 16px;
	font-size: var(--font-size-xs);
	font-weight: var(--font-weight-semibold);
	letter-spacing: var(--letter-spacing-button);
	text-transform: uppercase;
	line-height: var(--line-height-normal);
	color: var(--color-neutral-05);
}

.gl-chat__docs {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin-top: 0;
	padding-left: 0;
	border-left: none;
	width: 100%;
}

.gl-chat__doc {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 0 0 0 16px;
	border-left: 1px solid var(--color-text-link);
	text-decoration: none;
	color: inherit;
	box-sizing: border-box;
}

.gl-chat__doc:hover .gl-chat__doc-title {
	color: var(--color-brand);
}

.gl-chat__doc-type {
	display: block;
	font-size: var(--font-size-xs);
	font-weight: var(--font-weight-extrabold);
	letter-spacing: var(--letter-spacing-pretitle);
	text-transform: uppercase;
	line-height: var(--line-height-tight);
	color: var(--color-brand);
	margin-bottom: 0;
}

.gl-chat__doc-title {
	display: block;
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-bold);
	line-height: var(--line-height-body);
	color: var(--color-black);
	margin-bottom: 0;
}

.gl-chat__doc-blurb {
	display: block;
	font-size: var(--font-size-xs);
	font-weight: var(--font-weight-regular);
	color: #666;
	line-height: var(--line-height-body);
}

.gl-chat__doc-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-top: 10px;
}

.gl-chat__doc-action {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0;
	border: none;
	background: transparent;
	color: var(--color-black, #46272d);
	font-family: var(--font-family-base);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	line-height: 1.15;
}

.gl-chat__doc-action-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 1000px;
	flex-shrink: 0;
	box-sizing: border-box;
}

.gl-chat__doc-action--download .gl-chat__doc-action-icon {
	background: var(--color-brand, #00968f);
}

.gl-chat__doc-action--dossier .gl-chat__doc-action-icon {
	background: var(--color-white);
	border: 1px solid var(--color-brand, #00968f);
}

.gl-chat__doc-action-icon img {
	width: 16px;
	height: auto;
	display: block;
}

.gl-chat__doc-action-label {
	color: var(--color-black, #46272d);
}

.gl-chat__doc-action:hover {
	opacity: 0.85;
	text-decoration: none;
}

.gl-chat__doc-action:hover .gl-chat__doc-action-label {
	text-decoration: underline;
	text-decoration-color: currentColor;
}

.gl-chat__typing {
	font-size: var(--font-size-sm);
	color: var(--color-neutral-05);
	font-style: italic;
}

.gl-chat__bubble--skeleton {
	display: flex;
	flex-direction: column;
	gap: 0.55em;
	width: 100%;
	max-width: none;
	position: relative;
}

.gl-chat__placeholder {
	display: block;
	height: 0.9em;
	margin: 0;
	border-radius: 4px;
	overflow: hidden;
	background-color: rgba(0, 0, 0, 0.06);
	background-image: linear-gradient(
		90deg,
		rgba(0, 0, 0, 0.05) 0%,
		rgba(0, 0, 0, 0.11) 40%,
		rgba(0, 0, 0, 0.05) 80%
	);
	background-size: 200% 100%;
	animation: gl-chat-skeleton-shimmer 1.35s ease-in-out infinite;
}

.gl-chat__msg--ai.is-loading {
	padding-right: 16px;
}

.gl-chat__msg.is-loading .gl-chat__placeholder:nth-child(1) {
	width: 100%;
	animation-delay: 0ms;
}

.gl-chat__msg.is-loading .gl-chat__placeholder:nth-child(2) {
	width: 82%;
	margin-bottom: 0.75em;
	animation-delay: 120ms;
}

.gl-chat__msg.is-loading .gl-chat__placeholder:nth-child(3) {
	width: 100%;
	animation-delay: 240ms;
}

.gl-chat__msg.is-loading .gl-chat__placeholder:nth-child(4) {
	width: 74%;
	animation-delay: 360ms;
}

.gl-chat__thread-loader {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	padding: 48px 24px;
	box-sizing: border-box;
}

.gl-chat__msg--ai .gl-chat__bubble {
	position: relative;
}

/* ---- Composer ---- */
.gl-chat__composer {
	padding: 8px;
	border-top: none;
	background: var(--color-neutral-01);
}

.gl-chat__composer-field {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 4px;
	min-height: 64px;
	padding: 8px 8px 8px 15px;
	border: 1px solid var(--color-neutral-04);
	border-radius: 0;
	background: var(--color-white);
	box-sizing: border-box;
}

.gl-chat__input {
	flex: 1;
	min-width: 0;
	border: none;
	background: transparent;
	font-family: var(--font-family-base);
	font-size: var(--font-size-base);
	line-height: var(--line-height-body);
	color: var(--color-black);
	outline: none;
	padding: 8px 0;
}

.gl-chat__input::placeholder {
	color: var(--color-neutral-04);
}

.gl-chat__composer-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.gl-chat__composer-menu-wrap {
	position: relative;
}

.gl-chat__composer-menu,
.gl-chat__send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: none;
	border-radius: 0;
	cursor: pointer;
	flex-shrink: 0;
}

.gl-chat__composer-menu {
	background: transparent;
	border: 2px solid var(--color-neutral-02);
	color: var(--color-black);
}

.gl-chat__composer-menu:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.gl-chat__composer-menu:not(:disabled):hover {
	border-color: var(--color-neutral-04);
}

.gl-chat__composer-menu[aria-expanded='true'] {
	border-color: var(--color-brand);
}

.gl-chat__composer-dropdown {
	position: absolute;
	right: 0;
	bottom: calc(100% + 8px);
	min-width: 180px;
	padding: 6px;
	background: var(--color-white);
	border: 1px solid var(--color-neutral-02);
	box-shadow: 0 8px 24px rgba(70, 39, 45, 0.12);
	z-index: 5;
}

.gl-chat__composer-dropdown-item {
	display: block;
	width: 100%;
	margin: 0;
	padding: 10px 12px;
	border: none;
	background: transparent;
	text-align: left;
	font-family: var(--font-family-base);
	font-size: var(--font-size-sm);
	line-height: var(--line-height-body);
	color: var(--color-neutral-05);
	cursor: pointer;
}

.gl-chat__composer-dropdown-item:hover {
	background: var(--color-neutral-01);
	color: var(--color-black);
}

.gl-chat__send {
	background: var(--color-brand);
	color: var(--color-white);
}

.gl-chat__send:hover {
	background: #007a74;
}

/* ---- Confirm delete (identidade do site) ---- */
.gl-chat-confirm {
	position: absolute;
	inset: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

.gl-chat-confirm[hidden] {
	display: none;
}

.gl-chat-confirm__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(70, 39, 45, 0.42);
}

.gl-chat-confirm__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 420px;
	background: var(--color-white);
	border: 1px solid var(--color-neutral-02);
	box-shadow: var(--shadow-card-hover);
	display: flex;
	flex-direction: column;
}

.gl-chat-confirm__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 24px;
	background: var(--color-neutral-01);
	border-bottom: 1px solid var(--color-neutral-02);
}

.gl-chat-confirm__title {
	margin: 0;
	font-family: var(--font-family-base);
	font-size: 18px;
	font-weight: var(--font-weight-bold);
	line-height: var(--line-height-tight);
	color: var(--color-black);
}

.gl-chat-confirm__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 2px solid var(--color-neutral-04);
	background: transparent;
	color: var(--color-black);
	cursor: pointer;
	flex-shrink: 0;
}

.gl-chat-confirm__close:hover {
	border-color: var(--color-brand);
	color: var(--color-brand);
}

.gl-chat-confirm__body {
	padding: 24px;
}

.gl-chat-confirm__text {
	margin: 0;
	font-family: var(--font-family-base);
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-regular);
	line-height: var(--line-height-body);
	color: var(--color-neutral-05);
}

.gl-chat-confirm__actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 24px 24px;
}

.gl-chat-confirm__btn {
	min-height: 40px;
	padding: 8px 24px;
}

.gl-chat-confirm__btn--ghost {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 2px solid var(--color-neutral-04);
	border-radius: var(--border-radius-pill);
	background: transparent;
	font-family: var(--font-family-base);
	font-size: 14px;
	font-weight: var(--font-weight-semibold);
	letter-spacing: var(--letter-spacing-button);
	text-transform: uppercase;
	line-height: var(--line-height-normal);
	color: var(--color-black);
	cursor: pointer;
}

.gl-chat-confirm__btn--ghost:hover {
	border-color: var(--color-brand);
	color: var(--color-brand);
}

.gl-chat-confirm__btn--danger {
	background: var(--color-brand);
}

.gl-chat-confirm__btn--danger:hover {
	background: #007a74;
}

body.gl-chat-open {
	overflow: hidden;
}

@media (max-width: 900px) {
	.gl-chat__panel {
		flex-direction: column;
	}

	.gl-chat__sidebar {
		width: 100%;
		max-height: 40%;
		border-right: none;
		border-bottom: 1px solid var(--color-neutral-02);
	}

	.gl-chat__main {
		border-left: none;
	}

	.gl-chat__title {
		font-size: 22px;
	}

	.gl-chat__sparkles {
		width: 40px;
		height: 40px;
	}

	.gl-chat__msg--user,
	.gl-chat__msg--ai {
		padding-left: 16px;
		padding-right: 16px;
	}

	.gl-chat__msg {
		max-width: 100%;
	}
}
