/* =========================================================
   SoyIMPAR Experiencia · motion, ticker de marca y chatbot
   Todo respeta prefers-reduced-motion.
   ========================================================= */

:root {
	--si-red: #c83f50;
	--si-red-dark: #a82f40;
	--si-pink: #d57fa6;
	--si-green: #00946d;
	--si-yellow: #efb700;
	--si-ink: #1d1d1f;
	--si-ease: cubic-bezier(.22, .8, .3, 1);
}

html { scroll-behavior: smooth; }

/* ---------- 1. Entrada de página ---------- */
@keyframes si-page-in { from { opacity: 0; } to { opacity: 1; } }
body.si-ready { animation: si-page-in .5s ease both; }

/* ---------- 2. Aparecer al hacer scroll ---------- */
.si-reveal {
	opacity: 0;
	transform: translateY(26px) scale(.985);
	transition: opacity .7s var(--si-ease), transform .7s var(--si-ease);
	transition-delay: var(--si-delay, 0ms);
	will-change: opacity, transform;
}
.si-reveal.si-in {
	opacity: 1;
	transform: none;
	will-change: auto;
}

/* ---------- 3. Microinteracciones de producto ---------- */
.woocommerce ul.products li.product img,
.eael-product-wrap img,
.elementor-widget-image img {
	transition: transform .6s var(--si-ease), filter .4s ease;
}
.woocommerce ul.products li.product:hover img,
.eael-product-wrap:hover img {
	transform: scale(1.06) rotate(-1deg);
}

/* brillo que cruza los botones de compra */
a.add_to_cart_button,
.single_add_to_cart_button {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}
a.add_to_cart_button::after,
.single_add_to_cart_button::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
	transform: translateX(-120%);
	transition: transform .7s ease;
	z-index: -1;
}
a.add_to_cart_button:hover::after,
.single_add_to_cart_button:hover::after {
	transform: translateX(120%);
}

/* latido del botón principal */
@keyframes si-pulse {
	0%, 100% { box-shadow: 0 6px 16px rgba(200, 63, 80, .35); }
	50%      { box-shadow: 0 6px 26px rgba(200, 63, 80, .6); }
}
.single-product .single_add_to_cart_button { animation: si-pulse 2.6s ease-in-out infinite; }

/* etiqueta de oferta con bamboleo suave */
@keyframes si-wiggle {
	0%, 100% { transform: rotate(-4deg); }
	50%      { transform: rotate(4deg); }
}
.woocommerce span.onsale { animation: si-wiggle 3s ease-in-out infinite; }

/* carrito: salto al añadir */
@keyframes si-bump {
	0% { transform: scale(1); }
	30% { transform: scale(1.35) rotate(-8deg); }
	60% { transform: scale(.95) rotate(4deg); }
	100% { transform: scale(1); }
}
.si-bump { animation: si-bump .6s var(--si-ease); }

/* menú: subrayado que crece */
.main-header-menu > .menu-item > a { position: relative; }
.main-header-menu > .menu-item > a::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 6px;
	width: 0;
	height: 3px;
	border-radius: 3px;
	background: var(--si-red);
	transition: width .3s var(--si-ease), left .3s var(--si-ease);
}
.main-header-menu > .menu-item > a:hover::after,
.main-header-menu > .menu-item.current-menu-item > a::after {
	width: 70%;
	left: 15%;
}

/* ---------- 4. Ticker de marca (reemplaza la franja estática) ---------- */
body.si-has-ticker:not(.wp-admin)::before { display: none; }

.si-ticker {
	background: var(--si-red);
	color: #fff;
	overflow: hidden;
	white-space: nowrap;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	line-height: 1;
	padding: 10px 0;
	position: relative;
	z-index: 5;
}
.si-ticker__track {
	display: inline-flex;
	gap: 0;
	animation: si-marquee 38s linear infinite;
	will-change: transform;
}
.si-ticker:hover .si-ticker__track { animation-play-state: paused; }
.si-ticker__item { padding: 0 22px; display: inline-flex; align-items: center; gap: 22px; }
.si-ticker__item::after { content: "✦"; color: var(--si-yellow); }
.si-ticker__item--hot { color: var(--si-yellow); }
@keyframes si-marquee { to { transform: translateX(-50%); } }

