/* Support Funnel - widget styles */

#dec-chat-root {
	--dec-primary: #2563eb;
	--dec-bg: #f3f4f6;
	--dec-bot-bubble: #ffffff;
	--dec-bot-text: #111827;
	--dec-user-bubble: #2563eb;
	--dec-user-text: #ffffff;
	--dec-header-text: #ffffff;
	--dec-btn-radius: 14px;
	--dec-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#dec-chat-root *,
#dec-chat-root *::before,
#dec-chat-root *::after {
	box-sizing: border-box;
}

/* ---------- launcher ---------- */
.dec-launcher {
	position: fixed;
	bottom: 22px;
	right: 22px;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: var(--dec-primary);
	color: #fff;
	box-shadow: var(--dec-shadow);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2147483000;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	overflow: hidden;
	padding: 0;
}
#dec-chat-root.dec-left .dec-launcher { right: auto; left: 22px; }
.dec-launcher:hover { transform: scale(1.06); }
.dec-launcher:active { transform: scale(0.96); }
.dec-launcher img { width: 100%; height: 100%; object-fit: cover; }
.dec-launcher-open { transform: rotate(0); }

/* ---------- window ---------- */
.dec-window {
	position: fixed;
	bottom: 96px;
	right: 22px;
	width: var(--dec-width, 380px);
	max-width: calc(100vw - 32px);
	height: var(--dec-height, 620px);
	max-height: calc(100vh - 130px);
	background: var(--dec-bg);
	border-radius: 18px;
	box-shadow: var(--dec-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 2147483000;
	opacity: 1;
	transform: translateY(0);
	transition: opacity 0.25s ease, transform 0.25s ease;
}
#dec-chat-root.dec-left .dec-window { right: auto; left: 22px; }

/* Docked: full-height panel flush to the side. */
#dec-chat-root.dec-docked .dec-window {
	top: 0;
	bottom: 0;
	right: 0;
	height: 100vh;
	max-height: 100vh;
	border-radius: 0;
}
#dec-chat-root.dec-docked.dec-left .dec-window { left: 0; right: auto; }
#dec-chat-root.dec-docked .dec-window.dec-hidden { transform: translateX(24px); }
#dec-chat-root.dec-docked.dec-left .dec-window.dec-hidden { transform: translateX(-24px); }

/* Drag-to-resize handle (inner edge). */
.dec-resize-handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 9px;
	cursor: ew-resize;
	z-index: 6;
	display: none;
}
#dec-chat-root.dec-resizable .dec-resize-handle { display: block; }
#dec-chat-root.dec-left .dec-resize-handle { left: auto; right: 0; }
.dec-resize-handle::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 3px;
	transform: translateY(-50%);
	width: 3px;
	height: 40px;
	border-radius: 3px;
	background: rgba(0, 0, 0, 0.18);
	opacity: 0;
	transition: opacity 0.15s ease;
}
#dec-chat-root.dec-left .dec-resize-handle::after { left: auto; right: 3px; }
.dec-resize-handle:hover::after { opacity: 1; }
body.dec-resizing { user-select: none; cursor: ew-resize; }
body.dec-resizing .dec-window { transition: none; }
.dec-window.dec-hidden {
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	pointer-events: none;
}
/* Generic hide for in-window elements (composer, footer in live mode). */
.dec-composer.dec-hidden,
.dec-footer.dec-hidden { display: none !important; }
#dec-chat-root.dec-no-anim .dec-window { transition: none; }

