#wcp-widget-root {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Bulletproof icon colors: many themes ship a global "svg { fill: currentColor }"
   reset which silently overrides inline fill/stroke attributes (SVG presentation
   attributes have lower CSS priority than any theme stylesheet rule). These
   classes with !important guarantee our icons stay visible on every theme. */
#wcp-widget-root svg { display: block; fill: none; }
#wcp-widget-root .wcp-icon-fill-white   { fill: #ffffff !important; stroke: none !important; }
#wcp-widget-root .wcp-icon-fill-accent  { fill: var(--wcp-color, #25D366) !important; stroke: none !important; }
#wcp-widget-root .wcp-icon-stroke-white { fill: none !important; stroke: #ffffff !important; }

/* Responsive show/hide */
@media (max-width: 782px) {
	#wcp-widget-root:not(.wcp-show-mobile) { display: none !important; }
}
@media (min-width: 783px) {
	#wcp-widget-root:not(.wcp-show-desktop) { display: none !important; }
}

/* Entrance animation for the whole widget */
@keyframes wcp-entrance {
	0%   { opacity: 0; transform: translateY(24px) scale(0.6); }
	60%  { opacity: 1; transform: translateY(-4px) scale(1.04); }
	100% { opacity: 1; transform: translateY(0) scale(1); }
}
#wcp-widget-root { animation: wcp-entrance 0.55s cubic-bezier(.34,1.56,.64,1) both; animation-delay: 0.2s; }

/* ---------- Toggle button ---------- */
#wcp-toggle-btn {
	position: relative;
	width: var(--wcp-size, 60px) !important;
	height: var(--wcp-size, 60px) !important;
	border-radius: 50% !important;
	background: var(--wcp-color, #25D366) !important;
	border: none !important;
	padding: 0 !important;
	margin: 0 !important;
	box-shadow: 0 6px 20px rgba(0,0,0,0.22), 0 2px 6px rgba(0,0,0,0.15);
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s ease;
}
#wcp-toggle-btn:hover { transform: scale(1.08) rotate(-4deg); box-shadow: 0 10px 26px rgba(0,0,0,0.3); }
#wcp-toggle-btn:active { transform: scale(0.94); }

.wcp-icon-chat, .wcp-icon-close {
	position: absolute;
	transition: opacity 0.2s ease, transform 0.3s cubic-bezier(.34,1.56,.64,1);
}
.wcp-icon-close { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.wcp-icon-chat  { opacity: 1; transform: rotate(0) scale(1); }
#wcp-widget-root.wcp-popup-open .wcp-icon-chat  { opacity: 0; transform: rotate(90deg) scale(0.5); }
#wcp-widget-root.wcp-popup-open .wcp-icon-close { opacity: 1; transform: rotate(0) scale(1); }

/* Pulsing attention ring */
.wcp-pulse-ring {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--wcp-color, #25D366);
	opacity: 0;
	pointer-events: none;
}
.wcp-pulse-on #wcp-toggle-btn .wcp-pulse-ring {
	animation: wcp-pulse 2.6s cubic-bezier(0,0,.2,1) infinite;
}
@keyframes wcp-pulse {
	0%   { opacity: 0.55; transform: scale(1); }
	80%  { opacity: 0; transform: scale(1.9); }
	100% { opacity: 0; transform: scale(1.9); }
}
#wcp-widget-root.wcp-popup-open .wcp-pulse-ring { animation: none !important; opacity: 0; }

#wcp-status-dot {
	position: absolute;
	top: 2px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.wcp-position-bottom-right #wcp-status-dot { right: 2px; }
.wcp-position-bottom-left #wcp-status-dot { left: 2px; }
#wcp-status-dot.wcp-online  { background: #2ecc71; }
#wcp-status-dot.wcp-offline { background: #b0b0b0; }

/* ---------- Waving UAE flag above the button ---------- */
.wcp-flag-wrap {
	position: absolute;
	bottom: 25%;
	left: 72%;
	transform: translateX(-50%);
	margin-bottom: -6px;
	pointer-events: none;
	filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}
.wcp-flag-svg {
	width: var(--wcp-flag-size, 80px) !important;
	height: auto !important;
	display: block;
}
.wcp-flag-cloth {
	transform-box: fill-box;
	transform-origin: 0% 50%;
	animation: wcp-flag-wave 1.8s ease-in-out infinite;
}
@keyframes wcp-flag-wave {
	0%, 100% { transform: skewY(0deg) scaleX(1); }
	25%      { transform: skewY(-5deg) scaleX(0.97); }
	50%      { transform: skewY(0deg) scaleX(1); }
	75%      { transform: skewY(5deg) scaleX(0.97); }
}

/* ---------- Popup ---------- */
#wcp-popup {
	position: absolute;
	bottom: calc(var(--wcp-size, 60px) + 18px);
	width: 336px;
	max-width: calc(100vw - 32px);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 16px 48px rgba(0,0,0,0.22), 0 4px 12px rgba(0,0,0,0.1);
	background: #fff;
	display: flex;
	flex-direction: column;
	transform-origin: bottom right;
	transition: opacity 0.25s ease, transform 0.28s cubic-bezier(.34,1.4,.64,1), visibility 0.28s;
}
.wcp-position-bottom-right #wcp-popup { right: 0; transform-origin: bottom right; }
.wcp-position-bottom-left  #wcp-popup { left: 0; transform-origin: bottom left; }

