/*
 * Tawk.to custom launcher and contact teaser.
 *
 * Colours, type and radii come from the theme.json custom properties; the
 * fallback after each var() keeps the widget legible if a token is missing.
 */

.ags-tawk-launcher {
	align-items: center;
	background: var(--wp--custom--color--button--states--default--background, #005c8c);
	border: 0;
	border-radius: 999px;
	bottom: max(30px, env(safe-area-inset-bottom));
	box-shadow: 0 6px 20px rgb(0 0 0 / 25%);
	color: var(--wp--custom--color--tokens--text--white, #fff);
	cursor: pointer;
	display: flex;
	font-family: var(--wp--custom--typography--font-family--primary, system-ui, sans-serif);
	font-size: 15px;
	font-weight: 600;
	gap: 10px;
	line-height: 1;
	padding: 14px 20px;
	position: fixed;
	right: max(30px, env(safe-area-inset-right));
	transition: transform 0.18s ease, background 0.18s ease;

	/* Sits behind the teaser (999), which opens over the same corner. */
	z-index: 998;
}

.ags-tawk-launcher:hover {
	background: var(--wp--custom--color--button--states--hover--background, #00264f);
	transform: translateY(-2px);
}

.ags-tawk-launcher:focus-visible {
	box-shadow: 0 0 0 5px var(--wp--custom--color--tokens--surface--blue, #005c8c), 0 6px 20px rgb(0 0 0 / 25%);
	outline: 3px solid var(--wp--custom--color--tokens--surface--white, #fff);
	outline-offset: 2px;
}

.ags-tawk-launcher[hidden] {
	display: none;
}

/* Status dot. Shared by the launcher and the avatar. */
.ags-tawk-dot {
	background: #c5ced8;
	border-radius: 50%;
	height: 9px;
	width: 9px;
}

.ags-tawk-dot--online {
	background: #3ec46d;
}

.ags-tawk-dot--away {
	background: #f0b429;
}

/* Greeting teaser. */
.ags-tawk-teaser {
	animation: ags-tawk-teaser-in 0.22s ease;
	background: var(--wp--custom--color--tokens--surface--white, #fff);
	border-radius: 16px 16px 6px;
	bottom: max(24px, env(safe-area-inset-bottom));
	box-shadow: 0 12px 32px rgb(0 0 0 / 20%);
	box-sizing: border-box;
	color: var(--wp--custom--color--tokens--text--dark-blue, #00264f);
	font-family: var(--wp--custom--typography--font-family--primary, system-ui, sans-serif);
	font-size: 15px;
	line-height: 1.45;
	max-width: calc(100vw - 48px);
	padding: 18px 18px 16px;
	position: fixed;
	right: max(24px, env(safe-area-inset-right));
	width: 300px;

	/* Same corner as the launcher, higher z-index, so it covers it. */
	z-index: 999;
}

.ags-tawk-teaser:focus {
	outline: none;
}

.ags-tawk-teaser[hidden] {
	display: none;
}

@keyframes ags-tawk-teaser-in {

	from {
		opacity: 0;
		transform: translateY(8px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.ags-tawk-teaser__close {
	background: none;
	border: 0;
	border-radius: var(--wp--custom--border--radius--4, 4px);
	color: var(--wp--custom--color--tokens--text--gray, #5f6368);
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	min-height: 32px;
	min-width: 32px;
	padding: 0;
	position: absolute;
	right: 6px;
	top: 4px;
}

.ags-tawk-teaser__close:hover {
	color: var(--wp--custom--color--tokens--text--blue, #005c8c);
}

.ags-tawk-teaser__close:focus-visible,
.ags-tawk-btn:focus-visible {
	outline: 3px solid var(--wp--custom--color--tokens--text--dark-blue, #00264f);
	outline-offset: 2px;
}

/* Header: avatar and intro copy. */
.ags-tawk-teaser__head {
	align-items: center;
	display: flex;
	gap: 12px;
	margin-bottom: 14px;
	padding-right: 16px;
}

.ags-tawk-teaser__avatar {
	background: #cfe4f5;
	border-radius: 50%;
	flex: 0 0 auto;
	height: 60px;
	position: relative;
	width: 60px;
}

.ags-tawk-teaser__avatar img {
	border-radius: 50%;
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.ags-tawk-dot--avatar {
	background: #6b7785;
	bottom: -1px;
	box-shadow: 0 0 0 2px var(--wp--custom--color--tokens--surface--white, #fff);
	height: 12px;
	position: absolute;
	right: -1px;
	width: 12px;
}

.ags-tawk-dot--avatar.ags-tawk-dot--online {
	background: #1a7f37;
}

.ags-tawk-dot--avatar.ags-tawk-dot--away {
	background: #946200;
}

.ags-tawk-teaser__intro {
	display: flex;
	flex-direction: column;
}

.ags-tawk-teaser__title {
	font-size: 15px;
}

.ags-tawk-teaser__subtitle {
	color: var(--wp--custom--color--tokens--text--gray, #5f6368);
	font-size: 13.5px;
	margin-top: 2px;
}

/* Actions: Call (primary) and Chat (secondary). */
.ags-tawk-teaser__actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ags-tawk-btn {
	align-items: center;
	border-radius: 10px;
	box-sizing: border-box;
	cursor: pointer;
	display: flex;
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 600;
	gap: 8px;
	justify-content: center;
	line-height: 1;
	padding: 11px 14px;
	text-decoration: none;
	transition: background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
	width: 100%;
}

.ags-tawk-btn:hover {
	transform: translateY(-1px);
}

.ags-tawk-btn[hidden] {
	display: none;
}

.ags-tawk-btn--call {
	background: var(--wp--custom--color--button--states--default--background, #005c8c);
	border: 0;
	box-shadow: 0 4px 14px rgb(0 92 140 / 35%);
	color: var(--wp--custom--color--tokens--text--white, #fff);
}

.ags-tawk-btn--call:hover {
	background: var(--wp--custom--color--button--states--hover--background, #00264f);
	color: var(--wp--custom--color--tokens--text--white, #fff);
}

.ags-tawk-btn--chat {
	background: var(--wp--custom--color--tokens--surface--white, #fff);
	border: 1.5px solid var(--wp--custom--color--tokens--surface--blue, #005c8c);
	color: var(--wp--custom--color--tokens--text--blue, #005c8c);
}

.ags-tawk-btn--chat:hover {
	background: #eef5fa;
	border-color: var(--wp--custom--color--tokens--surface--dark-blue, #00264f);
}

@media (prefers-reduced-motion: reduce) {

	.ags-tawk-teaser {
		animation: none;
	}

	.ags-tawk-launcher,
	.ags-tawk-btn {
		transition: none;
	}

	.ags-tawk-launcher:hover,
	.ags-tawk-btn:hover {
		transform: none;
	}
}
