/* BoatsCover chat window. Colours are the theme's own (style.css :root). */

.bc-chat {
	--bcc-accent: var(--bc-strap, #f26a21);
	--bcc-accent-dark: var(--bc-strap-dark, #d4550f);
	--bcc-ink: var(--bc-slate, #16212b);
	--bcc-soft: var(--bc-fog, #e8ebed);
	--bcc-line: var(--bc-line, #cfd6da);
	--bcc-muted: var(--bc-tarp-soft, #64757f);

	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-size: 15px;
	line-height: 1.45;
}

/* Open, the window sits above everything, the cookie badge included. */
.bc-chat--open {
	z-index: 2147483000;
}

/* ---------------------------------------------------------------- button */

.bc-chat__toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 52px;
	padding: 0 20px 0 16px;
	border: 0;
	border-radius: 26px;
	background: var(--bcc-accent);
	color: #fff;
	font-weight: 700;
	letter-spacing: 0.02em;
	box-shadow: 0 8px 24px rgba(22, 33, 43, 0.28);
	cursor: pointer;
	transition: transform 0.15s ease, background-color 0.15s ease;
}

.bc-chat__toggle:hover,
.bc-chat__toggle:focus-visible {
	background: var(--bcc-accent-dark);
	color: #fff;
	transform: translateY(-1px);
}

.bc-chat__toggle svg {
	width: 22px;
	height: 22px;
	flex: none;
}

.bc-chat__badge {
	display: none;
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border: 2px solid #fff;
	border-radius: 10px;
	background: var(--bcc-ink);
	color: #fff;
	font-size: 11px;
	line-height: 16px;
	text-align: center;
}

.bc-chat--unseen .bc-chat__badge {
	display: block;
}

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

.bc-chat__panel {
	display: flex;
	flex-direction: column;
	width: 380px;
	height: min(600px, calc(100vh - 110px));
	background: #fff;
	color: var(--bcc-ink);
	border-radius: 16px;
	box-shadow: 0 16px 48px rgba(22, 33, 43, 0.32);
	overflow: hidden;
}

.bc-chat__panel[hidden],
.bc-chat__start[hidden],
.bc-chat__conversation[hidden],
.bc-chat__error[hidden] {
	display: none;
}

.bc-chat__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 14px 14px 16px;
	background: var(--bcc-ink);
	color: #fff;
}

.bc-chat__avatar {
	display: grid;
	place-items: center;
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	color: var(--bcc-ink);
	font-weight: 800;
	font-size: 18px;
	box-shadow: inset 0 -4px 0 var(--bcc-accent);
}

.bc-chat__titles {
	flex: 1;
	min-width: 0;
}

.bc-chat__title {
	margin: 0;
	color: #fff;
	font-size: 16px;
	font-family: var(--bc-display, inherit);
	line-height: 1.2;
}

.bc-chat__status {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 3px 0 0;
	font-size: 12px;
	color: #c7d1d8;
}

.bc-chat__dot {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #3ccf6e;
	box-shadow: 0 0 0 3px rgba(60, 207, 110, 0.25);
}

.bc-chat__dot--off {
	background: #9aa7b0;
	box-shadow: none;
}

.bc-chat__close {
	display: grid;
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.bc-chat__close:hover,
.bc-chat__close:focus-visible {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}

.bc-chat__close svg {
	width: 20px;
	height: 20px;
}

/* -------------------------------------------------- ticks and typing */

.bc-chat__tick {
	margin-left: 4px;
	letter-spacing: -0.15em;
}

.bc-chat__tick--seen {
	color: var(--bcc-accent);
	opacity: 1;
}

.bc-chat__msg--in .bc-chat__time {
	opacity: 0.75;
}

.bc-chat__typing {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	padding: 12px 14px;
}

.bc-chat__typing[hidden] {
	display: none;
}

.bc-chat__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--bcc-muted);
	animation: bc-chat-typing 1.2s infinite ease-in-out;
}

.bc-chat__typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.bc-chat__typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes bc-chat-typing {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* ------------------------------------------------------- start screen */

.bc-chat__start {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0;
	padding: 20px;
	overflow-y: auto;
	background: var(--bcc-soft);
}

.bc-chat__start-title {
	margin: 0;
	font-size: 18px;
	font-family: var(--bc-display, inherit);
}

.bc-chat__start-text {
	margin: 0 0 4px;
	font-size: 14px;
	color: var(--bcc-muted);
}

.bc-chat__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0;
	font-size: 13px;
	font-weight: 600;
}

.bc-chat .bc-chat__field input {
	width: 100%;
	height: 46px;
	padding: 0 14px;
	border: 1px solid var(--bcc-line);
	border-radius: 10px;
	background: #fff;
	font-size: 16px; /* 16px stops iOS zooming into the field */
	font-weight: 400;
	box-shadow: none;
}

.bc-chat .bc-chat__field input:focus {
	outline: none;
	border-color: var(--bcc-accent);
	box-shadow: 0 0 0 3px rgba(242, 106, 33, 0.2);
}

.bc-chat__start-button {
	height: 48px;
	margin-top: 4px;
	border: 0;
	border-radius: 10px;
	background: var(--bcc-accent);
	color: #fff;
	font-weight: 700;
	font-size: 15px;
	cursor: pointer;
}

.bc-chat__start-button:hover,
.bc-chat__start-button:focus-visible {
	background: var(--bcc-accent-dark);
	color: #fff;
}

.bc-chat__start-button:disabled {
	opacity: 0.6;
}

.bc-chat__error {
	margin: 0;
	color: #b32d2e;
	font-size: 13px;
}

/* ------------------------------------------------------- conversation */

.bc-chat__conversation {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.bc-chat__log {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 16px;
	overflow-y: auto;
	background: var(--bcc-soft);
}

.bc-chat__msg {
	position: relative;
	max-width: 82%;
	padding: 9px 12px 6px;
	border-radius: 16px 16px 16px 4px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(22, 33, 43, 0.08);
	align-self: flex-start;
	animation: bc-chat-pop 0.16s ease-out;
}

.bc-chat__msg--in {
	align-self: flex-end;
	border-radius: 16px 16px 4px 16px;
	background: var(--bcc-ink);
	color: #fff;
}

.bc-chat__text {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.bc-chat__time {
	margin-top: 2px;
	font-size: 11px;
	text-align: right;
	opacity: 0.6;
}

.bc-chat__form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 0;
	padding: 10px 12px;
	border-top: 1px solid var(--bcc-line);
	background: #fff;
}

.bc-chat .bc-chat__input {
	flex: 1;
	min-height: 44px;
	max-height: 140px;
	padding: 11px 14px;
	border: 1px solid var(--bcc-line);
	border-radius: 22px;
	background: #fff;
	font-size: 16px;
	line-height: 1.35;
	resize: none;
	box-shadow: none;
}

.bc-chat .bc-chat__input:focus {
	outline: none;
	border-color: var(--bcc-accent);
}

.bc-chat__send {
	display: grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--bcc-accent);
	color: #fff;
	cursor: pointer;
}

.bc-chat__send:hover,
.bc-chat__send:focus-visible {
	background: var(--bcc-accent-dark);
	color: #fff;
}

.bc-chat__send:disabled {
	opacity: 0.5;
}

.bc-chat__send svg {
	width: 20px;
	height: 20px;
	margin-left: 2px;
}

.bc-chat__log .bc-chat__error {
	align-self: center;
}

.bc-chat__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.bc-chat__foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 2px 12px;
	padding: 8px 14px 10px;
	background: #fff;
	font-size: 11px;
	color: var(--bcc-muted);
}

.bc-chat__foot a {
	color: inherit;
}

.bc-chat__wa {
	font-weight: 600;
}

@keyframes bc-chat-pop {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
	.bc-chat__panel:not([hidden]) {
		animation: bc-chat-in 0.2s ease-out;
	}

	@keyframes bc-chat-in {
		from { opacity: 0; transform: translateY(10px) scale(0.98); }
		to { opacity: 1; transform: none; }
	}
}

@media (prefers-reduced-motion: reduce) {
	.bc-chat__msg {
		animation: none;
	}
}

/* ----------------------------------------------------------------- phone */

/*
 * A round button that mirrors the cookie badge on the left: same 50px circle,
 * same 20px from the edge, same 80px up - clear of Storefront's handheld footer
 * bar. Open, the chat takes the whole screen, as phone messengers do.
 */
@media (max-width: 767px) {
	.bc-chat {
		right: 20px;
		bottom: calc(80px + env(safe-area-inset-bottom, 0px));
	}

	.bc-chat__toggle {
		width: 50px;
		height: 50px;
		padding: 0;
		border-radius: 50%;
	}

	.bc-chat__toggle-label {
		display: none;
	}

	.bc-chat--open .bc-chat__toggle {
		display: none;
	}

	.bc-chat__panel {
		position: fixed;
		inset: 0;
		width: auto;
		height: auto;
		border-radius: 0;
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}

	.bc-chat__head {
		padding-top: calc(14px + env(safe-area-inset-top, 0px));
	}

	html.bc-chat-locked,
	html.bc-chat-locked body {
		overflow: hidden;
	}
}
