/* Bulgaria Estate – чат асистент */
#bec-root {
	--bec-accent: #AA8E5F;
	--bec-accent-dark: #8f764c;
	--bec-ink: #1c1c1e;
	--bec-anth: #2c2c2e;
	--bec-in: #ecebe8;
	--bec-line: #e3e0da;
	--bec-soft: #f9f8f6;
	--bec-muted: #8e877c;
	--bec-text2: #6e6a63;
	--bec-green: #34c759;
	--bec-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-family: var(--bec-font);
	font-size: 14px;
	line-height: 1.4;
	color: var(--bec-ink);
}
#bec-root *, #bec-root *::before, #bec-root *::after { box-sizing: border-box; }
#bec-root button { font-family: inherit; cursor: pointer; }
#bec-root [hidden] { display: none !important; }

/* Launcher */
.bec-launcher {
	position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 99990;
	width: 58px; height: 58px; border-radius: 50%; border: 0; padding: 0;
	background: var(--bec-accent); color: #fff;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 6px 20px rgba(28, 28, 30, .22);
	transition: transform .15s ease;
}
.bec-launcher:hover { transform: scale(1.05); }

/* Пулсиране: две вълни излизат от бутона, докато клиентът не е отворил чата в това посещение */
.bec-launcher::before, .bec-launcher::after {
	content: ""; position: absolute; inset: 0; border-radius: 50%;
	background: var(--bec-accent); z-index: -1; pointer-events: none;
	animation: bec-ring 2.8s cubic-bezier(.2, .6, .35, 1) infinite;
}
.bec-launcher::after { animation-delay: .9s; }
@keyframes bec-ring {
	0%   { transform: scale(1);    opacity: .45; }
	70%  { transform: scale(1.75); opacity: 0; }
	100% { transform: scale(1.75); opacity: 0; }
}
/* Лек "дъх" на самия бутон */
.bec-launcher { animation: bec-breathe 2.8s ease-in-out infinite; }
@keyframes bec-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.bec-launcher:hover { animation-play-state: paused; }
/* Спира, когато чатът или изборът са отворени, и след като клиентът вече е писал */
#bec-root.bec-is-open .bec-launcher, #bec-root.bec-choosing .bec-launcher, #bec-root.bec-engaged .bec-launcher,
#bec-root.bec-is-open .bec-launcher::before, #bec-root.bec-choosing .bec-launcher::before, #bec-root.bec-engaged .bec-launcher::before,
#bec-root.bec-is-open .bec-launcher::after, #bec-root.bec-choosing .bec-launcher::after, #bec-root.bec-engaged .bec-launcher::after {
	animation: none;
}
#bec-root.bec-is-open .bec-launcher::before, #bec-root.bec-choosing .bec-launcher::before, #bec-root.bec-engaged .bec-launcher::before,
#bec-root.bec-is-open .bec-launcher::after, #bec-root.bec-choosing .bec-launcher::after, #bec-root.bec-engaged .bec-launcher::after {
	opacity: 0;
}
.bec-launcher:focus-visible { outline: 3px solid var(--bec-ink); outline-offset: 3px; }
.bec-launcher svg { width: 26px; height: 26px; }
.bec-launcher-dot {
	position: absolute; top: 2px; right: 2px; width: 13px; height: 13px; border-radius: 50%;
	background: var(--bec-green); border: 2px solid var(--bec-accent);
}

/* Вдигнат над чужд плаващ бутон (Call Now Button и др.) */
#bec-root.bec-shift .bec-launcher { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
#bec-root.bec-shift .bec-invite { bottom: calc(166px + env(safe-area-inset-bottom, 0px)); }

/* Invitation bubble */
.bec-invite {
	position: fixed; right: 20px; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); z-index: 99990;
	max-width: 260px; padding: 11px 32px 12px 14px;
	background: #fff; border: 1px solid var(--bec-line); border-radius: 18px 18px 5px 18px;
	box-shadow: 0 8px 24px rgba(28, 28, 30, .12);
	text-align: left; color: var(--bec-ink);
	animation: bec-pop .35s ease-out both;
}
.bec-invite-body { display: block; background: none; border: 0; padding: 0; text-align: left; color: inherit; font-size: 14px; line-height: 1.4; }
.bec-invite-title { display: block; font-size: 12px; font-weight: 600; color: var(--bec-accent-dark); margin-bottom: 3px; }
.bec-invite-close {
	position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; background: none;
	color: var(--bec-muted); font-size: 16px; line-height: 1; border-radius: 50%;
}
.bec-invite-close:hover { background: var(--bec-soft); }

