/**
 * Modal "Atendente virtual" (chamada de voz) - só na home.
 * Markup em noon_atendente_voz() (functions.php), lógica em assets/js/noon-atendente-voz.js.
 * Referência de design: .claude/Modal - Chatbot NOON/design_handoff_noon_modal/README.md
 *
 * Estados (atributo data-estado no #noon-voz):
 *   inicial -> modal e ícone escondidos (antes do JS rodar)
 *   fechado -> só o ícone com a orbe no canto inferior esquerdo (estado padrão)
 *   aberto  -> modal sobre a página
 *
 * O ícone fica no canto ESQUERDO porque o direito já tem WhatsApp, motor Abity e Lia (float-icons.css).
 * No desktop ele sobe junto com a barra de reservas (--abity-bar-h, medido em motor_abity_html()).
 * Os seletores usam duas classes de propósito: o reset do Hello e o kit do Elementor estilizam
 * button/a/h2 com especificidade 0,1,1.
 */

.noon-voz {
	--noon-voz-texto: #121214;
	--noon-voz-texto-2: #6b6b72;
	--noon-voz-ciano: #1fd5f9;
	--noon-voz-margem: clamp(16px, 4vw, 24px);
	--noon-voz-icone: clamp(58px, 15vw, 68px);
	font-family: Poppins, sans-serif;
	-webkit-tap-highlight-color: transparent;
}

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

html.noon-voz-aberto {
	overflow: hidden;
}

/* ---------------------------------------------------------------- Overlay */

.noon-voz .noon-voz__overlay {
	position: fixed;
	inset: 0;
	z-index: 2147483100; /* acima do iframe da Lia (2147483000) */
	display: flex;
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: rgba(18, 18, 20, 0);
	visibility: hidden;
	transition: background 0.45s ease, visibility 0s linear 0.6s;
}

.noon-voz[data-estado="aberto"] .noon-voz__overlay {
	background: rgba(18, 18, 20, 0.45);
	visibility: visible;
	transition: background 0.45s ease, visibility 0s linear 0s;
}

/* ------------------------------------------------------- Moldura de vidro */

.noon-voz .noon-voz__moldura {
	position: relative;
	width: min(520px, 100%);
	margin: auto;
	container-type: inline-size;
	padding: clamp(6px, 2vw, 10px);
	border-radius: clamp(30px, 8vw, 38px);
	background: linear-gradient(160deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.14) 45%, rgba(255, 255, 255, 0.28) 100%);
	-webkit-backdrop-filter: blur(24px) saturate(140%);
	backdrop-filter: blur(24px) saturate(140%);
	border: 1px solid rgba(255, 255, 255, 0.55);
	box-shadow: 0 24px 80px rgba(18, 18, 20, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.7);
	outline: none;
	/* Recolhido: encolhe e desliza até o ícone no canto inferior esquerdo */
	transform: translate(calc(-50vw + 52px), calc(50vh - 52px - var(--abity-bar-h, 0px))) scale(0.1);
	opacity: 0;
	pointer-events: none;
	transition: transform 0.6s cubic-bezier(0.6, 0, 0.2, 1), opacity 0.45s ease 0.15s;
}

.noon-voz[data-estado="aberto"] .noon-voz__moldura {
	transform: translate(0, 0) scale(1);
	opacity: 1;
	pointer-events: auto;
	transition: transform 0.6s cubic-bezier(0.6, 0, 0.2, 1), opacity 0.45s ease 0s;
}

/* ------------------------------------------------------------------- Card */