/* ---------- header ---------- */
.dec-header {
	background: var(--dec-primary);
	color: var(--dec-header-text);
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-shrink: 0;
}
.dec-header-inner { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dec-logo {
	background: rgba(255, 255, 255, 0.18);
	border-radius: 8px;
	padding: 4px 8px;
	display: flex;
	align-items: center;
	max-height: 44px;
}
/* full rectangular logo - never cropped to a circle */
.dec-logo img {
	display: block;
	max-height: 34px;
	max-width: 130px;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 0;
}
.dec-title-wrap { min-width: 0; }
.dec-title {
	font-weight: 600;
	font-size: 16px;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.dec-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	opacity: 0.92;
	margin-top: 2px;
}
.dec-status .dec-dot {
	width: 8px; height: 8px; border-radius: 50%;
	background: #9ca3af;
}
.dec-status.is-online .dec-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.25); }
.dec-status.is-offline .dec-dot { background: #f59e0b; }

/* Header row holding the status and the Start-over pill. */
.dec-status-row {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-top: 2px;
}
.dec-status-row .dec-status { margin-top: 0; }
.dec-header-restart {
	background: rgba(255, 255, 255, 0.18);
	border: none;
	color: inherit;
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1;
	padding: 4px 11px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s ease;
	white-space: nowrap;
}
.dec-header-restart:hover { background: rgba(255, 255, 255, 0.3); }
.dec-close {
	background: transparent; border: none; color: inherit;
	font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px;
	opacity: 0.85;
}
.dec-close:hover { opacity: 1; }

/* Dock / float toggle (visitor control). */
.dec-dock-toggle {
	display: none;
	background: transparent; border: none; cursor: pointer;
	color: inherit; opacity: 0.85; padding: 4px; border-radius: 6px; line-height: 0;
}
.dec-dock-toggle:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }
.dec-dock-toggle.is-docked svg { transform: scaleX(-1); }
#dec-chat-root.dec-can-dock .dec-dock-toggle { display: inline-flex; align-items: center; justify-content: center; }
.dec-title-wrap { flex: 1 1 auto; }

/* Reveal the close/dock controls only when hovering the header (mouse
   devices). Touch devices have no hover, so they stay visible for tapping. */
@media (hover: hover) {
	.dec-close,
	.dec-dock-toggle {
		opacity: 0;
		transition: opacity 0.15s ease, background 0.15s ease;
	}
	.dec-header:hover .dec-close,
	.dec-header:hover .dec-dock-toggle,
	.dec-close:focus-visible,
	.dec-dock-toggle:focus-visible { opacity: 0.85; }
	.dec-header:hover .dec-close:hover,
	.dec-header:hover .dec-dock-toggle:hover { opacity: 1; }
}

/* ---------- header with full-width logo ---------- */
.dec-header.dec-has-logo {
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
	position: relative;
	text-align: center;
}
.dec-logo-full {
	width: 100%;
	box-sizing: border-box;
	background: #fff;
	border-radius: 10px;
	padding: 6px; /* overridden inline from the Logo padding setting */
}
.dec-logo-full.is-transparent {
	background: transparent;
	border-radius: 0;
}
.dec-logo-full img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 60px;
	object-fit: contain;
	object-position: center;
	border-radius: 0;
}
.dec-header.dec-has-logo .dec-status { justify-content: center; }
.dec-header.dec-has-logo .dec-status-row { display: flex; justify-content: center; }
.dec-header.dec-has-logo .dec-close {
	position: absolute;
	top: 8px;
	right: 10px;
	color: #fff;
	background: rgba(0, 0, 0, 0.18);
	width: 26px;
	height: 26px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
}
.dec-header.dec-has-logo .dec-dock-toggle {
	position: absolute;
	top: 9px;
	right: 42px;
	color: #fff;
	background: rgba(0, 0, 0, 0.18);
	width: 26px;
	height: 26px;
	border-radius: 50%;
}
.dec-header.dec-has-logo .dec-dock-toggle:hover { background: rgba(0, 0, 0, 0.28); }

/* ---------- body ---------- */
.dec-body {
	flex: 1;
	overflow-y: auto;
	padding: 18px 16px 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scroll-behavior: smooth;
}
.dec-row { display: flex; }
.dec-row-bot { justify-content: flex-start; }
.dec-row-user { justify-content: flex-end; }

