/**
 * TCL Quote Bot — Chat Widget Styles
 *
 * Floating launcher button + expandable chat panel.
 * No framework, no build tooling.
 *
 * @package TCL_Quote_Bot
 */

/* ── CSS Custom Properties ───────────────────────────────────────────────── */

:root {
	--tcl-bot-primary:        #1a56a0;
	--tcl-bot-primary-dark:   #143f7d;
	--tcl-bot-primary-light:  #e8f0fb;
	--tcl-bot-accent:         #e8a020;
	--tcl-bot-text:           #1a1a2e;
	--tcl-bot-text-light:     #555566;
	--tcl-bot-bg:             #ffffff;
	--tcl-bot-bg-alt:         #f5f7fa;
	--tcl-bot-border:         #dde3ec;
	--tcl-bot-radius:         14px;
	--tcl-bot-shadow:         0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
	--tcl-bot-font:           -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--tcl-bot-panel-width:    380px;
	--tcl-bot-panel-height:   540px;
	--tcl-bot-z:              999999;
}

/* ── Launcher Button ─────────────────────────────────────────────────────── */

#tcl-bot-launcher {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: var(--tcl-bot-z);
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: var(--tcl-bot-primary);
	border: none;
	cursor: pointer;
	box-shadow: var(--tcl-bot-shadow);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, transform 0.2s ease;
	outline: none;
	padding: 0;
}

#tcl-bot-launcher:hover {
	background: var(--tcl-bot-primary-dark);
	transform: scale(1.06);
}

#tcl-bot-launcher:focus-visible {
	outline: 3px solid var(--tcl-bot-accent);
	outline-offset: 2px;
}

#tcl-bot-launcher svg {
	width: 28px;
	height: 28px;
	fill: #fff;
	transition: transform 0.25s ease, opacity 0.2s ease;
}

#tcl-bot-launcher .tcl-bot-icon-close {
	display: none;
}

#tcl-bot-launcher[aria-expanded="true"] .tcl-bot-icon-open {
	display: none;
}

#tcl-bot-launcher[aria-expanded="true"] .tcl-bot-icon-close {
	display: block;
}

/* Unread indicator badge */
#tcl-bot-launcher .tcl-bot-badge {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--tcl-bot-accent);
	border: 2px solid #fff;
	display: none;
}

#tcl-bot-launcher .tcl-bot-badge.visible {
	display: block;
}

/* ── Chat Panel ──────────────────────────────────────────────────────────── */

#tcl-bot-panel {
	position: fixed;
	bottom: 96px;
	right: 24px;
	z-index: var(--tcl-bot-z);
	width: var(--tcl-bot-panel-width);
	height: var(--tcl-bot-panel-height);
	border-radius: var(--tcl-bot-radius);
	background: var(--tcl-bot-bg);
	box-shadow: var(--tcl-bot-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform-origin: bottom right;

	/* Hidden state */
	opacity: 0;
	visibility: hidden;
	transform: scale(0.92) translateY(12px);
	pointer-events: none;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s ease 0.22s;
}

#tcl-bot-panel.open {
	opacity: 1;
	visibility: visible;
	transform: scale(1) translateY(0);
	pointer-events: auto;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s ease 0s;
}

/* ── Panel Header ────────────────────────────────────────────────────────── */

#tcl-bot-header {
	background: var(--tcl-bot-primary);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}

#tcl-bot-header .tcl-bot-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255,255,255,0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 18px;
}

#tcl-bot-header .tcl-bot-header-text {
	flex: 1;
	min-width: 0;
}

#tcl-bot-header .tcl-bot-name {
	font-weight: 600;
	font-size: 14px;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#tcl-bot-header .tcl-bot-status {
	font-size: 11px;
	opacity: 0.8;
}

#tcl-bot-header .tcl-bot-header-close {
	background: none;
	border: none;
	color: rgba(255,255,255,0.8);
	cursor: pointer;
	padding: 4px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s;
	flex-shrink: 0;
}

#tcl-bot-header .tcl-bot-header-close:hover {
	color: #fff;
}

#tcl-bot-header .tcl-bot-header-close svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

#tcl-bot-header .tcl-bot-header-back {
	background: none;
	border: none;
	color: rgba(255,255,255,0.8);
	cursor: pointer;
	padding: 4px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s, background-color 0.15s;
	flex-shrink: 0;
}

