/* Chatbot widget — layout inspired by provided mockup */

.chatbot-widget-root {
	position: fixed;
	z-index: 999999;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: #1a2744;
}

.chatbot-widget-root.chatbot-pos-right {
	right: 20px;
	bottom: 20px;
}

.chatbot-widget-root.chatbot-pos-left {
	left: 20px;
	bottom: 20px;
}

.chatbot-toggle {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: var(--chatbot-primary, #6c63ff);
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	transition: transform 0.15s ease;
}

.chatbot-toggle:hover {
	transform: scale(1.05);
}

.chatbot-panel {
	position: absolute;
	bottom: 72px;
	width: min(380px, calc(100vw - 40px));
	height: min(560px, calc(100vh - 120px));
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.chatbot-pos-right .chatbot-panel {
	right: 0;
}

.chatbot-pos-left .chatbot-panel {
	left: 0;
}

.chatbot-panel[hidden] {
	display: none !important;
}

.chatbot-header {
	background: linear-gradient(135deg, var(--chatbot-primary, #6c63ff) 0%, #4b6cb7 100%);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.chatbot-header-avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid rgba(255, 255, 255, 0.35);
	flex-shrink: 0;
	background: rgba(255, 255, 255, 0.2);
}

.chatbot-header-text {
	flex: 1;
	min-width: 0;
}

.chatbot-header-name {
	font-weight: 700;
	font-size: 16px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.chatbot-ai-badge {
	font-size: 10px;
	font-weight: 600;
	background: rgba(255, 255, 255, 0.25);
	padding: 2px 6px;
	border-radius: 6px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.chatbot-header-sub {
	font-size: 12px;
	opacity: 0.92;
	margin-top: 2px;
}

.chatbot-close {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	border: none;
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	flex-shrink: 0;
}

.chatbot-close:hover {
	background: rgba(255, 255, 255, 0.35);
}

.chatbot-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: #fff;
}

.chatbot-tab-panel {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.chatbot-tab-panel[hidden] {
	display: none !important;
}

.chatbot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #fafbff;
}

.chatbot-msg {
	max-width: 92%;
	margin-bottom: 12px;
	word-wrap: break-word;
	white-space: pre-wrap;
}

.chatbot-msg-bot {
	margin-right: auto;
	color: #1a2744;
}

.chatbot-msg-user {
	margin-left: auto;
	background: #ede9ff;
	padding: 10px 14px;
	border-radius: 14px 14px 4px 14px;
	color: #1a2744;
}

.chatbot-msg-bot-inner {
	background: #fff;
	padding: 10px 14px;
	border-radius: 14px 14px 14px 4px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chatbot-msg-bot-inner p {
	margin: 0 0 0.5em;
}

.chatbot-msg-bot-inner p:last-child {
	margin-bottom: 0;
}

.chatbot-msg-bot-inner a {
	color: var(--chatbot-primary, #6c63ff);
	word-break: break-all;
	text-decoration: underline;
}

.chatbot-msg-bot-inner a:hover {
	opacity: 0.8;
}

.chatbot-msg-bot-inner h1,
.chatbot-msg-bot-inner h2,
.chatbot-msg-bot-inner h3,
.chatbot-msg-bot-inner h4,
.chatbot-msg-bot-inner h5,
.chatbot-msg-bot-inner h6 {
	margin: 0.6em 0 0.3em;
	font-weight: 700;
	line-height: 1.3;
}

.chatbot-msg-bot-inner h1 { font-size: 1.25em; }
.chatbot-msg-bot-inner h2 { font-size: 1.1em; }
.chatbot-msg-bot-inner h3 { font-size: 1em; }

.chatbot-msg-bot-inner ul,
.chatbot-msg-bot-inner ol {
	margin: 0.4em 0 0.4em 1.4em;
	padding: 0;
}

.chatbot-msg-bot-inner li {
	margin-bottom: 0.2em;
}

.chatbot-msg-bot-inner strong,
.chatbot-msg-bot-inner b {
	font-weight: 700;
}

.chatbot-msg-bot-inner em,
.chatbot-msg-bot-inner i {
	font-style: italic;
}

.chatbot-msg-bot-inner table {
	border-collapse: collapse;
	width: 100%;
	font-size: 0.9em;
	margin: 0.5em 0;
}

.chatbot-msg-bot-inner th,
.chatbot-msg-bot-inner td {
	border: 1px solid #ddd;
	padding: 5px 8px;
	text-align: left;
}

.chatbot-msg-bot-inner th {
	background: #f5f5f5;
	font-weight: 700;
}

.chatbot-msg-bot-inner img {
	max-width: 100%;
	height: auto;
	border-radius: 6px;
	margin: 4px 0;
}

.chatbot-msg-bot-inner iframe {
	max-width: 100%;
	border: none;
	border-radius: 6px;
	margin: 6px 0;
	display: block;
}

.chatbot-typing {
	display: inline-flex;
	gap: 4px;
	padding: 8px 0;
}

.chatbot-typing span {
	width: 6px;
	height: 6px;
	background: #6c63ff;
	border-radius: 50%;
	animation: chatbot-bounce 1.2s infinite ease-in-out both;
}

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

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

@keyframes chatbot-bounce {
	0%,
	80%,
	100% {
		transform: scale(0.6);
		opacity: 0.5;
	}
	40% {
		transform: scale(1);
		opacity: 1;
	}
}

.chatbot-input-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid #eef0f4;
	background: #fff;
}

.chatbot-attach {
	border: none;
	background: transparent;
	cursor: pointer;
	font-size: 18px;
	opacity: 0.45;
	padding: 4px;
}

.chatbot-input {
	flex: 1;
	border: none;
	background: #f0f2f7;
	border-radius: 12px;
	padding: 10px 12px;
	font-size: 14px;
	outline: none;
}

.chatbot-input::placeholder {
	color: #8b93a7;
}

.chatbot-send {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: none;
	background: #2f6fed;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.chatbot-send:hover {
	filter: brightness(1.05);
}

.chatbot-tabs {
	display: flex;
	border-top: 1px solid #eef0f4;
	background: #fff;
}

.chatbot-tab {
	flex: 1;
	border: none;
	background: transparent;
	padding: 10px 4px 12px;
	cursor: pointer;
	font-size: 11px;
	color: #8b93a7;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	position: relative;
}

.chatbot-tab-icon {
	font-size: 18px;
	line-height: 1;
}

.chatbot-tab.is-active {
	color: #1a2744;
	font-weight: 600;
}

.chatbot-tab.is-active::before {
	content: "";
	position: absolute;
	top: 0;
	left: 20%;
	right: 20%;
	height: 3px;
	background: #1a2744;
	border-radius: 0 0 3px 3px;
}

.chatbot-history-list {
	flex: 1;
	overflow-y: auto;
	padding: 12px 16px;
	font-size: 13px;
	color: #1a2744;
}

.chatbot-history-item {
	margin-bottom: 14px;
	padding-bottom: 12px;
	border-bottom: 1px solid #eef0f4;
}

.chatbot-history-item:last-child {
	border-bottom: none;
}

.chatbot-history-meta {
	font-size: 11px;
	color: #8b93a7;
	margin-bottom: 4px;
}

@media (max-width: 480px) {
	.chatbot-panel {
		width: calc(100vw - 24px);
		height: min(70vh, 520px);
		bottom: 68px;
	}
}
