/* Namespaced, isolated from host theme: every rule is scoped under
 * #wpac-chat-root and uses its own font/color tokens rather than
 * inheriting body/button/input/heading styles from the active theme. */

#wpac-chat-root, #wpac-chat-root * {
	box-sizing: border-box;
}
#wpac-chat-root {
	--wpac-accent: #FF5A1F;
	--wpac-ink: #14151A;
	--wpac-body: #6b6e76;
	--wpac-border: #ececec;
	--wpac-bg: #fcfcfb;

	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 999999;
	font-family: Inter, "Geist", Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--wpac-ink);
}
#wpac-chat-root button {
	font-family: inherit;
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
}
#wpac-chat-root :focus-visible {
	outline: 2px solid var(--wpac-accent);
	outline-offset: 2px;
}

/* ---------- Collapsed bubble ---------- */
.wpac-bubble {
	display: flex;
	align-items: center;
	gap: 9px;
	background: var(--wpac-ink);
	border-radius: 999px;
	padding: 15px 20px 15px 15px;
	height: 56px;
	box-shadow: 0 10px 30px -10px rgba(0,0,0,0.35);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.wpac-bubble:hover { transform: translateY(-2px); box-shadow: 0 14px 36px -10px rgba(0,0,0,0.42); }
.wpac-bubble-icon {
	width: 28px; height: 28px; border-radius: 50%; background: var(--wpac-accent);
	display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.wpac-bubble-label { color: #fff; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.wpac-bubble-dot {
	width: 7px; height: 7px; border-radius: 50%; background: #34D399;
	margin-left: 2px; box-shadow: 0 0 0 2px rgba(52,211,153,0.25);
}

/* ---------- Panel ---------- */
.wpac-panel {
	position: absolute;
	bottom: 68px;
	right: 0;
	width: 440px;
	height: 660px;
	max-height: calc(100vh - 110px);
	background: #ffffff;
	border-radius: 22px;
	box-shadow: 0 30px 80px -22px rgba(0,0,0,0.32);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--wpac-border);
}
.wpac-panel--anim { animation: wpac-pop-in 0.22s cubic-bezier(0.22,1,0.36,1); }
@keyframes wpac-pop-in {
	from { opacity: 0; transform: translateY(14px) scale(0.97); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Header (~68px) ---------- */
.wpac-header {
	display: flex; align-items: center; gap: 11px;
	padding: 14px 16px; height: 68px; flex-shrink: 0;
	border-bottom: 1px solid var(--wpac-border);
}
.wpac-brandmark { width: 34px; height: 34px; border-radius: 10px; object-fit: contain; flex-shrink: 0; }
.wpac-brandmark--fallback {
	display: flex; align-items: center; justify-content: center;
	background: var(--wpac-accent); color: #ffffff; font-weight: 700; font-size: 12.5px;
	letter-spacing: 0.05em; border-radius: 10px;
}
.wpac-header-text { flex: 1; min-width: 0; }
.wpac-header-title { font-size: 14.5px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.wpac-header-sub { font-size: 11px; color: #9a9a9a; font-weight: 500; }
.wpac-status { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: #34D399; flex-shrink: 0; }
.wpac-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #34D399; }
.wpac-header-close {
	color: #9a9a9a; display: flex; align-items: center; justify-content: center;
	width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; transition: background 0.15s ease;
}
.wpac-header-close:hover { background: #f2f2f2; color: var(--wpac-ink); }

/* ---------- Body / welcome ---------- */
.wpac-body { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; background: var(--wpac-bg); position: relative; }

.wpac-welcome { padding: 22px 20px 16px; transition: opacity 0.2s ease, transform 0.2s ease; }
.wpac-welcome--hidden { opacity: 0; transform: translateY(-6px); pointer-events: none; }
.wpac-welcome-q { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.24; margin-bottom: 8px; }
.wpac-welcome-accent {
	display: block; width: 28px; height: 3px; border-radius: 2px;
	background: var(--wpac-accent); margin-bottom: 12px;
}
.wpac-welcome-sub { font-size: 12.5px; line-height: 1.55; color: var(--wpac-body); margin-bottom: 16px; }

.wpac-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.wpac-action-card {
	display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
	background: #ffffff; border: 1px solid var(--wpac-border); border-radius: 14px;
	padding: 11px 12px;
	transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.wpac-action-card:hover { border-color: var(--wpac-accent); transform: translateY(-1px); box-shadow: 0 8px 18px -10px rgba(0,0,0,0.15); }
.wpac-action-icon {
	flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px;
	background: #f6f6f5; display: flex; align-items: center; justify-content: center;
	transition: background 0.15s ease;
}
.wpac-action-card:hover .wpac-action-icon { background: rgba(0,0,0,0.06); }
.wpac-action-text { display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; }
.wpac-action-label { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.wpac-action-desc { font-size: 10.5px; line-height: 1.4; color: #8a8d94; }
.wpac-action-arrow { display: none; }

.wpac-cta-wide {
	width: 100%; background: var(--wpac-ink); border-radius: 14px; padding: 14px 16px;
	display: flex; align-items: center; justify-content: space-between;
	transition: transform 0.12s ease, background 0.15s ease;
}
.wpac-cta-wide:hover { background: #000; transform: translateY(-1px); }
.wpac-cta-wide-text { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.wpac-cta-wide-label { font-size: 13.5px; font-weight: 700; color: var(--wpac-accent); }
.wpac-cta-wide-desc { font-size: 11px; color: #b8bcc4; }
.wpac-cta-wide-arrow { color: var(--wpac-accent); font-size: 15px; }

/* ---------- Messages ---------- */
.wpac-messages { flex: 1; padding: 6px 18px 14px; display: flex; flex-direction: column; gap: 14px; }

.wpac-msg { max-width: 90%; font-size: 13.5px; line-height: 1.6; word-wrap: break-word; }
.wpac-msg--in { animation: wpac-msg-in 0.26s cubic-bezier(0.22,1,0.36,1); }
@keyframes wpac-msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.wpac-msg p { margin: 0 0 6px 0; } .wpac-msg p:last-child { margin-bottom: 0; }
.wpac-msg ul, .wpac-msg ol { margin: 4px 0 6px 0; padding-left: 18px; }
.wpac-msg li { margin-bottom: 4px; }
.wpac-msg strong { font-weight: 700; }

.wpac-msg-user {
	align-self: flex-end;
	background: #f1f3f5;
	border: 1px solid #e2e5e9;
	color: var(--wpac-ink);
	padding: 10px 14px;
	border-radius: 14px;
	border-bottom-right-radius: 4px;
}
.wpac-msg-assistant { align-self: flex-start; padding: 0 2px; }
.wpac-msg-eyebrow {
	display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em;
	color: #b8bcc4; margin-bottom: 4px;
}

.wpac-typing { display: flex; align-items: center; gap: 4px; padding: 4px 2px; }
.wpac-typing span { width: 6px; height: 6px; border-radius: 50%; background: #ccc; animation: wpac-blink 1.2s infinite ease-in-out; }
.wpac-typing span:nth-child(2) { animation-delay: 0.2s; }
.wpac-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wpac-blink { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

/* ---------- Source citation cards ---------- */
.wpac-sources { align-self: flex-start; max-width: 100%; width: 100%; }
.wpac-sources-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: #b8bcc4; margin: 0 0 6px 2px; }
.wpac-sources-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.wpac-source-card {
	display: flex; align-items: center; gap: 8px; flex-shrink: 0;
	background: #ffffff; border: 1px solid var(--wpac-border); border-radius: 12px;
	padding: 10px 12px; text-decoration: none; max-width: 190px;
	transition: border-color 0.15s ease, transform 0.12s ease;
}
.wpac-source-card:hover { border-color: var(--wpac-accent); transform: translateY(-1px); }
.wpac-source-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--wpac-ink); }
.wpac-source-arrow { font-size: 12px; color: #9a9a9a; flex-shrink: 0; }

/* ---------- Contextual CTA ---------- */
.wpac-contextual-cta {
	align-self: flex-start; max-width: 90%;
	background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 14px;
	padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
}
.wpac-contextual-cta span { font-size: 12.5px; font-weight: 600; color: var(--wpac-ink); }
.wpac-contextual-cta-btn {
	align-self: flex-start; background: var(--wpac-ink); color: var(--wpac-accent);
	border-radius: 10px; padding: 8px 13px; font-size: 12px; font-weight: 700;
	transition: transform 0.12s ease;
}
.wpac-contextual-cta-btn:hover { transform: translateY(-1px); }

.wpac-lead-badge {
	align-self: flex-start; max-width: 90%;
	display: flex; align-items: center; gap: 7px;
	background: #EAF9F2; border: 1px solid #B8ECD3; border-radius: 12px;
	padding: 9px 13px; font-size: 12px; font-weight: 600; color: #1B7A4D;
}
.wpac-lead-badge span { color: #1B7A4D; font-weight: 800; }
.wpac-lead-badge--booking {
	background: #f4f6f8; border-color: #dde2e6; color: var(--wpac-ink);
}
.wpac-lead-badge--booking span { color: var(--wpac-accent); }

.wpac-feedback-row {
	display: flex; gap: 4px; margin-top: 6px;
}
.wpac-feedback-btn {
	display: flex; align-items: center; justify-content: center;
	width: 26px; height: 26px; border-radius: 7px; color: #9a9a9a;
	border: 1px solid var(--wpac-border);
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.wpac-feedback-btn:hover { background: #f2f2f2; color: #14151A; border-color: #d8d8d8; }
.wpac-feedback-confirm {
	display: inline-block; font-size: 11.5px; font-weight: 600; margin-top: 6px;
}
.wpac-feedback-confirm--up { color: #1B7A4D; }
.wpac-feedback-confirm--down { color: #8a8a8a; }

/* ---------- Tools menu slide-up ---------- */
.wpac-menu-panel {
	position: absolute; left: 0; right: 0; bottom: 64px;
	background: #ffffff; border-top: 1px solid #eee; border-radius: 18px 18px 0 0;
	box-shadow: 0 -12px 30px -14px rgba(0,0,0,0.18);
	max-height: 0; overflow: hidden; opacity: 0;
	transition: max-height 0.25s ease, opacity 0.2s ease;
	display: flex; flex-direction: column; padding: 0 8px; z-index: 2;
}
.wpac-menu-panel.is-open { max-height: 320px; opacity: 1; padding: 8px 8px; overflow-y: auto; }
.wpac-menu-row {
	display: flex; align-items: center; justify-content: space-between; width: 100%;
	text-align: left; padding: 13px 10px; font-size: 14px; font-weight: 600;
	border-radius: 10px; transition: background 0.15s ease;
}
.wpac-menu-row:hover { background: #f5f5f5; }
.wpac-menu-back { align-self: flex-start; font-size: 13px; font-weight: 600; color: #8a8a8a; padding: 8px 10px; }
.wpac-menu-back:hover { color: var(--wpac-ink); }
.wpac-menu-heading { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: #b8bcc4; padding: 4px 10px 6px; }
.wpac-menu-question { display: block; width: 100%; text-align: left; padding: 11px 10px; font-size: 13px; color: #333; border-radius: 10px; transition: background 0.15s ease; }
.wpac-menu-question:hover { background: #f5f5f5; color: var(--wpac-ink); }

/* ---------- Input row (~56px) ---------- */
.wpac-input-row {
	display: flex; align-items: center; border-top: 1px solid #eee;
	padding: 10px 12px; gap: 8px; background: #fff; flex-shrink: 0;
	position: relative; z-index: 1;
}
.wpac-tools-btn {
	background: #f5f5f5; border-radius: 50%; width: 38px; height: 38px;
	flex-shrink: 0; display: flex; align-items: center; justify-content: center;
	transition: background 0.15s ease;
}
.wpac-tools-btn:hover { background: #ebebeb; }
#wpac-chat-root .wpac-input-row input {
	all: revert;
	box-sizing: border-box;
	flex: 1; border: 1px solid #e2e2e2; border-radius: 16px; padding: 11px 16px;
	font-family: inherit; font-size: 13.5px; outline: none; min-width: 0;
	transition: border-color 0.15s ease;
}
#wpac-chat-root .wpac-input-row input:focus { border-color: var(--wpac-accent); }
.wpac-input-row button#wpac-send {
	background: var(--wpac-ink); border-radius: 50%; width: 38px; height: 38px;
	flex-shrink: 0; display: flex; align-items: center; justify-content: center;
	transition: transform 0.1s ease, background 0.15s ease;
}
.wpac-input-row button#wpac-send:hover { background: var(--wpac-accent); transform: scale(1.05); }
.wpac-input-row button#wpac-send:hover svg path { fill: #ffffff; }

/* ================================================================ */
/* VARIANT 1: Concierge (Friendly bubble + rounded modal)           */
/* ================================================================ */
#wpac-chat-root.wpac-style-concierge .wpac-panel {
	border-radius: 22px;
}

/* ================================================================ */
/* VARIANT 2: Side Sheet (Full height right drawer + 2x2 grid)     */
/* ================================================================ */
#wpac-chat-root.wpac-style-side_sheet .wpac-panel {
	position: fixed;
	top: 0;
	bottom: 0;
	right: 0;
	width: 440px;
	max-width: 100vw;
	height: 100vh;
	max-height: 100vh;
	border-radius: 0;
	border-top: none;
	border-right: none;
	border-bottom: none;
	border-left: 1px solid var(--wpac-border);
	box-shadow: -12px 0 45px rgba(0,0,0,0.18);
}
#wpac-chat-root.wpac-style-side_sheet .wpac-header {
	height: 72px;
	background: #fafafa;
	border-bottom: 1px solid var(--wpac-border);
}
#wpac-chat-root.wpac-style-side_sheet .wpac-welcome {
	padding: 24px 22px 18px;
}
#wpac-chat-root.wpac-style-side_sheet .wpac-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin: 16px 0;
}
#wpac-chat-root.wpac-style-side_sheet .wpac-action-card {
	padding: 16px 14px;
	border-radius: 14px;
	background: #ffffff;
	border: 1.5px solid var(--wpac-border);
	box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
#wpac-chat-root.wpac-style-side_sheet .wpac-action-card:hover {
	border-color: var(--wpac-accent);
	box-shadow: 0 10px 22px -8px rgba(0,0,0,0.12);
}
#wpac-chat-root.wpac-style-side_sheet .wpac-action-icon {
	width: 32px;
	height: 32px;
	border-radius: 9px;
}
#wpac-chat-root.wpac-style-side_sheet .wpac-action-label {
	font-size: 13.5px;
	margin-top: 4px;
}
#wpac-chat-root.wpac-style-side_sheet .wpac-action-desc {
	font-size: 11px;
}

/* ================================================================ */
/* VARIANT 3: Messenger (WhatsApp-familiar compact header & chat)   */
/* ================================================================ */
#wpac-chat-root.wpac-style-messenger .wpac-header {
	background: var(--wpac-accent);
	color: #ffffff;
	border-bottom: none;
}
#wpac-chat-root.wpac-style-messenger .wpac-header-title {
	color: #ffffff;
}
#wpac-chat-root.wpac-style-messenger .wpac-header-sub {
	color: rgba(255, 255, 255, 0.82);
}
#wpac-chat-root.wpac-style-messenger .wpac-header-close {
	color: #ffffff;
}
#wpac-chat-root.wpac-style-messenger .wpac-header-close:hover {
	background: rgba(255, 255, 255, 0.2);
	color: #ffffff;
}
#wpac-chat-root.wpac-style-messenger .wpac-status {
	color: #ffffff;
}
#wpac-chat-root.wpac-style-messenger .wpac-status-dot {
	background: #ffffff;
}
#wpac-chat-root.wpac-style-messenger .wpac-brandmark--fallback {
	background: rgba(255, 255, 255, 0.25);
	color: #ffffff;
}
#wpac-chat-root.wpac-style-messenger .wpac-msg-user {
	background: #DCF8C6;
	border: 1px solid #c5e8ab;
	color: #111111;
	border-radius: 12px;
	border-top-right-radius: 2px;
}
#wpac-chat-root.wpac-style-messenger .wpac-msg-assistant {
	background: #ffffff;
	border: 1px solid #e5e5e5;
	padding: 10px 14px;
	border-radius: 12px;
	border-top-left-radius: 2px;
	box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

@media (prefers-reduced-motion: reduce) {
	.wpac-panel--anim, .wpac-msg--in { animation: none; }
}

/* ---------- Mobile: near-full-screen, safe areas ---------- */
@media (max-width: 480px) {
	#wpac-chat-root { bottom: max(16px, env(safe-area-inset-bottom)); right: 16px; }
	.wpac-panel,
	#wpac-chat-root.wpac-style-side_sheet .wpac-panel {
		position: fixed;
		top: env(safe-area-inset-top, 12px);
		left: 12px; right: 12px;
		bottom: env(safe-area-inset-bottom, 12px);
		width: auto; height: auto; max-height: none;
		border-radius: 20px;
	}
	.wpac-bubble-label { display: none; }
	.wpac-bubble { padding: 15px; }
}