#tcl-bot-header .tcl-bot-header-back:hover {
	color: #fff;
}

#tcl-bot-header .tcl-bot-header-back svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

[dir="rtl"] .tcl-bot-header-back,
.tcl-bot-rtl .tcl-bot-header-back {
	transform: scaleX(-1);
}

/* ── Messages Area ───────────────────────────────────────────────────────── */

#tcl-bot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scroll-behavior: smooth;
}

/* Message bubbles */
.tcl-bot-msg {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	animation: tcl-bot-fade-in 0.2s ease;
}

.tcl-bot-msg--bot {
	justify-content: flex-start;
}

.tcl-bot-msg--user {
	justify-content: flex-end;
}

.tcl-bot-msg--bot .tcl-bot-msg-avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--tcl-bot-primary-light);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex-shrink: 0;
}

.tcl-bot-msg--user .tcl-bot-msg-avatar {
	display: none;
}

.tcl-bot-bubble {
	max-width: 78%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.5;
	word-break: break-word;
	font-family: var(--tcl-bot-font);
}

.tcl-bot-msg--bot .tcl-bot-bubble {
	background: var(--tcl-bot-bg-alt);
	color: var(--tcl-bot-text);
	border-bottom-left-radius: 4px;
}

.tcl-bot-msg--user .tcl-bot-bubble {
	background: var(--tcl-bot-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
}

/* Typing indicator */
.tcl-bot-typing {
	display: flex;
	gap: 4px;
	padding: 10px 14px;
	background: var(--tcl-bot-bg-alt);
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	width: fit-content;
}

.tcl-bot-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--tcl-bot-text-light);
	animation: tcl-bot-bounce 1.2s infinite ease-in-out;
}

.tcl-bot-typing span:nth-child(2) { animation-delay: 0.15s; }
.tcl-bot-typing span:nth-child(3) { animation-delay: 0.30s; }

@keyframes tcl-bot-bounce {
	0%, 60%, 100% { transform: translateY(0); }
	30%            { transform: translateY(-5px); }
}

@keyframes tcl-bot-fade-in {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ── Fallback Panel ──────────────────────────────────────────────────────── */

.tcl-bot-fallback {
	background: #fff8ec;
	border: 1px solid #f5d27a;
	border-radius: 10px;
	padding: 12px 14px;
	font-size: 13px;
	color: var(--tcl-bot-text);
	line-height: 1.5;
}

.tcl-bot-fallback p {
	margin: 0 0 10px;
}

.tcl-bot-fallback .tcl-bot-fallback-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.tcl-bot-fallback a {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 7px 13px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	transition: background 0.15s;
}

.tcl-bot-fallback a.tcl-bot-fallback-form {
	background: var(--tcl-bot-primary);
	color: #fff;
}

.tcl-bot-fallback a.tcl-bot-fallback-form:hover {
	background: var(--tcl-bot-primary-dark);
}

.tcl-bot-fallback a.tcl-bot-fallback-wa {
	background: #25d366;
	color: #fff;
}

.tcl-bot-fallback a.tcl-bot-fallback-wa:hover {
	background: #1da851;
}

/* ── Input Area ──────────────────────────────────────────────────────────── */

#tcl-bot-input-area {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--tcl-bot-border);
	background: var(--tcl-bot-bg);
	flex-shrink: 0;
}

#tcl-bot-input {
	flex: 1;
	min-height: 36px;
	max-height: 100px;
	resize: none;
	border: 1px solid var(--tcl-bot-border);
	border-radius: 10px;
	padding: 8px 12px;
	font-size: 14px;
	font-family: var(--tcl-bot-font);
	color: var(--tcl-bot-text);
	background: var(--tcl-bot-bg-alt);
	outline: none;
	line-height: 1.5;
	transition: border-color 0.15s;
	overflow-y: auto;
}

#tcl-bot-input:focus {
	border-color: var(--tcl-bot-primary);
}

/* P7: validation error state — red ring, ID-scoped + literal hex to beat theme resets */
#tcl-bot-input-area .tcl-bot-input--error,
#tcl-bot-input.tcl-bot-input--error {
	border-color: #d23f3f !important;
	box-shadow: 0 0 0 2px rgba(210, 63, 63, 0.18);
}

