/* Knowledge Base AI Chatbot — frontend widget v1.2 (Adsplode-style design).
   Heavily namespaced under .gfsc to coexist with Kadence/Elementor themes. */

.gfsc {
	--gfsc-accent: #1a56db;
	--gfsc-bg: #ffffff;
	--gfsc-text: #1f2937;
	--gfsc-border: #e5e7eb;
	--gfsc-bot-bubble: #f3f4f6;
	--gfsc-area: #f7f9fa;
	font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14.5px;
	color: var(--gfsc-text);
	line-height: 1.5;
	box-sizing: border-box;
}
.gfsc *,
.gfsc *::before,
.gfsc *::after {
	box-sizing: inherit;
}

/* ---- Theme-proof reset: stop theme button/input styles from leaking in ---- */

.gfsc button,
.gfsc input,
.gfsc textarea {
	-webkit-appearance: none !important;
	appearance: none !important;
	margin: 0;
	font-family: inherit !important;
	font-size: inherit;
	line-height: inherit;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-decoration: none !important;
	box-shadow: none !important;
	text-shadow: none !important;
}
.gfsc button {
	border: 0;
	background: none;
	cursor: pointer;
}
.gfsc button:focus,
.gfsc button:hover,
.gfsc button:active,
.gfsc input:focus,
.gfsc textarea:focus {
	outline: none !important;
	box-shadow: none !important;
}
.gfsc button:focus-visible {
	outline: 2px solid rgba(0, 0, 0, 0.4) !important;
	outline-offset: 2px;
}

/* ---- Floating mode ---- */

.gfsc--floating {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 14px;
}
.gfsc--floating.gfsc--left {
	right: auto;
	left: 24px;
	align-items: flex-start;
}

/* ---- FAB ---- */

.gfsc-bubble {
	width: 60px;
	height: 60px;
	border-radius: 50% !important;
	border: 0 !important;
	cursor: pointer;
	background: var(--gfsc-accent) !important;
	color: #fff !important;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
	order: 2;
	overflow: hidden;
	padding: 0;
}
.gfsc-bubble:hover {
	transform: scale(1.06) translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.gfsc-bubble:focus-visible { outline: 3px solid rgba(0, 0, 0, 0.35); outline-offset: 2px; }
.gfsc-fab-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
	pointer-events: none;
}

/* ---- Panel ---- */

