/* TASK-06K: Web Chat widget. Scoped under .chatbot-* only -- never touches
   .container/.header/.button/.content or any other global selector.
   Reuses this site's own existing design tokens (css/new/style.css's :root
   custom properties) rather than introducing a new palette/framework. */

.chatbot-widget {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 1050;
	font-family: var(--font-primary, Arial, sans-serif);
}

.chatbot-launcher {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: none;
	background: var(--color-primary, #2f57ef);
	color: var(--color-white, #fff);
	box-shadow: var(--shadow-1, 0px 6px 34px rgba(215, 216, 222, 0.41));
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform .2s ease, background .2s ease;
}

.chatbot-launcher:hover,
.chatbot-launcher:focus-visible {
	background: var(--color-heading, #192335);
	transform: translateY(-2px);
}

.chatbot-launcher-icon-close {
	display: none;
}

.chatbot-widget.is-open .chatbot-launcher-icon-open {
	display: none;
}

.chatbot-widget.is-open .chatbot-launcher-icon-close {
	display: inline-flex;
}

.chatbot-panel {
	position: absolute;
	right: 0;
	bottom: 72px;
	width: 360px;
	max-width: calc(100vw - 40px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: var(--color-white, #fff);
	border-radius: var(--radius-big, 16px);
	box-shadow: var(--shadow-1, 0px 6px 34px rgba(215, 216, 222, 0.41));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--color-border, #e6e3f1);
}

.chatbot-panel[hidden] {
	display: none;
}

.chatbot-panel-header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: var(--color-primary, #2f57ef);
	color: var(--color-white, #fff);
}

.chatbot-panel-title {
	font-weight: 600;
	font-size: 15px;
}

/* TASK-06N: groups the always-visible "Dang ky Webinar" header link together
   with the existing close button, so the header's own space-between layout
   (title on the left, actions on the right) is unaffected. */
.chatbot-header-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

.chatbot-header-link {
	color: var(--color-white, #fff);
	font-size: 12.5px;
	font-weight: 600;
	text-decoration: underline;
	white-space: nowrap;
}

.chatbot-header-link:hover,
.chatbot-header-link:focus-visible {
	color: var(--color-white, #fff);
	text-decoration: none;
}

.chatbot-close-btn {
	background: transparent;
	border: none;
	color: var(--color-white, #fff);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
}

.chatbot-close-btn:hover,
.chatbot-close-btn:focus-visible {
	background: rgba(255, 255, 255, 0.18);
}

.chatbot-messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--color-light, #F5F7FA);
}

.chatbot-message {
	max-width: 82%;
	padding: 9px 13px;
	border-radius: var(--radius-10, 10px);
	font-size: 13.5px;
	line-height: 1.5;
	white-space: pre-wrap;
	word-break: break-word;
}

.chatbot-message-user {
	align-self: flex-end;
	background: var(--color-primary, #2f57ef);
	color: var(--color-white, #fff);
	border-bottom-right-radius: 2px;
}

.chatbot-message-assistant {
	align-self: flex-start;
	background: var(--color-white, #fff);
	color: var(--color-heading, #192335);
	border: 1px solid var(--color-border, #e6e3f1);
	border-bottom-left-radius: 2px;
}

.chatbot-message-error {
	align-self: flex-start;
	background: var(--danger-opacity, #FF000310);
	color: var(--color-danger, #FF0003);
	border: 1px solid var(--color-danger, #FF0003);
}

/* TASK-06N: a system notice (e.g. "registration succeeded") is never the AI
   "speaking" -- deliberately no avatar/border/alignment matching the
   assistant bubble, so it reads as a status line, not a reply. */
.chatbot-message-system {
	align-self: center;
	max-width: 92%;
	text-align: center;
	background: var(--color-light, #F5F7FA);
	color: var(--color-body, #6b7385);
	font-size: 12.5px;
	border: none;
}

/* TASK-06N: Suggested Questions -- shown once alongside the opening message,
   hidden permanently (via the [hidden] attribute, JS-controlled) once the
   first message of the session is sent. */
.chatbot-suggestions {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 0 14px 10px;
	background: var(--color-light, #F5F7FA);
}

.chatbot-suggestions[hidden] {
	display: none;
}

.chatbot-suggestions-title {
	margin: 0 0 2px;
	font-size: 12px;
	color: var(--color-body, #6b7385);
}

.chatbot-suggestion {
	align-self: flex-start;
	background: var(--color-white, #fff);
	color: var(--color-primary, #2f57ef);
	border: 1px solid var(--color-primary, #2f57ef);
	border-radius: var(--radius-big, 16px);
	padding: 7px 14px;
	font-size: 13px;
	cursor: pointer;
	text-align: left;
}

.chatbot-suggestion:hover,
.chatbot-suggestion:focus-visible {
	background: var(--color-primary, #2f57ef);
	color: var(--color-white, #fff);
}

.chatbot-suggestion:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* TASK-06N: the fixed CONSULTATION-mode CTA -- a distinct block below the
   message it belongs to, not another chat bubble. */
.chatbot-cta-group {
	align-self: flex-start;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.chatbot-cta {
	display: inline-flex;
	align-items: center;
	border-radius: var(--radius-10, 10px);
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.chatbot-cta-primary {
	background: var(--color-primary, #2f57ef);
	color: var(--color-white, #fff);
}

.chatbot-cta-primary:hover,
.chatbot-cta-primary:focus-visible {
	background: var(--color-heading, #192335);
	color: var(--color-white, #fff);
}

.chatbot-status {
	flex: 0 0 auto;
	min-height: 20px;
	padding: 0 14px;
	font-size: 12px;
	color: var(--color-body, #6b7385);
}

.chatbot-composer {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--color-border, #e6e3f1);
	background: var(--color-white, #fff);
}

.chatbot-input {
	flex: 1 1 auto;
	resize: none;
	max-height: 90px;
	border: 1px solid var(--color-border, #e6e3f1);
	border-radius: var(--radius-10, 10px);
	padding: 9px 12px;
	font-size: 13.5px;
	font-family: inherit;
	color: var(--color-heading, #192335);
}

.chatbot-input:focus-visible {
	outline: 2px solid var(--color-primary, #2f57ef);
	outline-offset: 1px;
}

.chatbot-send-btn {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	background: var(--color-primary, #2f57ef);
	color: var(--color-white, #fff);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.chatbot-send-btn:disabled {
	background: var(--color-gray, #A1A9AC);
	cursor: not-allowed;
}

.chatbot-send-btn:focus-visible,
.chatbot-launcher:focus-visible {
	outline: 2px solid var(--color-heading, #192335);
	outline-offset: 2px;
}

.chatbot-suggestion:focus-visible,
.chatbot-cta:focus-visible,
.chatbot-header-link:focus-visible {
	outline: 2px solid var(--color-heading, #192335);
	outline-offset: 2px;
}

@media (max-width: 575.98px) {
	.chatbot-widget {
		right: 12px;
		bottom: 12px;
	}

	.chatbot-panel {
		right: -12px;
		bottom: 64px;
		width: 100vw;
		max-width: 100vw;
		height: calc(100vh - 90px);
		max-height: calc(100vh - 90px);
		border-radius: var(--radius-big, 16px) var(--radius-big, 16px) 0 0;
	}

	/* TASK-06N: thumb-friendly minimum tap targets (>=44px tall) for the new
	   interactive elements, per the design doc's accessibility requirement. */
	.chatbot-suggestion,
	.chatbot-cta {
		min-height: 44px;
		padding-top: 11px;
		padding-bottom: 11px;
	}

	.chatbot-cta-group {
		flex-direction: column;
		align-items: stretch;
	}
}

/* TASK-06K.1: the canonical /chatbot page presents this SAME widget as the
   page's primary content instead of a small floating corner panel. Purely
   additive -- every rule here is scoped under body.chatbot-page-view, so no
   existing .chatbot-* selector above is changed and every other page that
   includes this same stylesheet is completely unaffected. The launcher/close
   affordances are hidden here because there is no separate "page behind it"
   to reveal on this dedicated page -- closing has no destination. */
.chatbot-page-view .chatbot-widget {
	position: static;
	max-width: 720px;
	margin: 32px auto;
	padding: 0 16px;
}

.chatbot-page-view .chatbot-launcher,
.chatbot-page-view .chatbot-close-btn {
	display: none;
}

.chatbot-page-view .chatbot-panel {
	position: static;
	width: 100%;
	max-width: 100%;
	height: 70vh;
	max-height: 640px;
	margin: 0 auto;
}

@media (max-width: 575.98px) {
	.chatbot-page-view .chatbot-widget {
		margin: 0;
		padding: 0;
	}

	.chatbot-page-view .chatbot-panel {
		height: calc(100vh - 220px);
		max-height: none;
		border-radius: var(--radius-big, 16px);
	}
}
