/* =============================================
   Live chat widget (floating button + FAQ popup)
   Loads site-wide.

   Responsive plan:
   large  (>=1024px): fixed popup, 360px wide, 480px tall
   medium (768-1023px): fixed popup, 340px wide, 460px tall
   small  (<768px): bottom-sheet style, near full width, ~70vh tall
   ============================================= */

.chat-widget {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 999;
}

/* ---- Floating toggle button ---- */
.chat-widget__toggle {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #25d366;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	animation: solid-chat-bounce 2.4s ease-in-out infinite;
	position: relative;
}

.chat-widget__toggle:hover {
	background: #1ebe5b;
	animation-play-state: paused;
}

@keyframes solid-chat-bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-5px); }
}

@media (prefers-reduced-motion: reduce) {
	.chat-widget__toggle {
		animation: none;
	}
}

.chat-widget__icon-close {
	display: none;
	position: absolute;
}

.chat-widget.is-open .chat-widget__icon-open {
	display: none;
}

.chat-widget.is-open .chat-widget__icon-close {
	display: block;
}

.chat-widget.is-open .chat-widget__toggle {
	animation: none;
}

/* ---- Popup panel ---- */
.chat-widget__panel {
	position: absolute;
	bottom: 72px;
	right: 0;
	width: 360px;
	height: 480px;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(0.98);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.chat-widget.is-open .chat-widget__panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.chat-widget__header {
	background: var(--color-text);
	color: #fff;
	padding: 18px 20px;
	flex-shrink: 0;
}

.chat-widget__title {
	color: #fff;
	font-size: 1.05rem;
	margin: 0 0 4px;
}

.chat-widget__subtitle {
	font-size: 0.82rem;
	color: rgba(255, 255, 255, 0.75);
	margin: 0;
}

.chat-widget__body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 20px;
}

.chat-widget__faq-label {
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--color-text-muted);
	margin: 0 0 10px;
}

.chat-widget__faq-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.faq-item {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	overflow: hidden;
}

.faq-item__question {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 12px;
	background: none;
	border: none;
	text-align: left;
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--color-text);
	cursor: pointer;
}

.faq-item__arrow {
	flex-shrink: 0;
	transition: transform 0.15s ease;
}

.faq-item__question[aria-expanded="true"] .faq-item__arrow {
	transform: rotate(180deg);
}

.faq-item__answer {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.2s ease;
}

.faq-item__answer p {
	padding: 0 12px 12px;
	margin: 0;
	font-size: 0.82rem;
	color: var(--color-text-muted);
	line-height: 1.5;
}

.chat-widget__footer {
	flex-shrink: 0;
	padding: 14px 20px;
	border-top: 1px solid var(--color-border);
	background: var(--color-bg-alt);
}

.chat-widget__footer-label {
	font-size: 0.78rem;
	color: var(--color-text-muted);
	margin: 0 0 8px;
	text-align: center;
}

.chat-widget__whatsapp-btn {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: #25d366;
	border-color: #25d366;
}

.chat-widget__whatsapp-btn:hover {
	background: #1ebe5b;
	border-color: #1ebe5b;
}

/* =============================================
   Responsive
   ============================================= */

/* Medium: 768px - 1023px, slightly narrower panel */
@media (min-width: 768px) and (max-width: 1023px) {
	.chat-widget__panel {
		width: 340px;
		height: 460px;
	}
}

/* Small: < 768px, bottom-sheet style */
@media (max-width: 767px) {
	.chat-widget {
		bottom: 16px;
		right: 16px;
	}

	.chat-widget__toggle {
		width: 48px;
		height: 48px;
	}

	.chat-widget__panel {
		position: fixed;
		bottom: 0;
		right: 0;
		left: 0;
		width: auto;
		margin: 0 12px;
		height: 70vh;
		border-radius: var(--radius-lg) var(--radius-lg) 0 0;
	}
}