/*
 * All brand colors below reference CSS custom properties set inline by the
 * plugin (from this site's own Houzez theme options — see
 * class-theme-adapter.php) with a neutral gold/charcoal fallback, so this
 * same file renders correctly on any Houzez install without edits.
 */
#houzez-ai-chat-root {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 100000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.houzez-ai-toggle {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: none;
	background: var(--houzez-ai-primary, #d4af7a);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease;
}

.houzez-ai-toggle:hover {
	transform: scale(1.05);
}

.houzez-ai-toggle-icon {
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--houzez-ai-primary-text, #fff);
}

.houzez-ai-toggle-icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

.houzez-ai-panel {
	position: absolute;
	right: 0;
	bottom: 72px;
	width: 380px;
	max-width: calc(100vw - 40px);
	height: min(600px, 75vh);
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.houzez-ai-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: var(--houzez-ai-secondary, #1b1b1b);
	background: linear-gradient(135deg, var(--houzez-ai-secondary, #1b1b1b) 0%, color-mix(in srgb, var(--houzez-ai-secondary, #1b1b1b) 75%, black) 100%);
	color: var(--houzez-ai-secondary-text, #fff);
	flex-shrink: 0;
	position: relative;
	z-index: 1;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.houzez-ai-header-main {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.houzez-ai-header-avatar {
	width: 34px;
	height: 34px;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--houzez-ai-primary, #d4af7a);
	color: var(--houzez-ai-primary-text, #fff);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--houzez-ai-primary, #d4af7a) 40%, transparent);
}

.houzez-ai-header-avatar svg {
	width: 20px;
	height: 20px;
}

.houzez-ai-header-text {
	display: flex;
	align-items: center;
	gap: 7px;
	min-width: 0;
}

.houzez-ai-header-title {
	font-weight: 600;
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--houzez-ai-secondary-text, #fff);
}

.houzez-ai-status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #3ddc84;
	flex-shrink: 0;
	animation: houzez-ai-status-pulse 2s ease-in-out infinite;
}

@keyframes houzez-ai-status-pulse {
	0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.5); }
	50%      { opacity: 0.7; box-shadow: 0 0 0 3px rgba(61, 220, 132, 0); }
}

.houzez-ai-close {
	background: none;
	border: none;
	color: inherit;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
	flex-shrink: 0;
}

.houzez-ai-thread {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.houzez-ai-welcome p {
	margin: 0 0 10px;
	font-size: 13px;
	color: #555;
}

.houzez-ai-suggestions {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.houzez-ai-suggestion {
	text-align: left;
	background: #f7f7f7;
	background: color-mix(in srgb, var(--houzez-ai-primary, #d4af7a) 10%, white);
	border: 1px solid #eee;
	border: 1px solid color-mix(in srgb, var(--houzez-ai-primary, #d4af7a) 25%, white);
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 12px;
	/* Neutral dark gray, not a brand-tinted color: the background above is
	   only lightly tinted (10-18% mix into white) so it stays near-white
	   regardless of hue, and a fixed neutral text color reads reliably
	   across every possible brand color instead of clashing with some. */
	color: #444;
	cursor: pointer;
}

.houzez-ai-suggestion:hover {
	background: color-mix(in srgb, var(--houzez-ai-primary, #d4af7a) 18%, white);
}

.houzez-ai-entry {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.houzez-ai-bubble-user {
	align-self: flex-end;
	max-width: 85%;
	background: var(--houzez-ai-secondary, #1b1b1b);
	color: var(--houzez-ai-secondary-text, #fff);
	padding: 8px 12px;
	border-radius: 12px 12px 2px 12px;
	font-size: 13px;
}

.houzez-ai-bubble-assistant {
	align-self: flex-start;
	max-width: 90%;
	background: #f2f2f2;
	color: #333;
	padding: 8px 12px;
	border-radius: 12px 12px 12px 2px;
	font-size: 13px;
	line-height: 1.4;
}

.houzez-ai-response {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.houzez-ai-notice {
	font-size: 11px;
	color: #97722f;
	background: #fdf6e8;
	border: 1px solid #f0e0b8;
	border-radius: 6px;
	padding: 5px 8px;
}

.houzez-ai-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.houzez-ai-chip {
	background: #eef6f0;
	color: #2f6b45;
	border: 1px solid #cfe8d6;
	border-radius: 999px;
	padding: 3px 10px;
	font-size: 11px;
	font-weight: 600;
}

.houzez-ai-count {
	font-size: 12px;
	color: #777;
}

.houzez-ai-error {
	font-size: 13px;
	color: #a33;
	background: #fbeeee;
	border-radius: 8px;
	padding: 10px 12px;
}

.houzez-ai-results {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Own the line-height rather than inheriting the theme's body value: a loose
   theme line-height silently inflates the card, and since the thumbnail
   stretches to the card's height, that turns its box portrait and makes
   object-fit crop hard into a landscape photo. Card height is the real
   control for how much of the image survives. */
.houzez-ai-card {
	display: flex;
	align-items: stretch;
	gap: 10px;
	line-height: 1.35;
	text-decoration: none;
	color: inherit;
	border: 1px solid #eee;
	border-radius: 8px;
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.houzez-ai-card:hover {
	border-color: var(--houzez-ai-primary, #d4af7a);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Stretches to the card's height so the image never strands itself at the top
   with dead space beneath. Width is tuned against the ~80px card height the
   line-height above produces, landing the box near 4:3 — close enough to a
   typical listing photo that object-fit has almost nothing to crop. */
.houzez-ai-card-img-wrap {
	width: 104px;
	flex: 0 0 104px;
	align-self: stretch;
	min-height: 78px;
	background: #f2f2f2;
	position: relative;
	overflow: hidden;
}

.houzez-ai-card-img-wrap.is-broken {
	background: linear-gradient(135deg, #f2f2f2 25%, #e9e9e9 25%, #e9e9e9 50%, #f2f2f2 50%, #f2f2f2 75%, #e9e9e9 75%);
	background-size: 12px 12px;
}

/* Absolute fill rather than width/height:100% — themes commonly ship a global
   `img { max-width: 100%; height: auto }`, which defeats object-fit and lets
   the natural aspect ratio push the image out of the card. Pinning all four
   edges fills the wrap even if a theme forces height back to auto. */
.houzez-ai-card-img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	min-width: 0;
	min-height: 0;
	object-fit: cover;
	object-position: center;
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
}

.houzez-ai-card-img-wrap.is-broken .houzez-ai-card-img {
	display: none;
}

.houzez-ai-card-badge {
	position: absolute;
	top: 4px;
	left: 4px;
	z-index: 1;
	max-width: calc(100% - 8px);
	box-sizing: border-box;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	background: var(--houzez-ai-primary, #d4af7a);
	color: var(--houzez-ai-primary-text, #1b1b1b);
	font-size: 9px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	padding: 2px 6px;
	border-radius: 4px;
	line-height: 1.4;
}

.houzez-ai-card-body {
	flex: 1 1 0;
	min-width: 0;
	padding: 6px 8px 6px 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
}

/* Explicit line-height: sellers put emoji in titles, and emoji fall back to a
   font with taller metrics that stretches a `normal` line box. */
.houzez-ai-card-title {
	font-size: 13px;
	line-height: 1.35;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.houzez-ai-card-location {
	font-size: 11px;
	color: #888;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	display: flex;
	align-items: center;
	gap: 3px;
}

.houzez-ai-card-location .houzez-icon {
	font-size: 10px;
	/* Not the raw primary color: this sits directly on a plain white card
	   background, where a very light/pale brand color would wash out. */
	color: var(--houzez-ai-primary-on-light, #d4af7a);
}

/* nowrap, not wrap: a second meta line makes the card taller, which re-narrows
   the stretched thumbnail's aspect ratio and brings the hard crop back. */
.houzez-ai-card-meta {
	font-size: 11px;
	color: #666;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: nowrap;
	overflow: hidden;
}

.houzez-ai-card-meta span {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.houzez-ai-card-meta .houzez-icon {
	font-size: 11px;
	color: #999;
}

.houzez-ai-card-price {
	font-size: 12px;
	font-weight: 700;
	color: #1b1b1b;
}

.houzez-ai-form {
	display: flex;
	border-top: 1px solid #eee;
	padding: 10px;
	gap: 6px;
	flex-shrink: 0;
}

.houzez-ai-input {
	flex: 1;
	min-width: 0;
	border: 1px solid #ddd;
	border-radius: 6px;
	padding: 8px 10px;
	font-size: 13px;
}

.houzez-ai-mic {
	background: #f2f2f2;
	border: 1px solid #ddd;
	border-radius: 6px;
	width: 34px;
	flex-shrink: 0;
	cursor: pointer;
	color: #555;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.houzez-ai-mic:hover {
	background: #ebebeb;
}

.houzez-ai-mic.is-listening {
	background: var(--houzez-ai-primary, #d4af7a);
	border-color: var(--houzez-ai-primary, #d4af7a);
	color: var(--houzez-ai-primary-text, #1b1b1b);
	animation: houzez-ai-mic-pulse 1.2s ease-in-out infinite;
}

@keyframes houzez-ai-mic-pulse {
	0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--houzez-ai-primary, #d4af7a) 45%, transparent); }
	50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--houzez-ai-primary, #d4af7a) 0%, transparent); }
}

.houzez-ai-send {
	background: var(--houzez-ai-primary, #d4af7a);
	border: none;
	border-radius: 6px;
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	color: var(--houzez-ai-primary-text, #1b1b1b);
	flex-shrink: 0;
}

/* Two-part loader: Houzez's own icon font morphing shape (in a soft circular
   badge) + rotating status text, e.g. search -> map -> pin -> deal. */
.houzez-ai-loader {
	display: flex;
	align-items: center;
	gap: 12px;
	align-self: flex-start;
	max-width: 90%;
	background: #f2f2f2;
	padding: 10px 14px 10px 10px;
	border-radius: 12px 12px 12px 2px;
}

.houzez-ai-loader-icon-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #fff;
	flex-shrink: 0;
	animation: houzez-ai-loader-pulse 1.8s ease-in-out infinite;
}

.houzez-ai-loader-icon {
	font-size: 16px;
	line-height: 1;
	color: var(--houzez-ai-primary, #d4af7a);
	display: inline-block;
	text-align: center;
}

.houzez-ai-loader-icon.is-popping {
	animation: houzez-ai-icon-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes houzez-ai-icon-pop {
	0%   { transform: scale(0.4) rotate(-25deg); opacity: 0; }
	60%  { transform: scale(1.15) rotate(8deg); opacity: 1; }
	100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes houzez-ai-loader-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.08); }
	50%      { box-shadow: 0 0 0 5px rgba(0, 0, 0, 0); }
}

.houzez-ai-loader-text {
	font-size: 12px;
	color: #777;
}

/* Chat-on-WhatsApp CTA: WhatsApp's own brand green, kept fixed regardless of
   the site's theme color, so it reads as the familiar WhatsApp button the
   same way the theme's own listing/footer WhatsApp buttons already do. */
.houzez-ai-whatsapp-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	align-self: flex-start;
	background: #25d366;
	color: #fff;
	text-decoration: none;
	font-size: 12px;
	font-weight: 600;
	padding: 8px 14px;
	border-radius: 999px;
	margin-top: 2px;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.houzez-ai-whatsapp-btn:hover,
.houzez-ai-whatsapp-btn:focus-visible {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
	color: #fff;
}

.houzez-ai-whatsapp-btn .houzez-icon {
	font-size: 15px;
	line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
	.houzez-ai-loader-icon.is-popping,
	.houzez-ai-loader-icon-wrap,
	.houzez-ai-mic.is-listening,
	.houzez-ai-status-dot,
	.houzez-ai-toggle,
	.houzez-ai-whatsapp-btn {
		animation: none;
		transition: none;
	}
}

@media (max-width: 480px) {
	.houzez-ai-panel {
		right: -10px;
		width: calc(100vw - 20px);
	}
}