#wcp-popup.wcp-hidden {
	opacity: 0;
	transform: translateY(16px) scale(0.92);
	visibility: hidden;
	pointer-events: none;
}
#wcp-popup:not(.wcp-hidden) {
	opacity: 1;
	transform: translateY(0) scale(1);
	visibility: visible;
}

.wcp-popup-header {
	background: var(--wcp-color, #25D366);
	color: #fff;
	padding: 16px 16px;
	display: flex;
	align-items: center;
	gap: 10px;
}
.wcp-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.wcp-avatar-fallback { display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.22); }
.wcp-header-text { display: flex; flex-direction: column; flex-grow: 1; line-height: 1.35; }
.wcp-header-text strong { font-size: 15px; letter-spacing: 0.1px; }
.wcp-header-text span { font-size: 12px; opacity: 0.92; display: flex; align-items: center; gap: 5px; }
.wcp-header-status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.wcp-header-status-dot.wcp-online { background: #baffcf; }
.wcp-header-status-dot.wcp-offline { background: rgba(255,255,255,0.6); }

#wcp-close-btn {
	background: rgba(255,255,255,0.18) !important;
	border: none !important;
	color: #fff;
	width: 26px !important;
	height: 26px !important;
	border-radius: 50% !important;
	padding: 0 !important;
	margin: 0 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s ease, transform 0.15s ease;
}
#wcp-close-btn:hover { background: rgba(255,255,255,0.3); transform: rotate(90deg); }

.wcp-popup-body {
	padding: 16px;
	background: #EDEAE3;
	background-image: radial-gradient(rgba(0,0,0,0.025) 1px, transparent 1px);
	background-size: 14px 14px;
	max-height: 280px;
	overflow-y: auto;
}
.wcp-theme-dark .wcp-popup-body { background: #171717; background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px); }

.wcp-typing-indicator {
	display: inline-flex;
	gap: 4px;
	background: #fff;
	padding: 12px 14px;
	border-radius: 14px 14px 14px 4px;
	box-shadow: 0 1px 2px rgba(0,0,0,0.08);
	width: fit-content;
}
.wcp-theme-dark .wcp-typing-indicator { background: #2b2b2b; }
.wcp-typing-indicator span {
	width: 6px; height: 6px; border-radius: 50%;
	background: #9a9a9a;
	animation: wcp-typing-bounce 1.1s infinite ease-in-out;
}
.wcp-typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.wcp-typing-indicator span:nth-child(3) { animation-delay: 0.3s; }
@keyframes wcp-typing-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

@keyframes wcp-bubble-in {
	from { opacity: 0; transform: translateY(8px) scale(0.96); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}
.wcp-bubble {
	background: #fff;
	padding: 11px 13px;
	border-radius: 14px 14px 14px 4px;
	font-size: 13.5px;
	line-height: 1.5;
	color: #222;
	max-width: 92%;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	animation: wcp-bubble-in 0.35s ease both;
}
.wcp-theme-dark .wcp-bubble { background: #2b2b2b; color: #eee; }

.wcp-quick-replies { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.wcp-quick-reply-chip {
	background: #fff;
	border: 1.5px solid var(--wcp-color, #25D366);
	color: var(--wcp-color, #25D366);
	border-radius: 18px;
	padding: 6px 12px;
	font-size: 12.5px;
	font-weight: 500;
	cursor: pointer;
	opacity: 0;
	animation: wcp-bubble-in 0.35s ease both;
	transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.wcp-quick-reply-chip:nth-child(1) { animation-delay: 0.05s; }
.wcp-quick-reply-chip:nth-child(2) { animation-delay: 0.12s; }
.wcp-quick-reply-chip:nth-child(3) { animation-delay: 0.19s; }
.wcp-quick-reply-chip:nth-child(4) { animation-delay: 0.26s; }
.wcp-quick-reply-chip:hover { background: var(--wcp-color, #25D366); color: #fff; transform: translateY(-1px); }

.wcp-popup-footer {
	padding: 10px 12px;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	background: #fff;
	border-top: 1px solid #eee;
}
.wcp-theme-dark .wcp-popup-footer { background: #202020; border-top: 1px solid #333; }

#wcp-message-box {
	flex-grow: 1;
	resize: none;
	border: 1.5px solid #e2e2e2;
	border-radius: 20px;
	padding: 10px 15px;
	font-size: 13.5px;
	font-family: inherit;
	line-height: 1.3;
	max-height: 90px;
	transition: border-color 0.15s ease;
}
#wcp-message-box:focus { outline: none; border-color: var(--wcp-color, #25D366); }
.wcp-theme-dark #wcp-message-box { background: #2b2b2b; color: #eee; border-color: #3a3a3a; }

#wcp-send-btn {
	background: var(--wcp-color, #25D366) !important;
	color: #fff;
	border: none !important;
	border-radius: 50% !important;
	width: 40px !important;
	height: 40px !important;
	min-width: 40px;
	padding: 0 !important;
	margin: 0 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0,0,0,0.18);
	transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), filter 0.15s ease;
}
#wcp-send-btn svg { transform: translateX(-1px); }
#wcp-send-btn:hover { transform: scale(1.08); filter: brightness(1.05); }
#wcp-send-btn:active { transform: scale(0.92); }
