/* Oversite — Chat Widget Styles
   FAB button, speed-dial menu, mobile bottom-sheet, greeting bubble
   ================================================================ */

:root {
	--qweb-cw-color: #25D366;
	--qweb-cw-size: 56px;
	--qweb-cw-size-mobile: 48px;
	--qweb-cw-gap: 20px;
	--qweb-cw-item-size: 44px;
}

/* ── FAB container ────────────────────────────────────────────── */
.qweb-cw {
	position: fixed;
	z-index: 999998;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.4;
}

.qweb-cw--bottom-right { bottom: var(--qweb-cw-gap); right: var(--qweb-cw-gap); }
.qweb-cw--bottom-left  { bottom: var(--qweb-cw-gap); left: var(--qweb-cw-gap); }
.qweb-cw--top-right    { top: var(--qweb-cw-gap); right: var(--qweb-cw-gap); }
.qweb-cw--top-left     { top: var(--qweb-cw-gap); left: var(--qweb-cw-gap); }

/* ── Main FAB button ──────────────────────────────────────────── */
.qweb-cw__fab {
	width: var(--qweb-cw-size);
	height: var(--qweb-cw-size);
	border-radius: 50%;
	background: var(--qweb-cw-color);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 16px rgba(0,0,0,.2);
	transition: transform .2s, box-shadow .2s, background .2s;
	position: relative;
	color: #fff;
	padding: 0;
}

.qweb-cw__fab:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 24px rgba(0,0,0,.25);
}

.qweb-cw__fab svg {
	width: 26px;
	height: 26px;
	fill: currentColor;
	transition: transform .3s;
}

.qweb-cw.is-open .qweb-cw__fab svg {
	transform: rotate(45deg);
}

/* Pulse animation */
.qweb-cw__fab--pulse::before {
	content: '';
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	background: var(--qweb-cw-color);
	opacity: .4;
	animation: qweb-cw-pulse 2s ease-in-out infinite;
	z-index: -1;
}

@keyframes qweb-cw-pulse {
	0%, 100% { transform: scale(1); opacity: .4; }
	50%      { transform: scale(1.25); opacity: 0; }
}

.qweb-cw.is-open .qweb-cw__fab--pulse::before {
	animation: none;
	opacity: 0;
}

/* Badge */
.qweb-cw__badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 18px;
	height: 18px;
	border-radius: 9px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
	line-height: 1;
	box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.qweb-cw__badge--dot {
	min-width: 10px;
	height: 10px;
	padding: 0;
	border-radius: 50%;
}

.qweb-cw.is-open .qweb-cw__badge { display: none; }

/* ── Speed-dial menu (desktop/tablet) ─────────────────────────── */
.qweb-cw__menu {
	position: absolute;
	display: flex;
	flex-direction: column;
	gap: 10px;
	pointer-events: none;
	opacity: 0;
	transition: opacity .25s;
}

.qweb-cw.is-open .qweb-cw__menu {
	pointer-events: auto;
	opacity: 1;
}

/* Position menu relative to FAB */
.qweb-cw--bottom-right .qweb-cw__menu,
.qweb-cw--bottom-left .qweb-cw__menu {
	bottom: calc(var(--qweb-cw-size) + 12px);
}

.qweb-cw--top-right .qweb-cw__menu,
.qweb-cw--top-left .qweb-cw__menu {
	top: calc(var(--qweb-cw-size) + 12px);
	flex-direction: column-reverse;
}

.qweb-cw--bottom-right .qweb-cw__menu,
.qweb-cw--top-right .qweb-cw__menu {
	right: 6px;
	align-items: flex-end;
}

.qweb-cw--bottom-left .qweb-cw__menu,
.qweb-cw--top-left .qweb-cw__menu {
	left: 6px;
	align-items: flex-start;
}

/* ── Menu item ────────────────────────────────────────────────── */
.qweb-cw__item {
	display: flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	transform: scale(0) translateY(10px);
	transition: transform .2s cubic-bezier(.34,1.56,.64,1), opacity .2s;
	opacity: 0;
}

.qweb-cw.is-open .qweb-cw__item {
	transform: scale(1) translateY(0);
	opacity: 1;
}

/* Stagger animation */
.qweb-cw.is-open .qweb-cw__item:nth-child(1) { transition-delay: .03s; }
.qweb-cw.is-open .qweb-cw__item:nth-child(2) { transition-delay: .06s; }
.qweb-cw.is-open .qweb-cw__item:nth-child(3) { transition-delay: .09s; }
.qweb-cw.is-open .qweb-cw__item:nth-child(4) { transition-delay: .12s; }
.qweb-cw.is-open .qweb-cw__item:nth-child(5) { transition-delay: .15s; }
.qweb-cw.is-open .qweb-cw__item:nth-child(6) { transition-delay: .18s; }
.qweb-cw.is-open .qweb-cw__item:nth-child(7) { transition-delay: .21s; }
.qweb-cw.is-open .qweb-cw__item:nth-child(8) { transition-delay: .24s; }

