/* Datxale WhatsApp Chat Pro — frontend widget. All selectors plugin-scoped + reset so themes can't leak in. */
.datxale-wa-pro {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
}
.datxale-wa-pro *,
.datxale-wa-pro *::before,
.datxale-wa-pro *::after { box-sizing: border-box; }

/* Floating action button */
.datxale-wa-fab {
	position: relative;
	width: 60px;
	height: 60px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #25d366;
	box-shadow: 0 8px 22px rgba(37, 211, 102, .45);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .22s ease, box-shadow .22s ease;
}
.datxale-wa-fab:hover { transform: scale(1.07); box-shadow: 0 10px 26px rgba(37, 211, 102, .55); }
.datxale-wa-fab:focus { outline: none; }
.datxale-wa-fab-icon { width: 32px; height: 32px; fill: #fff; display: block; }
.datxale-wa-x { display: none; color: #fff; font-size: 30px; line-height: 1; font-weight: 400; }
.datxale-wa-pro.datxale-open .datxale-wa-fab-icon { display: none; }
.datxale-wa-pro.datxale-open .datxale-wa-x { display: block; }

/* Panel */
.datxale-wa-panel {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: 300px;
	max-width: calc(100vw - 44px);
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .20);
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(.98);
	transform-origin: bottom right;
	transition: opacity .2s ease, transform .2s ease, visibility .2s;
	pointer-events: none;
}
.datxale-wa-pro.datxale-open .datxale-wa-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* Header */
.datxale-wa-head { background: linear-gradient(135deg, #25d366 0%, #128c7e 100%); color: #fff; padding: 18px 18px 16px; }
.datxale-wa-head-title { display: block; font-size: 16px; font-weight: 700; line-height: 1.3; margin: 0; }
.datxale-wa-head-sub { display: block; font-size: 12px; line-height: 1.4; opacity: .92; margin-top: 4px; font-weight: 400; }

/* List */
.datxale-wa-list { padding: 8px; max-height: 320px; overflow-y: auto; }

/* Agent row */
.datxale-wa-agent {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px;
	border-radius: 12px;
	text-decoration: none;
	background: transparent;
	box-shadow: none;
	transition: background .15s ease;
}
.datxale-wa-agent:hover,
.datxale-wa-agent:focus { background: #f0f5f3; text-decoration: none; box-shadow: none; outline: none; }
.datxale-wa-agent + .datxale-wa-agent { margin-top: 2px; }

.datxale-wa-avatar {
	position: relative;
	flex: 0 0 46px;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: #dff7e6;
	color: #0e7a5f;
	font-size: 18px;
	font-weight: 700;
	text-transform: uppercase;
	display: flex;
	align-items: center;
	justify-content: center;
}
.datxale-wa-dot { position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: #25d366; border: 2px solid #fff; }

.datxale-wa-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.datxale-wa-name { font-size: 14px; font-weight: 700; color: #1f2937; line-height: 1.25; }
.datxale-wa-role { font-size: 12px; color: #6b7280; line-height: 1.25; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.datxale-wa-go { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: #25d366; display: flex; align-items: center; justify-content: center; }
.datxale-wa-go-icon { width: 17px; height: 17px; fill: #fff; display: block; }

/* Left position */
.datxale-wa-pro.datxale-wa-left { right: auto; left: 22px; align-items: flex-start; }
.datxale-wa-pro.datxale-wa-left .datxale-wa-panel { transform-origin: bottom left; }

/* Online / offline status badge */
.datxale-wa-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; background: rgba(255, 255, 255, .22); color: #fff; padding: 3px 10px; border-radius: 20px; margin-bottom: 9px; }
.datxale-wa-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #a7f3d0; }
.datxale-wa-pro.datxale-wa-closed .datxale-wa-head { background: linear-gradient(135deg, #64748b 0%, #334155 100%); }
.datxale-wa-pro.datxale-wa-closed .datxale-wa-status::before { background: #fca5a5; }
.datxale-wa-pro.datxale-wa-closed .datxale-wa-dot { background: #9ca3af; }
.datxale-wa-pro.datxale-wa-closed .datxale-wa-go { background: #64748b; }

/* Greeting bubble */
.datxale-wa-greet {
	display: none;
	align-items: flex-start;
	gap: 10px;
	max-width: 240px;
	margin-bottom: 12px;
	padding: 12px 14px;
	background: #fff;
	color: #1f2937;
	border-radius: 16px;
	box-shadow: 0 12px 34px rgba(0, 0, 0, .16);
	font-size: 14px;
	line-height: 1.4;
	cursor: pointer;
}
.datxale-wa-greet.datxale-show { display: flex; animation: datxale-wa-pop .25s ease; }
.datxale-wa-greet-text { flex: 1 1 auto; }
.datxale-wa-greet-x { flex: 0 0 auto; border: 0; padding: 0; background: transparent; color: #9ca3af; font-size: 18px; line-height: 1; cursor: pointer; }
.datxale-wa-pro.datxale-open .datxale-wa-greet { display: none; }
@keyframes datxale-wa-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
	.datxale-wa-pro { right: 16px; bottom: 16px; }
	.datxale-wa-pro.datxale-wa-left { left: 16px; right: auto; }
	.datxale-wa-panel { width: calc(100vw - 32px); }
}

/* Tamaño / forma del botón (Pro) */
.datxale-wa-pro.datxale-wa-size-small .datxale-wa-fab { width: 50px; height: 50px; }
.datxale-wa-pro.datxale-wa-size-small .datxale-wa-fab-icon { width: 26px; height: 26px; }
.datxale-wa-pro.datxale-wa-size-large .datxale-wa-fab { width: 72px; height: 72px; }
.datxale-wa-pro.datxale-wa-size-large .datxale-wa-fab-icon { width: 38px; height: 38px; }
.datxale-wa-pro.datxale-wa-shape-square .datxale-wa-fab { border-radius: 18px; }
/* Badge de mensaje no leído (Pro) */
.datxale-wa-badge { display: none; position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #ef4444; color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.datxale-wa-pro.datxale-wa-badge-on .datxale-wa-badge { display: block; }

/* Móvil: ceder espacio al banner de cookies mientras esté visible (UX/legal) */
@media (max-width: 600px) {
	body:has(.datxale-cookie-consent:not(.is-hidden)) #datxale-wa-pro,
	body:has(.datxale-cookie-consent:not(.is-hidden)) .datxale-wa-pro { bottom: 150px; }
}