.gfsc--floating .gfsc-panel {
	order: 1;
	width: 380px;
	height: 600px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 120px);
	opacity: 0;
	transform: scale(0.9) translateY(20px);
	transform-origin: bottom right;
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.gfsc--left .gfsc-panel { transform-origin: bottom left; }
.gfsc--floating.is-open .gfsc-panel {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.gfsc--inline .gfsc-panel {
	width: 100%;
	max-width: 640px;
	height: 560px;
	margin: 0 auto;
}

.gfsc-panel {
	position: relative;
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--gfsc-bg);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* ---- Header ---- */

.gfsc-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	background: var(--gfsc-accent);
	color: #fff;
	flex-shrink: 0;
}
.gfsc-head-info {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}
.gfsc-head-avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	color: var(--gfsc-accent);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.gfsc-head-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.gfsc-head-meta { flex: 1; min-width: 0; }
.gfsc-head-name {
	font-weight: 600;
	font-size: 17px;
	letter-spacing: -0.3px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.gfsc-head-sub { font-size: 12px; opacity: 0.85; }

.gfsc-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.gfsc-head-actions button {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 6px;
	border-radius: 6px;
	transition: background-color 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}
.gfsc-head-actions button:hover { background: rgba(255, 255, 255, 0.25) !important; }

/* ---- Messages area ---- */

.gfsc-msgs {
	flex: 1 1 auto;
	min-height: 0; /* critical: lets this flex child shrink so overflow can scroll */
	overflow-y: auto !important;
	overflow-x: hidden !important;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-y;
	scroll-behavior: smooth;
	padding: 20px;
	background: var(--gfsc-area);
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* thin custom scrollbar */
.gfsc-msgs::-webkit-scrollbar { width: 6px; }
.gfsc-msgs::-webkit-scrollbar-track { background: transparent; }
.gfsc-msgs::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
.gfsc-msgs::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
.gfsc-msgs { scrollbar-width: thin; scrollbar-color: #d1d5db transparent; }

.gfsc-msg { display: flex; flex-direction: column; max-width: 85%; min-width: 0; }
.gfsc-msg--user { align-self: flex-end; align-items: flex-end; }
.gfsc-msg--bot { align-self: flex-start; align-items: flex-start; }

.gfsc-msg-bubble {
	padding: 13px 18px;
	border-radius: 20px;
	white-space: pre-wrap;
	max-width: 100%;
	overflow-wrap: anywhere;
	word-break: break-word;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	animation: gfscFadeSlideUp 0.3s ease-out;
}
.gfsc-msg--user .gfsc-msg-bubble {
	background: var(--gfsc-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.gfsc-msg--bot .gfsc-msg-bubble {
	background: var(--gfsc-bot-bubble);
	color: var(--gfsc-text);
	border-bottom-left-radius: 4px;
}

.gfsc-sources {
	margin-top: 4px;
	font-size: 11.5px;
	color: #6b7280;
	padding: 0 6px;
	overflow-wrap: anywhere;
}

/* ---- Links inside messages ---- */

.gfsc-msg-bubble a.gfsc-link {
	color: var(--gfsc-accent) !important;
	text-decoration: underline !important;
	overflow-wrap: anywhere;
	word-break: break-all;
	cursor: pointer;
}
.gfsc-msg--user .gfsc-msg-bubble a.gfsc-link { color: #fff !important; }
.gfsc-msg-bubble a.gfsc-link:hover { opacity: 0.85; }

/* ---- Quick questions (colored pills, staggered) ---- */

.gfsc-quick {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: stretch;
	margin-top: 2px;
}
.gfsc-pill {
	color: #fff !important;
	background: var(--gfsc-accent) !important;
	border: 0 !important;
	border-radius: 24px !important;
	padding: 12px 18px !important;
	font-weight: 500 !important;
	font-size: 14.5px !important;
	cursor: pointer;
	text-align: left !important;
	transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.2s;
	white-space: normal;
	word-break: break-word;
	overflow-wrap: break-word;
	line-height: 1.4;
	display: block;
	width: 100%;
	opacity: 0;
	transform: translateY(10px);
	animation: gfscFadeSlideUp 0.3s ease-out forwards;
}
.gfsc-pill:nth-child(1) { animation-delay: 0.10s; }
.gfsc-pill:nth-child(2) { animation-delay: 0.20s; }
.gfsc-pill:nth-child(3) { animation-delay: 0.30s; }
.gfsc-pill:nth-child(4) { animation-delay: 0.40s; }
.gfsc-pill:nth-child(5) { animation-delay: 0.50s; }
.gfsc-pill:nth-child(6) { animation-delay: 0.60s; }
.gfsc-pill:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ---- Typing indicator ---- */

.gfsc-typing { display: flex; gap: 4px; align-items: center; min-height: 20px; }
.gfsc-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9ca3af;
	animation: gfscTyping 1.4s infinite ease-in-out both;
}
.gfsc-typing span:nth-child(1) { animation-delay: -0.32s; }
.gfsc-typing span:nth-child(2) { animation-delay: -0.16s; }

/* ---- Input area ---- */

.gfsc-form {
	display: flex;
	gap: 12px;
	align-items: center;
	margin: 0 !important;
	padding: 14px 18px 18px !important;
	background: var(--gfsc-bg) !important;
	border: 0 !important;
	border-top: 1px solid var(--gfsc-border) !important;
	flex-shrink: 0;
}
.gfsc-form-inner {
	display: flex;
	flex: 1;
	gap: 8px;
	align-items: center;
	background: #fff !important;
	border: 2px solid var(--gfsc-accent) !important;
	border-radius: 999px !important;
	padding: 5px 5px 5px 20px !important;
	transition: box-shadow 0.2s;
	min-width: 0;
}
.gfsc-form-inner:focus-within {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--gfsc-accent) 18%, transparent) !important;
}
.gfsc-field {
	flex: 1;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	outline: none !important;
	box-shadow: none !important;
	font-size: 15px !important;
	color: var(--gfsc-text) !important;
	font-family: inherit !important;
	padding: 9px 0 !important;
	margin: 0 !important;
	min-width: 0;
	width: 100%;
	min-height: 0 !important;
	height: auto !important;
}
.gfsc-field::placeholder {
	color: #9ca3af !important;
	opacity: 1;
}
.gfsc-send {
	width: 44px !important;
	height: 44px !important;
	min-width: 44px !important;
	min-height: 44px !important;
	padding: 0 !important;
	border-radius: 50% !important;
	border: 0 !important;
	background: var(--gfsc-accent) !important;
	color: #fff !important;
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: transform 0.2s, filter 0.2s;
}
.gfsc-send svg {
	width: 20px;
	height: 20px;
	stroke: #fff !important;
	fill: none !important;
	display: block;
}
.gfsc-send:hover { filter: brightness(1.08); }
.gfsc-send:active { transform: scale(0.95) !important; }

/* ---- Lead form ---- */

.gfsc-lead-row { max-width: 95%; }
.gfsc-lead-box {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 240px;
	border-radius: 20px;
	border-bottom-left-radius: 4px;
}
.gfsc-lead-intro { font-weight: 600; margin-bottom: 4px; }
.gfsc-lead-label {
	font-size: 12px;
	font-weight: 600;
	color: #4b5563;
	margin-top: 4px;
}
.gfsc-lead-input {
	border: 1px solid #d6d9e0 !important;
	border-radius: 12px !important;
	padding: 9px 14px !important;
	font-size: 13.5px !important;
	background: #fff !important;
	color: var(--gfsc-text) !important;
	font-family: inherit !important;
	width: 100%;
	outline: none;
}
.gfsc-lead-input:focus { border-color: var(--gfsc-accent) !important; }
.gfsc-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	opacity: 0;
}
.gfsc-lead-err { color: #b91c1c; font-size: 12px; min-height: 14px; }
.gfsc-lead-submit {
	margin-top: 4px;
	border: 0 !important;
	border-radius: 24px !important;
	background: var(--gfsc-accent) !important;
	color: #fff !important;
	font-weight: 700;
	font-size: 14px;
	padding: 11px 18px;
	cursor: pointer;
	transition: filter 0.2s, transform 0.2s;
}
.gfsc-lead-submit:hover { filter: brightness(1.08); }
.gfsc-lead-submit:active { transform: scale(0.98); }
.gfsc-lead-submit:disabled { opacity: 0.6; cursor: default; }

/* ---- Keyframes ---- */

@keyframes gfscTyping {
	0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
	40% { transform: scale(1); opacity: 1; }
}
@keyframes gfscFadeSlideUp {
	0%   { opacity: 0; transform: translateY(10px); }
	100% { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.gfsc-msg-bubble, .gfsc-pill { animation: none; opacity: 1; transform: none; }
	.gfsc-typing span { animation: none; }
	.gfsc--floating .gfsc-panel { transition: none; }
	.gfsc-msgs { scroll-behavior: auto; }
}

/* ---- Mobile: compact popup (same behavior as desktop) ---- */

@media (max-width: 500px) {
	.gfsc--floating .gfsc-panel {
		width: 90vw;
		max-width: calc(100vw - 24px);
		height: min(540px, 72dvh);
		max-height: calc(100dvh - 150px); /* room for the FAB + offsets, never covers the page */
		border-radius: 16px;
	}

	.gfsc-msgs { padding: 16px 14px; }
	.gfsc-form { padding: 12px 14px 14px !important; }

	.gfsc-field { font-size: 16px !important; } /* prevents iOS Safari auto-zoom on focus */
}

/* ---- Booking button + modal ---- */

.gfsc-booking-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	border: 0 !important;
	border-radius: 24px !important;
	background: var(--gfsc-accent) !important;
	color: #fff !important;
	font-weight: 600;
	font-size: 14.5px;
	font-family: inherit;
	padding: 13px 20px;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
	transition: filter 0.2s, transform 0.2s;
	animation: gfscFadeSlideUp 0.3s ease-out;
}
.gfsc-booking-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.gfsc-booking-btn:active { transform: scale(0.98); }
.gfsc-booking-btn svg { flex-shrink: 0; }

.gfsc-modal {
	position: absolute;
	inset: 0;
	background: var(--gfsc-bg);
	z-index: 20;
	display: none;
	flex-direction: column;
	border-radius: inherit;
	overflow: hidden;
}
.gfsc-modal.is-visible { display: flex; }

.gfsc-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 20px;
	background: var(--gfsc-accent);
	color: #fff;
	flex-shrink: 0;
}
.gfsc-modal-title { font-weight: 600; font-size: 16px; }
.gfsc-modal-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 8px;
	border-radius: 6px;
	transition: background-color 0.2s;
}
.gfsc-modal-close:hover { background: rgba(255, 255, 255, 0.25) !important; }

.gfsc-modal-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto !important;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: var(--gfsc-area);
}
.gfsc-modal-body iframe {
	width: 100% !important;
	height: 100% !important;
	min-height: 420px;
	border: 0;
	display: block;
}