.dec-bubble {
	max-width: 82%;
	padding: 11px 14px;
	font-size: 14.5px;
	line-height: 1.45;
	border-radius: 16px;
	animation: dec-pop 0.28s ease;
	word-wrap: break-word;
}
#dec-chat-root.dec-no-anim .dec-bubble { animation: none; }
.dec-bubble-bot {
	background: var(--dec-bot-bubble);
	color: var(--dec-bot-text);
	border-bottom-left-radius: 5px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
}
.dec-bubble-user {
	background: var(--dec-user-bubble);
	color: var(--dec-user-text);
	border-bottom-right-radius: 5px;
}
.dec-node-title { display: block; margin-bottom: 4px; }
.dec-node-text { }

@keyframes dec-pop {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

/* typing indicator */
.dec-typing { display: inline-flex; gap: 4px; align-items: center; }
.dec-typing span {
	width: 7px; height: 7px; border-radius: 50%;
	background: #9ca3af; display: inline-block;
	animation: dec-blink 1.2s infinite ease-in-out both;
}
.dec-typing span:nth-child(2) { animation-delay: 0.2s; }
.dec-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dec-blink {
	0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
	40% { opacity: 1; transform: scale(1); }
}

/* ---------- options / buttons ---------- */
.dec-options {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: flex-end;
	margin: 2px 0 6px;
	animation: dec-pop 0.3s ease;
}
.dec-opt {
	background: #fff;
	color: var(--dec-primary);
	border: 1.5px solid var(--dec-primary);
	border-radius: var(--dec-btn-radius);
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	text-align: center;
	max-width: 90%;
	transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
	text-decoration: none;
	display: inline-block;
}
.dec-opt:hover {
	background: var(--dec-primary);
	color: #fff;
	transform: translateY(-1px);
}
.dec-opt:active { transform: translateY(0); }
.dec-opt-link { border-style: dashed; }

/* recommendation card */
.dec-reco {
	width: 90%;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	padding: 14px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.06);
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: stretch;
}
.dec-reco-tag { font-weight: 600; color: var(--dec-primary); font-size: 13px; }
.dec-reco-cta {
	background: var(--dec-primary);
	color: #fff;
	border-color: var(--dec-primary);
}
.dec-reco-cta:hover { opacity: 0.9; background: var(--dec-primary); color: #fff; }

/* form */
.dec-form { align-items: stretch; width: 100%; }
.dec-input {
	width: 100%;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	padding: 11px 13px;
	font-size: 14px;
	font-family: inherit;
	background: #fff;
	color: #111827;
}
.dec-input:focus {
	outline: none;
	border-color: var(--dec-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.dec-form-error { color: #dc2626; font-size: 12.5px; min-height: 0; }
.dec-form-submit {
	background: var(--dec-primary);
	color: #fff;
	border-color: var(--dec-primary);
	max-width: 100%;
}
.dec-form-submit:hover { opacity: 0.92; background: var(--dec-primary); color: #fff; }
.dec-form-submit:disabled { opacity: 0.6; cursor: default; }

/* ---------- footer ---------- */
.dec-footer {
	flex-shrink: 0;
	padding: 10px 14px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: rgba(255, 255, 255, 0.6);
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.dec-back, .dec-restart {
	background: transparent;
	border: none;
	color: #6b7280;
	font-size: 13px;
	cursor: pointer;
	padding: 4px 6px;
}
.dec-back:hover, .dec-restart:hover { color: var(--dec-primary); }

/* ---------- mobile ---------- */
@media (max-width: 480px) {
	.dec-window {
		width: 100vw !important;
		height: 100vh !important;
		max-height: 100vh;
		bottom: 0;
		right: 0;
		border-radius: 0;
	}
	#dec-chat-root.dec-left .dec-window { left: 0; }
	.dec-launcher { bottom: 16px; right: 16px; }
	#dec-chat-root.dec-left .dec-launcher { left: 16px; }
	.dec-resize-handle { display: none !important; }
	.dec-dock-toggle { display: none !important; }
}

/* ---------- live chat ---------- */
.dec-bubble-agent .dec-agent-name {
	display: block;
	font-size: 11px;
	font-weight: 700;
	color: var(--dec-primary);
	margin-bottom: 2px;
}
.dec-composer {
	flex-shrink: 0;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	background: #fff;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	position: relative;
}
.dec-live-input {
	flex: 1;
	resize: none;
	max-height: 96px;
	min-height: 38px;
	padding: 9px 12px;
	border: 1px solid #d7dbe0;
	border-radius: 18px;
	font: inherit;
	font-size: 14px;
	line-height: 1.4;
	outline: none;
}
.dec-live-input:focus { border-color: var(--dec-primary); }
.dec-live-send {
	flex-shrink: 0;
	height: 38px;
	min-width: 38px;
	padding: 0 16px;
	border: none;
	border-radius: 10px;
	background: var(--dec-primary);
	color: #fff;
	cursor: pointer;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.12s ease, opacity 0.12s ease, filter 0.12s ease;
}
/* Icon-only fallback (no send text set) stays compact. */
.dec-live-send:not(.dec-live-send-text) { padding: 0; width: 38px; }
.dec-live-send:hover { filter: brightness(0.95); }
.dec-live-send:active { transform: scale(0.97); }
.dec-live-end {
	position: absolute;
	top: -30px;
	right: 12px;
	background: rgba(255, 255, 255, 0.95);
	border: 1px solid rgba(0, 0, 0, 0.08);
	color: #6b7280;
	font-size: 12px;
	padding: 3px 10px;
	border-radius: 999px;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.dec-live-end:hover { color: var(--dec-primary); }

/* ---------- agent "is typing" (plain text, no bubble) ---------- */
.dec-typing-row { padding: 0; }
.dec-agent-typing {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--dec-bot-text, #6b7280);
	opacity: 0.7;
	font-size: 12.5px;
	font-style: italic;
	padding: 2px 4px 6px;
	white-space: nowrap;
}
.dec-agent-typing-text { white-space: nowrap; }
.dec-agent-typing-dots { display: inline-flex; flex-direction: row; gap: 3px; flex: 0 0 auto; }
.dec-agent-typing-dots span {
	display: inline-block;
	width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.6;
	animation: dec-typing-bounce 1.2s infinite ease-in-out;
}
.dec-agent-typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.dec-agent-typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes dec-typing-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
	30% { transform: translateY(-3px); opacity: 0.9; }
}

/* ---------- priority options + divider ---------- */
.dec-opt-priority {
	background: var(--dec-priority-bg, #16a34a) !important;
	color: var(--dec-priority-text, #fff) !important;
	border-color: var(--dec-priority-bg, #16a34a) !important;
	font-weight: 600;
}
.dec-opt-priority:hover { filter: brightness(0.95); }
.dec-opt-divider {
	height: 0;
	border-top: 1px dashed rgba(0, 0, 0, 0.18);
	margin: 4px 2px 2px;
}
.dec-node-bold { font-weight: 700; }

/* Inline custom SVG icons inside messages. */
.dec-inline-icon { display: inline-flex; vertical-align: -0.16em; }
.dec-inline-icon svg { width: 1.15em; height: 1.15em; }

/* Mute toggle in the live composer */
.dec-mute {
	flex: 0 0 auto; border: none; background: transparent; cursor: pointer;
	color: var(--dec-primary, #2563eb); padding: 6px; border-radius: 8px;
	display: inline-flex; align-items: center; justify-content: center;
}
.dec-mute:hover { background: rgba(0,0,0,0.06); }
.dec-mute.is-muted { color: #94a3b8; }

/* End-of-conversation prompt (genuine dead-ends only) */
.dec-end-note { margin: 14px 0 6px; text-align: center; }
.dec-end-divider {
	position: relative; text-align: center; margin-bottom: 10px;
}
.dec-end-divider::before {
	content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: rgba(0,0,0,0.1);
}
.dec-end-divider span {
	position: relative; background: var(--dec-bg, #f8fafc); padding: 0 10px;
	font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8;
}
.dec-end-restart { display: inline-block; width: auto; }

/* Locked (Pro) feature cues in the widget */
.dec-lock-note {
	margin-top: 8px; font-size: 12px; color: #92400e;
	background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 7px 10px; text-align: center;
}
.dec-opt.dec-locked { opacity: 0.55; cursor: not-allowed; }
.dec-icon-locked { opacity: 0.5; }