.noon-voz .noon-voz__card {
	position: relative;
	min-height: 100cqw; /* quadrado quando o conteúdo cabe, cresce na altura no mobile */
	overflow: hidden;
	border-radius: clamp(24px, 6.5vw, 28px);
	background: linear-gradient(180deg, #f3f3f2 0%, #ecedef 100%);
	color: var(--noon-voz-texto);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: clamp(32px, 9vw, 40px) clamp(20px, 6vw, 40px);
}

.noon-voz .noon-voz__aura {
	position: absolute;
	left: 50%;
	bottom: -110px;
	width: 135%;
	height: 170px;
	border-radius: 50%;
	filter: blur(40px);
	opacity: 0.35;
	pointer-events: none;
	transform: translateX(-50%);
	transform-origin: 50% 100%;
	background: linear-gradient(90deg, #e9a8d6 0%, #b49bf2 14%, #86a7ee 28%, #6fd3f2 42%, #9ab4e4 56%, #d7a6e6 70%, #b49bf2 85%, #e9a8d6 100%);
	background-size: 220% 100%;
	animation: noonVozAuraFlow 10s ease-in-out infinite, noonVozAuraBreath 5s ease-in-out infinite;
}

/* -------------------------------------------------------------- Fechar (X) */

.noon-voz .noon-voz__fechar {
	position: absolute;
	top: clamp(6px, 2vw, 12px);
	right: clamp(6px, 2vw, 12px);
	z-index: 2;
	width: 44px;
	height: 44px;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
	color: #3a3a40;
	cursor: pointer;
	transition: background 0.2s ease;
}

.noon-voz .noon-voz__fechar:hover,
.noon-voz .noon-voz__fechar:focus {
	background: rgba(18, 18, 20, 0.06);
	color: #3a3a40;
}

.noon-voz .noon-voz__fechar:focus-visible,
.noon-voz .noon-voz__cta:focus-visible,
.noon-voz .noon-voz__icone-botao:focus-visible {
	outline: 2px solid var(--noon-voz-texto);
	outline-offset: 3px;
}

.noon-voz .noon-voz__fechar svg {
	display: block;
	width: 20px;
	height: 20px;
}

/* ------------------------------------------------------------ Logo e orbe */

.noon-voz .noon-voz__logo {
	position: relative;
	display: block;
	width: auto;
	height: clamp(28px, 8.5vw, 34px);
	max-width: none;
	margin: 0;
}

.noon-voz .noon-voz__orbe {
	position: relative;
	flex: 0 0 auto;
	width: clamp(150px, 44vw, 184px);
	aspect-ratio: 1 / 1;
	margin-top: clamp(14px, 4.5vw, 18px);
}

.noon-voz .noon-voz__halo {
	position: absolute;
	inset: -52%;
	pointer-events: none;
	background: radial-gradient(circle, rgba(157, 178, 208, 0.45) 0%, rgba(157, 178, 208, 0) 62%);
}

.noon-voz .noon-voz__aro {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	pointer-events: none;
	border: 1px solid rgba(94, 111, 139, 0.18);
}

.noon-voz .noon-voz__aro--interno {
	inset: 11%;
	background: rgba(255, 255, 255, 0.3);
	border-color: rgba(94, 111, 139, 0.28);
}

.noon-voz .noon-voz__canvas {
	position: absolute;
	left: 1%;
	top: 1%;
	width: 98%;
	height: 98%;
	display: block;
	pointer-events: none;
}

/* Sem WebGL: círculo em gradiente no lugar do shader (a esfera ocupa 60% do canvas) */
.noon-voz .noon-voz__orbe-fallback {
	display: none;
	position: absolute;
	inset: 20%;
	border-radius: 50%;
	pointer-events: none;
	background: radial-gradient(circle at 34% 28%, #fff 0%, #e4eaf3 18%, #a9bad3 50%, #5e6f8b 100%);
	box-shadow: 0 0 50px rgba(157, 178, 208, 0.75);
}

.noon-voz.noon-voz--sem-webgl .noon-voz__orbe-fallback {
	display: block;
}

.noon-voz.noon-voz--sem-webgl .noon-voz__canvas,
.noon-voz.noon-voz--sem-webgl .noon-voz__mini {
	display: none;
}

.noon-voz .noon-voz__falando {
	position: absolute;
	left: 50%;
	bottom: -2px;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 13px;
	background: rgba(255, 255, 255, 0.85);
	border: 1px solid rgba(18, 18, 20, 0.1);
	border-radius: 999px;
	box-shadow: 0 4px 14px rgba(94, 111, 139, 0.18);
	pointer-events: none;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	color: var(--noon-voz-texto);
}

.noon-voz .noon-voz__barras {
	display: flex;
	align-items: center;
	gap: 3px;
	height: 14px;
}

.noon-voz .noon-voz__barras span {
	width: 3px;
	height: 14px;
	border-radius: 2px;
	background: var(--noon-voz-ciano);
	transform-origin: 50% 50%;
	animation: noonVozBarPulse 0.9s ease-in-out infinite;
}

/* duração 0.9s + (i % 3) × 0.18s, atraso i × 0.12s */
.noon-voz .noon-voz__barras span:nth-child(1) { animation-duration: 0.9s;  animation-delay: 0s; }
.noon-voz .noon-voz__barras span:nth-child(2) { animation-duration: 1.08s; animation-delay: 0.12s; }
.noon-voz .noon-voz__barras span:nth-child(3) { animation-duration: 1.26s; animation-delay: 0.24s; }
.noon-voz .noon-voz__barras span:nth-child(4) { animation-duration: 0.9s;  animation-delay: 0.36s; }
.noon-voz .noon-voz__barras span:nth-child(5) { animation-duration: 1.08s; animation-delay: 0.48s; }
.noon-voz .noon-voz__barras span:nth-child(6) { animation-duration: 1.26s; animation-delay: 0.6s; }

/* Animações do modal só rodam com ele aberto (a aura tem blur de 40px, é cara) */
.noon-voz:not([data-estado="aberto"]) .noon-voz__aura,
.noon-voz:not([data-estado="aberto"]) .noon-voz__barras span {
	animation-play-state: paused;
}

/* ------------------------------------------------------------ Título e CTA */

.noon-voz .noon-voz__titulo {
	position: relative;
	max-width: 380px;
	margin: clamp(20px, 6vw, 24px) 0 0;
	padding: 0;
	font-family: Poppins, sans-serif;
	font-size: clamp(21px, 6vw, 26px);
	line-height: 1.25;
	font-weight: 400;
	letter-spacing: -0.01em;
	text-transform: none;
	text-wrap: balance;
	color: var(--noon-voz-texto);
}

.noon-voz .noon-voz__titulo strong {
	font-weight: 600;
}

.noon-voz .noon-voz__acoes {
	position: relative;
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin-top: clamp(20px, 6vw, 22px);
}

.noon-voz .noon-voz__cta {
	width: min(100%, 300px);
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 0 28px;
	background: var(--noon-voz-texto);
	color: #fff;
	border: 0;
	border-radius: 0; /* cantos retos, padrão Noon */
	font-family: Poppins, sans-serif;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.04em;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
	transition: background 0.2s ease;
}

.noon-voz .noon-voz__cta:hover,
.noon-voz .noon-voz__cta:focus {
	background: #2a2a2e;
	color: #fff;
	text-decoration: none;
}

.noon-voz .noon-voz__cta svg {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
}

.noon-voz .noon-voz__legenda {
	font-size: 12px;
	line-height: 1.4;
	color: var(--noon-voz-texto-2);
	white-space: nowrap;
}

/* ----------------------------------------------------------------- Ícone */

.noon-voz .noon-voz__icone {
	position: fixed;
	left: var(--noon-voz-margem);
	bottom: calc(var(--noon-voz-margem) + var(--abity-bar-h, 0px) + env(safe-area-inset-bottom, 0px));
	z-index: 997; /* abaixo do WhatsApp (998) e do motor de reservas aberto (999) */
	display: flex;
	align-items: center;
	gap: 12px;
	transform-origin: left bottom;
	transform: scale(0.4);
	opacity: 0;
	pointer-events: none;
	transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.2) 0s, opacity 0.3s ease 0s, bottom 0.2s ease;
}

.noon-voz[data-estado="fechado"] .noon-voz__icone {
	transform: scale(1);
	opacity: 1;
	pointer-events: auto;
	transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.2) 0.45s, opacity 0.3s ease 0.45s, bottom 0.2s ease;
}

/* Painel do motor de reservas aberto no mobile: o ícone sai do caminho */
html.noon-voz-motor-aberto .noon-voz .noon-voz__icone {
	opacity: 0;
	pointer-events: none;
}

.noon-voz .noon-voz__icone-botao {
	position: relative;
	flex: 0 0 auto;
	width: var(--noon-voz-icone);
	height: var(--noon-voz-icone);
	min-height: 0;
	margin: 0;
	padding: 5px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.75);
	background: linear-gradient(160deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.35) 100%);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	box-shadow: 0 10px 30px rgba(18, 18, 20, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
	cursor: pointer;
}

