/*
 * LeadPopup AI — Frontend styles.
 * Aislados con #lpai-popup-root + clases prefijadas .lpai-*.
 * Soporta 3 layouts (modal / slide_in / top_bar), 3 sizes y 3 fuentes.
 */

#lpai-popup-root,
#lpai-popup-root *,
#lpai-popup-root *::before,
#lpai-popup-root *::after {
	box-sizing: border-box;
}

#lpai-popup-root {
	position: fixed;
	z-index: 999999;
	font-size: 16px;
	line-height: 1.5;
	color: var(--lpai-text, #1d2327);
}

#lpai-popup-root[hidden] {
	display: none !important;
}

/* ----------------------------------------------------------------
 * Tipografías
 * ---------------------------------------------------------------- */
.lpai-font--system { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.lpai-font--serif  { font-family: Georgia, "Times New Roman", serif; }
.lpai-font--display { font-family: "Helvetica Neue", "Arial Black", Impact, sans-serif; letter-spacing: -0.01em; }

/* ----------------------------------------------------------------
 * Backdrop (sólo en modal)
 * ---------------------------------------------------------------- */
.lpai-popup-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(2px);
	cursor: pointer;
	animation: lpai-fade-in 200ms ease-out;
}

/* ----------------------------------------------------------------
 * Layout: MODAL (centrado)
 * ---------------------------------------------------------------- */
.lpai-layout--modal {
	inset: 0;
}