#tcl-bot-input::placeholder {
	color: #aab;
}

#tcl-bot-send {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--tcl-bot-primary);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.15s, transform 0.1s;
	padding: 0;
}

#tcl-bot-send:hover {
	background: var(--tcl-bot-primary-dark);
}

#tcl-bot-send:active {
	transform: scale(0.94);
}

#tcl-bot-send:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

#tcl-bot-send svg {
	width: 20px;
	height: 20px;
	fill: #fff;
}

/* ── Privacy notice ──────────────────────────────────────────────────────── */

#tcl-bot-privacy {
	text-align: center;
	font-size: 10px;
	color: var(--tcl-bot-text-light);
	padding: 4px 12px 8px;
	flex-shrink: 0;
}

/* ── Service Menu ────────────────────────────────────────────────────────── */

#tcl-bot-menu.tcl-bot-mode-menu {
	flex: 1;
	overflow-y: auto;
	padding: 14px 12px 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: var(--tcl-bot-bg-alt);
}

.tcl-bot-menu-intro {
	font-size: 13px;
	font-weight: 500;
	color: var(--tcl-bot-text-light);
	padding: 2px 0 4px;
	line-height: 1.4;
}

.tcl-bot-svc-btns {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Service card buttons — rendered as <a> anchors */
.tcl-bot-svc-btn {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 12px 14px;
	min-height: 44px;
	background: var(--tcl-bot-bg);
	border: 1.5px solid var(--tcl-bot-border);
	border-radius: 10px;
	font-family: var(--tcl-bot-font);
	font-size: 14px;
	font-weight: 600;
	color: var(--tcl-bot-text);
	text-decoration: none;
	text-align: left;
	box-shadow: 0 2px 8px rgba(26, 86, 160, 0.07);
	cursor: pointer;
	transition: background 0.16s ease, border-color 0.16s ease,
	            transform 0.14s ease, box-shadow 0.16s ease;
	outline: none;
	box-sizing: border-box;
}

.tcl-bot-svc-btn:hover {
	background: var(--tcl-bot-primary-light);
	border-color: #4a7fc1;
	transform: translateY(-1px);
	box-shadow: 0 4px 14px rgba(26, 86, 160, 0.14);
	color: var(--tcl-bot-text);
	text-decoration: none;
}

.tcl-bot-svc-btn:focus-visible {
	outline: 3px solid var(--tcl-bot-accent);
	outline-offset: 2px;
}

.tcl-bot-svc-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(26, 86, 160, 0.10);
}

/* "Autre / j'ai une question" — secondary ghost style */
.tcl-bot-autre-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 44px;
	padding: 10px 14px;
	margin-top: 4px;
	background: transparent;
	border: 1.5px solid var(--tcl-bot-border);
	border-radius: 10px;
	font-family: var(--tcl-bot-font);
	font-size: 13px;
	font-weight: 500;
	color: var(--tcl-bot-primary);
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
	outline: none;
	box-sizing: border-box;
}

.tcl-bot-autre-btn:hover {
	background: var(--tcl-bot-primary-light);
	border-color: #4a7fc1;
	color: var(--tcl-bot-primary);
}

.tcl-bot-autre-btn:focus-visible {
	outline: 3px solid var(--tcl-bot-accent);
	outline-offset: 2px;
}

.tcl-bot-autre-btn:active {
	background: var(--tcl-bot-primary-light);
}

/* ── RTL support (Arabic) ─────────────────────────────────────────────────── */

[dir="rtl"] #tcl-bot-launcher,
.tcl-bot-rtl #tcl-bot-launcher {
	right: auto;
	left: 24px;
}

[dir="rtl"] #tcl-bot-panel,
.tcl-bot-rtl #tcl-bot-panel {
	right: auto;
	left: 24px;
	transform-origin: bottom left;
}

[dir="rtl"] .tcl-bot-msg--bot,
.tcl-bot-rtl .tcl-bot-msg--bot {
	flex-direction: row-reverse;
}

[dir="rtl"] .tcl-bot-msg--bot .tcl-bot-bubble,
.tcl-bot-rtl .tcl-bot-msg--bot .tcl-bot-bubble {
	border-radius: 16px;
	border-bottom-right-radius: 4px;
	border-bottom-left-radius: 16px;
}

