/**
 * Estilos del widget flotante (frontend).
 *
 * @package UsbWhatsappFlotante
 */

.usbwf-widget {
	position: fixed;
	bottom: 20px;
	z-index: 99999;
	font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	line-height: 1.4;
}
.usbwf-widget.usbwf-pos-right {
	right: 20px;
}
.usbwf-widget.usbwf-pos-left {
	left: 20px;
}

/* ---------- Botón lanzador (solo el fraile) ---------- */
.usbwf-launcher {
	position: relative;
	width: 84px;
	height: 84px;
	border: none;
	background: transparent;
	padding: 0;
	cursor: pointer;
	display: block;
	margin-inline-start: auto;
	animation: usbwf-pop 0.4s ease;
	transition: transform 0.2s ease;
}
.usbwf-widget.usbwf-pos-left .usbwf-launcher {
	margin-inline-start: 0;
	margin-inline-end: auto;
}
.usbwf-launcher:hover {
	transform: scale( 1.06 );
}
.usbwf-launcher-logo {
	width: 100%;
	height: 100%;
	object-fit: contain;
	filter: drop-shadow( 0 4px 8px rgba( 0, 0, 0, 0.3 ) );
	transform-origin: bottom center;
	animation: usbwf-greet 6s ease-in-out 3s infinite;
}
.usbwf-launcher:hover .usbwf-launcher-logo,
.usbwf-widget.usbwf-open .usbwf-launcher-logo {
	animation-play-state: paused;
}

/* ---------- Ventana tipo chat ---------- */
.usbwf-panel {
	position: absolute;
	bottom: 98px;
	width: 340px;
	max-width: calc( 100vw - 40px );
	background: #efeae2;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.25 );
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY( 16px ) scale( 0.96 );
	transform-origin: bottom right;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}
.usbwf-pos-right .usbwf-panel {
	right: 0;
}
.usbwf-pos-left .usbwf-panel {
	left: 0;
	transform-origin: bottom left;
}
.usbwf-widget.usbwf-open .usbwf-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY( 0 ) scale( 1 );
}

/* Encabezado */
.usbwf-panel-heading {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var( --usbwf-primary, #1B4F8A );
	color: #fff;
}
.usbwf-avatar {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.usbwf-avatar img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.usbwf-heading-text {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}
.usbwf-heading-text strong {
	font-family: "Playfair Display", Georgia, serif;
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.usbwf-status {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	opacity: 0.9;
}
.usbwf-status-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #4ade80;
	box-shadow: 0 0 0 2px rgba( 74, 222, 128, 0.3 );
}
.usbwf-close {
	flex: 0 0 auto;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 0 2px;
	opacity: 0.85;
}
.usbwf-close:hover {
	opacity: 1;
}

/* Cuerpo */
.usbwf-panel-body {
	padding: 18px 16px 8px;
	background:
		#efeae2
		url( "data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23000000' fill-opacity='0.03'%3E%3Cpath d='M0 38.59l2.83-2.83 1.41 1.41L1.41 40H0v-1.41zM0 1.4l2.83 2.83 1.41-1.41L1.41 0H0v1.41zM38.59 40l-2.83-2.83 1.41-1.41L40 38.59V40h-1.41zM40 1.41l-2.83 2.83-1.41-1.41L38.59 0H40v1.41z'/%3E%3C/g%3E%3C/svg%3E" );
	max-height: 60vh;
	overflow-y: auto;
}

/* Burbuja de bienvenida */
.usbwf-welcome {
	position: relative;
	background: #fff;
	border-radius: 0 12px 12px 12px;
	padding: 12px 14px;
	margin-bottom: 16px;
	box-shadow: 0 1px 1px rgba( 0, 0, 0, 0.08 );
}
.usbwf-welcome::before {
	content: "";
	position: absolute;
	top: 0;
	left: -8px;
	border-width: 0 8px 8px 0;
	border-style: solid;
	border-color: transparent #fff transparent transparent;
}
.usbwf-welcome-title {
	margin: 0 0 4px;
	font-family: "Playfair Display", Georgia, serif;
	font-size: 15px;
	font-weight: 700;
	color: var( --usbwf-title, #8B1A2B );
}
.usbwf-welcome-text {
	margin: 0;
	font-size: 14px;
	color: #3b4a54;
}

/* Botones de WhatsApp */
.usbwf-buttons-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-bottom: 6px;
}
.usbwf-wa-button {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #fff;
	border: 1px solid rgba( 27, 79, 138, 0.12 );
	border-left: 4px solid var( --usbwf-accent, #C9A227 );
	border-radius: 10px;
	padding: 11px 12px;
	text-decoration: none;
	color: var( --usbwf-primary, #1B4F8A );
	font-weight: 600;
	font-size: 14px;
	box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.06 );
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.usbwf-wa-button:hover {
	transform: translateX( 2px );
	background: #fbfcfe;
	box-shadow: 0 3px 8px rgba( 27, 79, 138, 0.15 );
}
.usbwf-wa-icon {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #25d366;
	color: #fff;
}
.usbwf-wa-label {
	flex: 1 1 auto;
}
.usbwf-wa-arrow {
	flex: 0 0 auto;
	font-size: 20px;
	color: var( --usbwf-accent, #C9A227 );
	font-weight: 700;
}

/* Pie */
.usbwf-panel-footer {
	padding: 8px 16px 12px;
	text-align: center;
	font-size: 11px;
	color: #8696a0;
	background: #efeae2;
}

/* ---------- Animaciones ---------- */
@keyframes usbwf-pop {
	0% { transform: scale( 0 ); }
	80% { transform: scale( 1.1 ); }
	100% { transform: scale( 1 ); }
}
@keyframes usbwf-greet {
	0%, 82%, 100% { transform: translateY( 0 ) rotate( 0deg ); }
	85% { transform: translateY( -7px ) rotate( -5deg ); }
	88% { transform: translateY( 0 ) rotate( 4deg ); }
	91% { transform: translateY( -4px ) rotate( -3deg ); }
	94% { transform: translateY( 0 ) rotate( 2deg ); }
	97% { transform: translateY( 0 ) rotate( 0deg ); }
}

@media ( prefers-reduced-motion: reduce ) {
	.usbwf-launcher,
	.usbwf-launcher-logo,
	.usbwf-panel,
	.usbwf-wa-button {
		animation: none !important;
		transition: none !important;
	}
}

/* ---------- Responsive ---------- */
@media ( max-width: 480px ) {
	.usbwf-panel {
		width: calc( 100vw - 32px );
	}
	.usbwf-widget {
		bottom: 16px;
	}
	.usbwf-widget.usbwf-pos-right {
		right: 16px;
	}
	.usbwf-widget.usbwf-pos-left {
		left: 16px;
	}
}