.noon-voz .noon-voz__icone-botao:hover,
.noon-voz .noon-voz__icone-botao:focus {
	background: linear-gradient(160deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.35) 100%);
	border-color: rgba(255, 255, 255, 0.75);
}

.noon-voz .noon-voz__pulso {
	position: absolute;
	inset: -1px;
	border-radius: 50%;
	border: 2px solid rgba(157, 178, 208, 0.9);
	pointer-events: none;
	opacity: 0;
}

.noon-voz[data-estado="fechado"] .noon-voz__pulso {
	animation: noonVozIconPulse 2.2s ease-out infinite;
}

.noon-voz .noon-voz__mini {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
}

.noon-voz .noon-voz__icone-botao .noon-voz__orbe-fallback {
	inset: 5px;
}

.noon-voz .noon-voz__rotulo {
	display: flex;
	align-items: center;
	gap: 8px;
	/* Não pode passar por baixo do WhatsApp em telas estreitas (mobile: 53px + 16px da borda + 8px de folga) */
	max-width: calc(100vw - 2 * var(--noon-voz-margem) - var(--noon-voz-icone) - 12px - 61px);
	padding: 10px 16px;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid rgba(18, 18, 20, 0.08);
	border-radius: 999px;
	box-shadow: 0 8px 24px rgba(18, 18, 20, 0.14);
	font-size: 13px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--noon-voz-texto);
	pointer-events: none;
	opacity: 0;
	transform: translateX(-8px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.noon-voz .noon-voz__rotulo-ponto {
	flex: 0 0 auto;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--noon-voz-ciano);
	box-shadow: 0 0 8px var(--noon-voz-ciano);
}