[dir="rtl"] .tcl-bot-msg--user .tcl-bot-bubble,
.tcl-bot-rtl .tcl-bot-msg--user .tcl-bot-bubble {
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	border-bottom-right-radius: 16px;
}

/* RTL — Service Menu */
[dir="rtl"] .tcl-bot-menu-intro,
.tcl-bot-rtl .tcl-bot-menu-intro {
	text-align: right;
}

[dir="rtl"] .tcl-bot-svc-btn,
.tcl-bot-rtl .tcl-bot-svc-btn {
	text-align: right;
	flex-direction: row-reverse;
}

[dir="rtl"] .tcl-bot-autre-btn,
.tcl-bot-rtl .tcl-bot-autre-btn {
	text-align: right;
}

/* ── Quick-reply Chips (flow mode) ──────────────────────────────────────── */

.tcl-bot-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	padding: 4px 12px 8px;
	animation: tcl-bot-fade-in 0.18s ease;
}

.tcl-bot-chip {
	display: inline-flex;
	align-items: center;
	padding: 7px 14px;
	border-radius: 20px;
	background: var(--tcl-bot-bg);
	border: 1.5px solid var(--tcl-bot-primary);
	color: var(--tcl-bot-primary);
	font-family: var(--tcl-bot-font);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
	outline: none;
	line-height: 1.3;
	white-space: nowrap;
}

.tcl-bot-chip:hover {
	background: var(--tcl-bot-primary-light);
	border-color: var(--tcl-bot-primary-dark);
}

.tcl-bot-chip:focus-visible {
	outline: 3px solid var(--tcl-bot-accent);
	outline-offset: 2px;
}

.tcl-bot-chip:active {
	background: var(--tcl-bot-primary);
	color: #fff;
}

/* "Passer" / Skip chip — secondary ghost */
.tcl-bot-chip--skip {
	border-color: var(--tcl-bot-border);
	color: var(--tcl-bot-text-light);
	font-style: italic;
}

.tcl-bot-chip--skip:hover {
	background: var(--tcl-bot-bg-alt);
	border-color: var(--tcl-bot-text-light);
	color: var(--tcl-bot-text);
}

/* "← Modifier" chip — inside recap */
.tcl-bot-chip--modify {
	border-color: var(--tcl-bot-border);
	color: var(--tcl-bot-primary);
	margin-top: 8px;
	font-style: normal;
}

.tcl-bot-chip--modify:hover {
	background: var(--tcl-bot-primary-light);
}

/* Skip row (sits below chips area, above input) */
.tcl-bot-skip-row {
	padding: 2px 12px 6px;
	display: flex;
	gap: 6px;
}

/* ── Recap card ──────────────────────────────────────────────────────────── */

.tcl-bot-bubble--recap {
	background: var(--tcl-bot-bg);
	border: 1.5px solid var(--tcl-bot-border);
	padding: 14px 16px;
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	max-width: 88%;
}

.tcl-bot-recap-heading {
	font-size: 13px;
	font-weight: 600;
	color: var(--tcl-bot-primary);
	margin-bottom: 10px;
}

.tcl-bot-recap-list {
	margin: 0 0 12px;
	padding: 0;
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 4px 12px;
}

.tcl-bot-recap-list dt {
	font-size: 12px;
	font-weight: 600;
	color: var(--tcl-bot-text-light);
	white-space: nowrap;
}

.tcl-bot-recap-list dd {
	font-size: 13px;
	color: var(--tcl-bot-text);
	margin: 0;
	word-break: break-word;
}

/* ── Consent row ─────────────────────────────────────────────────────────── */

.tcl-bot-consent-row {
	margin-top: 12px;
	padding-top: 10px;
	border-top: 1px solid var(--tcl-bot-border);
}

.tcl-bot-consent-label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 12px;
	color: var(--tcl-bot-text);
	cursor: pointer;
	line-height: 1.5;
}

.tcl-bot-consent-check {
	margin-top: 2px;
	flex-shrink: 0;
	accent-color: var(--tcl-bot-primary);
	cursor: pointer;
}

.tcl-bot-consent-label a {
	color: var(--tcl-bot-primary);
	text-decoration: underline;
}

/* ── Submit button (recap) ───────────────────────────────────────────────── */

