
/* ============================================================
   FLOATING ACTION BUTTON (FAB)
   ============================================================ */

.wa-floating-container {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 9999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wa-floating-container * {
	box-sizing: border-box;
}

/* Main FAB button */
.wa-main-button {
	width: 84px;
	height: 84px;
	cursor: grab;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: transform 0.2s ease;
	user-select: none;
	animation: wa-heartbeat 2.5s ease-in-out infinite;
	touch-action: none;
}
.wa-main-button.wa-dragging {
	cursor: grabbing;
	animation: none;
	transition: none;
}

.wa-main-button:hover {
	transform: scale(1.08);
	animation: none;
}

.wa-main-button:active {
	transform: scale(0.92);
	animation: none;
}

.wa-main-button img {
	width: 80px;
	height: 80px;
	pointer-events: none;
	object-fit: contain;
	filter: brightness(1.05) saturate(1.1) drop-shadow(0 0 6px rgba(37, 211, 102, 0.3));
}

@keyframes wa-heartbeat {
	0% { transform: scale(1); }
	25% { transform: scale(1.06); }
	50% { transform: scale(1); }
	75% { transform: scale(1.06); }
	100% { transform: scale(1); }
}

/* Badge on FAB */
.wa-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	background: #FF3B30;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	min-width: 20px;
	height: 20px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 5px;
	box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Options popup */
.wa-options {
	position: absolute;
	bottom: 90px;
	right: -10px;
	display: none;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
}

.wa-options.active {
	display: flex;
}
.wa-options-right {
	right: auto;
	left: -10px;
	align-items: flex-start;
}

.wa-option {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #25D366;
	color: #fff;
	text-decoration: none;
	padding: 10px 16px;
	border-radius: 8px;
	box-shadow: 0 2px 10px rgba(0,0,0,0.2);
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
	transition: background 0.15s ease, transform 0.15s ease;
	animation: wa-slide-up 0.25s ease;
}

.wa-option:hover {
	background: #1DA851;
	color: #fff;
	transform: translateX(-4px);
	text-decoration: none;
}

.wa-option-disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: auto;
}

.wa-option-disabled:hover {
	background: #25D366;
	color: #fff;
	transform: none;
}

@keyframes wa-slide-up {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.wa-option-icon {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #fff;
	color: #25D366;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex-shrink: 0;
}

.wa-option-text {
	display: flex;
	align-items: center;
	gap: 6px;
}

.wa-badge-small {
	background: #128C7E;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	min-width: 18px;
	height: 18px;
	border-radius: 9px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
}


/* ============================================================
   CHAT MODAL
   ============================================================ */

.wa-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 9998;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0,0,0,0.3);
}

.wa-modal-content {
	width: 480px;
	height: 550px;
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 8px 32px rgba(0,0,0,0.25);
	position: absolute;
	cursor: default;
}

/* Chat header */
.wa-chat-header {
	background: #25D366;
	color: #fff;
	padding: 12px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: move;
	user-select: none;
	flex-shrink: 0;
}.wa-chat-header-info {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	flex: 1;
}

.wa-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255,255,255,0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 16px;
	flex-shrink: 0;
}

