/* ===================================================================
 * Chatbot VNDC widget — minimal, không phụ thuộc framework CSS nào.
 * Toàn bộ class đều prefix --gcv-- để khỏi đụng theme WP.
 * Biến --gcv-color được JS set từ config.primary_color.
 * =================================================================== */

#gau-chatbot-vndc-root {
	--gcv-color: #1e88e5;
	--gcv-color-fg: #fff;
	--gcv-radius: 14px;
	--gcv-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===================================================================
 * Reset chống theme/Elementor đè style vào button + input
 * Tăng specificity bằng cách bọc trong #gau-chatbot-vndc-root.
 * =================================================================== */

#gau-chatbot-vndc-root,
#gau-chatbot-vndc-root *,
#gau-chatbot-vndc-root *::before,
#gau-chatbot-vndc-root *::after {
	box-sizing: border-box;
}

#gau-chatbot-vndc-root button,
#gau-chatbot-vndc-root input,
#gau-chatbot-vndc-root textarea {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background-image: none;
	text-transform: none;
	letter-spacing: normal;
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
	margin: 0;
	box-shadow: none;
}

/* Diệt mũi tên spinner của số (một số theme apply cho cả textarea) */
#gau-chatbot-vndc-root input::-webkit-outer-spin-button,
#gau-chatbot-vndc-root input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
#gau-chatbot-vndc-root textarea {
	resize: none;
	overflow-y: auto;
}
#gau-chatbot-vndc-root .gcv-input::-webkit-scrollbar { width: 6px; }
#gau-chatbot-vndc-root .gcv-input::-webkit-scrollbar-thumb {
	background: #c5cad3; border-radius: 3px;
}

.gcv-launcher {
	position: fixed;
	bottom: 24px;
	z-index: 2147483600;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px 12px 14px;
	border: 0;
	border-radius: 999px;
	background: var(--gcv-color);
	color: var(--gcv-color-fg);
	font-size: 15px;
	font-weight: 600;
	box-shadow: var(--gcv-shadow);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gcv-launcher:hover { transform: translateY(-2px); }
.gcv-launcher--right { right: 24px; }
.gcv-launcher--left  { left: 24px;  }
.gcv-launcher__icon {
	width: 22px; height: 22px; display: inline-block; flex: none;
}

.gcv-panel {
	position: fixed;
	bottom: 90px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 120px);
	z-index: 2147483601;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: var(--gcv-radius);
	box-shadow: var(--gcv-shadow);
	overflow: hidden;
	opacity: 0;
	transform: translateY(10px);
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
}
.gcv-panel--right { right: 24px; }
.gcv-panel--left  { left: 24px;  }
.gcv-panel--open {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.gcv-header {
	padding: 14px 16px;
	background: var(--gcv-color);
	color: var(--gcv-color-fg);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}
.gcv-header__title    { font-weight: 700; font-size: 16px; line-height: 1.2; }
.gcv-header__subtitle { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.gcv-header__close {
	background: transparent;
	border: 0;
	color: var(--gcv-color-fg);
	cursor: pointer;
	padding: 4px;
	border-radius: 6px;
	opacity: 0.8;
}
.gcv-header__close:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }

.gcv-body {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: #f7f8fa;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.gcv-msg {
	max-width: 80%;
	padding: 9px 13px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
}
.gcv-msg--bot {
	align-self: flex-start;
	background: #fff;
	color: #222;
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.gcv-msg--user {
	align-self: flex-end;
	background: var(--gcv-color);
	color: var(--gcv-color-fg);
	border-bottom-right-radius: 4px;
}
.gcv-msg--error {
	align-self: flex-start;
	background: #ffe9e9;
	color: #b00020;
	font-size: 13px;
}

.gcv-typing {
	align-self: flex-start;
	padding: 10px 14px;
	background: #fff;
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	display: flex;
	gap: 4px;
}
.gcv-typing span {
	width: 7px; height: 7px;
	background: #b8bcc4;
	border-radius: 50%;
	animation: gcv-blink 1.2s infinite both;
}
.gcv-typing span:nth-child(2) { animation-delay: 0.2s; }
.gcv-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes gcv-blink {
	0%, 80%, 100% { opacity: 0.25; }
	40%           { opacity: 1; }
}

.gcv-footer {
	border-top: 1px solid #e7e9ee;
	background: #fff;
	padding: 10px 12px;
	display: flex;
	gap: 8px;
	align-items: flex-end;
}
.gcv-input {
	flex: 1;
	resize: none;
	border: 1px solid #d8dbe2;
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 14px;
	font-family: inherit;
	line-height: 1.4;
	max-height: 120px;
	outline: none;
	transition: border-color 0.15s;
}
.gcv-input:focus { border-color: var(--gcv-color); }
.gcv-send {
	background: var(--gcv-color);
	color: var(--gcv-color-fg);
	border: 0;
	border-radius: 10px;
	padding: 0 14px;
	height: 38px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
}
.gcv-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 480px) {
	.gcv-panel {
		width: calc(100vw - 16px);
		height: calc(100vh - 100px);
		bottom: 80px;
	}
	.gcv-panel--right { right: 8px; }
	.gcv-panel--left  { left: 8px;  }
	.gcv-launcher--right { right: 16px; bottom: 16px; }
	.gcv-launcher--left  { left: 16px;  bottom: 16px; }
}