.tcl-bot-submit-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin-top: 12px;
	padding: 10px 16px;
	background: var(--tcl-bot-primary);
	border: none;
	border-radius: 10px;
	font-family: var(--tcl-bot-font);
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	cursor: pointer;
	transition: background 0.15s, transform 0.1s;
	outline: none;
}

.tcl-bot-submit-btn:hover {
	background: var(--tcl-bot-primary-dark);
}

.tcl-bot-submit-btn:active {
	transform: scale(0.97);
}

.tcl-bot-submit-btn:focus-visible {
	outline: 3px solid var(--tcl-bot-accent);
	outline-offset: 2px;
}

.tcl-bot-submit-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── RTL — chips & recap ─────────────────────────────────────────────────── */

[dir="rtl"] .tcl-bot-chips,
.tcl-bot-rtl .tcl-bot-chips {
	direction: rtl;
}

[dir="rtl"] .tcl-bot-chip,
.tcl-bot-rtl .tcl-bot-chip {
	direction: rtl;
}

[dir="rtl"] .tcl-bot-recap-list,
.tcl-bot-rtl .tcl-bot-recap-list {
	direction: rtl;
}

[dir="rtl"] .tcl-bot-consent-label,
.tcl-bot-rtl .tcl-bot-consent-label {
	direction: rtl;
	text-align: right;
}

/* ── Mobile scrim / backdrop (item 6) ───────────────────────────────────── */

#tcl-bot-scrim {
	display: none; /* hidden on desktop and when closed */
}

@media (max-width: 480px) {
	#tcl-bot-scrim {
		display: none;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: calc(var(--tcl-bot-z) - 1);
	}

	#tcl-bot-scrim.open {
		display: block;
	}
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
	#tcl-bot-panel {
		right: 0;
		bottom: 0;
		width: 100%;
		height: 85vh;
		border-radius: var(--tcl-bot-radius) var(--tcl-bot-radius) 0 0;
		transform-origin: bottom center;
	}

	[dir="rtl"] #tcl-bot-panel,
	.tcl-bot-rtl #tcl-bot-panel {
		left: 0;
		right: 0;
	}

	#tcl-bot-launcher {
		bottom: 16px;
		right: 16px;
	}

	/* Mobile — Service Menu: full-width cards, comfortable tap targets */
	#tcl-bot-menu.tcl-bot-mode-menu {
		padding: 12px 10px 10px;
	}

	.tcl-bot-svc-btn {
		width: 100%;
		min-height: 48px;
		font-size: 15px;
	}

	.tcl-bot-autre-btn {
		width: 100%;
		min-height: 48px;
		font-size: 14px;
	}

	/* Mobile chips — slightly larger tap targets */
	.tcl-bot-chip {
		padding: 9px 16px;
		font-size: 14px;
	}

	/* Mobile recap */
	.tcl-bot-bubble--recap {
		max-width: 96%;
	}
}

/* ── Avatar image ────────────────────────────────────────────────────────────
   When config.avatarUrl is present the JS renders <img class="tcl-bot-avatar-img">
   inside the .tcl-bot-avatar wrapper instead of the emoji. ── */

.tcl-bot-avatar-img {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: contain;
	background: #fff;
	display: block;
}

/* Inline SVG icons (replaces former emoji) */
.tcl-bot-ic { width: 1em; height: 1em; fill: currentColor; vertical-align: -0.125em; flex-shrink: 0; }
.tcl-bot-greet-ic { width: 1.05em; height: 1.05em; margin-inline-start: 6px; vertical-align: -0.18em; }

/* SVG fallback avatar — fill the avatar box like the <img> does */
.tcl-bot-avatar .tcl-bot-avatar-ic,
.tcl-bot-msg-avatar .tcl-bot-avatar-ic,
.tcl-bot-teaser-avatar .tcl-bot-avatar-ic { width: 64%; height: 64%; fill: var(--tcl-bot-primary); }

/* Header + hero avatars sit on dark blue → white glyph */
#tcl-bot-header .tcl-bot-avatar .tcl-bot-avatar-ic,
.tcl-bot-hero-avatar .tcl-bot-avatar-ic { fill: #ffffff; }

/* Warn glyph in the fallback error avatar */
.tcl-bot-msg-avatar .tcl-bot-warn-ic { fill: #d23f3f; width: 60%; height: 60%; }

/* ── Proactive teaser card ────────────────────────────────────────────────── */

#tcl-bot-teaser {
	position: fixed;
	bottom: calc(58px + 12px + 24px); /* launcher-height + gap + launcher-bottom */
	right: 24px;
	z-index: var(--tcl-bot-z);
	width: 280px;
	max-width: calc(100vw - 32px);
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 8px 32px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.10);
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 14px 12px 14px 14px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px);
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s ease 0.22s;
	pointer-events: none;
}

