#stellar-chatbot-root {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#stellar-chatbot-toggle-wrap {
	position: relative;
	width: 64px;
	height: 64px;
}

#stellar-chatbot-toggle-wrap::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: #4b6ef5;
	opacity: 0.55;
	animation: stellar-chatbot-pulse 2.4s ease-out infinite;
	pointer-events: none;
}

#stellar-chatbot-toggle {
	position: relative;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 3px solid #fff;
	background: #4b6ef5;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease;
	padding: 0;
	overflow: hidden;
	animation: stellar-chatbot-bounce 3.2s ease-in-out infinite;
}

#stellar-chatbot-toggle-icon {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

#stellar-chatbot-toggle:hover {
	transform: scale(1.1);
	animation-play-state: paused;
}

#stellar-chatbot-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #ff4d5e;
	border: 2px solid #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	line-height: 1;
	color: #fff;
	pointer-events: none;
}

#stellar-chatbot-root.stellar-chatbot-open #stellar-chatbot-toggle-wrap::before,
#stellar-chatbot-root.stellar-chatbot-open #stellar-chatbot-toggle {
	animation: none;
}

#stellar-chatbot-root.stellar-chatbot-open #stellar-chatbot-badge {
	display: none;
}

#stellar-chatbot-root.stellar-chatbot-open #stellar-chatbot-toggle-wrap {
	display: none;
}

@keyframes stellar-chatbot-pulse {
	0% { transform: scale(1); opacity: 0.55; }
	70% { transform: scale(1.5); opacity: 0; }
	100% { transform: scale(1.5); opacity: 0; }
}

@keyframes stellar-chatbot-bounce {
	0%, 80%, 100% { transform: translateY(0); }
	88% { transform: translateY(-6px); }
	94% { transform: translateY(0); }
}

#stellar-chatbot-panel {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 360px;
	min-width: 300px;
	max-width: min(600px, calc(100vw - 40px));
	height: min(460px, calc(100vh - 40px));
	min-height: 320px;
	max-height: min(700px, calc(100vh - 40px));
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

#stellar-chatbot-panel[hidden] {
	display: none;
}

#stellar-chatbot-close {
	position: absolute;
	top: 8px;
	right: 8px;
	box-sizing: border-box;
	width: 26px;
	height: 26px;
	min-width: 26px;
	max-width: 26px;
	min-height: 26px;
	max-height: 26px;
	flex-shrink: 0;
	margin: 0;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 3;
}

#stellar-chatbot-close:hover {
	background: rgba(0, 0, 0, 0.55);
}

#stellar-chatbot-resize-handle {
	position: absolute;
	left: 0;
	top: 0;
	width: 24px;
	height: 24px;
	cursor: nwse-resize;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
}

#stellar-chatbot-resize-handle svg {
	width: 16px;
	height: 16px;
	color: rgba(0, 0, 0, 0.45);
	pointer-events: none;
}

#stellar-chatbot-canvas-wrap {
	width: 100%;
	flex: 0 1 240px;
	min-height: 60px;
	background: linear-gradient(180deg, #dce8ff 0%, #f3f6ff 100%);
	position: relative;
	overflow: hidden;
}

/* Thin drag strip along the bottom edge of the avatar viewer, so the chat-history
   area can be given more room without resizing the whole panel (see
   stellar-chatbot.php's title attribute for the double-click-to-minimize hint). */
#stellar-chatbot-avatar-resize-handle {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 10px;
	cursor: ns-resize;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
}

#stellar-chatbot-avatar-resize-handle span {
	width: 36px;
	height: 4px;
	border-radius: 2px;
	background: rgba(0, 0, 0, 0.2);
	pointer-events: none;
}

#stellar-chatbot-avatar-resize-handle:hover span {
	background: rgba(0, 0, 0, 0.35);
}

#stellar-chatbot-logo {
	position: absolute;
	top: -8%;
	left: 50%;
	transform: translateX(-50%);
	width: 62%;
	max-width: 220px;
	height: auto;
	opacity: 0.3;
	pointer-events: none;
	z-index: 0;
}