/* ---------- 5. Aviso de renovación ---------- */
.si-renew {
	position: fixed;
	left: 50%;
	bottom: 22px;
	z-index: 99985;
	width: min(92vw, 460px);
	transform: translate(-50%, 140%);
	opacity: 0;
	background: #fff;
	color: var(--si-ink);
	border-radius: 18px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
	border: 2px solid var(--si-ink);
	padding: 16px 44px 16px 18px;
	transition: transform .7s var(--si-ease), opacity .5s ease;
}
.si-renew.si-show { transform: translate(-50%, 0); opacity: 1; }
.si-renew::before {
	content: "";
	position: absolute;
	left: -2px; top: -2px; right: -2px;
	height: 8px;
	border-radius: 16px 16px 0 0;
	background: linear-gradient(90deg, var(--si-red), var(--si-pink), var(--si-yellow), var(--si-green));
}
.si-renew__title { font-weight: 800; font-size: 17px; margin: 6px 0 4px; }
.si-renew__text { font-size: 14px; line-height: 1.4; margin: 0 0 10px; color: #444; }
.si-renew__cta {
	display: inline-block;
	background: var(--si-red);
	color: #fff !important;
	border-radius: 999px;
	padding: 8px 18px;
	font-weight: 700;
	font-size: 14px;
	transition: transform .2s ease, background .2s ease;
}
.si-renew__cta:hover { background: var(--si-red-dark); transform: translateY(-2px); }
.si-renew__close {
	position: absolute;
	top: 12px; right: 10px;
	width: 32px; height: 32px;
	border: 0;
	background: transparent;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: #555;
}

/* ---------- 6. Snackbar al añadir al carrito ---------- */
.si-snack {
	position: fixed;
	left: 50%;
	top: 70px;
	z-index: 99999;
	transform: translate(-50%, -30px);
	opacity: 0;
	background: var(--si-ink);
	color: #fff;
	padding: 12px 20px;
	border-radius: 999px;
	font-weight: 600;
	font-size: 14px;
	pointer-events: none;
	transition: transform .5s var(--si-ease), opacity .4s ease;
}
.si-snack.si-show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- 7. Chatbot "Parce IMPAR" ---------- */
.si-chat-btn {
	position: fixed;
	right: 20px;
	bottom: 96px;
	z-index: 99990;
	display: flex;
	align-items: center;
	gap: 10px;
	border: 2px solid var(--si-ink);
	background: var(--si-yellow);
	color: var(--si-ink);
	padding: 10px 16px 10px 12px;
	border-radius: 999px;
	font: 700 14px/1 inherit;
	cursor: pointer;
	box-shadow: 4px 4px 0 var(--si-ink);
	transition: transform .2s var(--si-ease), box-shadow .2s ease;
	animation: si-float 3.6s ease-in-out infinite;
}
.si-chat-btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--si-ink); }
.si-chat-btn__icon { font-size: 22px; line-height: 1; }
@keyframes si-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
.si-chat-btn.si-hidden { display: none; }