#tcl-bot-teaser.visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s ease 0s;
}

.tcl-bot-teaser-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--tcl-bot-primary-light);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	flex-shrink: 0;
	overflow: hidden;
}

.tcl-bot-teaser-content {
	flex: 1;
	min-width: 0;
	position: relative;
}

.tcl-bot-teaser-body {
	display: block;
	width: 100%;
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	text-align: left;
	cursor: pointer;
	font-family: var(--tcl-bot-font);
}

.tcl-bot-teaser-body:focus-visible {
	outline: 3px solid var(--tcl-bot-accent);
	outline-offset: 2px;
	border-radius: 4px;
}

.tcl-bot-teaser-greeting {
	font-size: 14px;
	font-weight: 700;
	color: var(--tcl-bot-text);
	line-height: 1.3;
	margin-bottom: 4px;
}

.tcl-bot-teaser-text {
	font-size: 13px;
	color: var(--tcl-bot-text);
	line-height: 1.45;
	margin-bottom: 6px;
}

.tcl-bot-teaser-meta {
	font-size: 11px;
	color: var(--tcl-bot-text-light);
	line-height: 1.3;
}

.tcl-bot-teaser-sender {
	font-weight: 600;
}

.tcl-bot-teaser-close {
	position: absolute;
	top: -2px;
	right: -6px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--tcl-bot-bg-alt);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	flex-shrink: 0;
	transition: background-color 0.15s;
}

.tcl-bot-teaser-close svg {
	width: 14px;
	height: 14px;
	fill: var(--tcl-bot-text-light);
	pointer-events: none;
}

.tcl-bot-teaser-close:hover {
	background: var(--tcl-bot-border);
}

.tcl-bot-teaser-close:focus-visible {
	outline: 3px solid var(--tcl-bot-accent);
	outline-offset: 2px;
}

/* Teaser RTL */
#tcl-bot-teaser[dir="rtl"] {
	right: auto;
	left: 24px;
	text-align: right;
}

#tcl-bot-teaser[dir="rtl"] .tcl-bot-teaser-body {
	text-align: right;
}

#tcl-bot-teaser[dir="rtl"] .tcl-bot-teaser-close {
	right: auto;
	left: -6px;
}

@media (max-width: 480px) {
	#tcl-bot-teaser {
		bottom: calc(58px + 10px + 16px); /* launcher-height + gap + launcher-bottom-mobile */
		right: 16px;
		left: auto;
		width: calc(100vw - 32px);
	}

	#tcl-bot-teaser[dir="rtl"] {
		right: auto;
		left: 16px;
	}
}

/* ── Teaser dot on launcher (separate from unread badge) ─────────────────── */

.tcl-bot-teaser-dot {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #e8a020;
	border: 2px solid #fff;
	display: none;
}

/* ── Home greeting hero ───────────────────────────────────────────────────── */

.tcl-bot-home-hero {
	background: linear-gradient(135deg, #1a56a0 0%, #143f7d 100%);
	margin: -14px -12px 0 -12px;
	padding: 20px 16px 18px;
	flex-shrink: 0;
}

.tcl-bot-home-hero-inner {
	display: flex;
	align-items: center;
	gap: 12px;
}

.tcl-bot-hero-avatar {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: rgba(255,255,255,0.2);
	font-size: 26px;
	flex-shrink: 0;
	border: 2px solid rgba(255,255,255,0.4);
	overflow: hidden;
}

.tcl-bot-home-hero-text {
	flex: 1;
	min-width: 0;
}

.tcl-bot-home-greeting {
	font-size: 18px;
	font-weight: 700;
	color: #ffffff;
	line-height: 1.3;
	margin-bottom: 3px;
}

.tcl-bot-home-sub {
	font-size: 13px;
	color: rgba(255,255,255,0.85);
	line-height: 1.4;
}

.tcl-bot-menu-cards {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 12px;
}

/* RTL hero */
.tcl-bot-home-hero-inner[dir="rtl"] {
	flex-direction: row-reverse;
	text-align: right;
}

/* ── Rounded-pill composer ───────────────────────────────────────────────── */

#tcl-bot-input-area {
	padding: 10px 12px;
	border-top: 1px solid var(--tcl-bot-border);
	background: var(--tcl-bot-bg);
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

#tcl-bot-input {
	flex: 1;
	min-height: 38px;
	max-height: 100px;
	resize: none;
	border: 1.5px solid var(--tcl-bot-border);
	border-radius: 20px;
	padding: 9px 14px;
	font-size: 14px;
	font-family: var(--tcl-bot-font);
	color: var(--tcl-bot-text);
	background: var(--tcl-bot-bg-alt);
	outline: none;
	line-height: 1.5;
	transition: border-color 0.15s;
	overflow-y: auto;
}

