/* Webshero Floating Contact — chat-style widget */

.wsfc,
.wsfc *,
.wsfc *::before,
.wsfc *::after { box-sizing: border-box; }

.wsfc {
	--wsfc-bg: #DE1C1D;
	--wsfc-text: #FFFFFF;
	--wsfc-panel-bg: #FFFFFF;
	--wsfc-panel-text: #1A1308;
	--wsfc-panel-width: 380px;
	--wsfc-panel-height: 640px;
	--wsfc-z: 990;
	--wsfc-fab-size: 48px;
	--wsfc-edge: 24px;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Floating Action Button (chat trigger) ---------- */
.wsfc__trigger {
	position: fixed;
	left: var(--wsfc-edge);
	bottom: var(--wsfc-edge);
	z-index: calc(var(--wsfc-z) + 20);
	padding: 14px 22px 14px 18px;
	margin: 0;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: var(--wsfc-bg);
	color: var(--wsfc-text);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
	font-family: inherit;
	font-weight: 700;
	font-size: 0.85rem;
	letter-spacing: 0.04em;
	line-height: 1;
	white-space: nowrap;
	transition: transform .3s cubic-bezier(.22,.61,.36,1), box-shadow .25s ease, filter .25s ease, background-color .25s ease, padding .25s ease, gap .25s ease;
}

.wsfc__trigger:hover,
.wsfc__trigger:focus-visible {
	outline: none;
	transform: translateY(-2px);
	box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

.wsfc__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	flex-shrink: 0;
	transition: opacity .2s ease, transform .25s ease;
}
.wsfc__icon--close {
	position: absolute;
	left: 50%;
	top: 50%;
	margin: -11px 0 0 -11px;
	opacity: 0;
	transform: scale(0.6);
}

/* When open: collapse to a compact circle showing only the X */
.wsfc.is-open .wsfc__trigger {
	padding: 0;
	width: var(--wsfc-fab-size);
	height: var(--wsfc-fab-size);
	border-radius: 50%;
	gap: 0;
}
.wsfc.is-open .wsfc__icon--chat {
	opacity: 0;
	transform: scale(0.6);
}
.wsfc.is-open .wsfc__icon--close {
	opacity: 1;
	transform: scale(1);
}
.wsfc.is-open .wsfc__label {
	max-width: 0;
	opacity: 0;
	margin-left: -10px;
}

.wsfc__label {
	display: inline-block;
	max-width: 320px;
	opacity: 1;
	overflow: hidden;
	transition: max-width .3s ease, opacity .2s ease, margin-left .25s ease;
}

/* Subtle pulse to attract attention (only when closed) */
.wsfc:not(.is-open) .wsfc__trigger::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 999px;
	box-shadow: 0 0 0 0 var(--wsfc-bg);
	animation: wsfc-pulse 2.4s ease-out infinite;
	opacity: 0.55;
	pointer-events: none;
}
@keyframes wsfc-pulse {
	0%   { box-shadow: 0 0 0 0 var(--wsfc-bg); opacity: 0.55; }
	70%  { box-shadow: 0 0 0 18px var(--wsfc-bg); opacity: 0; }
	100% { box-shadow: 0 0 0 0 var(--wsfc-bg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.wsfc:not(.is-open) .wsfc__trigger::after { animation: none; }
}

/* ---------- Backdrop (mobile only) ---------- */
.wsfc-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s ease, visibility .3s ease;
	z-index: calc(var(--wsfc-z) + 5);
}
.wsfc.is-open .wsfc-backdrop { opacity: 1; visibility: visible; }

@media (min-width: 769px) {
	.wsfc-backdrop { display: none; }
}

/* ---------- Chat panel ---------- */
.wsfc-panel {
	position: fixed;
	left: var(--wsfc-edge);
	bottom: calc(var(--wsfc-edge) + var(--wsfc-fab-size) + 16px);
	width: var(--wsfc-panel-width);
	max-width: calc(100vw - (var(--wsfc-edge) * 2));
	height: var(--wsfc-panel-height);
	max-height: calc(100vh - (var(--wsfc-edge) * 2) - var(--wsfc-fab-size) - 24px);
	/* dvh = viewport visible real en móvil (100vh incluye la zona de la barra del navegador) */
	max-height: calc(100dvh - (var(--wsfc-edge) * 2) - var(--wsfc-fab-size) - 24px);
	background: var(--wsfc-panel-bg);
	color: var(--wsfc-panel-text);
	z-index: calc(var(--wsfc-z) + 10);
	border-radius: 16px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
	opacity: 0;
	visibility: hidden;
	transform: translateY(16px) scale(0.96);
	transform-origin: bottom left;
	transition: opacity .25s ease, transform .3s cubic-bezier(.22,.61,.36,1), visibility .3s ease;
	pointer-events: none;
}

.wsfc.is-open .wsfc-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* Panel header */
.wsfc-panel__header {
	padding: 22px 24px 20px;
	background: var(--wsfc-bg);
	color: var(--wsfc-text);
	display: flex;
	align-items: flex-start;
	gap: 14px;
	flex-shrink: 0;
}
.wsfc-panel__heading {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	flex: 1 1 auto;
}
.wsfc-panel__title {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: 0;
	color: inherit;
	line-height: 1.25;
}
.wsfc-panel__subtitle {
	margin: 0;
	font-size: 0.82rem;
	line-height: 1.4;
	color: rgba(255, 255, 255, 0.82);
}

.wsfc-panel__close {
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	background: transparent;
	border: 0;
	color: inherit;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background-color .2s ease;
}
.wsfc-panel__close:hover,
.wsfc-panel__close:focus-visible {
	background: rgba(255, 255, 255, 0.18);
	outline: none;
}

/* Body */
.wsfc-panel__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 22px 24px 24px;
	background: #ffffff;
	/* Firefox scrollbar */
	scrollbar-width: thin;
	scrollbar-color: var(--wsfc-bg) transparent;
}