.si-chat {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99991;
	width: min(94vw, 380px);
	height: min(76vh, 560px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 2px solid var(--si-ink);
	border-radius: 20px;
	box-shadow: 8px 8px 0 var(--si-ink);
	overflow: hidden;
	transform: translateY(30px) scale(.96);
	opacity: 0;
	visibility: hidden;
	transform-origin: bottom right;
	transition: transform .45s var(--si-ease), opacity .3s ease, visibility 0s linear .45s;
}
.si-chat.si-open {
	transform: none;
	opacity: 1;
	visibility: visible;
	transition-delay: 0s;
}
.si-chat__head {
	background: var(--si-red);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
}
.si-chat__avatar {
	width: 40px; height: 40px;
	border-radius: 50%;
	background: var(--si-yellow);
	display: grid;
	place-items: center;
	font-size: 22px;
	border: 2px solid #fff;
}
.si-chat__who { flex: 1; line-height: 1.2; }
.si-chat__who strong { display: block; font-size: 16px; }
.si-chat__who span { font-size: 12px; opacity: .9; }
.si-chat__close {
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	width: 36px; height: 36px;
}
.si-chat__msgs {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: #fdf6f8;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scroll-behavior: smooth;
}
.si-msg {
	max-width: 86%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14.5px;
	line-height: 1.45;
	word-wrap: break-word;
	animation: si-msg-in .4s var(--si-ease) both;
}
@keyframes si-msg-in { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.si-msg--bot { background: #fff; border: 1.5px solid #eadde1; align-self: flex-start; border-bottom-left-radius: 4px; color: var(--si-ink); }
.si-msg--user { background: var(--si-ink); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.si-msg a { color: var(--si-red); font-weight: 700; text-decoration: underline; word-break: break-all; }
.si-msg--user a { color: var(--si-yellow); }

.si-typing { display: inline-flex; gap: 4px; padding: 14px; }
.si-typing i {
	width: 7px; height: 7px;
	border-radius: 50%;
	background: var(--si-pink);
	animation: si-dot 1s ease-in-out infinite;
}
.si-typing i:nth-child(2) { animation-delay: .15s; }
.si-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes si-dot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

.si-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: #fdf6f8; }
.si-chip {
	border: 1.5px solid var(--si-red);
	background: #fff;
	color: var(--si-red);
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background .2s ease, color .2s ease, transform .15s ease;
}
.si-chip:hover { background: var(--si-red); color: #fff; transform: translateY(-1px); }

.si-chat__form { display: flex; gap: 8px; padding: 10px 12px; border-top: 2px solid var(--si-ink); background: #fff; }
.si-chat__input {
	flex: 1;
	border: 1.5px solid #cfc3c7;
	border-radius: 999px;
	padding: 10px 14px;
	font-size: 15px;
	min-width: 0;
}
.si-chat__input:focus { outline: 3px solid var(--si-green); outline-offset: 1px; border-color: var(--si-green); }
.si-chat__send {
	border: 0;
	background: var(--si-red);
	color: #fff;
	width: 44px; height: 44px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 18px;
	transition: transform .15s ease, background .2s ease;
}
.si-chat__send:hover:not(:disabled) { background: var(--si-red-dark); transform: scale(1.06); }
.si-chat__send:disabled { opacity: .5; cursor: wait; }
.si-chat__note { font-size: 11px; color: #777; text-align: center; padding: 0 12px 8px; background: #fff; }

@media (max-width: 600px) {
	.si-chat { right: 0; left: 0; bottom: 0; width: 100%; height: 82vh; border-radius: 20px 20px 0 0; box-shadow: none; }
	.si-chat-btn { right: 12px; bottom: 84px; }
	.si-chat-btn__label { display: none; }
	.si-chat-btn { padding: 12px; }
	.si-ticker { font-size: 11.5px; padding: 8px 0; }
	.si-renew { bottom: 84px; }
}

/* ---------- 8. Accesibilidad: sin movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	body.si-ready,
	.si-reveal,
	.si-ticker__track,
	.single-product .single_add_to_cart_button,
	.woocommerce span.onsale,
	.si-chat-btn,
	.si-msg,
	.si-typing i { animation: none !important; }
	.si-reveal { opacity: 1; transform: none; transition: none; }
	.si-ticker__track { transform: none; flex-wrap: wrap; justify-content: center; white-space: normal; }
	.si-ticker__item:nth-child(n+4) { display: none; }
	.si-chat, .si-renew, .si-snack { transition: none; }
	.woocommerce ul.products li.product:hover img { transform: none; }
}
