/* ============================================================
   LeadDesk AI — widget styles.

   Every brand-specific value is a custom property set inline by
   LeadDesk_Frontend::brand_css(), so white-labelling is a colour
   picker rather than a stylesheet edit. Neutral values below are
   fallbacks for when the inline block is missing.
   ============================================================ */
.leaddesk-root {
	--leaddesk-primary: #0F62FE;
	--leaddesk-primary-dark: #0043CE;
	--leaddesk-primary-soft: rgba(15, 98, 254, .1);
	--leaddesk-accent: #0EA5A3;
	--leaddesk-accent-dark: #0B8785;
	--leaddesk-header: #16181D;
	--leaddesk-ink: #16181D;
	--leaddesk-ink-2: #3A3F49;
	--leaddesk-muted: #6B7280;
	--leaddesk-line: #E5E7EB;
	--leaddesk-bg-soft: #F7F8FA;
	--leaddesk-edge: 22px;

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.leaddesk-root *,
.leaddesk-root *::before,
.leaddesk-root *::after {
	box-sizing: border-box;
}

/* ---- Launcher ---- */
.leaddesk-launcher {
	position: fixed;
	bottom: var(--leaddesk-edge);
	z-index: 999990;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	background-color: var(--leaddesk-primary);
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='%23ffffff' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/></svg>");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 32px 32px;
	box-shadow: 0 14px 32px rgba(0, 0, 0, .22), 0 4px 10px rgba(0, 0, 0, .12);
	transition: transform .22s ease, box-shadow .22s ease;
}

.leaddesk-pos-right .leaddesk-launcher { right: var(--leaddesk-edge); }
.leaddesk-pos-left  .leaddesk-launcher { left: var(--leaddesk-edge); }

.leaddesk-launcher:hover {
	transform: translateY(-3px) scale(1.04);
	box-shadow: 0 22px 44px rgba(0, 0, 0, .28);
}

.leaddesk-launcher:focus-visible {
	outline: 3px solid var(--leaddesk-primary);
	outline-offset: 3px;
}

.leaddesk-launcher.is-open {
	transform: scale(0);
	pointer-events: none;
}

.leaddesk-pulse {
	position: absolute;
	inset: -4px;
	z-index: -1;
	border-radius: 50%;
	background: var(--leaddesk-primary);
	opacity: .4;
	animation: leaddesk-pulse 2s ease-in-out infinite;
}

@keyframes leaddesk-pulse {
	0%        { transform: scale(.95); opacity: .5; }
	70%, 100% { transform: scale(1.25); opacity: 0; }
}

.leaddesk-launcher-badge {
	position: absolute;
	top: -6px;
	right: -6px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	color: var(--leaddesk-primary);
	font-size: 13px;
	font-weight: 800;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

.leaddesk-launcher-badge[hidden] { display: none; }

/* ---- Preview bubble ---- */
.leaddesk-preview {
	position: fixed;
	bottom: 32px;
	z-index: 999989;
	display: none;
	align-items: center;
	gap: 11px;
	max-width: 296px;
	padding: 12px 18px 12px 12px;
	border-radius: 18px;
	background: #fff;
	cursor: pointer;
	box-shadow: 0 14px 36px rgba(16, 18, 21, .16), 0 4px 12px rgba(16, 18, 21, .08);
	animation: leaddesk-preview-in .35s cubic-bezier(.4, 0, .2, 1);
}

.leaddesk-pos-right .leaddesk-preview { right: 96px; }
.leaddesk-pos-left  .leaddesk-preview { left: 96px; }

.leaddesk-preview.is-visible { display: flex; }

@keyframes leaddesk-preview-in {
	from { opacity: 0; transform: translateX(12px) scale(.96); }
	to   { opacity: 1; transform: translateX(0) scale(1); }
}

.leaddesk-preview-avatar {
	width: 42px;
	height: 42px;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--leaddesk-primary);
	color: #fff;
	font-weight: 800;
	font-size: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.leaddesk-preview-text {
	font-size: 15px;
	line-height: 1.35;
	color: var(--leaddesk-ink);
}

.leaddesk-preview-close {
	position: absolute;
	top: -6px;
	right: -6px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 1px solid var(--leaddesk-line);
	background: #fff;
	color: var(--leaddesk-muted);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 6px rgba(16, 18, 21, .1);
}

/* ---- Panel ---- */
.leaddesk-panel {
	position: fixed;
	bottom: var(--leaddesk-edge);
	z-index: 999992;
	width: 386px;
	max-width: calc(100vw - 32px);
	height: 612px;
	max-height: calc(100vh - 80px);
	display: none;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--leaddesk-line);
	border-radius: 18px;
	background: #fff;
	opacity: 0;
	transform: translateY(20px);
	box-shadow: 0 30px 60px rgba(16, 18, 21, .22), 0 8px 20px rgba(16, 18, 21, .12);
	transition: transform .25s ease, opacity .2s ease;
}

.leaddesk-pos-right .leaddesk-panel { right: var(--leaddesk-edge); }
.leaddesk-pos-left  .leaddesk-panel { left: var(--leaddesk-edge); }

.leaddesk-panel.is-open {
	display: flex;
	opacity: 1;
	transform: translateY(0);
}

.leaddesk-header {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	background: var(--leaddesk-header);
	color: #fff;
}

.leaddesk-avatar {
	position: relative;
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	border: 2px solid rgba(255, 255, 255, .18);
	border-radius: 50%;
	background: var(--leaddesk-primary);
	color: #fff;
	font-weight: 800;
	display: flex;
	align-items: center;
	justify-content: center;
}

.leaddesk-header-meta { flex: 1; min-width: 0; }

.leaddesk-name {
	font-weight: 700;
	font-size: 15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.leaddesk-status {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
	font-size: 12px;
	color: rgba(255, 255, 255, .7);
}

.leaddesk-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #22C55E;
}

.leaddesk-close {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .1);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.leaddesk-close:hover { background: rgba(255, 255, 255, .2); }

/* ---- Messages ---- */
.leaddesk-messages {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 20px 18px;
	overflow-y: auto;
	background: var(--leaddesk-bg-soft);
	scroll-behavior: smooth;
}

.leaddesk-msg {
	max-width: 84%;
	padding: 12px 14px;
	border-radius: 14px;
	font-size: 15px;
	line-height: 1.45;
	animation: leaddesk-msg-in .25s ease;
}

@keyframes leaddesk-msg-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

.leaddesk-msg.is-bot {
	align-self: flex-start;
	border: 1px solid var(--leaddesk-line);
	border-bottom-left-radius: 4px;
	background: #fff;
	color: var(--leaddesk-ink-2);
}

.leaddesk-msg.is-user {
	align-self: flex-end;
	border-bottom-right-radius: 4px;
	background: var(--leaddesk-primary);
	color: #fff;
}

.leaddesk-msg p { margin: 0; }
.leaddesk-msg p + p { margin-top: 8px; }
.leaddesk-msg strong { font-weight: 700; color: var(--leaddesk-ink); }
.leaddesk-msg.is-user strong { color: #fff; }

.leaddesk-typing {
	align-self: flex-start;
	display: none;
	gap: 5px;
	align-items: center;
	margin: 0 18px;
	padding: 14px 16px;
	border: 1px solid var(--leaddesk-line);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	background: #fff;
}

.leaddesk-typing.is-visible { display: flex; }

.leaddesk-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--leaddesk-muted);
	animation: leaddesk-typing 1.2s ease infinite;
}