/* WebKit (Chrome, Safari, Edge) custom scrollbar */
.wsfc-panel__body::-webkit-scrollbar {
	width: 8px;
}
.wsfc-panel__body::-webkit-scrollbar-track {
	background: transparent;
}
.wsfc-panel__body::-webkit-scrollbar-thumb {
	background-color: var(--wsfc-bg);
	border-radius: 999px;
}
.wsfc-panel__body::-webkit-scrollbar-thumb:hover {
	background-color: var(--wsfc-bg);
	filter: brightness(0.9);
}

/* Intro paragraph (replaces the chat bubble) */
.wsfc-panel__intro {
	margin: 0 0 18px;
	font-size: 0.9rem;
	line-height: 1.5;
	color: rgba(0, 0, 0, 0.65);
}

.wsfc-panel__form {
	padding: 0;
	margin: 0;
}

.wsfc-panel__missing {
	margin: 0;
	padding: 14px;
	background: #fff6f6;
	border-left: 3px solid var(--wsfc-bg);
	color: #6b1313;
	font-size: 0.88rem;
	border-radius: 0 8px 8px 0;
}

/* ---------- CF7 form styling (chat look) ---------- */
.wsfc-panel .wpcf7 { margin: 0; padding: 0; }
.wsfc-panel .wpcf7 form { margin: 0; }
.wsfc-panel .ws-cf7-row { margin: 0 0 14px; }
.wsfc-panel .ws-cf7-row:last-of-type { margin-bottom: 0; }

.wsfc-panel .wpcf7 input[type="text"],
.wsfc-panel .wpcf7 input[type="email"],
.wsfc-panel .wpcf7 input[type="tel"],
.wsfc-panel .wpcf7 input[type="url"],
.wsfc-panel .wpcf7 select,
.wsfc-panel .wpcf7 textarea {
	width: 100%;
	padding: 11px 13px;
	font-family: inherit;
	font-size: 0.9rem;
	color: var(--wsfc-panel-text);
	background: #f4f4f1;
	border: 1px solid transparent;
	border-radius: 10px;
	outline: none;
	box-shadow: none;
	transition: border-color .2s ease, background-color .2s ease;
	appearance: none;
	-webkit-appearance: none;
}