.noon-voz--dica[data-estado="fechado"] .noon-voz__rotulo,
.noon-voz[data-estado="fechado"] .noon-voz__icone-botao:hover + .noon-voz__rotulo,
.noon-voz[data-estado="fechado"] .noon-voz__icone-botao:focus-visible + .noon-voz__rotulo {
	opacity: 1;
	transform: translateX(0);
}

@media (max-width: 480px) {
	.noon-voz .noon-voz__rotulo {
		padding: 8px 12px;
		font-size: 12px;
	}
}

/* ------------------------------------------------------------- Keyframes */

@keyframes noonVozAuraFlow {
	0% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}

@keyframes noonVozAuraBreath {
	0%, 100% { transform: translateX(-50%) scale(1, 1); opacity: 0.3; }
	50% { transform: translateX(-50%) scale(1.05, 1.15); opacity: 0.4; }
}

@keyframes noonVozBarPulse {
	0%, 100% { transform: scaleY(0.35); }
	50% { transform: scaleY(1); }
}

@keyframes noonVozIconPulse {
	0% { transform: scale(1); opacity: 0.55; }
	100% { transform: scale(1.45); opacity: 0; }
}

/* --------------------------------------------------------- Menos movimento */

@media (prefers-reduced-motion: reduce) {
	.noon-voz .noon-voz__aura,
	.noon-voz[data-estado="fechado"] .noon-voz__pulso {
		animation: none;
	}

	.noon-voz .noon-voz__barras span {
		animation: none;
	}

	.noon-voz .noon-voz__barras span:nth-child(1),
	.noon-voz .noon-voz__barras span:nth-child(6) { transform: scaleY(0.36); }
	.noon-voz .noon-voz__barras span:nth-child(2) { transform: scaleY(0.71); }
	.noon-voz .noon-voz__barras span:nth-child(3) { transform: scaleY(1); }
	.noon-voz .noon-voz__barras span:nth-child(4) { transform: scaleY(0.57); }
	.noon-voz .noon-voz__barras span:nth-child(5) { transform: scaleY(0.79); }

	.noon-voz .noon-voz__moldura,
	.noon-voz[data-estado="aberto"] .noon-voz__moldura,
	.noon-voz .noon-voz__icone,
	.noon-voz[data-estado="fechado"] .noon-voz__icone {
		transition-duration: 0.01s;
		transition-delay: 0s;
	}
}