#tcl-bot-input:focus {
	border-color: var(--tcl-bot-primary);
}

#tcl-bot-send {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--tcl-bot-primary);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.15s, transform 0.1s;
	box-shadow: 0 2px 8px rgba(26, 86, 160, 0.25);
	padding: 0;
}

/* ── Service card polish ─────────────────────────────────────────────────── */

.tcl-bot-svc-btn {
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(26, 86, 160, 0.08);
}

.tcl-bot-svc-btn:hover {
	box-shadow: 0 4px 16px rgba(26, 86, 160, 0.16);
}

/* ── prefers-reduced-motion ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	#tcl-bot-teaser,
	#tcl-bot-panel,
	#tcl-bot-launcher,
	.tcl-bot-msg,
	.tcl-bot-chips,
	.tcl-bot-svc-btn {
		transition: none !important;
		animation: none !important;
		transform: none !important;
	}

	#tcl-bot-teaser.visible {
		transform: none;
	}

	#tcl-bot-panel.open {
		transform: none;
	}

	.tcl-bot-typing span {
		animation: none !important;
	}

	@keyframes tcl-bot-bounce {
		0%, 100% { transform: none; }
	}

	@keyframes tcl-bot-fade-in {
		from { opacity: 1; transform: none; }
		to   { opacity: 1; transform: none; }
	}
}

/* ── Brand-color fix ──────────────────────────────────────────────────────────
   hello-elementor reset.css applies color:#cc3366 to every <a>/<button>; inside
   the widget that raspberry beats the var()-based colors elsewhere in this file,
   so the service buttons, quick-reply chips and links render pink-red. Re-assert
   the brand palette with LITERAL values + widget-scoped selectors so the theme
   reset cannot override them (literals also survive the CDN/CSS optimizer). ──── */
#tcl-bot-menu  .tcl-bot-svc-btn         { color: #1a56a0; border-color: #1a56a0; }
#tcl-bot-menu  .tcl-bot-svc-btn:hover   { color: #1a56a0; }
#tcl-bot-menu  .tcl-bot-autre-btn       { color: #1a56a0; border-color: #dde3ec; }
#tcl-bot-menu  .tcl-bot-autre-btn:hover { color: #1a56a0; }
#tcl-bot-panel .tcl-bot-chip            { color: #1a56a0; border-color: #1a56a0; }
#tcl-bot-panel .tcl-bot-chip--skip      { color: #555566; border-color: #dde3ec; }
#tcl-bot-panel .tcl-bot-chip--modify    { color: #1a56a0; border-color: #dde3ec; }
#tcl-bot-panel .tcl-bot-chip--selected  { background-color: #1a56a0; color: #ffffff; }
#tcl-bot-panel .tcl-bot-consent-label a,
#tcl-bot-panel #tcl-bot-privacy a       { color: #1a56a0; }

/* ── Hover/focus background seal ──────────────────────────────────────────────
   hello-elementor reset.css: [type=button]:hover,[type=button]:focus,button:hover,
   button:focus { background-color:#cc3366 }. Our chips/buttons are type="button", so that
   rule (0,2,0) ties .tcl-bot-chip:hover (0,2,0) and wins on source order → red bg. Seal with
   ID scope + literal hex. The base rule's background-color also outranks the theme :focus
   (1,1,0 > 0,2,0) so focused buttons stay at their resting colour. ──────────────────────── */
