/* =========================================================================
   TIEVERA — Sales Assistant widget.
   Self-contained: carries its own palette so it looks right even if the
   brand plugin is deactivated.
   ========================================================================= */

.tvbot {
	--tvbot-base: #2b1219;
	--tvbot-surface: #38181f;
	--tvbot-maroon: #6e0820;
	--tvbot-maroon-deep: #4a0516;
	--tvbot-gold: #d6a64a;
	--tvbot-gold-soft: #ecc878;
	--tvbot-paper: #f3efe8;
	--tvbot-muted: #bdb2a1;
	--tvbot-line: rgba(214, 166, 74, 0.26);
	--tvbot-line-soft: rgba(243, 239, 232, 0.12);
	--tvbot-serif: "Cormorant", "Cormorant Garamond", Georgia, serif;
	--tvbot-sans: "Montserrat", "Segoe UI", system-ui, sans-serif;

	position: fixed;
	right: clamp(14px, 3vw, 28px);
	bottom: clamp(14px, 3vw, 28px);
	z-index: 9000;
	font-family: var(--tvbot-sans);
}

.tvbot :where(*, *::before, *::after) { box-sizing: border-box; }
.tvbot :where(p) { margin: 0; }

.tvbot__sr {
	position: absolute !important;
	width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --- launcher ---------------------------------------------------------- */

.tvbot__launch {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	min-height: 52px;
	padding: 0 1.25rem;
	background: linear-gradient(150deg, var(--tvbot-maroon) -10%, var(--tvbot-maroon-deep) 95%);
	color: var(--tvbot-gold-soft);
	border: 1px solid var(--tvbot-line);
	border-radius: 30px;
	font-family: var(--tvbot-sans);
	font-size: 0.74rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	cursor: pointer;
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
	transition: transform 220ms ease, border-color 220ms ease;
}

.tvbot__launch:hover {
	transform: translateY(-2px);
	border-color: var(--tvbot-gold);
}

.tvbot__launch:focus-visible {
	outline: 2px solid var(--tvbot-gold);
	outline-offset: 3px;
}

.tvbot__launch-ico { display: inline-flex; color: var(--tvbot-gold); }

.tvbot.is-open .tvbot__launch { opacity: 0; pointer-events: none; }

/* --- panel ------------------------------------------------------------- */

.tvbot__panel {
	position: absolute;
	right: 0;
	bottom: 0;
	width: min(380px, calc(100vw - 28px));
	height: min(560px, calc(100vh - 120px));
	display: flex;
	flex-direction: column;
	background: var(--tvbot-base);
	border: 1px solid var(--tvbot-line);
	border-radius: 6px;
	box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
	overflow: hidden;
	opacity: 0;
	transform: translateY(14px) scale(0.98);
	transform-origin: bottom right;
	transition: opacity 240ms ease, transform 260ms cubic-bezier(0.22, 0.8, 0.3, 1);
}

.tvbot__panel[hidden] { display: none; }

.tvbot.is-open .tvbot__panel {
	opacity: 1;
	transform: none;
}

.tvbot__head {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 1rem;
	background: linear-gradient(150deg, var(--tvbot-maroon) -20%, var(--tvbot-maroon-deep) 95%);
	border-bottom: 1px solid var(--tvbot-line);
	flex: none;
}

.tvbot__avatar {
	display: grid;
	place-items: center;
	width: 38px; height: 38px;
	border: 1px solid var(--tvbot-line);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.35);
	flex: none;
}

