#aiawc-chat-root {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	/* Theme customization defaults — overridden inline per-site from plugin
	   settings (theme color, launcher size) via JS. */
	--aiawc-primary: #2271b1;
	--aiawc-launcher-size: 72px;
	--aiawc-launcher-size-transparent: 88px;
}

/* Bottom-left placement, set from the "Chat Position" setting. */
#aiawc-chat-root.aiawc-position-left {
	right: auto;
	left: 20px;
}

.aiawc-launcher {
	width: var(--aiawc-launcher-size);
	height: var(--aiawc-launcher-size);
	border-radius: 50%;
	background: var(--aiawc-primary);
	color: #ffffff;
	border: none;
	cursor: grab;
	box-shadow: 0 4px 14px rgba(0,0,0,0.25);
	font-size: calc(var(--aiawc-launcher-size) * 0.42);
	display: flex;
	align-items: center;
	justify-content: center;
	touch-action: none;
	user-select: none;
	padding: 0;
	overflow: hidden;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	-webkit-tap-highlight-color: transparent;
}

.aiawc-launcher:active {
	cursor: grabbing;
}

/* Pop the icon up slightly on hover — no background/color change, just scale + lift. */
.aiawc-launcher:hover,
.aiawc-launcher:focus-visible {
	background: var(--aiawc-primary);
	transform: scale(1.1);
	box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}

.aiawc-launcher:focus {
	outline: none;
}

/* Icon-only style has no circle to fill, so the icon can run bigger without
   looking cramped or getting clipped. */
.aiawc-launcher.aiawc-transparent {
	width: var(--aiawc-launcher-size-transparent);
	height: var(--aiawc-launcher-size-transparent);
	background: transparent;
	box-shadow: none;
}

.aiawc-launcher.aiawc-transparent:hover,
.aiawc-launcher.aiawc-transparent:focus-visible {
	background: transparent;
	box-shadow: none;
}

/* Default (circle background): crop-to-fill so the logo reads at full size
   instead of shrinking to fit inside the circle with empty space around it. */
.aiawc-launcher img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

/* Icon-only style: show the whole logo (no circle to crop against). */
.aiawc-launcher.aiawc-transparent img {
	object-fit: contain;
}

.aiawc-launcher.aiawc-dragging {
	transition: none;
	transform: none;
}

#aiawc-chat-root, #aiawc-chat-root * {
	box-sizing: border-box;
}

.aiawc-window {
	position: absolute;
	bottom: calc(var(--aiawc-launcher-size) + 16px);
	right: 0;
	width: 340px;
	max-width: 90vw;
	height: 460px;
	max-height: 70vh;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba(0,0,0,0.25);
	display: none;
	flex-direction: column;
	overflow: hidden;
	color: #1a1a1a;
}

#aiawc-chat-root.aiawc-position-left .aiawc-window {
	right: auto;
	left: 0;
}

.aiawc-window.open { display: flex; }

.aiawc-header {
	background: var(--aiawc-primary);
	color: #ffffff !important;
	padding: 12px 16px;
	font-weight: 600;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.aiawc-header span { color: #ffffff !important; }

.aiawc-header button {
	background: none;
	border: none;
	color: #ffffff !important;
	font-size: 18px;
	cursor: pointer;
}

.aiawc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	background: #f7f8fa;
	color: #1a1a1a;
}

.aiawc-msg {
	margin-bottom: 10px;
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 10px;
	font-size: 14px;
	line-height: 1.4;
	white-space: pre-wrap;
	color: #1a1a1a !important;
}

.aiawc-msg.user {
	background: var(--aiawc-primary);
	color: #ffffff !important;
	margin-left: auto;
	border-bottom-right-radius: 2px;
}

.aiawc-msg.assistant {
	background: #ffffff;
	border: 1px solid #e0e0e0;
	margin-right: auto;
	border-bottom-left-radius: 2px;
	color: #1a1a1a !important;
}

.aiawc-msg.assistant a,
.aiawc-msg.assistant strong {
	color: var(--aiawc-primary) !important;
}

.aiawc-msg.system {
	background: transparent;
	color: #888888 !important;
	font-size: 12px;
	text-align: center;
	max-width: 100%;
}

.aiawc-quote-link {
	display: inline-block;
	margin-top: 6px;
	font-size: 13px;
	color: var(--aiawc-primary) !important;
	font-weight: 600;
	text-decoration: none;
}

.aiawc-input-row {
	display: flex;
	border-top: 1px solid #e0e0e0;
	padding: 8px;
	gap: 8px;
	background: #ffffff;
}

.aiawc-input-row input {
	flex: 1;
	border: 1px solid #ccc;
	border-radius: 20px;
	padding: 8px 14px;
	font-size: 16px; /* 16px avoids iOS Safari auto-zooming into the field on focus */
	outline: none;
	background: #ffffff !important;
	color: #1a1a1a !important;
}

.aiawc-input-row input::placeholder {
	color: #999999 !important;
}

.aiawc-input-row button {
	background: var(--aiawc-primary);
	color: #ffffff !important;
	border: none;
	border-radius: 20px;
	padding: 8px 16px;
	cursor: pointer;
	font-size: 14px;
}

.aiawc-input-row button:disabled {
	opacity: 0.6;
	cursor: default;
}

.aiawc-typing {
	font-size: 12px;
	color: #999999 !important;
	padding: 0 12px 8px;
	background: #ffffff;
}

/* ---------------------------------------------------------------
   Mobile responsiveness
   - Smaller, thumb-friendly launcher.
   - The chat window goes near-full-screen instead of a small floating
     box, which is hard to use/read on small screens.
   --------------------------------------------------------------- */
@media (max-width: 480px) {
	#aiawc-chat-root {
		bottom: 14px;
		right: 14px;
	}

	#aiawc-chat-root.aiawc-position-left {
		right: auto;
		left: 14px;
	}

	.aiawc-window {
		position: fixed;
		top: 12px;
		left: 12px;
		right: 12px;
		bottom: 12px;
		width: auto;
		max-width: none;
		height: auto;
		max-height: none;
		border-radius: 16px;
	}

	.aiawc-header {
		padding: 14px 16px;
		font-size: 16px;
	}

	.aiawc-msg {
		font-size: 15px;
		max-width: 90%;
	}

	.aiawc-input-row {
		padding: 10px;
		padding-bottom: max(10px, env(safe-area-inset-bottom));
	}
}

/* Slightly bigger window on small tablets/large phones in landscape, or
   phones just above the 480px cutoff, so it isn't cramped either. */
@media (min-width: 481px) and (max-width: 700px) {
	.aiawc-window {
		width: 92vw;
		max-width: 400px;
		height: 65vh;
		max-height: 560px;
	}
}