#stellar-chatbot-canvas {
	position: relative;
	z-index: 1;
}


#stellar-chatbot-canvas {
	width: 100%;
	height: 100%;
	display: block;
}

#stellar-chatbot-messages {
	flex: 1;
	min-height: 80px;
	overflow-y: auto;
	padding: 10px 12px;
	background: #f8f9fb;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* While the topic menu is showing (root menu right after the greeting, or any
   submenu), there are usually only 1-2 short messages — flex:1 would stretch this
   into a big empty box between the greeting and the menu buttons, especially on
   tall mobile viewports (portrait). Shrink to fit content instead; flex:1 comes
   back once the menu is hidden/emptied (composer shown, real chat in progress),
   where scrolling through a longer history is the point. */
#stellar-chatbot-messages:has(~ #stellar-chatbot-menu:not(:empty)) {
	flex: 0 1 auto;
	max-height: 45%;
}

.stellar-chatbot-msg {
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.4;
	word-wrap: break-word;
	white-space: pre-wrap;
}

.stellar-chatbot-msg.bot {
	align-self: flex-start;
	background: #e9ebf5;
	color: #222;
	border-bottom-left-radius: 2px;
}

.stellar-chatbot-readmore {
	border: none;
	background: transparent;
	color: #4b6ef5;
	font-size: 12.5px;
	font-weight: 600;
	padding: 4px 0 0;
	margin: 0;
	cursor: pointer;
}

.stellar-chatbot-readmore:hover {
	text-decoration: underline;
}

.stellar-chatbot-msg.user {
	align-self: flex-end;
	background: #4b6ef5;
	color: #fff;
	border-bottom-right-radius: 2px;
}

.stellar-chatbot-msg.system {
	align-self: center;
	color: #888;
	font-size: 12px;
	background: transparent;
}

.stellar-chatbot-typing {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 10px 14px;
}

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

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

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

@keyframes stellar-chatbot-typing-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

#stellar-chatbot-suggestions-wrap {
	flex-shrink: 0;
	background: #f8f9fb;
	border-top: 1px solid #eceff5;
}

#stellar-chatbot-suggestions-wrap:has(#stellar-chatbot-suggestions:empty) {
	display: none;
}

#stellar-chatbot-suggestions-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border: none;
	background: transparent;
	color: #6a728a;
	font-size: 11.5px;
	font-weight: 600;
	padding: 4px 12px;
	cursor: pointer;
}

#stellar-chatbot-suggestions-arrow {
	font-size: 9px;
	transition: transform 0.15s ease;
}

#stellar-chatbot-suggestions-wrap.stellar-chatbot-collapsed #stellar-chatbot-suggestions-arrow {
	transform: rotate(-90deg);
}

#stellar-chatbot-suggestions-wrap.stellar-chatbot-collapsed #stellar-chatbot-suggestions {
	display: none;
}

#stellar-chatbot-menu {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 10px 12px;
	overflow-y: auto;
}

#stellar-chatbot-menu:empty {
	display: none;
}

#stellar-chatbot-menu.stellar-chatbot-menu-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
}

#stellar-chatbot-menu.stellar-chatbot-menu-grid .stellar-chatbot-menu-back {
	grid-column: 1 / -1;
}

.stellar-chatbot-menu-btn {
	border: 1px solid #4b6ef5;
	background: #4b6ef5;
	color: #fff;
	border-radius: 12px;
	padding: 10px 14px;
	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.4;
	text-align: left;
	text-transform: none;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#stellar-chatbot-menu.stellar-chatbot-menu-grid .stellar-chatbot-menu-btn {
	text-align: center;
}

.stellar-chatbot-menu-btn:hover {
	background: #1f2f66;
	border-color: #1f2f66;
	color: #fff;
}

.stellar-chatbot-menu-back {
	align-self: flex-start;
	border: none;
	background: transparent;
	color: #6a728a;
	font-size: 12px;
	font-weight: 600;
	padding: 2px 4px;
	cursor: pointer;
}