.wsfc-panel .wpcf7 select {
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231A1308' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 12px 12px;
	padding-right: 36px;
	cursor: pointer;
}
.wsfc-panel .wpcf7 select:focus {
	background-color: #ffffff;
	border-color: var(--wsfc-bg);
}
.wsfc-panel .wpcf7 input::placeholder,
.wsfc-panel .wpcf7 textarea::placeholder {
	color: rgba(0, 0, 0, 0.42);
	font-weight: 400;
}
.wsfc-panel .wpcf7 input:focus,
.wsfc-panel .wpcf7 textarea:focus,
.wsfc-panel .wpcf7 select:focus {
	border-color: var(--wsfc-bg);
	background-color: #ffffff;
}
.wsfc-panel .wpcf7 textarea {
	resize: vertical;
	min-height: 90px;
	line-height: 1.5;
}

.wsfc-panel .wpcf7 .ws-cf7-row--submit { margin-top: 16px; }

.wsfc-panel .wpcf7 input[type="submit"],
.wsfc-panel .wpcf7 button[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 22px;
	font-family: inherit;
	font-weight: 700;
	font-size: 0.82rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wsfc-text);
	background: var(--wsfc-bg);
	border: 1px solid var(--wsfc-bg);
	border-radius: 999px;
	cursor: pointer;
	box-shadow: none;
	text-shadow: none;
	transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .25s ease;
	width: auto;
	min-height: 0;
	height: auto;
}
.wsfc-panel .wpcf7 input[type="submit"]:hover,
.wsfc-panel .wpcf7 button[type="submit"]:hover,
.wsfc-panel .wpcf7 input[type="submit"]:focus,
.wsfc-panel .wpcf7 button[type="submit"]:focus {
	background: transparent;
	color: var(--wsfc-bg);
	transform: translateY(-1px);
	outline: none;
}

.wsfc-panel .wpcf7-not-valid-tip {
	color: #C62121;
	font-size: 0.78rem;
	margin-top: 4px;
}
.wsfc-panel .wpcf7-response-output {
	margin: 14px 0 0 !important;
	padding: 10px 12px !important;
	border-radius: 8px !important;
	border-width: 1px !important;
	border-style: solid !important;
	font-size: 0.85rem;
	background: #f7f7f7;
}
.wsfc-panel .wpcf7 form.sent .wpcf7-response-output { border-color: #86BD41 !important; background: #f3f9eb; color: #2d5a14; }
.wsfc-panel .wpcf7 form.failed .wpcf7-response-output,
.wsfc-panel .wpcf7 form.aborted .wpcf7-response-output,
.wsfc-panel .wpcf7 form.invalid .wpcf7-response-output,
.wsfc-panel .wpcf7 form.unaccepted .wpcf7-response-output { border-color: #C62121 !important; background: #fdf1f1; color: #6b1313; }
.wsfc-panel .wpcf7-spinner { background-color: var(--wsfc-bg); }


/* ---------- Body lock (mobile) ---------- */
@media (max-width: 768px) {
	body.wsfc-open { overflow: hidden; }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
	.wsfc { --wsfc-edge: 16px; --wsfc-fab-size: 56px; }
	.wsfc-panel {
		right: var(--wsfc-edge);
		left: var(--wsfc-edge);
		bottom: calc(var(--wsfc-edge) + var(--wsfc-fab-size) + 12px);
		width: auto;
		/* Alto según contenido, tope = viewport visible (dvh; 100vh se cuela bajo la barra del navegador) */
		height: auto;
		max-height: calc(100vh - (var(--wsfc-edge) * 2) - var(--wsfc-fab-size) - 24px);
		max-height: calc(100dvh - (var(--wsfc-edge) * 2) - var(--wsfc-fab-size) - 24px);
	}
	.wsfc-panel__title { font-size: 0.98rem; }
}

/* El CTA no puede quedar enterrado en el scroll del panel (cualquier viewport):
   fijado al borde inferior del área scrollable, con fondo para tapar el contenido que pasa. */
.wsfc-panel .ws-cf7-row--submit {
	position: sticky;
	bottom: 0;
	margin: 0 -24px -24px;
	padding: 10px 24px 16px;
	background: var(--wsfc-panel-bg);
}
.wsfc-panel .ws-cf7-row--submit p { margin: 0; }

@media print {
	.wsfc { display: none !important; }
}
