/**
 * Inquiry Chat – front-end widget
 * Fixed-position chat window; never participates in page flow (that is what
 * breaks many themes on mobile).
 */

.ic-widget {
	--ic-accent: #111827;
	--ic-ink: #111827;
	--ic-muted: #6b7280;
	--ic-line: #e5e7eb;
	--ic-surface: #ffffff;
	--ic-bg: #f7f7f8;
	--ic-radius: 16px;
	--ic-fab: 56px;
	--ic-gap: 16px;
	--ic-safe: env(safe-area-inset-bottom, 0px);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--ic-ink);
	position: relative;
	z-index: 999998;
}

.ic-widget *,
.ic-widget *::before,
.ic-widget *::after {
	box-sizing: border-box;
}

.ic-widget [hidden] {
	display: none !important;
}

.ic-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* honeypot */
.ic-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

/* ---------- floating button ---------- */
.ic-fab {
	position: fixed;
	right: var(--ic-gap);
	bottom: calc(var(--ic-gap) + var(--ic-safe));
	width: var(--ic-fab);
	height: var(--ic-fab);
	border: 0;
	border-radius: 50%;
	background: var(--ic-accent);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	box-shadow: 0 10px 28px rgba(17, 24, 39, .28), 0 2px 6px rgba(17, 24, 39, .18);
	transition: transform .18s ease, box-shadow .18s ease;
	z-index: 999999;
}

.ic-fab:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 34px rgba(17, 24, 39, .32), 0 3px 8px rgba(17, 24, 39, .2);
}

.ic-fab:focus-visible {
	outline: 3px solid rgba(17, 24, 39, .35);
	outline-offset: 3px;
}

.ic-fab__icon {
	width: 26px;
	height: 26px;
}

.ic-fab__pulse {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #22c55e;
	box-shadow: 0 0 0 3px #fff;
}

.ic-widget[data-state="open"] .ic-fab__pulse {
	display: none;
}

/* ---------- panel ---------- */
.ic-panel {
	position: fixed;
	right: var(--ic-gap);
	bottom: calc(var(--ic-gap) + var(--ic-fab) + 12px + var(--ic-safe));
	width: 372px;
	max-height: min(620px, calc(100vh - 140px));
	display: flex;
	flex-direction: column;
	background: var(--ic-surface);
	border-radius: var(--ic-radius);
	box-shadow: 0 24px 60px rgba(17, 24, 39, .22), 0 4px 12px rgba(17, 24, 39, .1);
	overflow: hidden;
	z-index: 999999;
	animation: ic-pop .2s ease-out;
}

@keyframes ic-pop {
	from { opacity: 0; transform: translateY(10px) scale(.98); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.ic-panel { animation: none; }
	.ic-fab { transition: none; }
}

.ic-head {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 11px 12px;
	background: var(--ic-accent);
	color: #fff;
	flex: 0 0 auto;
}

.ic-head__text {
	min-width: 0;
}

.ic-head__title {
	display: block;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ic-head__sub {
	display: block;
	font-size: 12px;
	opacity: .82;
	line-height: 1.3;
}

.ic-close {
	margin-left: auto;
	background: transparent;
	border: 0;
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 8px;
	cursor: pointer;
	display: grid;
	place-items: center;
	opacity: .85;
	flex: 0 0 auto;
}

.ic-close:hover { background: rgba(255, 255, 255, .16); opacity: 1; }
.ic-close svg { width: 16px; height: 16px; }

.ic-context {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	padding: 7px 12px;
	font-size: 12px;
	background: #f3f4f6;
	color: var(--ic-muted);
	border-bottom: 1px solid var(--ic-line);
	flex: 0 0 auto;
}

.ic-context__label { text-transform: uppercase; letter-spacing: .04em; font-size: 10px; align-self: center; }
.ic-context__value { color: var(--ic-ink); font-weight: 500; }

/* ---------- message log ---------- */
.ic-log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 14px 12px 6px;
	background: var(--ic-bg);
	display: flex;
	flex-direction: column;
	gap: 8px;
	scroll-behavior: smooth;
	min-height: 120px;
}

.ic-msg {
	max-width: 88%;
	padding: 9px 12px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.45;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
}

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

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

.ic-msg--note {
	align-self: center;
	font-size: 12px;
	color: var(--ic-muted);
	background: transparent;
	padding: 2px 4px;
	text-align: center;
}

.ic-msg--error {
	align-self: flex-start;
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #b91c1c;
}

.ic-typing {
	align-self: flex-start;
	display: inline-flex;
	gap: 4px;
	padding: 11px 13px;
	background: #fff;
	border: 1px solid var(--ic-line);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
}

.ic-typing i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9ca3af;
	animation: ic-blink 1.2s infinite ease-in-out;
}

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

@keyframes ic-blink {
	0%, 60%, 100% { opacity: .35; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-2px); }
}

/* ---------- composer ---------- */
.ic-compose {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	background: #fff;
	border-top: 1px solid var(--ic-line);
	flex: 0 0 auto;
}

.ic-input {
	flex: 1 1 auto;
	min-height: 38px;
	max-height: 116px;
	padding: 9px 11px;
	border: 1px solid var(--ic-line);
	border-radius: 10px;
	font: inherit;
	font-size: 14px;
	line-height: 1.4;
	resize: none;
	color: var(--ic-ink);
	background: #fff;
}

.ic-input:focus {
	outline: none;
	border-color: var(--ic-accent);
	box-shadow: 0 0 0 3px rgba(17, 24, 39, .08);
}