/* ---- Header quick-action bar ---- */

.gfsc-actions {
	display: flex;
	gap: 8px;
	padding: 10px 16px;
	background: var(--gfsc-bg);
	border-bottom: 1px solid var(--gfsc-border);
	flex-shrink: 0;
}
.gfsc-action-btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	border: 1.5px solid var(--gfsc-accent) !important;
	background: #fff !important;
	color: var(--gfsc-accent) !important;
	border-radius: 999px !important;
	padding: 8px 14px;
	font-weight: 600;
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s, color 0.15s, transform 0.15s;
	white-space: nowrap;
	min-width: 0;
}
.gfsc-action-btn span { overflow: hidden; text-overflow: ellipsis; }
.gfsc-action-btn svg { flex-shrink: 0; }
.gfsc-action-btn:hover { background: var(--gfsc-accent) !important; color: #fff !important; }
.gfsc-action-btn:active { transform: scale(0.97); }

/* ---- "Book a call" alternative inside the lead form ---- */

.gfsc-lead-alt {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	margin-top: 6px;
	border: 1.5px solid var(--gfsc-accent) !important;
	background: transparent !important;
	color: var(--gfsc-accent) !important;
	border-radius: 24px !important;
	padding: 9px 16px;
	font-weight: 600;
	font-size: 13.5px;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}
.gfsc-lead-alt:hover { background: var(--gfsc-accent) !important; color: #fff !important; }

/* ---- Icon size armor: theme `svg { width:100% }` rules can't inflate our icons ---- */

.gfsc-booking-btn svg {
	width: 18px !important;
	height: 18px !important;
	min-width: 18px !important;
	max-width: 18px !important;
	flex-shrink: 0;
}
.gfsc-booking-btn {
	white-space: nowrap !important;
}
.gfsc-booking-btn span {
	display: inline-block;
}
.gfsc-action-btn svg,
.gfsc-lead-alt svg {
	width: 16px !important;
	height: 16px !important;
	min-width: 16px !important;
	max-width: 16px !important;
	flex-shrink: 0;
}
.gfsc-head-actions button svg {
	width: 18px !important;
	height: 18px !important;
	min-width: 18px !important;
	max-width: 18px !important;
}
.gfsc-head-avatar svg {
	width: 20px !important;
	height: 20px !important;
}
.gfsc-send svg {
	min-width: 20px !important;
	max-width: 20px !important;
	min-height: 20px !important;
	max-height: 20px !important;
}
/* Catch-all guard for any future icon inside widget buttons */
.gfsc button svg {
	max-width: 28px;
	max-height: 28px;
}
