/* TWM Social Chat: frontend. Light palette only; every styled block sets background and color.
 * Colours, offsets and z-index come from the inline :root custom properties (Assets::inline_css). */

/* Elements rendered hidden and revealed by JS must stay hidden despite display rules below. */
.tsc-root[hidden],
.tsc-root [hidden],
.tsc-buttons [hidden] {
	display: none !important;
}

/* ---- Floating launcher (P1) ---- */

.tsc-root {
	--tsc-shift-cart: 0px;
	--tsc-shift-cookie: 0px;
	--tsc-shift-cm: 0px;
	position: fixed;
	bottom: calc(var(--tsc-bottom, 90px) + var(--tsc-shift-cart) + var(--tsc-shift-cookie) + var(--tsc-shift-cm));
	z-index: var(--tsc-z, 1000);
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-size: 15px;
	line-height: 1.4;
	transition: bottom 0.2s ease;
}

.tsc-root--right {
	right: var(--tsc-side, 20px);
}

.tsc-root--left {
	left: var(--tsc-side, 20px);
	align-items: flex-start;
}

/* Flatsome sticky add-to-cart bar. */
body.has-sticky-product-cart .tsc-root {
	--tsc-shift-cart: var(--tsc-sticky-cart, 60px);
}

/* Flatsome cookie notice: always shift above it, never cover its accept button. */
body:has(.flatsome-cookies--active) .tsc-root,
.tsc-root.tsc-cookie-active {
	--tsc-shift-cookie: var(--tsc-cookie-h, 96px);
}

/* Bottom-left belongs to Campaign Manager's trigger; on the left, sit above it. */
body:has(#wc-campaign-floating-trigger:not(.hidden)) .tsc-root--left {
	--tsc-shift-cm: 48px;
}

.tsc-launcher,
.tsc-launcher:hover,
.tsc-launcher:focus,
.tsc-launcher:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 56px;
	min-height: 56px;
	margin: 0;
	padding: 0 20px 0 16px;
	border: 0;
	border-radius: 28px;
	background: var(--tsc-btn-bg, #1F7A4D);
	color: var(--tsc-btn-fg, #FFFFFF);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
}

.tsc-launcher .tsc-icon {
	width: 26px;
	height: 26px;
	flex: none;
}

/* Style: icon only (round button, label kept for screen readers). */
.tsc-style--icon .tsc-launcher {
	width: 56px;
	padding: 0;
}

.tsc-style--icon .tsc-launcher__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Style: pill (text only). */
.tsc-style--pill .tsc-launcher {
	min-height: 48px;
	padding: 0 22px;
}

.tsc-style--pill .tsc-launcher .tsc-icon {
	display: none;
}

/* ---- Panel ---- */

.tsc-panel {
	position: absolute;
	bottom: calc(100% + 12px);
	right: 0;
	width: min(320px, calc(100vw - 2 * var(--tsc-side, 20px)));
	max-height: min(70vh, 480px);
	overflow-y: auto;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 12px;
	background: var(--tsc-panel-bg, #FFFFFF);
	color: var(--tsc-panel-fg, #1A1A1A);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
	text-align: left;
}

.tsc-root--left .tsc-panel {
	right: auto;
	left: 0;
}

.tsc-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 8px 8px 16px;
	background: var(--tsc-panel-bg, #FFFFFF);
	color: var(--tsc-panel-fg, #1A1A1A);
}

.tsc-panel__title {
	margin: 0;
	padding: 0;
	font-size: 16px;
	font-weight: 700;
	color: inherit;
}

.tsc-panel__close,
.tsc-greeting__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 22px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.tsc-panel__list {
	margin: 0;
	padding: 0 8px 8px;
	list-style: none;
}

.tsc-panel__list li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tsc-entry,
.tsc-entry:hover,
.tsc-entry:focus,
.tsc-entry:visited {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	padding: 10px 8px;
	border-radius: 8px;
	background: var(--tsc-panel-bg, #FFFFFF);
	color: var(--tsc-panel-fg, #1A1A1A);
	text-decoration: none;
}

.tsc-entry:hover {
	background: rgba(0, 0, 0, 0.05);
}

.tsc-entry__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 20px;
	background: var(--tsc-btn-bg, #1F7A4D);
	color: var(--tsc-btn-fg, #FFFFFF);
}

.tsc-entry__icon .tsc-icon {
	width: 22px;
	height: 22px;
}

.tsc-entry__text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.tsc-entry__name {
	font-weight: 600;
}

.tsc-entry__role {
	font-size: 13px;
	opacity: 0.8;
}

/* ---- Greeting bubble ---- */

.tsc-greeting {
	position: absolute;
	bottom: calc(100% + 12px);
	right: 0;
	display: flex;
	align-items: center;
	gap: 4px;
	width: max-content;
	max-width: min(280px, calc(100vw - 2 * var(--tsc-side, 20px)));
	padding: 4px 4px 4px 14px;
	border-radius: 12px;
	background: var(--tsc-panel-bg, #FFFFFF);
	color: var(--tsc-panel-fg, #1A1A1A);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
	animation: tsc-pop 0.25s ease-out;
}

.tsc-root--left .tsc-greeting {
	right: auto;
	left: 0;
}

@keyframes tsc-pop {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* ---- Inline buttons (P2 product, P4 shortcode) ---- */

.tsc-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 1em;
}

.tsc-button,
.tsc-button:hover,
.tsc-button:focus,
.tsc-button:visited {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	margin: 0;
	padding: 0 16px;
	border: 0;
	border-radius: 4px;
	background: var(--tsc-btn-bg, #1F7A4D);
	color: var(--tsc-btn-fg, #FFFFFF);
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	text-transform: none;
}

.tsc-button .tsc-icon {
	width: 20px;
	height: 20px;
	flex: none;
}

.tsc-button--icon,
.tsc-button--icon:hover,
.tsc-button--icon:focus {
	justify-content: center;
	width: 44px;
	padding: 0;
	border-radius: 22px;
}

.tsc-button--link,
.tsc-button--link:hover,
.tsc-button--link:focus,
.tsc-button--link:visited {
	min-height: 0;
	padding: 0;
	background: transparent;
	color: inherit;
	font-weight: inherit;
	text-decoration: underline;
}

.tsc-button:hover,
.tsc-launcher:hover {
	filter: brightness(0.94);
}

/* ---- Focus and motion ---- */

.tsc-root :focus-visible,
.tsc-buttons :focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #1A1A1A;
}

@media (prefers-reduced-motion: reduce) {
	.tsc-root,
	.tsc-greeting {
		transition: none;
		animation: none;
	}
}