.ic-input::placeholder { color: #9ca3af; }

.ic-send {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 10px;
	background: var(--ic-accent);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
}

.ic-send svg { width: 18px; height: 18px; }
.ic-send:disabled { opacity: .45; cursor: default; }

.ic-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 0 12px 9px;
	background: #fff;
	min-height: 10px;
	flex: 0 0 auto;
}

.ic-link {
	background: none;
	border: 0;
	padding: 0;
	color: var(--ic-muted);
	font: inherit;
	font-size: 12px;
	cursor: pointer;
	text-decoration: underline;
}

.ic-link:hover { color: var(--ic-ink); }

.ic-dots {
	display: inline-flex;
	gap: 4px;
	margin-left: auto;
}

.ic-dots i {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: #d1d5db;
}

.ic-dots i.is-on { background: var(--ic-accent); }

/* ---------- mobile: full-width sheet, still fixed ---------- */
@media (max-width: 600px) {
	.ic-widget { --ic-gap: 12px; }

	.ic-panel {
		left: var(--ic-gap);
		right: var(--ic-gap);
		width: auto;
		bottom: calc(var(--ic-gap) + var(--ic-fab) + 10px + var(--ic-safe));
		max-height: calc(100vh - 120px);
		max-height: calc(100dvh - 120px);
		border-radius: 14px;
	}

	.ic-log { padding: 12px 10px 4px; }
	.ic-msg { max-width: 92%; }
	.ic-input { font-size: 16px; } /* prevents iOS zoom-on-focus */
}

@media (max-width: 360px) {
	.ic-fab { width: 52px; height: 52px; }
}

/* ---------- optional details block ---------- */
.ic-inline {
	align-self: stretch;
	display: flex;
	flex-direction: column;
	gap: 7px;
	padding: 10px;
	background: #fff;
	border: 1px solid var(--ic-line);
	border-radius: 12px;
	margin-top: 2px;
}

.ic-inline__field {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--ic-line);
	border-radius: 8px;
	font: inherit;
	font-size: 14px;
	color: var(--ic-ink);
	background: #fff;
}

.ic-inline__field:focus {
	outline: none;
	border-color: var(--ic-accent);
	box-shadow: 0 0 0 3px rgba(17, 24, 39, .08);
}

.ic-inline__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-top: 2px;
}

.ic-inline__send {
	flex: 1 1 auto;
	min-height: 36px;
	padding: 0 14px;
	border: 0;
	border-radius: 9px;
	background: var(--ic-accent);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
}

.ic-inline__skip {
	flex: 0 0 auto;
	background: none;
	border: 0;
	padding: 6px 2px;
	color: var(--ic-muted);
	font: inherit;
	font-size: 12px;
	text-decoration: underline;
	cursor: pointer;
}

.ic-inline__send:hover { filter: brightness(1.08); }
.ic-inline__skip:hover { color: var(--ic-ink); }

.ic-retry,
.ic-restart {
	align-self: flex-start;
	margin: 2px 0 6px;
}

/* keep clear of the WordPress admin bar when logged in */
body.admin-bar .ic-fab,
body.admin-bar .ic-panel { margin-bottom: 0; }

/* ---------- step 1: profile form ---------- */
.ic-view {
	flex: 1;
	min-width: 0;
	min-height: 0;
	display: flex;
	flex-direction: column;
	background: var(--ic-bg);
}

.ic-view[hidden] {
	display: none !important;
}

.ic-view--form {
	padding: 13px 14px 16px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.ic-intro {
	margin: 0 0 12px;
	font-size: 13px;
	line-height: 1.45;
	color: var(--ic-muted);
}

.ic-fields {
	display: grid;
	gap: 7px;
}

.ic-field {
	display: block;
}

.ic-field__label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .02em;
	color: var(--ic-muted);
	margin-bottom: 4px;
	text-transform: uppercase;
}

.ic-req {
	color: #dc2626;
	font-style: normal;
}

.ic-field__input {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border: 1px solid var(--ic-line);
	border-radius: 9px;
	font: inherit;
	font-size: 14px;
	line-height: 1.3;
	color: var(--ic-ink);
	background: #fff;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.ic-field__input:focus {
	outline: none;
	border-color: var(--ic-accent);
	box-shadow: 0 0 0 3px rgba(17, 24, 39, .08);
}

.ic-btn {
	width: 100%;
	margin-top: 13px;
	padding: 11px 14px;
	border: 0;
	border-radius: 10px;
	background: var(--ic-accent);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.ic-btn:hover {
	opacity: .92;
}

.ic-btn:focus-visible {
	outline: 2px solid var(--ic-accent);
	outline-offset: 2px;
}

.ic-form__error {
	margin: 10px 0 0;
	padding: 7px 9px;
	font-size: 12px;
	color: #b91c1c;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
}

.ic-form__note {
	margin: 6px 0 0;
	font-size: 10.5px;
	line-height: 1.3;
	color: #9ca3af;
}

.ic-typing {
	align-self: flex-start;
	max-width: 84%;
	padding: 10px 12px;
	background: #fff;
	border: 1px solid var(--ic-line);
	border-radius: 14px;
	display: inline-flex;
	gap: 4px;
}

.ic-typing i {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: #9ca3af;
	animation: ic-blink 1.2s infinite ease-in-out;
}

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

@keyframes ic-blink {
	0%, 80%, 100% { opacity: .25; }
	40% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.ic-typing i { animation: none; }
}