.tvbot__who { display: flex; flex-direction: column; line-height: 1.25; }
.tvbot__who strong { color: #fff; font-size: 0.95rem; font-weight: 600; }
.tvbot__who em {
	color: var(--tvbot-gold-soft);
	font-style: normal;
	font-size: 0.62rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.tvbot__close {
	margin-left: auto;
	display: grid; place-items: center;
	width: 36px; height: 36px;
	background: none;
	border: 0;
	color: rgba(255, 255, 255, 0.8);
	cursor: pointer;
	border-radius: 50%;
}

.tvbot__close:hover { color: #fff; background: rgba(0, 0, 0, 0.25); }

/* --- log --------------------------------------------------------------- */

.tvbot__log {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.7rem;
	scrollbar-width: thin;
	scrollbar-color: var(--tvbot-line) transparent;
}

.tvbot__log::-webkit-scrollbar { width: 6px; }
.tvbot__log::-webkit-scrollbar-thumb { background: var(--tvbot-line); border-radius: 3px; }

.tvbot__msg { display: flex; }
.tvbot__msg--user { justify-content: flex-end; }

.tvbot__bubble {
	max-width: 86%;
	padding: 0.7rem 0.9rem;
	font-size: 0.88rem;
	line-height: 1.62;
	border-radius: 10px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.tvbot__msg--assistant .tvbot__bubble {
	background: var(--tvbot-surface);
	color: var(--tvbot-paper);
	border: 1px solid var(--tvbot-line-soft);
	border-bottom-left-radius: 3px;
}

.tvbot__msg--user .tvbot__bubble {
	background: var(--tvbot-gold);
	color: #1a1206;
	border-bottom-right-radius: 3px;
	font-weight: 500;
}

.tvbot__bubble a {
	color: var(--tvbot-gold);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.tvbot__msg--user .tvbot__bubble a { color: #4a0516; }

/* typing indicator */
.tvbot__dots { display: flex; gap: 5px; align-items: center; padding: 0.9rem; }
.tvbot__dots span {
	width: 6px; height: 6px;
	background: var(--tvbot-gold);
	border-radius: 50%;
	animation: tvbot-blink 1.3s infinite ease-in-out;
}
.tvbot__dots span:nth-child(2) { animation-delay: 0.18s; }
.tvbot__dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes tvbot-blink {
	0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
	40%           { opacity: 1;    transform: translateY(-3px); }
}

/* --- starter chips ------------------------------------------------------ */

.tvbot__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	padding: 0 1rem;
}

.tvbot__chips:empty { display: none; }

.tvbot__chip {
	padding: 0.42rem 0.8rem;
	background: transparent;
	color: var(--tvbot-gold);
	border: 1px solid var(--tvbot-line);
	border-radius: 20px;
	font-family: var(--tvbot-sans);
	font-size: 0.74rem;
	cursor: pointer;
	transition: background-color 200ms ease;
}

.tvbot__chip:hover { background: rgba(214, 166, 74, 0.12); }

/* --- composer ----------------------------------------------------------- */

.tvbot__form {
	display: flex;
	align-items: flex-end;
	gap: 0.5rem;
	padding: 0.85rem 1rem;
	margin-top: 0.6rem;
	border-top: 1px solid var(--tvbot-line-soft);
	flex: none;
}

.tvbot__input {
	flex: 1;
	min-height: 44px;
	max-height: 120px;
	padding: 0.7rem 0.85rem;
	font: 400 0.88rem/1.5 var(--tvbot-sans);
	color: var(--tvbot-paper);
	background: rgba(0, 0, 0, 0.35);
	border: 1px solid var(--tvbot-line-soft);
	border-radius: 6px;
	resize: none;
	overflow-y: auto;
}

.tvbot__input::placeholder { color: var(--tvbot-muted); opacity: 0.75; }

.tvbot__input:focus {
	outline: 2px solid var(--tvbot-gold);
	outline-offset: 1px;
	border-color: var(--tvbot-gold);
}

.tvbot__send {
	display: grid;
	place-items: center;
	width: 44px; height: 44px;
	flex: none;
	background: var(--tvbot-gold);
	color: #1a1206;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 200ms ease;
}

.tvbot__send:hover { background: var(--tvbot-gold-soft); }

.tvbot__foot {
	padding: 0 1rem 0.85rem;
	font-size: 0.68rem;
	color: var(--tvbot-muted);
	text-align: center;
}

.tvbot__foot a { color: var(--tvbot-gold); }

/* --- small screens ------------------------------------------------------ */

@media (max-width: 480px) {
	.tvbot { right: 12px; bottom: 12px; left: 12px; }

	.tvbot__panel {
		width: auto;
		left: 0;
		right: 0;
		height: min(72vh, 540px);
	}

	.tvbot__launch { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
	.tvbot__panel,
	.tvbot__launch { transition: none; }
	.tvbot__dots span { animation: none; opacity: 0.7; }
}