#tcl-bot-menu  .tcl-bot-svc-btn          { background-color: #ffffff; }
#tcl-bot-menu  .tcl-bot-svc-btn:hover    { background-color: #e8f0fb; border-color: #4a7fc1; }
#tcl-bot-menu  .tcl-bot-autre-btn        { background-color: transparent; }
#tcl-bot-menu  .tcl-bot-autre-btn:hover  { background-color: #e8f0fb; border-color: #4a7fc1; }
#tcl-bot-panel .tcl-bot-chip             { background-color: #ffffff; }
#tcl-bot-panel .tcl-bot-chip:hover       { background-color: #e8f0fb; border-color: #143f7d; }
#tcl-bot-panel .tcl-bot-chip:active      { background-color: #1a56a0; color: #ffffff; }
#tcl-bot-panel .tcl-bot-chip--skip:hover { background-color: #f5f7fa; border-color: #555566; color: #1a1a2e; }
#tcl-bot-panel .tcl-bot-chip--modify:hover { background-color: #e8f0fb; }
#tcl-bot-panel .tcl-bot-submit-btn       { background-color: #1a56a0; color: #ffffff; border: none; }
#tcl-bot-panel .tcl-bot-submit-btn:hover { background-color: #143f7d; }
#tcl-bot-header .tcl-bot-header-back       { background-color: transparent; }
#tcl-bot-header .tcl-bot-header-back:hover { background-color: rgba(255,255,255,0.15); }
/* Launcher + send already win on ID specificity (1,1,0 > 0,2,0); seal defensively in case the
   CSS optimizer drops the var() in their `background:` shorthand on production. */
#tcl-bot-launcher:hover { background-color: #143f7d; }
#tcl-bot-send:hover     { background-color: #143f7d; }

/* ── Teaser reset.css seals ───────────────────────────────────────────────────
   hello-elementor reset bleeds color:#cc3366 and [type=button]:hover/:focus
   background-color:#cc3366. Teaser is a launcher sibling, outside #tcl-bot-menu
   and #tcl-bot-panel, so the existing seals do NOT cover it.
   Seal with #tcl-bot-teaser-scoped literal hex, base + :hover + :focus +
   :focus-visible, with border:none where needed. ────────────────────────────── */
#tcl-bot-teaser                               { color: #1a1a2e; background-color: #ffffff; border: none; }
#tcl-bot-teaser .tcl-bot-teaser-body         { color: #1a1a2e; background-color: transparent; border: none; }
#tcl-bot-teaser .tcl-bot-teaser-body:hover   { color: #1a1a2e; background-color: transparent; border: none; }
#tcl-bot-teaser .tcl-bot-teaser-body:focus   { color: #1a1a2e; background-color: transparent; border: none; }
#tcl-bot-teaser .tcl-bot-teaser-body:focus-visible { color: #1a1a2e; background-color: transparent; border: none; }
#tcl-bot-teaser .tcl-bot-teaser-close         { background-color: #f5f7fa; border: none; }
#tcl-bot-teaser .tcl-bot-teaser-close:hover   { background-color: #dde3ec; border: none; }
#tcl-bot-teaser .tcl-bot-teaser-close:focus   { background-color: #f5f7fa; border: none; }
#tcl-bot-teaser .tcl-bot-teaser-close:focus-visible { background-color: #f5f7fa; border: none; }

/* ── Teaser nowrap fix ────────────────────────────────────────────────────────
   hello-elementor reset.css sets white-space:nowrap on button/[type=button] children
   which bleeds into .tcl-bot-teaser-body (a <button>) and its descendants, causing
   the greeting + body text to overflow the 280px card (scrollWidth 433 vs 204).
   Override with literal white-space:normal + width:100% + min-width:0, scoped to
   #tcl-bot-teaser so specificity (1,1,0) beats the theme reset (0,2,0). ──────── */
#tcl-bot-teaser .tcl-bot-teaser-content      { flex: 1 1 auto; min-width: 0; }
#tcl-bot-teaser .tcl-bot-teaser-body         { display: block; width: 100%; box-sizing: border-box; white-space: normal; text-align: left; }
#tcl-bot-teaser .tcl-bot-teaser-greeting,
#tcl-bot-teaser .tcl-bot-teaser-text         { white-space: normal; overflow-wrap: anywhere; }
#tcl-bot-teaser[dir="rtl"] .tcl-bot-teaser-body { text-align: right; }