.lpai-layout--modal .lpai-popup {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-height: 92vh;
	overflow-y: auto;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	animation: lpai-pop-in 220ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.lpai-layout--modal.lpai-size--compact .lpai-popup { width: min(92vw, 380px); }
.lpai-layout--modal.lpai-size--medium  .lpai-popup { width: min(92vw, 460px); }
.lpai-layout--modal.lpai-size--large   .lpai-popup { width: min(94vw, 720px); }

/* ----------------------------------------------------------------
 * Layout: SLIDE-IN (esquina, sin backdrop)
 * ---------------------------------------------------------------- */
.lpai-layout--slide_in {
	inset: auto 0 0 0;
	pointer-events: none;
}

.lpai-layout--slide_in .lpai-popup {
	position: absolute;
	bottom: 24px;
	width: min(92vw, 360px);
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	pointer-events: auto;
	animation: lpai-slide-in 280ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.lpai-layout--slide_in.lpai-pos--bottom_right .lpai-popup { right: 24px; }
.lpai-layout--slide_in.lpai-pos--bottom_left  .lpai-popup { left: 24px; }

.lpai-layout--slide_in.lpai-size--compact .lpai-popup { width: min(92vw, 320px); }
.lpai-layout--slide_in.lpai-size--medium  .lpai-popup { width: min(92vw, 380px); }
.lpai-layout--slide_in.lpai-size--large   .lpai-popup { width: min(94vw, 440px); }

@media (max-width: 640px) {
	.lpai-layout--slide_in .lpai-popup {
		bottom: 12px;
		left: 12px !important;
		right: 12px !important;
		width: auto;
	}
}

/* ----------------------------------------------------------------
 * Layout: SPLIT 50/50 (form izquierda, imagen full-bleed derecha)
 * ---------------------------------------------------------------- */
.lpai-layout--split {
	inset: 0;
}

.lpai-layout--split .lpai-popup {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: grid;
	grid-template-columns: 1fr 1fr;
	width: min(94vw, 880px);
	max-height: 92vh;
	border-radius: 4px;
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
	animation: lpai-pop-in 240ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.lpai-layout--split.lpai-size--compact .lpai-popup { width: min(94vw, 720px); }
.lpai-layout--split.lpai-size--large   .lpai-popup { width: min(96vw, 1040px); }

.lpai-layout--split .lpai-popup__image--split {
	width: 100%;
	height: 100%;
	min-height: 420px;
	overflow: hidden;
	order: 2;
}

.lpai-layout--split .lpai-popup__image--split img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.lpai-layout--split .lpai-popup__content {
	order: 1;
	padding: 56px 48px 44px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	overflow-y: auto;
}

.lpai-layout--split.lpai-size--compact .lpai-popup__content { padding: 44px 36px 36px; }
.lpai-layout--split.lpai-size--large   .lpai-popup__content { padding: 64px 60px 52px; }

@media (max-width: 720px) {
	.lpai-layout--split .lpai-popup {
		grid-template-columns: 1fr;
		max-width: 92vw;
	}
	/* En móvil queremos la imagen arriba y el contenido debajo. Invertimos
	   los `order` que sí sirven en desktop para tener form a la izquierda. */
	.lpai-layout--split .lpai-popup__image--split {
		order: 1;
		min-height: 200px;
		max-height: 220px;
	}
	.lpai-layout--split .lpai-popup__content {
		order: 2;
		padding: 32px 24px 28px;
	}
}

/* ----------------------------------------------------------------
 * Layout: TOP BAR
 * ---------------------------------------------------------------- */
.lpai-layout--top_bar {
	top: 0;
	left: 0;
	right: 0;
	bottom: auto;
}

.lpai-layout--top_bar .lpai-popup {
	width: 100%;
	border-radius: 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	animation: lpai-slide-down 220ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.lpai-layout--top_bar .lpai-popup__content {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 56px 10px 18px;
	flex-wrap: wrap;
	justify-content: center;
}

.lpai-layout--top_bar .lpai-popup__title-inline {
	font-weight: 700;
	font-size: 14px;
}

.lpai-layout--top_bar .lpai-popup__body-inline {
	font-size: 13px;
	opacity: 0.85;
}

.lpai-layout--top_bar .lpai-popup__form {
	flex-direction: row;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.lpai-layout--top_bar .lpai-popup__form input[type="email"] {
	width: 220px;
	padding: 7px 10px;
	font-size: 13px;
	border-radius: 4px;
}

.lpai-layout--top_bar .lpai-popup__btn {
	padding: 7px 14px;
	font-size: 13px;
	width: auto;
}

.lpai-layout--top_bar .lpai-consent {
	font-size: 11px;
	max-width: 100%;
	flex-basis: 100%;
}

.lpai-layout--top_bar .lpai-popup__close {
	top: 50%;
	right: 14px;
	transform: translateY(-50%);
	font-size: 22px;
}

@media (max-width: 720px) {
	.lpai-layout--top_bar .lpai-popup__form input[type="email"] {
		width: 100%;
	}
}

/* ----------------------------------------------------------------
 * Fondo (solid / gradient)
 * ---------------------------------------------------------------- */
.lpai-popup {
	background: var(--lpai-bg, #ffffff);
	color: var(--lpai-text, #1d2327);
}

.lpai-bg--gradient .lpai-popup {
	background: linear-gradient(135deg, var(--lpai-bg, #fb923c) 0%, var(--lpai-bg2, #fcd34d) 100%);
}

/* ----------------------------------------------------------------
 * Imagen interna del popup
 * ---------------------------------------------------------------- */
.lpai-popup__image {
	overflow: hidden;
}

.lpai-popup__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* image_position: top */
.lpai-img--top .lpai-popup__image {
	width: 100%;
	max-height: 200px;
	border-top-left-radius: 12px;
	border-top-right-radius: 12px;
}

/* image_position: left / right (modal large) */
.lpai-layout--modal.lpai-img--left .lpai-popup,
.lpai-layout--modal.lpai-img--right .lpai-popup {
	display: flex;
	overflow: hidden;
}

.lpai-layout--modal.lpai-img--left  .lpai-popup__image { order: 1; width: 45%; max-width: 320px; }
.lpai-layout--modal.lpai-img--left  .lpai-popup__content { order: 2; flex: 1; }

.lpai-layout--modal.lpai-img--right .lpai-popup__image { order: 2; width: 45%; max-width: 320px; }
.lpai-layout--modal.lpai-img--right .lpai-popup__content { order: 1; flex: 1; }

@media (max-width: 640px) {
	.lpai-layout--modal.lpai-img--left .lpai-popup,
	.lpai-layout--modal.lpai-img--right .lpai-popup {
		flex-direction: column;
	}
	.lpai-layout--modal.lpai-img--left .lpai-popup__image,
	.lpai-layout--modal.lpai-img--right .lpai-popup__image {
		width: 100%;
		max-width: none;
		max-height: 180px;
	}
}

/* ----------------------------------------------------------------
 * Botón cerrar + contenido
 * ---------------------------------------------------------------- */
.lpai-popup__close {
	position: absolute;
	top: 8px;
	right: 12px;
	background: transparent;
	border: 0;
	font-size: 28px;
	line-height: 1;
	color: inherit;
	opacity: 0.6;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 4px;
	z-index: 2;
}

.lpai-popup__close:hover,
.lpai-popup__close:focus {
	opacity: 1;
	outline: none;
}

.lpai-popup__content {
	padding: 28px 28px 24px;
}

.lpai-size--compact .lpai-popup__content { padding: 22px 22px 20px; }
.lpai-size--large   .lpai-popup__content { padding: 36px 36px 30px; }

.lpai-popup__title {
	margin: 0 0 8px;
	font-size: 22px;
	line-height: 1.2;
	font-weight: 700;
	color: inherit;
}

.lpai-font--display .lpai-popup__title { font-size: 26px; line-height: 1.05; letter-spacing: -0.01em; }
.lpai-font--serif   .lpai-popup__title { font-size: 24px; font-weight: 600; }

.lpai-size--compact .lpai-popup__title { font-size: 18px; }
.lpai-size--large   .lpai-popup__title { font-size: 28px; }

/* title_style: large (más enfasis) */
.lpai-title--large .lpai-popup__title {
	font-size: clamp(28px, 4vw, 38px);
	line-height: 1.1;
	letter-spacing: -0.015em;
}

/* title_style: hero (gigante tipo Soi Paris) */
.lpai-title--hero .lpai-popup__title {
	font-size: clamp(56px, 9vw, 110px);
	font-weight: 900;
	line-height: 0.95;
	letter-spacing: -0.04em;
	margin: 4px 0 12px;
}

.lpai-title--hero.lpai-size--compact .lpai-popup__title {
	font-size: clamp(44px, 7vw, 80px);
}

/* Brand logo arriba del form */
.lpai-popup__brand {
	margin-bottom: 18px;
}

.lpai-popup__brand img {
	max-width: 120px;
	max-height: 40px;
	height: auto;
	width: auto;
	object-fit: contain;
	display: block;
}

.lpai-layout--split .lpai-popup__brand img {
	max-width: 140px;
	max-height: 48px;
}

/* Eyebrow (texto pequeño antes del título) */
.lpai-popup__eyebrow {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	opacity: 0.7;
	margin: 0 0 10px;
	line-height: 1.2;
}

.lpai-title--hero .lpai-popup__eyebrow {
	margin-bottom: 6px;
}

/* Disclaimer (texto legal pequeño bajo el botón) */
.lpai-popup__disclaimer {
	margin: 12px 0 0;
	font-size: 11px;
	line-height: 1.45;
	color: inherit;
	opacity: 0.65;
	text-align: center;
}

.lpai-popup__body {
	margin: 0 0 16px;
	font-size: 15px;
	color: inherit;
	opacity: 0.9;
}

.lpai-popup__body p { margin: 0 0 8px; }

/* ----------------------------------------------------------------
 * Form
 * ---------------------------------------------------------------- */
.lpai-popup__form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.lpai-field input[type="email"] {
	width: 100%;
	padding: 12px 14px;
	font-size: 15px;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 6px;
	background: #fff;
	color: #1d2327;
	font-family: inherit;
}

.lpai-field input[type="email"]:focus {
	outline: 2px solid var(--lpai-btn-bg, #3a86ff);
	outline-offset: 1px;
	border-color: var(--lpai-btn-bg, #3a86ff);
}

.lpai-consent label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 12px;
	line-height: 1.4;
	color: inherit;
	opacity: 0.85;
}

.lpai-consent input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; }

.lpai-consent a {
	color: inherit;
	text-decoration: underline;
}

/* Honeypot oculto */
.lpai-honeypot {
	position: absolute !important;
	left: -10000px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.lpai-popup__btn {
	width: 100%;
	padding: 14px 18px;
	font-size: 15px;
	font-weight: 600;
	background: var(--lpai-btn-bg, #3a86ff);
	color: var(--lpai-btn-text, #ffffff);
	border: 0;
	border-radius: 6px;
	cursor: pointer;
	font-family: inherit;
	transition: filter 150ms ease;
	letter-spacing: 0.01em;
}

.lpai-cta--square .lpai-popup__btn { border-radius: 0; }
.lpai-cta--pill   .lpai-popup__btn { border-radius: 999px; }
.lpai-cta--rounded .lpai-popup__btn { border-radius: 6px; }

/* En layouts split y title hero el botón gana presencia */
.lpai-layout--split .lpai-popup__btn,
.lpai-title--hero .lpai-popup__btn {
	padding: 16px 20px;
	font-size: 14px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-weight: 700;
}

.lpai-popup__btn:hover,
.lpai-popup__btn:focus {
	filter: brightness(0.92);
	outline: none;
}

.lpai-popup__btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	filter: none;
}

.lpai-popup__msg {
	margin: 4px 0 0;
	font-size: 13px;
	min-height: 18px;
	color: inherit;
}

.lpai-popup__msg.is-error   { color: #d62828; }
.lpai-popup__msg.is-success { color: #2bb673; }

.lpai-visually-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* ----------------------------------------------------------------
 * Animaciones
 * ---------------------------------------------------------------- */
@keyframes lpai-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes lpai-pop-in {
	from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
	to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes lpai-slide-in {
	from { opacity: 0; transform: translateY(20px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes lpai-slide-down {
	from { transform: translateY(-100%); }
	to   { transform: translateY(0); }
}

@media (max-width: 480px) {
	.lpai-layout--modal.lpai-size--medium .lpai-popup__content,
	.lpai-layout--modal.lpai-size--large  .lpai-popup__content { padding: 22px 20px 20px; }
}

/* ----------------------------------------------------------------
 * Success view: cupón + productos destacados (Sprint 4)
 * ---------------------------------------------------------------- */
.lpai-popup__success {
	display: flex;
	flex-direction: column;
	gap: 16px;
	animation: lpai-fade-in 280ms ease-out;
}

.lpai-popup__success[hidden] { display: none !important; }

.lpai-popup__success-title {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
	color: inherit;
	margin: 0;
}

/* Cupón */
.lpai-popup__coupon {
	background: rgba(0, 0, 0, 0.04);
	border: 2px dashed currentColor;
	border-radius: 8px;
	padding: 16px;
	text-align: center;
}

.lpai-popup__coupon-code-wrap {
	display: flex;
	gap: 0;
	align-items: stretch;
	max-width: 100%;
	margin: 0 auto;
}

.lpai-popup__coupon-code {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--lpai-bg, #fff);
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-right: 0;
	padding: 12px 16px;
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 18px;
	font-weight: 700;
	letter-spacing: 0.08em;
	border-top-left-radius: 6px;
	border-bottom-left-radius: 6px;
	user-select: all;
}

.lpai-popup__coupon-copy {
	background: var(--lpai-btn-bg, #1a1a1a);
	color: var(--lpai-btn-text, #fff);
	border: 0;
	padding: 0 18px;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	cursor: pointer;
	border-top-right-radius: 6px;
	border-bottom-right-radius: 6px;
	font-family: inherit;
	transition: filter 150ms ease;
}

.lpai-popup__coupon-copy:hover { filter: brightness(0.92); }
.lpai-popup__coupon-copy.is-copied { background: #2bb673; color: #fff; }

.lpai-popup__coupon-disclaimer {
	margin: 12px 0 0;
	font-size: 11px;
	line-height: 1.4;
	color: inherit;
	opacity: 0.7;
}

/* Productos destacados */
.lpai-popup__products {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}

.lpai-popup__product {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 8px;
	text-decoration: none;
	color: inherit;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.5);
	transition: transform 150ms ease, border-color 150ms ease;
}

.lpai-popup__product:hover {
	transform: translateY(-2px);
	border-color: var(--lpai-btn-bg, #3a86ff);
}

.lpai-popup__product-img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	background-size: cover;
	background-position: center;
	background-color: #fafafa;
	border-radius: 4px;
}

.lpai-popup__product-name {
	font-size: 12px;
	font-weight: 600;
	line-height: 1.25;
	color: inherit;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.lpai-popup__product-price {
	font-size: 12px;
	color: inherit;
	opacity: 0.75;
}

@media (max-width: 480px) {
	.lpai-popup__products { grid-template-columns: repeat(2, 1fr); }
}

/* Powered by branding (Free tier) */
.lpai-popup__powered-by {
	display: block;
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	font-size: 10px;
	font-weight: 400;
	text-align: center;
	color: inherit;
	opacity: 0.55;
	text-decoration: none;
	letter-spacing: 0.02em;
}

.lpai-popup__powered-by:hover {
	opacity: 0.85;
}

.lpai-popup__powered-by strong {
	font-weight: 600;
}