.leaddesk-typing span:nth-child(2) { animation-delay: .15s; }
.leaddesk-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes leaddesk-typing {
	0%, 60%, 100% { transform: translateY(0); opacity: .4; }
	30%           { transform: translateY(-4px); opacity: 1; }
}

/* ---- Actions ---- */
.leaddesk-actions {
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 56%;
	padding: 14px 14px 16px;
	overflow-y: auto;
	border-top: 1px solid var(--leaddesk-line);
	background: #fff;
}

.leaddesk-option {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 14px;
	border: 1.5px solid var(--leaddesk-line);
	border-radius: 10px;
	background: #fff;
	color: var(--leaddesk-ink);
	font: inherit;
	font-size: 15px;
	font-weight: 500;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	transition: .15s;
}

.leaddesk-option:hover {
	border-color: var(--leaddesk-primary);
	background: var(--leaddesk-primary-soft);
	color: var(--leaddesk-primary-dark);
}

.leaddesk-option.is-primary,
.leaddesk-option.is-call {
	justify-content: center;
	padding: 13px 14px;
	border-color: transparent;
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .04em;
	/* Sentence case: this is a button label, not a heading. */
	text-transform: none;
}

.leaddesk-option.is-primary { background: var(--leaddesk-primary); }
.leaddesk-option.is-primary:hover { background: var(--leaddesk-primary-dark); color: #fff; }
.leaddesk-option.is-call { background: var(--leaddesk-accent); }
.leaddesk-option.is-call:hover { background: var(--leaddesk-accent-dark); color: #fff; }

/* ---- Inline capture ---- */
.leaddesk-inline {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
}

.leaddesk-inline-input {
	flex: 1;
	min-width: 0;
	padding: 11px 13px;
	border: 1.5px solid var(--leaddesk-line);
	border-radius: 10px;
	background: #fff;
	color: var(--leaddesk-ink);
	font: inherit;
	font-size: 15px;
	transition: .15s;
}

.leaddesk-inline-input:focus {
	outline: none;
	border-color: var(--leaddesk-primary);
	box-shadow: 0 0 0 3px var(--leaddesk-primary-soft);
}

.leaddesk-inline-input.has-error { border-color: #DC2626; }

.leaddesk-inline-send {
	flex: none;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 10px;
	background: var(--leaddesk-primary);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.leaddesk-inline-send:hover { background: var(--leaddesk-primary-dark); }

/* Force the icon visible — Safari can drop currentColor on dynamically
   created inline SVGs, leaving the button looking empty. */
.leaddesk-inline-send svg {
	display: block;
	width: 19px;
	height: 19px;
	stroke: #fff;
	fill: none;
}

.leaddesk-skip {
	flex: none;
	padding: 0 4px;
	border: 0;
	background: none;
	color: var(--leaddesk-muted);
	font: inherit;
	font-size: 13px;
	text-decoration: underline;
	cursor: pointer;
}

/* ---- Badge bar (non-white-label plans) ---- */
.leaddesk-badge-bar {
	flex-shrink: 0;
	padding: 8px;
	border-top: 1px solid var(--leaddesk-line);
	background: #fff;
	text-align: center;
	font-size: 12px;
}

.leaddesk-badge-bar a {
	color: var(--leaddesk-muted);
	text-decoration: none;
}

/* ---- Mobile ---- */
@media (max-width: 560px) {
	.leaddesk-panel {
		right: 0;
		left: 0;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border: 0;
		border-radius: 0;
	}

	.leaddesk-launcher {
		width: 56px;
		height: 56px;
		background-size: 28px 28px;
	}

	.leaddesk-pos-right .leaddesk-preview,
	.leaddesk-pos-left .leaddesk-preview {
		right: 16px;
		left: 16px;
		bottom: 88px;
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.leaddesk-root *,
	.leaddesk-root *::before,
	.leaddesk-root *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}

/* Sizes here are px on purpose, never rem.
   rem resolves against the root font size, and plenty of themes change it —
   Martfury sets html { font-size: 10px }, which rendered the whole widget at
   about 62%. px makes the widget look the same whatever the theme does. */
#leaddeskPanel,
#leaddeskLauncher,
#leaddeskPreview {
	font-size: 15px;
}

/* ─── Product recommendation cards ─────────────────────────────────── */

.leaddesk-cards {
	list-style: none;
	margin: 10px 0 4px;
	padding: 0;
	display: grid;
	gap: 10px;
}

.leaddesk-card {
	border: 1px solid var(--leaddesk-line);
	border-radius: 14px;
	background: #fff;
	overflow: hidden;
}

.leaddesk-card-link {
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 10px;
	text-decoration: none;
	/* Full-contrast ink rather than a link colour: the whole row is the
	   target, and underlined blue on a card reads as broken. */
	color: var(--leaddesk-ink);
}

.leaddesk-card-link:hover .leaddesk-card-name,
.leaddesk-card-link:focus-visible .leaddesk-card-name {
	text-decoration: underline;
}

.leaddesk-card-img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 10px;
	flex: 0 0 auto;
	background: var(--leaddesk-bg-soft);
}

.leaddesk-card-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.leaddesk-card-name {
	font-weight: 600;
	font-size: 14px;
	line-height: 1.3;
	color: var(--leaddesk-ink);
}

.leaddesk-card-spec {
	font-size: 12px;
	/* #6B7280 on #fff is 4.83:1 — above the 4.5:1 floor for body text. */
	color: var(--leaddesk-muted);
}

.leaddesk-card-price {
	font-size: 14px;
	color: var(--leaddesk-ink);
}

.leaddesk-card-was {
	color: var(--leaddesk-muted);
	margin-right: 2px;
}

.leaddesk-card-choose {
	width: calc(100% - 20px);
	margin: 0 10px 10px;
}

/* ─── Visible focus, everywhere a keyboard can land ────────────────── */

.leaddesk-option:focus-visible,
.leaddesk-card-link:focus-visible,
.leaddesk-close:focus-visible,
.leaddesk-send:focus-visible,
.leaddesk-inline-input:focus-visible,
.leaddesk-preview:focus-visible,
.leaddesk-preview-close:focus-visible {
	/* Two-tone ring so it stays visible on both the white log and a
	   coloured button. */
	outline: 2px solid var(--leaddesk-ink);
	outline-offset: 2px;
	box-shadow: 0 0 0 4px #fff;
}

.leaddesk-option.is-primary:focus-visible,
.leaddesk-option.is-call:focus-visible {
	outline-color: #fff;
	box-shadow: 0 0 0 4px var(--leaddesk-ink);
}

@media (prefers-reduced-motion: reduce) {
	/* Every animation, not just the new ones. A message that fades in is
	   briefly below the contrast it settles at, which matters most to exactly
	   the people who ask for less motion. */
	.leaddesk-msg,
	.leaddesk-preview,
	.leaddesk-launcher,
	.leaddesk-typing span,
	.leaddesk-cards,
	.leaddesk-card {
		animation: none !important;
		transition: none !important;
	}
}

/* ─── Location picker ──────────────────────────────────────────────────
   Shares the card shell with product recommendations so the two read as
   one pattern. The pickable row is a <button>, so it needs the browser's
   default button styling removed before it will match. */

.leaddesk-loc-pick {
	appearance: none;
	-webkit-appearance: none;
	width: 100%;
	border: 0;
	background: none;
	font: inherit;
	text-align: left;
	cursor: pointer;
	color: var(--leaddesk-ink);
}

.leaddesk-cards.is-locations .leaddesk-card {
	transition: border-color .15s ease;
}

.leaddesk-cards.is-locations .leaddesk-card:hover {
	border-color: var(--leaddesk-primary);
}

.leaddesk-loc-pick:hover .leaddesk-card-name,
.leaddesk-loc-pick:focus-visible .leaddesk-card-name {
	text-decoration: underline;
}

/* The phone line on a branch card is information, not a price. */
.leaddesk-cards.is-locations .leaddesk-card-price {
	color: var(--leaddesk-muted);
	font-size: 13px;
}

.leaddesk-loc-pick:focus-visible {
	outline: 2px solid var(--leaddesk-ink);
	outline-offset: 2px;
	box-shadow: 0 0 0 4px #fff;
}

@media (prefers-reduced-motion: reduce) {
	.leaddesk-cards.is-locations .leaddesk-card {
		transition: none !important;
	}
}
