/* Chat widget — RTL, brand palette (#4a7c59), Alef. */
#tbot-root {
	--tbot-green: #4a7c59;
	--tbot-green-dark: #2d5016;
	--tbot-cream: #F4F5E9;
	--tbot-ink: #2f4f38;
	/* Google's Hebrew UI font (enqueued by the plugin), falling back to the
	   site's Rubik, then system Hebrew-capable fonts. */
	font-family: 'Noto Sans Hebrew', 'Rubik', 'Assistant', 'Segoe UI', Arial, sans-serif;
	direction: rtl;
}

#tbot-root * { box-sizing: border-box; }

/* Floating bubble — WhatsApp-style avatar of Shlomi (image carries its own green ring). */
.tbot-bubble {
	position: fixed;
	bottom: 23px; /* center-aligns with the 60px side-cart basket (bottom 12 + margin 10) */
	left: 22px;
	right: auto;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: none;
	background: url('tbot-avatar.webp') center / cover no-repeat;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
	z-index: 99998;
	transition: transform 0.18s ease, opacity 0.18s ease;
}
.tbot-bubble:hover { transform: scale(1.06); }
.tbot-hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }

/* Contextual quiet opener — sits just above the launcher, left side. */
.tbot-opener {
	position: fixed;
	bottom: 92px;
	left: 22px;
	right: auto;
	max-width: 240px;
	background: var(--tbot-cream, #F4F5E9);
	color: var(--tbot-ink);
	padding: 11px 15px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.45;
	box-shadow: 0 6px 18px rgba(45, 80, 22, 0.18);
	cursor: pointer;
	z-index: 99998;
	border: 1px solid rgba(74, 124, 89, 0.18);
	transform-origin: bottom left;
	animation: tbot-opener-pop 0.28s ease-out;
}
/* Comic speech tail pointing down toward the avatar. */
.tbot-opener::after {
	content: '';
	position: absolute;
	left: 20px;
	bottom: -7px;
	width: 14px;
	height: 14px;
	background: var(--tbot-cream, #F4F5E9);
	border-right: 1px solid rgba(74, 124, 89, 0.18);
	border-bottom: 1px solid rgba(74, 124, 89, 0.18);
	transform: rotate(45deg);
}
@keyframes tbot-opener-pop {
	from { opacity: 0; transform: translateY(8px) scale(0.94); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Panel — opens from the bottom-left corner. */
.tbot-panel {
	position: fixed;
	bottom: 22px;
	left: 22px;
	right: auto;
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 44px);
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 18px 48px rgba(45, 80, 22, 0.26);
	display: none;
	flex-direction: column;
	overflow: hidden;
	z-index: 99999;
}
.tbot-panel.tbot-open { display: flex; }

.tbot-head {
	background: var(--tbot-green);
	color: #fff;
	padding: 14px 16px;
	font-size: 16px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.tbot-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 22px;
	cursor: pointer;
	line-height: 1;
}

.tbot-log {
	flex: 1;
	min-height: 0; /* CRITICAL: without this a flex:1 column child won't shrink below
	                  its content height, so overflow-y never engages and the panel
	                  clips the bottom. This is what made scroll fail on mobile+desktop. */
	overflow-y: auto;
	-webkit-overflow-scrolling: touch; /* momentum scroll on iOS */
	overscroll-behavior: contain;      /* don't chain scroll to the page behind */
	padding: 14px;
	background: var(--tbot-cream);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.tbot-msg {
	max-width: 86%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 17px; /* a notch above the 16px readability floor, per Shlomi */
	line-height: 1.55;
	word-wrap: break-word;
}
.tbot-user {
	align-self: flex-start;
	background: var(--tbot-green);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.tbot-assistant {
	align-self: flex-end;
	background: #fff;
	color: var(--tbot-ink);
	border: 1px solid rgba(74, 124, 89, 0.16);
	border-bottom-left-radius: 4px;
}
.tbot-msg a { color: inherit; text-decoration: underline; }
/* Freshly-streamed tail fades in instead of popping (wrapped by revealTail). */
.tbot-new { animation: tbot-word-in 0.28s ease-out; }
@keyframes tbot-word-in { from { opacity: 0; } to { opacity: 1; } }
/* The url() filter warps the already-masked logo inside the row — animated
   turbulence makes the tendrils writhe (see renderTyping for the filter def). */
.tbot-typing { padding: 6px 4px; background: none; box-shadow: none; border: none; filter: url(#tbot-tentacles); }
/* Thinking mark — the site logo as a mask, with a wave of green
   energy flowing through the mycelium and a slow meditative breath. */
.tbot-think {
	width: 46px;
	height: 30px;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
	background: linear-gradient(100deg, #2d5016 0%, #4a7c59 38%, #9ed084 50%, #4a7c59 62%, #2d5016 100%);
	background-size: 260% 100%;
	animation: tbot-think-flow 2.6s ease-in-out infinite, tbot-think-breathe 4.8s ease-in-out infinite;
	transform-origin: center;
}
@keyframes tbot-think-flow { 0% { background-position: 130% 0; } 100% { background-position: -130% 0; } }
/* No rotation — the tentacle writhe (the SVG displacement filter on the row)
   carries the motion. Just a VERY gentle zoom-in/out breath under it. */
@keyframes tbot-think-breathe {
	0%, 100% { transform: scale(0.96); opacity: 0.88; }
	50%      { transform: scale(1.05); opacity: 1; }
}
/* While words stream below it, the logo stays alive but smaller. */
.tbot-typing-stream { padding: 2px 4px; }
.tbot-typing-stream .tbot-think { width: 30px; height: 19px; }
/* No wave overlay — the word-reveal fade + the living panel ambience carry the
   motion now. flex-shrink:0 stays: a squeezable flex row with overflow≠visible
   was the collapsed-bubble bug, keep the row unsqueezable regardless. */
.tbot-msg.tbot-streaming { flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) {
	.tbot-think { animation: none; }
	.tbot-typing { filter: none; }
}

.tbot-cart {
	align-self: flex-end;
	display: flex;
	align-items: center;
	gap: 10px;
	background: #eaf2e6;
	border: 1px solid var(--tbot-green);
	border-radius: 12px;
	padding: 8px 12px;
	font-size: 15px;
	color: var(--tbot-green-dark);
}
.tbot-cart-link {
	background: var(--tbot-green);
	color: #fff !important;
	padding: 5px 12px;
	border-radius: 8px;
	text-decoration: none !important;
	font-weight: 700;
	white-space: nowrap;
}
/* Button variant of the cart link (AJAX add) — reset native button styling. */
button.tbot-cart-link {
	border: none;
	cursor: pointer;
	font-family: inherit;
	font-size: inherit;
	line-height: 1.4;
}
button.tbot-cart-link:disabled { opacity: 0.6; cursor: default; }
.tbot-wa { background: #25D366; }
/* The human door: call + WhatsApp side by side, wrapping on narrow panels.
   The call is the one we want tapped, so it is the warm button in a green room. */
.tbot-consult { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
.tbot-call {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #f0a63a;
	color: #1b2a20 !important;
}
.tbot-call:hover { background: #ffb64a; }
.tbot-call svg { flex: 0 0 auto; }
.tbot-call-desk { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: #ffd08a; }
.tbot-call-num { color: #fff !important; font-weight: 800; letter-spacing: 0.03em; text-decoration: none !important; }
.tbot-consult-note {
	align-self: flex-end;
	max-width: 88%;
	font-size: 13px;
	line-height: 1.45;
	color: #b8cbb0;
	margin: -4px 4px 4px 0;
}

.tbot-turnstile:empty { display: none; }
.tbot-turnstile { padding: 0 14px; }

.tbot-input {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid rgba(74, 124, 89, 0.14);
	background: #fff;
}
.tbot-input textarea {
	flex: 1;
	resize: none;
	border: 1px solid rgba(74, 124, 89, 0.3);
	border-radius: 12px;
	padding: 9px 12px;
	font-family: inherit;
	font-size: 17px; /* ≥16px also stops iOS auto-zoom on focus */
	max-height: 110px;
	outline: none;
}
.tbot-input textarea:focus { border-color: var(--tbot-green); }
#tbot-send {
	background: var(--tbot-green);
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	cursor: pointer;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Header actions: small WhatsApp button + close, top-left in RTL. */
.tbot-head-actions {
	display: flex;
	align-items: center;
	gap: 6px;
}
.tbot-wa-head {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: none;
	background: #25D366;
	color: #fff;
	cursor: pointer;
	padding: 0;
	transition: background 0.2s ease, transform 0.15s ease;
}
.tbot-wa-head:hover { background: #1ebe5d; transform: scale(1.08); }
/* Paper-plane send icon, mirrored for RTL so it points to the text flow. */
#tbot-send svg { transform: scaleX(-1); display: block; margin: auto; }

@media (max-width: 480px) {
	.tbot-panel {
		left: 0;
		right: auto;
		bottom: 0;
		width: 100vw;
		max-width: 100vw;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
	}
}

/*
 * The bot is now the single chat entry point on the left; the floating
 * WhatsApp button is hidden. Click-to-Chat renders its float as .ht-ctc-chat.
 * (Inline WhatsApp buttons inside pages are unaffected.)
 */
.ht-ctc-chat,
#ht-ctc,
.ht-ctc { display: none !important; }

/* When the chat panel is open, the floating side-cart overlaps the input row.
   The bot flags <body> with .tbot-panel-open; hide the cart while open (all widths). */
body.tbot-panel-open .xoo-wsc-basket { display: none !important; }

/* ===================== DARK PANEL (forest night) =====================
   Gemini-style living ambience, in brand: deep forest greens + a warm amber
   ember, drifting slowly behind the chat. The ambient layer lives on
   .tbot-panel::before (so it does NOT scroll with the log) and speeds up
   while the bot is thinking (:has(.tbot-typing) — older browsers just keep
   the calm drift). Bubbles/input/head get dark equivalents below. */
.tbot-panel {
	background: #0c1310;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}
/* AURORA BOREALIS ambience (per Shlomi: strong, clearly visible colors).
   ::before = the aurora itself — emerald, teal and violet curtains dancing
   with big hue swings. ::after = an amber WIND blowing in from the sun's
   corner (top-left), sweeping across and dying down. High alphas on the
   near-black panel so the colors genuinely show. */
.tbot-panel::before {
	content: '';
	position: absolute;
	inset: -15%;
	z-index: 0;
	pointer-events: none;
	background:
		radial-gradient(120% 80% at 80% -15%, rgba(56, 249, 168, 0.62), transparent 58%),
		radial-gradient(100% 75% at 12% 25%, rgba(139, 92, 246, 0.52), transparent 60%),
		radial-gradient(95% 80% at 55% 115%, rgba(47, 212, 201, 0.48), transparent 60%);
	animation: tbot-aurora 16s ease-in-out infinite;
}
.tbot-panel::after {
	content: '';
	position: absolute;
	inset: -15%;
	z-index: 0;
	pointer-events: none;
	background: linear-gradient(115deg,
		rgba(255, 179, 71, 0.6) 0%,
		rgba(232, 122, 0, 0.38) 24%,
		transparent 58%);
	opacity: 0.15;
	animation: tbot-sunwind 11s ease-in-out infinite;
}
@keyframes tbot-aurora {
	0%, 100% { filter: hue-rotate(0deg) saturate(1.15) brightness(1);     transform: translate(0, 0)    scale(1);    opacity: 0.95; }
	25%      { filter: hue-rotate(48deg) saturate(1.3) brightness(1.3);   transform: translate(4%, -4%) scale(1.18); opacity: 1; }
	50%      { filter: hue-rotate(-55deg) saturate(1.2) brightness(0.95); transform: translate(-4%, 3%) scale(1.08); opacity: 0.75; }
	75%      { filter: hue-rotate(28deg) saturate(1.35) brightness(1.2);  transform: translate(2%, -2%) scale(1.22); opacity: 0.95; }
}
@keyframes tbot-sunwind {
	0%, 100% { opacity: 0.15; transform: translate(-7%, 4%) skewX(-4deg); }
	45%      { opacity: 0.85; transform: translate(6%, -3%) skewX(3deg); }
	70%      { opacity: 0.4;  transform: translate(0, 0)    skewX(-2deg); }
}
.tbot-panel:has(.tbot-typing)::before { animation-duration: 6s; }
.tbot-panel:has(.tbot-typing)::after { animation-duration: 4.5s; }
/* Content sits above the ambient layer. */
.tbot-head, .tbot-log, .tbot-input, .tbot-turnstile { position: relative; z-index: 1; }
.tbot-head { background: linear-gradient(135deg, #17311f, #275c3c); }
.tbot-log { background: transparent; }
.tbot-assistant {
	background: rgba(16, 24, 20, 0.93); /* denser — keeps text crisp over the vivid aurora */
	color: #e9efe3;
	border-color: rgba(158, 208, 132, 0.16);
}
.tbot-cart {
	background: rgba(27, 42, 32, 0.92);
	color: #cfe3c2;
}
.tbot-input {
	background: rgba(12, 19, 16, 0.92);
	border-top-color: rgba(158, 208, 132, 0.14);
}
.tbot-input textarea {
	background: #16211b;
	color: var(--tbot-cream);
	border-color: rgba(74, 124, 89, 0.5);
}
.tbot-input textarea::placeholder { color: rgba(233, 239, 227, 0.45); }
.tbot-input textarea:focus { border-color: #9ed084; }
/* Send button — brand ember orange (the side-cart orange), pops on the dark. */
#tbot-send { background: #e87a00; }

/* Owner ops-mode — amber header so it's unmistakable you're not in sales mode. */
.tbot-panel.tbot-ops .tbot-head { background: linear-gradient(135deg, #4a3a13, #8a6a1e); }

/* Proactive teaser — same cream bubble, a refined orange accent edge so it
   reads as "reached out to you", not just the ambient opener. */
/* When the BOT initiates the conversation (the proactive teaser), the bubble is
   brand green with cream text — a clear visual signal that the bot
   REACHED OUT to you, distinct from the passive cream "I'm here" opener. The
   warm amber edge ties it to the send button + the aurora. */
.tbot-opener-pro {
	background: #014421;
	color: var(--tbot-cream, #F4F5E9);
	border-inline-start: 3px solid #e87a00;
}
.tbot-opener-pro::after {
	background: #014421;
	border-right-color: rgba(1, 44, 20, 0.55);
	border-bottom-color: rgba(1, 44, 20, 0.55);
}

/* Product cards the bot SHOWS in-chat (show_products) — the bot displays a
   product instead of only describing it: thumbnail, name, price, one-click add. */
.tbot-cards { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; align-self: stretch; position: relative; z-index: 1; }
.tbot-card {
	display: flex; align-items: center; gap: 11px;
	background: #f7f8f2; border: 1px solid rgba(1, 68, 33, 0.14);
	border-radius: 14px; padding: 8px; box-shadow: 0 3px 12px rgba(6, 80, 36, 0.18);
}
.tbot-card-media { flex: 0 0 auto; line-height: 0; }
.tbot-card-img { width: 58px; height: 58px; object-fit: cover; border-radius: 10px; display: block; background: #eef1e8; }
.tbot-card-noimg { background: #eef1e8; }
.tbot-card-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tbot-card-name { font-weight: 700; font-size: 14px; color: #1c2b1c; text-decoration: none; line-height: 1.25; }
.tbot-card-name:hover { text-decoration: underline; }
.tbot-card-price { font-size: 13px; color: #0b5c2c; font-weight: 700; }
.tbot-card-add {
	margin-top: 3px; align-self: flex-start;
	background: #014421; color: var(--tbot-cream, #F4F5E9);
	border: 0; border-radius: 999px; padding: 6px 18px;
	font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
	transition: background 0.15s;
}
.tbot-card-add:hover { background: #0b5c2c; }
.tbot-card-add:disabled { opacity: 0.7; cursor: default; }

/* Gentle attention pulse on the avatar bubble when the bot reaches out.
   The halo is a pseudo-element painted ONCE at full strength and only faded in and out — the
   first version animated box-shadow itself, which Chrome refuses to composite (a repaint on the
   main thread every frame for the 4.5s the pulse runs, right inside the TBT window; 25.8). */
.tbot-bubble::after {
	content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
	box-shadow: 0 0 0 9px rgba(232, 122, 0, 0.22), 0 6px 20px rgba(37, 211, 102, 0.5);
	opacity: 0;
}
@keyframes tbot-pulse-k {
	0%, 100% { opacity: 0; }
	50%      { opacity: 1; }
}
.tbot-bubble.tbot-pulse::after { animation: tbot-pulse-k 1.5s ease-in-out 3; will-change: opacity; }
@media (prefers-reduced-motion: reduce) { .tbot-bubble.tbot-pulse::after { animation: none; } }

/* Label-analyzer (Vision) camera button — round, subtle until hovered. */
.tbot-cam {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid rgba(158, 208, 132, 0.35);
	background: rgba(74, 124, 89, 0.22);
	color: #cfe3c2;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, transform 0.12s ease;
}
.tbot-cam:hover { background: rgba(74, 124, 89, 0.45); transform: translateY(-1px); }
.tbot-cam:active { transform: scale(0.94); }

/* Attached-photo preview strip above the composer. */
.tbot-attach {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px 0;
}
.tbot-attach-item { position: relative; flex-shrink: 0; }
.tbot-attach-item img {
	width: 54px;
	height: 54px;
	object-fit: cover;
	border-radius: 10px;
	border: 1px solid rgba(158, 208, 132, 0.4);
	display: block;
}
.tbot-attach-x {
	position: absolute;
	top: -7px;
	inset-inline-end: -7px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: none;
	background: #e87a00;
	color: #fff;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.tbot-attach-hint { font-size: 13px; color: rgba(233, 239, 227, 0.7); line-height: 1.35; }

/* A photo the visitor sent, shown inside their message bubble. */
.tbot-msg-img {
	display: block;
	max-width: 200px;
	max-height: 200px;
	width: auto;
	border-radius: 10px;
	margin-bottom: 6px;
}
@media (prefers-reduced-motion: reduce) {
	.tbot-panel::before, .tbot-panel::after { animation: none; }
}

/* Mobile alignment with the side-cart: at <=768px the basket moves up
   (bottom 25 + margin 10 = 35, h 60 -> center 65). Match the bubble's
   center (h 58 -> bottom 36) and lift the opener by the same 14px. */
@media (max-width: 768px) {
	.tbot-bubble { bottom: 36px; }
	.tbot-opener { bottom: 106px; }
}
/* Divider above turns the server restored from the visitor's previous conversation. */
.tbot-restored {
	text-align: center;
	font-size: 12px;
	color: #6b7b6e;
	margin: 6px 0 10px;
	position: relative;
}
.tbot-restored::before, .tbot-restored::after {
	content: '';
	display: inline-block;
	width: 18%;
	height: 1px;
	background: currentColor;
	opacity: .35;
	vertical-align: middle;
	margin: 0 8px;
}

/* Keep the open panel anchored to the raised bubble on tablets only —
   below 481px the panel is fullscreen (bottom: 0) and must stay so. */
@media (min-width: 481px) and (max-width: 768px) {
	.tbot-panel { bottom: 36px; }
}