@keyframes bec-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

/* Window */
.bec-window {
	position: fixed; right: 20px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 99991;
	width: 370px; height: min(640px, calc(100vh - 150px));
	display: flex; flex-direction: column;
	background: #fff; border: 1px solid var(--bec-line); border-radius: 20px; overflow: hidden;
	box-shadow: 0 16px 48px rgba(28, 28, 30, .18);
	animation: bec-pop .25s ease-out both;
}
.bec-head {
	position: relative; flex: none; padding: 10px 14px 8px; text-align: center;
	background: var(--bec-soft); border-bottom: 1px solid #efede9;
}
.bec-head img { width: 40px; height: 40px; border-radius: 50%; display: block; margin: 0 auto; }
.bec-head-name { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--bec-ink); }
.bec-head-btn {
	position: absolute; top: 14px; width: 34px; height: 34px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	border: 0; background: none; color: var(--bec-muted); text-decoration: none;
}
.bec-head-btn:hover { background: #efede9; }
.bec-head-btn svg { width: 19px; height: 19px; }
.bec-call { left: 10px; color: var(--bec-accent-dark); }
.bec-close { right: 10px; }
.bec-reset { right: 46px; }

/* Choice: website / WhatsApp / Viber */
.bec-chooser {
	position: fixed; right: 20px; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); z-index: 99991;
	width: 300px; max-width: calc(100vw - 32px); padding: 14px 10px 8px;
	background: #fff; border: 1px solid var(--bec-line); border-radius: 18px;
	box-shadow: 0 12px 36px rgba(28, 28, 30, .16);
	animation: bec-pop .25s ease-out both;
}
#bec-root.bec-shift .bec-chooser { bottom: calc(166px + env(safe-area-inset-bottom, 0px)); }
.bec-chooser-title { margin: 0 6px 8px; font-size: 15px; font-weight: 600; color: var(--bec-ink); }
.bec-opt {
	display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 6px;
	border: 0; border-top: 1px solid #f0eeea; background: none; border-radius: 0;
	text-align: left; text-decoration: none; color: var(--bec-ink); font: inherit;
}
.bec-chooser-title + .bec-opt { border-top: 0; }
.bec-opt:hover { background: var(--bec-soft); }
.bec-opt:focus-visible { outline: 2px solid var(--bec-ink); outline-offset: -2px; }
.bec-opt b { display: block; font-size: 14px; font-weight: 600; }
.bec-opt small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--bec-text2); }
.bec-opt-ic { width: 38px; height: 38px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--bec-soft); color: var(--bec-accent-dark); }
.bec-opt-ic svg { width: 21px; height: 21px; }
.bec-opt-wa .bec-opt-ic { color: #1f9d55; }
.bec-opt-vb .bec-opt-ic { color: #7360f2; }

/* Messages */
.bec-log {
	flex: 1; overflow-y: auto; overscroll-behavior: contain;
	padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 4px;
	-webkit-overflow-scrolling: touch;
}
.bec-log > * { flex-shrink: 0; } /* без свиване на съобщенията при скрол */
.bec-sep { align-self: center; margin: 8px 0 4px; font-size: 11px; color: var(--bec-muted); }
.bec-sep b { font-weight: 600; }
.bec-msg {
	max-width: 78%; padding: 8px 13px; font-size: 14px; line-height: 1.42;
	white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
}
.bec-msg strong { font-weight: 600; }
.bec-msg-in { align-self: flex-start; background: var(--bec-in); color: var(--bec-ink); border-radius: 18px 18px 18px 5px; }
.bec-msg-out { align-self: flex-end; background: var(--bec-accent); color: #fff; font-weight: 500; border-radius: 18px 18px 5px 18px; }
.bec-msg-in + .bec-msg-in { border-top-left-radius: 5px; }
.bec-msg-out + .bec-msg-out { border-top-right-radius: 5px; }
.bec-receipt { align-self: flex-end; margin: 1px 4px 4px; font-size: 11px; color: var(--bec-muted); }
.bec-receipt b { font-weight: 600; }

.bec-typing { align-self: flex-start; background: var(--bec-in); border-radius: 18px 18px 18px 5px; padding: 11px 14px; display: flex; gap: 4px; }
.bec-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--bec-muted); animation: bec-dot 1.2s infinite ease-in-out; }
.bec-typing i:nth-child(2) { animation-delay: .15s; }
.bec-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bec-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Property results inside the chat */
.bec-results {
	align-self: flex-start; width: 78%; margin: 2px 0;
	background: #fff; border: 1px solid var(--bec-line); border-radius: 16px; overflow: hidden;
}
.bec-row {
	display: flex; gap: 10px; align-items: center; padding: 8px 10px;
	text-decoration: none; color: inherit; border-top: 1px solid #f0eeea;
}
.bec-row:first-child { border-top: 0; }
.bec-row:hover { background: var(--bec-soft); }
.bec-thumb { width: 44px; height: 44px; flex: none; border-radius: 9px; background: var(--bec-anth) center/cover no-repeat; }
.bec-row-price { display: block; font-size: 13px; font-weight: 600; color: var(--bec-ink); }
.bec-row-meta { display: block; font-size: 12px; color: var(--bec-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bec-row-text { min-width: 0; }
.bec-all {
	display: block; width: 100%; padding: 9px 10px; border: 0; border-top: 1px solid #f0eeea;
	background: none; color: var(--bec-accent-dark); font-size: 13px; font-weight: 600; text-align: center;
}
.bec-all:hover { background: var(--bec-soft); }

/* Booking: days and times */
.bec-book { align-self: stretch; margin: 4px 0 2px; }
.bec-days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.bec-day {
	flex: none; padding: 7px 12px; border-radius: 14px; border: 1px solid var(--bec-line);
	background: #fff; color: var(--bec-ink); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.bec-day.is-active { background: var(--bec-anth); border-color: var(--bec-anth); color: #fff; }
.bec-times { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.bec-time {
	padding: 7px 0; border-radius: 10px; border: 1px solid var(--bec-accent);
	background: #fff; color: var(--bec-accent-dark); font-size: 13px; font-weight: 600;
}
.bec-time:hover { background: var(--bec-soft); }
.bec-time.is-active { background: var(--bec-accent); color: #fff; }
.bec-book-confirm {
	display: block; width: 100%; margin-top: 10px; padding: 10px; border: 0; border-radius: 12px;
	background: var(--bec-accent); color: #fff; font-size: 14px; font-weight: 600;
}
.bec-book-confirm:disabled { opacity: .6; }
.bec-form { margin-top: 2px; padding: 12px; background: #fff; border: 1px solid var(--bec-line); border-radius: 16px; }
.bec-form-title { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--bec-ink); }
.bec-saved { margin: 0 0 10px; padding: 8px 12px; background: var(--bec-soft); border-radius: 10px; font-size: 14px; line-height: 1.5; color: var(--bec-ink); }
.bec-form-foot .bec-form-back + .bec-form-back { margin-left: 6px; }
.bec-in {
	display: block; width: 100%; margin: 0 0 8px; padding: 9px 12px;
	border: 1px solid #dcd8d1; border-radius: 10px; background: #fff;
	font: inherit; font-size: 15px; color: var(--bec-ink); outline: 0;
}
.bec-in:focus { border-color: var(--bec-accent); }
.bec-form-err { margin: -2px 0 8px; font-size: 12.5px; color: #b42318; }
.bec-form .bec-book-confirm { margin-top: 2px; }
.bec-form-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 11.5px; color: var(--bec-muted); }
.bec-form-back { flex: none; border: 0; background: none; padding: 0; color: var(--bec-accent-dark); font: inherit; font-weight: 600; text-decoration: underline; }
@media (max-width: 600px) { .bec-in { font-size: 16px; } }
.bec-day:focus-visible, .bec-time:focus-visible, .bec-book-confirm:focus-visible { outline: 2px solid var(--bec-ink); outline-offset: 2px; }

/* Quick replies */
.bec-qrs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.bec-qr {
	padding: 6px 12px; border-radius: 16px; border: 1px solid var(--bec-accent);
	background: #fff; color: var(--bec-accent-dark); font-size: 13px; font-weight: 500; line-height: 1.3;
}
.bec-qr:hover { background: var(--bec-accent); color: #fff; }
.bec-qr-faq { border-color: var(--bec-line); color: var(--bec-ink); }
.bec-qr-faq:hover { background: var(--bec-anth); border-color: var(--bec-anth); color: #fff; }
.bec-qr:focus-visible, .bec-all:focus-visible, .bec-row:focus-visible { outline: 2px solid var(--bec-ink); outline-offset: 2px; }

/* Composer */
.bec-composer { flex: none; padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)); background: #fff; }
.bec-field {
	display: flex; align-items: flex-end; gap: 6px;
	border: 1px solid #dcd8d1; border-radius: 20px; padding: 5px 5px 5px 14px; background: #fff;
}
.bec-field:focus-within { border-color: var(--bec-accent); }
.bec-input {
	flex: 1; border: 0; outline: 0; resize: none; background: none;
	font: inherit; font-size: 15px; line-height: 1.35; color: var(--bec-ink);
	max-height: 96px; padding: 4px 0; margin: 0; min-height: 22px;
}
.bec-input::placeholder { color: var(--bec-muted); }
.bec-send {
	width: 30px; height: 30px; flex: none; border-radius: 50%; border: 0;
	background: var(--bec-accent); color: #fff; display: flex; align-items: center; justify-content: center;
}
.bec-send:disabled { opacity: .45; cursor: default; }
.bec-send svg { width: 16px; height: 16px; }
.bec-note { margin: 6px 4px 0; font-size: 11px; color: var(--bec-muted); text-align: center; }
.bec-note a, .bec-sep a { color: inherit; }

/* Results panel */
.bec-panel {
	position: fixed; right: 402px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 99991;
	width: 380px; height: min(640px, calc(100vh - 150px));
	display: flex; flex-direction: column;
	background: var(--bec-soft); border: 1px solid var(--bec-line); border-radius: 20px; overflow: hidden;
	box-shadow: 0 16px 48px rgba(28, 28, 30, .18);
	animation: bec-pop .25s ease-out both;
}
.bec-panel-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 16px; background: #fff; border-bottom: 1px solid #efede9; }
.bec-panel-title { flex: 1; margin: 0; font-size: 14px; font-weight: 600; }
.bec-panel-back { display: none; }
.bec-panel-grid { flex: 1; overflow-y: auto; padding: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: start; grid-auto-rows: max-content; }
.bec-card { display: block; background: #fff; border: 1px solid var(--bec-line); border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit; }
.bec-card:hover { border-color: var(--bec-accent); }
.bec-card-img { aspect-ratio: 4 / 3; background: var(--bec-anth) center/cover no-repeat; }
.bec-card-body { padding: 8px 9px 10px; }
.bec-card-price { display: block; font-size: 14px; font-weight: 600; color: var(--bec-ink); }
.bec-card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; font-size: 12px; line-height: 1.35; color: var(--bec-ink); }
.bec-card-meta { display: block; margin-top: 4px; font-size: 11.5px; color: var(--bec-text2); }
.bec-panel-foot { flex: none; margin: 0; padding: 10px 14px 12px; font-size: 12.5px; color: var(--bec-text2); background: #fff; border-top: 1px solid #efede9; }
.bec-panel-foot button { border: 0; background: none; padding: 0; color: var(--bec-accent-dark); font: inherit; font-weight: 600; }

/* Hero button: [be_chat_button] */
.bec-hero-btn {
	display: inline-flex; align-items: center; gap: 10px;
	padding: 13px 24px; border: 0; border-radius: 28px;
	background: #AA8E5F; color: #fff; font: 600 15px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	cursor: pointer; transition: background .15s ease;
}
.bec-hero-btn:hover { background: #8f764c; }
.bec-hero-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.bec-hero-dot { width: 8px; height: 8px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 3px rgba(52, 199, 89, .25); }

/* Mobile: full screen like a messenger */
@media (max-width: 600px) {
	.bec-window, .bec-panel {
		inset: 0; right: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh;
		border-radius: 0; border: 0;
	}
	.bec-head { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
	.bec-head-btn { top: calc(14px + env(safe-area-inset-top, 0px)); }
	.bec-panel { z-index: 99992; }
	.bec-panel-head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
	.bec-panel-back { display: flex; }
	.bec-panel-x { display: none; }
	#bec-root.bec-is-open .bec-launcher, #bec-root.bec-is-open .bec-invite { display: none; }
	.bec-input { font-size: 16px; } /* без автоматичен zoom в iOS */
	.bec-invite { right: 16px; max-width: calc(100vw - 90px); }
}
/* Tablet / small laptop: panel over the chat instead of beside it */
@media (min-width: 601px) and (max-width: 860px) {
	.bec-panel { right: 20px; width: 370px; z-index: 99992; }
	.bec-panel-back { display: flex; }
	.bec-panel-x { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	#bec-root *, .bec-hero-btn { animation: none !important; transition: none !important; }
}