.stellar-chatbot-menu-back:hover {
	text-decoration: underline;
}

#stellar-chatbot-suggestions {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
	gap: 6px;
	padding: 0 12px 8px;
	background: #f8f9fb;
	flex-shrink: 0;
	scrollbar-width: thin;
}

#stellar-chatbot-suggestions:empty {
	padding: 0;
}

#stellar-chatbot-suggestions::-webkit-scrollbar {
	height: 4px;
}

#stellar-chatbot-suggestions::-webkit-scrollbar-thumb {
	background: #c7d0f0;
	border-radius: 4px;
}

.stellar-chatbot-suggestion {
	border: 1px solid #c7d0f0;
	background: #fff;
	color: #4b6ef5;
	border-radius: 14px;
	padding: 6px 12px;
	font-size: 12.5px;
	line-height: 1.3;
	text-transform: none;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	scroll-snap-align: start;
	transition: background 0.15s ease, color 0.15s ease;
}

.stellar-chatbot-suggestion:hover {
	background: #4b6ef5;
	color: #fff;
}

#stellar-chatbot-menu-return {
	flex-shrink: 0;
	border: none;
	border-top: 1px solid #eceff5;
	background: #f8f9fb;
	color: #6a728a;
	font-size: 11.5px;
	font-weight: 600;
	padding: 5px 12px;
	text-align: left;
	cursor: pointer;
}

#stellar-chatbot-menu-return:hover {
	color: #4b6ef5;
}

#stellar-chatbot-menu-return[hidden] {
	display: none;
}

#stellar-chatbot-form {
	display: flex;
	border-top: 1px solid #e5e7ee;
	padding: 8px;
	gap: 8px;
	background: #fff;
	flex-shrink: 0;
}

/* The explicit `display: flex` above wins over the browser's default
   `[hidden] { display: none }` UA rule, so setting the hidden attribute alone
   doesn't hide this — it needs its own override to actually disappear while
   the topic menu is showing. */
#stellar-chatbot-form[hidden] {
	display: none;
}

#stellar-chatbot-input {
	flex: 1;
	border: 1px solid #d9dce5;
	border-radius: 20px;
	padding: 8px 14px;
	font-size: 14px;
	outline: none;
}

#stellar-chatbot-input:disabled {
	background: #f0f1f5;
	color: #999;
	cursor: not-allowed;
}

#stellar-chatbot-form button {
	border: none;
	background: #4b6ef5;
	color: #fff;
	border-radius: 20px;
	padding: 8px 16px;
	font-size: 14px;
	cursor: pointer;
}

#stellar-chatbot-form button:disabled {
	background: #aab4d6;
	cursor: not-allowed;
}

/* Phone screens: below 600px width. #stellar-chatbot-panel intentionally has NO
   override here anymore — the base rule (line ~100) already sizes it compactly
   and responsively (width capped by max-width: min(600px, calc(100vw - 40px)),
   height by min(460px, calc(100vh - 40px))), anchored via right:0/bottom:0
   inside #stellar-chatbot-root's fixed corner. That's the same compact,
   corner-anchored card look on phone as on desktop — a full-screen override
   here was both unnecessary and the cause of a resize-handle bug (setting an
   explicit width/height while top+left+right+bottom were all constrained at
   once made the browser drop right/bottom and re-anchor at top-left mid-drag).
   Both resize handles stay enabled; initResizeHandle's mobile clamp (see
   chatbot.js) still applies a tighter viewport margin than desktop's. */
@media (max-width: 600px) {
	#stellar-chatbot-root {
		right: 10px;
		bottom: 10px;
	}

	#stellar-chatbot-canvas-wrap {
		flex: 0 0 180px;
	}

	#stellar-chatbot-toggle-wrap {
		width: 56px;
		height: 56px;
	}

	/* iOS Safari zooms the whole page in when a focused input's font-size is
	   under 16px — bump it here so tapping the message box doesn't trigger that. */
	#stellar-chatbot-input {
		font-size: 16px;
	}
}
