/* Floating personal-chat widget */
.telegram-chat {
	position: fixed;
	inset-inline-end: 1.5rem;
	bottom: 1.5rem;
	z-index: 10020;
	direction: rtl;
	font-family: Arial, sans-serif;
}

.telegram-chat button,
.telegram-chat textarea {
	font: inherit;
}

.telegram-chat__launcher {
	display: inline-flex;
	align-items: center;
	gap: .65rem;
	min-height: 3.75rem;
	padding: .55rem 1rem .55rem .6rem;
	border: 0;
	border-radius: 999px;
	background: #229ed9;
	box-shadow: 0 12px 28px rgba(15, 75, 110, .34);
	color: #fff;
	cursor: pointer;
	transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.telegram-chat__launcher:hover,
.telegram-chat__launcher:focus-visible {
	background: #1689c1;
	box-shadow: 0 15px 32px rgba(15, 75, 110, .42);
	transform: translateY(-2px);
	outline: none;
}

.telegram-chat__launcher-icon {
	display: grid;
	width: 2.5rem;
	height: 2.5rem;
	place-items: center;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
}

.telegram-chat__launcher svg {
	width: 1.45rem;
	height: 1.45rem;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
}

.telegram-chat__launcher-text {
	font-size: .93rem;
	font-weight: 700;
	white-space: nowrap;
}

.telegram-chat__badge {
	position: absolute;
	inset-block-start: -.2rem;
	inset-inline-start: -.2rem;
	min-width: 1.25rem;
	height: 1.25rem;
	padding: 0 .25rem;
	border: 2px solid #fff;
	border-radius: 999px;
	background: #e64c4c;
	color: #fff;
	font-size: .72rem;
	font-weight: 700;
	line-height: 1rem;
	text-align: center;
}

.telegram-chat__panel {
	position: absolute;
	inset-inline-end: 0;
	bottom: calc(100% + .8rem);
	display: flex;
	width: min(23rem, calc(100vw - 2rem));
	max-height: min(39rem, calc(100vh - 7.5rem));
	flex-direction: column;
	overflow: hidden;
	border: 1px solid rgba(16, 37, 48, .12);
	border-radius: 1.15rem;
	background: #f4f7f9;
	box-shadow: 0 20px 50px rgba(16, 37, 48, .26);
	color: #18303d;
	text-align: right;
}

.telegram-chat__panel[hidden] {
	display: none;
}

.telegram-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.1rem;
	background: #1689c1;
	color: #fff;
}

.telegram-chat__header h2,
.telegram-chat__header p {
	margin: 0;
}

.telegram-chat__header h2 {
	font-size: 1.04rem;
	font-weight: 700;
}

.telegram-chat__header p {
	margin-top: .18rem;
	font-size: .78rem;
	opacity: .9;
}

.telegram-chat__close {
	display: grid;
	width: 2rem;
	height: 2rem;
	flex: 0 0 auto;
	place-items: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.telegram-chat__close:hover,
.telegram-chat__close:focus-visible {
	background: rgba(255, 255, 255, .18);
	outline: none;
}

.telegram-chat__close svg,
.telegram-chat__form button svg {
	width: 1.25rem;
	height: 1.25rem;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2;
}

.telegram-chat__messages {
	display: flex;
	min-height: 14rem;
	flex: 1 1 auto;
	flex-direction: column;
	gap: .65rem;
	overflow-y: auto;
	padding: 1rem;
	scroll-behavior: smooth;
}

.telegram-chat__message {
	max-width: 86%;
	padding: .65rem .8rem;
	border-radius: .85rem;
	font-size: .92rem;
	line-height: 1.42;
	white-space: pre-wrap;
	word-break: break-word;
}

.telegram-chat__message--visitor {
	align-self: flex-start;
	border-end-start-radius: .2rem;
	background: #229ed9;
	color: #fff;
}

.telegram-chat__message--operator {
	align-self: flex-end;
	border-end-end-radius: .2rem;
	background: #fff;
	box-shadow: 0 1px 2px rgba(20, 52, 68, .1);
}

.telegram-chat__message--notice {
	align-self: center;
	padding: .45rem .7rem;
	border-radius: .5rem;
	background: transparent;
	color: #5b6b73;
	font-size: .78rem;
	text-align: center;
}

.telegram-chat__message--failed {
	background: #b64444;
}

.telegram-chat__status {
	min-height: 1.2rem;
	margin: 0;
	padding: 0 1rem .35rem;
	color: #67777e;
	font-size: .76rem;
}

.telegram-chat__status--error {
	color: #b23535;
}

.telegram-chat__form {
	display: flex;
	align-items: end;
	gap: .5rem;
	padding: .75rem;
	border-top: 1px solid #dce5e9;
	background: #fff;
}

.telegram-chat__form textarea {
	min-height: 2.7rem;
	max-height: 7rem;
	flex: 1 1 auto;
	resize: none;
	padding: .66rem .75rem;
	border: 1px solid #c8d5da;
	border-radius: .65rem;
	background: #fff;
	color: #18303d;
	font-size: .92rem;
	line-height: 1.35;
}

.telegram-chat__form textarea:focus {
	border-color: #229ed9;
	box-shadow: 0 0 0 3px rgba(34, 158, 217, .14);
	outline: none;
}

.telegram-chat__form button {
	display: grid;
	width: 2.7rem;
	height: 2.7rem;
	flex: 0 0 auto;
	place-items: center;
	border: 0;
	border-radius: .65rem;
	background: #229ed9;
	color: #fff;
	cursor: pointer;
}

.telegram-chat__form button:hover,
.telegram-chat__form button:focus-visible {
	background: #1689c1;
	outline: none;
}

.telegram-chat__form button:disabled {
	cursor: wait;
	opacity: .6;
}

.telegram-chat__privacy {
	margin: 0;
	padding: .5rem .85rem .7rem;
	background: #fff;
	color: #6a7a82;
	font-size: .68rem;
	text-align: center;
}

.telegram-chat__privacy a {
	color: inherit;
	text-decoration: underline;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 480px) {
	.telegram-chat {
		inset-inline-end: 1rem;
		bottom: 1rem;
		max-width: calc(100vw - 2rem);
	}

	/* Keep the Hebrew invitation visible on mobile, not just the icon. */
	.telegram-chat__launcher {
		justify-content: center;
		padding: .55rem .95rem .55rem .55rem;
	}

	.telegram-chat__launcher-icon {
		width: 2.2rem;
		height: 2.2rem;
	}

	.telegram-chat__launcher-text {
		display: inline;
		font-size: .82rem;
		white-space: normal;
	}

	/* Dim the page so the open chat reads as a distinct layer above the site. */
	.telegram-chat:has(.telegram-chat__panel:not([hidden]))::before {
		content: '';
		position: fixed;
		inset: 0;
		z-index: -1;
		background: rgba(8, 28, 38, .55);
	}

	.telegram-chat__panel {
		width: min(23rem, calc(100vw - 1.5rem));
		max-height: min(37rem, calc(100vh - 6.75rem));
		border: 2px solid #1689c1;
		box-shadow: 0 24px 60px rgba(8, 28, 38, .5);
	}
}