/* Right-aligned: reverse flex direction so label appears left of icon */
.qweb-cw--bottom-right .qweb-cw__item,
.qweb-cw--top-right .qweb-cw__item {
	flex-direction: row-reverse;
}

.qweb-cw__item-icon {
	width: var(--qweb-cw-item-size);
	height: var(--qweb-cw-item-size);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 20px;
	box-shadow: 0 2px 10px rgba(0,0,0,.15);
	flex-shrink: 0;
	transition: transform .15s;
}

.qweb-cw__item:hover .qweb-cw__item-icon {
	transform: scale(1.1);
}

.qweb-cw__item-icon svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

.qweb-cw__item-label {
	background: #fff;
	color: #1a1a2e;
	padding: 5px 12px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	box-shadow: 0 2px 8px rgba(0,0,0,.1);
	pointer-events: none;
}

/* ── Greeting bubble ──────────────────────────────────────────── */
.qweb-cw__greeting {
	position: absolute;
	background: #fff;
	color: #1a1a2e;
	padding: 12px 16px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.4;
	box-shadow: 0 4px 20px rgba(0,0,0,.12);
	max-width: 220px;
	opacity: 0;
	transform: scale(.9);
	transition: opacity .3s, transform .3s;
	pointer-events: none;
}

.qweb-cw__greeting.is-visible {
	opacity: 1;
	transform: scale(1);
	pointer-events: auto;
}

.qweb-cw.is-open .qweb-cw__greeting { display: none; }

.qweb-cw__greeting-close {
	position: absolute;
	top: 4px;
	right: 6px;
	background: none;
	border: none;
	font-size: 14px;
	color: #9ca3af;
	cursor: pointer;
	padding: 2px;
	line-height: 1;
}

/* Position greeting relative to FAB */
.qweb-cw--bottom-right .qweb-cw__greeting {
	bottom: calc(var(--qweb-cw-size) + 10px);
	right: 0;
	border-radius: 12px 12px 0 12px;
}
.qweb-cw--bottom-left .qweb-cw__greeting {
	bottom: calc(var(--qweb-cw-size) + 10px);
	left: 0;
	border-radius: 12px 12px 12px 0;
}
.qweb-cw--top-right .qweb-cw__greeting {
	top: calc(var(--qweb-cw-size) + 10px);
	right: 0;
	border-radius: 0 12px 12px 12px;
}
.qweb-cw--top-left .qweb-cw__greeting {
	top: calc(var(--qweb-cw-size) + 10px);
	left: 0;
	border-radius: 12px 0 12px 12px;
}

/* ── Backdrop (when menu open) ────────────────────────────────── */
.qweb-cw__backdrop {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999997;
	background: rgba(0,0,0,.15);
}

.qweb-cw__backdrop.is-visible { display: block; }

/* ================================================================
   MOBILE — Bottom sheet instead of speed-dial
   ================================================================ */
@media (max-width: 768px) {
	:root {
		--qweb-cw-size: var(--qweb-cw-size-mobile);
		--qweb-cw-gap: 16px;
	}

	.qweb-cw__menu { display: none !important; }

	.qweb-cw__sheet {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background: #fff;
		border-radius: 20px 20px 0 0;
		box-shadow: 0 -4px 24px rgba(0,0,0,.15);
		padding: 20px 16px calc(env(safe-area-inset-bottom, 8px) + 16px);
		transform: translateY(100%);
		transition: transform .3s cubic-bezier(.22,.68,0,1.2);
		z-index: 999999;
	}

	.qweb-cw__sheet.is-visible {
		transform: translateY(0);
	}

	.qweb-cw__sheet-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 16px;
		padding-bottom: 12px;
		border-bottom: 1px solid #f3f4f6;
	}

	.qweb-cw__sheet-title {
		font-size: 16px;
		font-weight: 700;
		color: #111827;
	}

	.qweb-cw__sheet-close {
		width: 32px;
		height: 32px;
		border-radius: 50%;
		background: #f3f4f6;
		border: none;
		font-size: 18px;
		cursor: pointer;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #6b7280;
	}

	.qweb-cw__sheet-grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 12px;
	}

	.qweb-cw__sheet-item {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 6px;
		text-decoration: none;
		padding: 12px 4px;
		border-radius: 12px;
		transition: background .15s;
	}

	.qweb-cw__sheet-item:active {
		background: #f3f4f6;
	}

	.qweb-cw__sheet-item .qweb-cw__item-icon {
		width: 48px;
		height: 48px;
		font-size: 24px;
	}

	.qweb-cw__sheet-item .qweb-cw__item-icon svg {
		width: 26px;
		height: 26px;
	}

	.qweb-cw__sheet-item span {
		font-size: 11px;
		font-weight: 600;
		color: #374151;
		text-align: center;
		line-height: 1.2;
	}
}

/* Hide sheet on desktop */
@media (min-width: 769px) {
	.qweb-cw__sheet { display: none !important; }
}