.wa-contact-name {
	font-weight: 600;
	font-size: 15px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wa-contact-phone {
	font-size: 12px;
	opacity: 0.8;
	margin-top: 1px;
}

.wa-chat-controls {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}

.wa-chat-controls button {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 6px 8px;
	border-radius: 4px;
	font-size: 16px;
	opacity: 0.8;
	transition: opacity 0.15s ease, background 0.15s ease;
	line-height: 1;
}

.wa-chat-controls button:hover {
	opacity: 1;
	background: rgba(255,255,255,0.15);
}

/* Thread chips */
.wa-contact-chips {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 8px 12px;
	background: #f0f2f5;
	border-bottom: 1px solid rgba(0,0,0,0.06);
	flex-shrink: 0;
	scrollbar-width: thin;
}

.wa-contact-chips::-webkit-scrollbar {
	height: 4px;
}

.wa-contact-chips::-webkit-scrollbar-thumb {
	background: rgba(0,0,0,0.15);
	border-radius: 2px;
}

.wa-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	background: #fff;
	color: #075E54;
	border: 1px solid rgba(0,0,0,0.1);
	border-radius: 16px;
	padding: 5px 12px;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.wa-chip:hover {
	background: #e9f7ef;
	border-color: #25D366;
}

.wa-chip.wa-chip-active {
	background: #25D366;
	border-color: #25D366;
	color: #fff;
}

.wa-chip-badge {
	background: #FF3B30;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	min-width: 16px;
	height: 16px;
	line-height: 16px;
	border-radius: 8px;
	padding: 0 4px;
	text-align: center;
	display: inline-block;
}

.wa-chip-active .wa-chip-badge {
	background: #fff;
	color: #25D366;
}

.wa-chip-badge-zero {
	display: none;
}

/* Chat body */
.wa-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #e5ddd5;
	background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4c9b0' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
	/* scroll-behavior: smooth; */
}

/* Date separator */
.wa-date-separator {
	text-align: center;
	margin: 12px 0 8px;
	font-size: 12px;
}

