/* ==========================================================================
   Widget de contacte per WhatsApp – SoporteWordpress
   Aparença fidel a WhatsApp (verd de marca, capçalera teal, fons de xat)
   ========================================================================== */

.sw-wa-widget {
	position: fixed;
	bottom: 1.5rem;
	right: 1.5rem;
	z-index: 9999;
	font-family: var(--font-family-base);
}

/* --------------------------------------------------------------------------
   Botó bombolla (verd WhatsApp)
   -------------------------------------------------------------------------- */
.sw-wa-bubble {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: #25d366;
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45), 0 2px 6px rgba(0, 0, 0, 0.12);
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
	position: relative;
	margin-left: auto;
}

.sw-wa-bubble:hover {
	background: #1ebe5d;
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(37, 211, 102, 0.4), 0 4px 8px rgba(0, 0, 0, 0.12);
}

.sw-wa-bubble:focus-visible {
	outline: 3px solid #25d366;
	outline-offset: 3px;
}

.sw-wa-bubble svg {
	width: 34px;
	height: 34px;
	transition: transform 0.2s ease;
}

/* Icona X quan el formulari està obert */
.sw-wa-widget.is-open .sw-wa-bubble .sw-wa-icon-logo {
	display: none;
}
.sw-wa-widget:not(.is-open) .sw-wa-bubble .sw-wa-icon-close {
	display: none;
}
.sw-wa-bubble .sw-wa-icon-close svg {
	width: 26px;
	height: 26px;
}

/* --------------------------------------------------------------------------
   Finestra / formulari
   -------------------------------------------------------------------------- */
.sw-wa-window {
	position: absolute;
	bottom: calc(60px + 1rem);
	right: 0;
	width: 340px;
	background: #efeae2;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.1);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform-origin: bottom right;

	transform: scale(0.85) translateY(8px);
	opacity: 0;
	pointer-events: none;
	transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.sw-wa-widget.is-open .sw-wa-window {
	transform: scale(1) translateY(0);
	opacity: 1;
	pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Capçalera (teal WhatsApp)
   -------------------------------------------------------------------------- */
.sw-wa-header {
	background: #075e54;
	padding: 0.9rem 1rem;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-shrink: 0;
}

.sw-wa-header-avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.sw-wa-header-avatar svg {
	width: 26px;
	height: 26px;
	color: #fff;
}

.sw-wa-header-info {
	flex: 1;
	min-width: 0;
}
.sw-wa-header-title {
	font-size: 0.95rem;
	font-weight: 600;
	color: #fff;
	margin: 0;
	line-height: 1.2;
}
.sw-wa-header-status {
	font-size: 0.75rem;
	color: rgba(255, 255, 255, 0.8);
	margin: 0.15rem 0 0;
	line-height: 1.2;
}

/* --------------------------------------------------------------------------
   Cos: fons de xat WhatsApp + bombolla de missatge
   -------------------------------------------------------------------------- */
.sw-wa-body {
	padding: 1.1rem 1rem 1rem;
	background-color: #efeae2;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill='%23d9d2c8' fill-opacity='0.4'%3E%3Ccircle cx='20' cy='20' r='1.5'/%3E%3C/g%3E%3C/svg%3E");
}

.sw-wa-msg-bubble {
	background: #fff;
	border-radius: 0 8px 8px 8px;
	padding: 0.7rem 0.85rem;
	font-size: 0.85rem;
	line-height: 1.45;
	color: #222;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
	position: relative;
	margin-bottom: 1rem;
	max-width: 90%;
}
.sw-wa-msg-bubble::before {
	content: '';
	position: absolute;
	top: 0;
	left: -8px;
	border-width: 0 8px 8px 0;
	border-style: solid;
	border-color: transparent #fff transparent transparent;
}

/* --------------------------------------------------------------------------
   Formulari
   -------------------------------------------------------------------------- */
.sw-wa-form {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.sw-wa-field label {
	display: block;
	font-size: 0.72rem;
	font-weight: 600;
	color: #075e54;
	margin-bottom: 0.25rem;
}

.sw-wa-field input {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid #d3ccc2;
	border-radius: 8px;
	padding: 0.6rem 0.75rem;
	font-size: 0.9rem;
	font-family: var(--font-family-base);
	color: #222;
	background: #fff;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
}
.sw-wa-field input:focus {
	border-color: #25d366;
	box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
}
.sw-wa-field input::placeholder {
	color: #9b968d;
}

.sw-wa-error {
	font-size: 0.72rem;
	color: #b91c1c;
	margin: 0;
	min-height: 0;
}

.sw-wa-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	border: none;
	border-radius: 24px;
	background: #25d366;
	color: #fff;
	font-size: 0.92rem;
	font-weight: 600;
	font-family: var(--font-family-base);
	padding: 0.7rem 1rem;
	cursor: pointer;
	margin-top: 0.15rem;
	transition: background 0.2s, transform 0.15s;
}
.sw-wa-submit:hover:not(:disabled) {
	background: #1ebe5d;
	transform: translateY(-1px);
}
.sw-wa-submit:disabled {
	background: #a9d9bb;
	cursor: not-allowed;
}
.sw-wa-submit svg {
	width: 18px;
	height: 18px;
}

.sw-wa-footer-note {
	font-size: 10px;
	color: #6b6b6b;
	text-align: center;
	margin: 0.6rem 0 0;
}

/* Spinner mentre desa */
.sw-wa-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: sw-wa-spin 0.7s linear infinite;
}
@keyframes sw-wa-spin {
	to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Responsive – mòbil
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
	.sw-wa-widget {
		bottom: 1rem;
		right: 1rem;
	}
	.sw-wa-window {
		width: calc(100vw - 2rem);
		right: 0;
	}
}
