/* =====================================================================
   BlackHex Tech: fondo CRM animado de la portada (lo construye assets/crm-hero.js)
   ===================================================================== */

/* Escritorio: texto del hero a la izquierda, CRM a la derecha (nunca se superponen). */
.fx-crm-bg {
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
}

/* WordPress limita el ancho de los hijos del hero; el fondo debe ocupar todo el hero. */
:is(.fx-hero, .is-style-crm-hero) > .fx-crm-bg { max-width: none; }

@media (min-width: 960px) {
	:is(.fx-hero, .is-style-crm-hero) > :not(.fx-crm-bg) {
		max-width: 470px;
		margin-left: max(1.5rem, calc((100% - 1200px) / 2)) !important;
		margin-right: auto !important;
	}

	:is(.fx-hero, .is-style-crm-hero) h1 { font-size: clamp(2rem, 3.1vw, 2.9rem) !important; line-height: 1.08; }
}

.fx-crm-stage {
	position: absolute;
	top: 50%;
	right: max(0px, calc((100% - 1200px) / 2 - 60px));
	width: min(740px, calc(100% - 600px));
	min-width: 480px;
	transform: translateY(-50%);
	perspective: 1600px;
}

.fx-crm-dash {
	position: relative;
	overflow: hidden;
	padding: 14px;
	opacity: 0.96;
	color: #94a3b8;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 13px;
	line-height: 1.3;
	border: 1px solid rgba(148, 163, 184, 0.24);
	border-radius: 16px;
	background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(11, 17, 32, 0.82));
	box-shadow: 0 30px 80px -20px rgba(34, 211, 238, 0.28);
	transform: rotateX(7deg) rotateY(-10deg);
	animation: fx-crm-float 9s ease-in-out infinite alternate;
}

@keyframes fx-crm-float {
	from { transform: translateY(-6px) rotateX(7deg) rotateY(-10deg); }
	to   { transform: translateY(8px) rotateX(5deg) rotateY(-7deg); }
}

/* Barra superior */
.fx-crm-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 12px;
}