.wa-date-separator span {
	background: rgba(225, 218, 207, 0.9);
	color: #555;
	padding: 4px 12px;
	border-radius: 12px;
	display: inline-block;
	font-weight: 500;
	box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

/* Messages */
.wa-message {
	margin-bottom: 8px;
	display: flex;
	flex-direction: column;
}

.wa-message.wa-outgoing {
	align-items: flex-end;
}

.wa-message.wa-incoming {
	align-items: flex-start;
}

.wa-bubble {
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.4;
	word-wrap: break-word;
	position: relative;
	box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.wa-outgoing .wa-bubble {
	background: #DCF8C6;
	border-top-right-radius: 2px;
}

.wa-incoming .wa-bubble {
	background: #fff;
	border-top-left-radius: 2px;
}

.wa-msg-text {
	margin-bottom: 2px;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.wa-msg-meta {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 4px;
	font-size: 11px;
	color: rgba(0,0,0,0.45);
	margin-top: 2px;
}

.wa-outgoing .wa-msg-meta {
	justify-content: flex-end;
}

.wa-msg-time {
	direction: ltr;
	unicode-bidi: bidi-override;
}

.wa-msg-media-wrap {
	max-width: 280px;
}
.wa-msg-media {
	max-width: 100%;
	max-height: 280px;
	border-radius: 8px;
	display: block;
	object-fit: contain;
	cursor: zoom-in;
}
.wa-msg-placeholder {
	color: #90a4ae;
	font-style: italic;
}

/* Media lightbox (zoom on image/sticker click) */
.wa-media-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.85);
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: zoom-out;
}
.wa-media-lightbox-content {
	position: relative;
	max-width: 92%;
	max-height: 92%;
}
.wa-media-lightbox-content img {
	max-width: 100%;
	max-height: 92vh;
	border-radius: 6px;
	display: block;
}
.wa-media-lightbox-close {
	position: absolute;
	top: -38px;
	right: 0;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 24px;
	cursor: pointer;
}

.wa-msg-status {
	font-size: 12px;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	gap: 2px;
}
.wa-msg-ref {
	font-size: 11px;
	color: rgba(0,0,0,0.35);
	text-decoration: none;
	margin-left: 4px;
	display: inline-flex;
	align-items: center;
	gap: 1px;
}
.wa-msg-ref:hover {
	color: #25D366;
	text-decoration: underline;
}

.wa-status-sent {
	color: rgba(0,0,0,0.35);
}

.wa-status-delivered {
	color: rgba(0,0,0,0.45);
}

.wa-status-read {
	color: #34B7F1;
}

.wa-status-failed {
	color: #FF3B30;
}

/* Linked object */
.wa-msg-object {
	margin-top: 2px;
	font-size: 11px;
	max-width: 85%;
}

.wa-outgoing .wa-msg-object {
	text-align: right;
}

.wa-msg-object a {
	color: #075E54;
	text-decoration: none;
	font-weight: 500;
	background: rgba(7,94,84,0.08);
	padding: 1px 6px;
	border-radius: 4px;
	display: inline-block;
}

.wa-msg-object a:hover {
	background: rgba(7,94,84,0.15);
	text-decoration: underline;
}

/* States */
.wa-loader,
.wa-no-messages,
.wa-error {
	text-align: center;
	padding: 40px 16px;
	color: rgba(0,0,0,0.4);
	font-size: 14px;
}

.wa-error {
	color: #FF3B30;
}

.wa-more-loader {
	text-align: center;
	padding: 12px;
	color: rgba(0,0,0,0.3);
	font-size: 12px;
}

.wa-more-loader::after {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-left: 5px;
	border: 2px solid rgba(0,0,0,0.1);
	border-top-color: #075E54;
	border-radius: 50%;
	animation: wa-spin 0.6s linear infinite;
	vertical-align: middle;
}

.wa-more-error {
	text-align: center;
	padding: 12px;
	color: #FF3B30;
	font-size: 12px;
	background: rgba(255,255,255,0.8);
	border-radius: 8px;
	margin-bottom: 8px;
}

.wa-loader::after {
	content: '';
	display: inline-block;
	width: 20px;
	height: 20px;
	margin-left: 6px;
	border: 2px solid rgba(0,0,0,0.15);
	border-top-color: #075E54;
	border-radius: 50%;
	animation: wa-spin 0.6s linear infinite;
	vertical-align: middle;
}

@keyframes wa-spin {
	to { transform: rotate(360deg); }
}


/* ============================================================
   FULLSCREEN MODE
   ============================================================ */

.wa-modal-fullscreen .wa-modal-content {
	width: 100% !important;
	height: 100% !important;
	border-radius: 0;
	top: 0 !important;
	left: 0 !important;
}

.wa-modal-fullscreen .wa-chat-header {
	cursor: default;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
	.wa-floating-container {
		bottom: 16px;
		right: 16px;
	}

	.wa-main-button {
		width: 72px;
		height: 72px;
	}

	.wa-main-button img {
		width: 48px;
		height: 48px;
	}

	.wa-badge {
		min-width: 28px;
		height: 28px;
		border-radius: 14px;
		font-size: 14px;
		top: -6px;
		right: -6px;
		padding: 0 6px;
	}

	.wa-badge-small {
		min-width: 22px;
		height: 22px;
		border-radius: 11px;
		font-size: 12px;
	}

	.wa-option {
		padding: 10px 16px;
		font-size: 14px;
		gap: 8px;
		min-height: 42px;
		border-radius: 8px;
	}

	.wa-option-icon {
		width: 32px;
		height: 32px;
		font-size: 14px;
	}

	.wa-option-text {
		gap: 4px;
	}

	.wa-chat-controls button {
		padding: 8px 12px;
		font-size: 18px;
		min-width: 44px;
		min-height: 44px;
	}

	.wa-modal-content {
		width: 92% !important;
		height: auto !important;
		max-height: 65vh !important;
		max-width: 92%;
		border-radius: 16px;
		top: 10vh !important;
		left: 4% !important;
	}

	.wa-chat-header {
		cursor: default;
	}

	.wa-bubble {
		max-width: 90%;
	}

	.wa-chat-body {
		padding: 10px;
	}

	.wa-contact-chips {
		padding: 8px 10px;
		gap: 6px;
	}

	.wa-chip {
		padding: 6px 12px;
		font-size: 13px;
		min-height: 34px;
		border-radius: 18px;
	}

	.wa-chip-badge {
		min-width: 18px;
		height: 18px;
		line-height: 18px;
		border-radius: 9px;
		font-size: 11px;
	}
}

/* Touch devices: disable hover effects that get stuck */
@media (hover: none) {
	.wa-main-button:hover {
		transform: none;
		animation: wa-heartbeat 2.5s ease-in-out infinite;
	}

	.wa-option:hover {
		background: #25D366;
		transform: none;
	}

	.wa-chat-controls button:hover {
		opacity: 0.8;
		background: none;
	}
}
