/**
 * WhatsApp live chat widget — CCB-branded (Wati-inspired speech bubble).
 */

.ccb-wa-widget {
	--ccb-wa-accent: #25d366;
	--ccb-wa-brand: var(--orange, #f59a57);
	--ccb-wa-ink: var(--charcoal, #242424);
	--ccb-wa-shadow: 4px 4px 0 var(--ccb-wa-accent);
	position: fixed;
	z-index: 9998;
	bottom: 24px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	font-family: var(--font-body, 'Work Sans', sans-serif);
}

.ccb-wa-widget--bottom-right {
	right: 24px;
}

.ccb-wa-widget--bottom-left {
	left: 24px;
	align-items: flex-start;
}

/* Speech bubble panel */
.ccb-wa-widget__panel {
	width: min(360px, calc(100vw - 48px));
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px) scale(0.97);
	transition:
		opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
		transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
		visibility 0.28s;
	pointer-events: none;
}

.ccb-wa-widget.is-open .ccb-wa-widget__panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.ccb-wa-widget__panel[hidden] {
	display: block;
}

.ccb-wa-widget__bubble {
	position: relative;
	padding: 20px 20px 14px;
	background: #fff;
	border: 2px solid var(--ccb-wa-ink);
	border-radius: 18px;
	box-shadow: var(--ccb-wa-shadow);
}

/* Tail pointing to launcher */
.ccb-wa-widget__bubble::after {
	content: '';
	position: absolute;
	bottom: -9px;
	width: 14px;
	height: 14px;
	background: #fff;
	border-right: 2px solid var(--ccb-wa-ink);
	border-bottom: 2px solid var(--ccb-wa-ink);
	transform: rotate(45deg);
}

.ccb-wa-widget--bottom-right .ccb-wa-widget__bubble::after {
	right: 22px;
}

.ccb-wa-widget--bottom-left .ccb-wa-widget__bubble::after {
	left: 22px;
}

.ccb-wa-widget__close {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 50%;
	background: #f5f5f5;
	color: var(--mid-gray, #767676);
	cursor: pointer;
	z-index: 2;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ccb-wa-widget__close:hover,
.ccb-wa-widget__close:focus-visible {
	background: #fff;
	border-color: var(--ccb-wa-ink);
	color: var(--ccb-wa-ink);
	outline: none;
}

.ccb-wa-widget__bubble-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin-bottom: 14px;
	border-radius: 50%;
	background: var(--ccb-wa-accent);
	border: 2px solid var(--ccb-wa-ink);
	box-shadow: 3px 3px 0 var(--ccb-wa-ink);
	color: var(--near-black, #0f0f0f);
	font-size: 18px;
}

.ccb-wa-widget__bubble-message {
	margin: 0 0 18px;
	padding-right: 24px;
	font-family: var(--font-head, 'Urbanist', sans-serif);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--ccb-wa-ink);
}

.ccb-wa-widget__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: 13px 18px;
	font-family: var(--font-head, 'Urbanist', sans-serif);
	font-size: 14px;
	font-weight: 700;
	color: #fff;
	text-decoration: none;
	background: var(--near-black, #0f0f0f);
	border: 2px solid var(--ccb-wa-ink);
	border-radius: 12px;
	box-shadow: var(--ccb-wa-shadow);
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.ccb-wa-widget__cta:hover,
.ccb-wa-widget__cta:focus-visible {
	color: #fff;
	background: var(--ccb-wa-ink);
	transform: translate(2px, 2px);
	box-shadow: 2px 2px 0 var(--ccb-wa-accent);
}

.ccb-wa-widget__cta span {
	flex: 1;
	text-align: center;
}

.ccb-wa-widget__cta .fa-whatsapp {
	font-size: 20px;
}

.ccb-wa-widget__cta .fa-chevron-right {
	font-size: 12px;
	opacity: 0.95;
}

.ccb-wa-widget__powered {
	margin: 14px 0 0;
	padding-top: 12px;
	border-top: 1px solid #ebebeb;
	font-size: 11px;
	line-height: 1.4;
	color: var(--mid-gray, #767676);
	text-align: center;
}

.ccb-wa-widget__powered .fa-bolt {
	margin-right: 4px;
	font-size: 10px;
	color: var(--ccb-wa-brand);
}

.ccb-wa-widget__powered a {
	font-weight: 700;
	color: var(--ccb-wa-ink);
	text-decoration: none;
	transition: color 0.2s ease;
}

.ccb-wa-widget__powered a:hover,
.ccb-wa-widget__powered a:focus-visible {
	color: var(--ccb-wa-brand);
}

/* Launcher toggle */
.ccb-wa-widget__launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 2px solid var(--ccb-wa-ink);
	border-radius: 50%;
	background: var(--ccb-wa-accent);
	box-shadow: 4px 4px 0 var(--ccb-wa-ink);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ccb-wa-widget__launcher:hover,
.ccb-wa-widget__launcher:focus-visible {
	transform: translate(2px, 2px);
	box-shadow: 2px 2px 0 var(--ccb-wa-ink);
	outline: none;
}

.ccb-wa-widget__launcher-icon {
	font-size: 26px;
	line-height: 1;
}

.ccb-wa-widget__launcher-icon--wa {
	color: var(--near-black, #0f0f0f);
}

.ccb-wa-widget__launcher-icon--close {
	display: none;
	font-size: 22px;
	color: var(--ccb-wa-ink);
}

.ccb-wa-widget.is-open .ccb-wa-widget__launcher-icon--wa {
	display: none;
}

.ccb-wa-widget.is-open .ccb-wa-widget__launcher-icon--close {
	display: block;
}

.ccb-wa-widget__launcher-pulse {
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	border: 2px solid var(--ccb-wa-accent);
	opacity: 0.55;
	animation: ccb-wa-pulse 2.2s ease-out infinite;
	pointer-events: none;
}

@keyframes ccb-wa-pulse {
	0% {
		transform: scale(1);
		opacity: 0.55;
	}
	70% {
		transform: scale(1.35);
		opacity: 0;
	}
	100% {
		transform: scale(1.35);
		opacity: 0;
	}
}

@media (max-width: 767px) {
	.ccb-wa-widget {
		bottom: 16px;
	}

	.ccb-wa-widget--bottom-right {
		right: 16px;
	}

	.ccb-wa-widget--bottom-left {
		left: 16px;
	}

	.ccb-wa-widget__panel {
		width: min(320px, calc(100vw - 32px));
	}
}

@media (prefers-reduced-motion: reduce) {
	.ccb-wa-widget__panel,
	.ccb-wa-widget__launcher,
	.ccb-wa-widget__cta,
	.ccb-wa-widget__close {
		transition: none;
	}

	.ccb-wa-widget__launcher-pulse {
		animation: none;
		display: none;
	}
}