.fx-crm-dots { display: inline-flex; gap: 5px; }
.fx-crm-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(148, 163, 184, 0.35); }
.fx-crm-title { color: #cbd5e1; letter-spacing: 0.06em; }
.fx-crm-live { margin-left: auto; color: #a3e635; }
.fx-crm-live::before {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-right: 6px;
	border-radius: 50%;
	background: #a3e635;
	animation: fx-crm-pulse 1.6s ease-in-out infinite;
}

@keyframes fx-crm-pulse { 50% { opacity: 0.25; } }

/* Metricas */
.fx-crm-kpis {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	margin-bottom: 12px;
}

.fx-crm-kpi {
	padding: 9px 11px;
	border: 1px solid rgba(148, 163, 184, 0.16);
	border-radius: 10px;
	background: rgba(30, 41, 59, 0.55);
}

.fx-crm-kpi small { display: block; color: #94a3b8; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; }
.fx-crm-kpi b { display: block; margin-top: 4px; color: #22d3ee; font-size: 26px; font-variant-numeric: tabular-nums; }

/* Embudo */
.fx-crm-board {
	position: relative;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
	margin-bottom: 12px;
}

.fx-crm-col {
	min-height: 230px;
	padding: 8px;
	border: 1px solid rgba(148, 163, 184, 0.14);
	border-radius: 10px;
	background: rgba(15, 23, 42, 0.55);
}

.fx-crm-colhead {
	display: flex;
	justify-content: space-between;
	margin-bottom: 8px;
	color: #cbd5e1;
	font-size: 11.5px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.fx-crm-colhead em {
	min-width: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: rgba(34, 211, 238, 0.16);
	color: #22d3ee;
	font-style: normal;
	text-align: center;
}

.fx-crm-card {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 9px;
	padding: 9px 10px;
	border: 1px solid rgba(148, 163, 184, 0.18);
	border-radius: 9px;
	background: rgba(30, 41, 59, 0.78);
	will-change: transform;
}

.fx-crm-card.is-won { border-color: rgba(163, 230, 53, 0.55); box-shadow: 0 0 18px -6px rgba(163, 230, 53, 0.6); }

.fx-crm-av {
	display: inline-grid;
	flex: none;
	place-items: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	color: #070b14;
	font-size: 12px;
	font-weight: 700;
}

.fx-crm-tx { display: flex; flex-direction: column; min-width: 0; }
.fx-crm-tx b { overflow: hidden; color: #e6edf7; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.fx-crm-tx i { color: #22d3ee; font-size: 12px; font-style: normal; }

/* Grafica */
.fx-crm-chart { height: 92px; border-radius: 10px; background: rgba(15, 23, 42, 0.5); }
.fx-crm-chart svg { display: block; width: 100%; height: 100%; }

.fx-crm-line {
	fill: none;
	stroke: #22d3ee;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-dasharray: 600;
	stroke-dashoffset: 600;
	filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.8));
	animation: fx-crm-draw 5s ease-in-out infinite alternate;
}

.fx-crm-area { opacity: 0; animation: fx-crm-area 5s ease-in-out infinite alternate; }

@keyframes fx-crm-draw { 0% { stroke-dashoffset: 600; } 70%, 100% { stroke-dashoffset: 0; } }
@keyframes fx-crm-area { 0%, 40% { opacity: 0; } 85%, 100% { opacity: 1; } }

/* Linea de escaneo */
.fx-crm-scan {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 2px;
	background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.7), transparent);
	animation: fx-crm-scan 6s linear infinite;
}

@keyframes fx-crm-scan { from { transform: translateY(0); } to { transform: translateY(420px); } }

/* Avisos */
.fx-crm-toasts {
	position: absolute;
	left: 1%;
	bottom: 4%;
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: flex-start;
}

.fx-crm-toast {
	padding: 7px 12px;
	border: 1px solid rgba(34, 211, 238, 0.4);
	border-radius: 999px;
	background: rgba(15, 23, 42, 0.92);
	color: #e6edf7;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 11px;
	animation: fx-crm-toast 3.4s ease both;
}

.fx-crm-toast.is-win { border-color: rgba(163, 230, 53, 0.6); color: #d9f99d; }

@keyframes fx-crm-toast {
	0%   { opacity: 0; transform: translateY(14px); }
	12%, 80% { opacity: 1; transform: none; }
	100% { opacity: 0; transform: translateY(-8px); }
}

/* Tablet y movil: el CRM va ARRIBA del texto, como bloque propio y reducido.
   La altura del bloque = altura del panel (~508 px a 600 px de ancho) x la escala. */
@media (max-width: 959px) {
	.fx-crm-bg {
		position: relative;
		z-index: 0;
		height: 464px;
		margin: 0 auto 1.5rem;
		overflow: hidden;
	}

	.fx-crm-stage {
		top: 0;
		left: 50%;
		right: auto;
		width: 600px;
		min-width: 0;
		transform: translateX(-50%) scale(0.9);
		transform-origin: top center;
	}

	.fx-crm-toasts { display: none; }
}

@media (max-width: 700px) {
	.fx-crm-bg { height: 374px; }
	.fx-crm-stage { transform: translateX(-50%) scale(0.72); }
}

@media (max-width: 520px) {
	.fx-crm-bg { height: 264px; }
	.fx-crm-stage { transform: translateX(-50%) scale(0.5); }
}

/* Animaciones apagadas: imagen fija, con la linea de la grafica ya dibujada */
html.fx-motion-off .fx-crm-line { stroke-dashoffset: 0; }
html.fx-motion-off .fx-crm-area { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
	html:not(.fx-force-motion) .fx-crm-line { stroke-dashoffset: 0; }
	html:not(.fx-force-motion) .fx-crm-area { opacity: 1; }
}

/* Boton para encender o apagar las animaciones */
.fx-motion-toggle {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 60;
	padding: 7px 12px;
	border: 1px solid rgba(148, 163, 184, 0.3);
	border-radius: 999px;
	background: rgba(15, 23, 42, 0.88);
	color: #94a3b8;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 11px;
	cursor: pointer;
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.fx-motion-toggle:hover,
.fx-motion-toggle:focus-visible { border-color: #22d3ee; color: #22d3ee; outline: none; }

/* =====================================================================
   Efectos extra de la portada (assets/fx-extras.js)
   ===================================================================== */

/* Cursor del titular que se escribe solo */
.fx-cursor {
	margin-left: 2px;
	color: #22d3ee;
	-webkit-text-fill-color: #22d3ee;
	animation: fx-blink 1s steps(1) infinite;
}

@keyframes fx-blink { 50% { opacity: 0; } }

/* Boton principal con brillo que late */
:is(.fx-hero, .is-style-crm-hero) .wp-block-button:not(.is-style-outline) .wp-block-button__link {
	animation: fx-glow 2.6s ease-in-out infinite;
}

@keyframes fx-glow {
	0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.45), 0 0 18px -4px rgba(34, 211, 238, 0.55); }
	50%      { box-shadow: 0 0 0 10px rgba(34, 211, 238, 0), 0 0 30px 0 rgba(34, 211, 238, 0.75); }
}

/* Indicador de scroll */
.fx-scrollcue {
	position: absolute;
	left: 50%;
	bottom: 14px;
	z-index: 1;
	width: 22px;
	height: 36px;
	margin-left: -11px;
	border: 2px solid rgba(148, 163, 184, 0.55);
	border-radius: 12px;
	pointer-events: none;
}

.fx-scrollcue span {
	position: absolute;
	top: 6px;
	left: 50%;
	width: 3px;
	height: 7px;
	margin-left: -1.5px;
	border-radius: 2px;
	background: #22d3ee;
	animation: fx-scrollcue 1.8s ease-in-out infinite;
}

@keyframes fx-scrollcue {
	0%   { opacity: 0; transform: translateY(0); }
	30%  { opacity: 1; }
	100% { opacity: 0; transform: translateY(14px); }
}

@media (max-width: 959px) { .fx-scrollcue { display: none; } }


/* =====================================================================
   Ajustes de movil/tablet y estilos de bloque (v1.4.0)
   ===================================================================== */

/* WooCommerce deja un padding-right:0 en <body> (bloqueo de scroll del carrito): se restaura el margen lateral. */
body { padding-right: var(--wp--preset--spacing--40) !important; }

/* Cabecera: una sola fila (logo, menu, cuenta y carrito), compacta en movil. */
.site-header > .wp-block-group { flex-wrap: nowrap !important; gap: 0.75rem; }
.site-brand { min-width: 0; flex-shrink: 1; }

@media (max-width: 782px) {
	.site-header { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
	.site-brand { gap: 0.5rem !important; }
	.site-brand .wp-block-site-title { font-size: 1.05rem !important; }
	.site-brand__logo img { width: 36px; height: 36px; }
}

/* Cifras del hero: tres en fila tambien en movil. */
@media (max-width: 781px) {
	:is(.fx-hero, .is-style-crm-hero) .wp-block-columns { flex-wrap: nowrap !important; gap: 0.75rem !important; }
	:is(.fx-hero, .is-style-crm-hero) .wp-block-column { flex-basis: 0 !important; flex-grow: 1 !important; min-width: 0; }
	:is(.fx-hero, .is-style-crm-hero) .is-style-tech-stat,
	:is(.fx-hero, .is-style-crm-hero) .tech-stat { font-size: 1.4rem !important; }
}

/* Estilos de bloque equivalentes a las clases del tema (se aplican desde el panel "Estilos"). */
.wp-block-button.is-style-glow .wp-block-button__link { animation: fx-glow 2.6s ease-in-out infinite; }
