/* CreatorClubX Modal Checkout — chrome del modal (página padre). */

.ccx-modal {
	--ccx-ease: cubic-bezier(0.16, 1, 0.3, 1);
	--ccx-bar-h: 44px;
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px 20px;
	box-sizing: border-box;
}

.ccx-modal[hidden] {
	display: none;
}

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

/* ---------- Fondo ---------- */

.ccx-modal__overlay {
	position: absolute;
	inset: 0;
	background: var(--ccx-overlay, rgba(10, 10, 10, 0.72));
	-webkit-backdrop-filter: blur(6px) saturate(120%);
	backdrop-filter: blur(6px) saturate(120%);
	opacity: 0;
	transition: opacity 260ms ease;
}

.ccx-modal.is-open .ccx-modal__overlay {
	opacity: 1;
}

/* ---------- Panel ---------- */

.ccx-modal__panel {
	position: relative;
	width: 100%;
	max-width: var(--ccx-max-width, 560px);
	max-height: calc(100dvh - 64px);
	background: var(--ccx-panel-bg, #fff);
	border-radius: var(--ccx-radius, 14px);
	box-shadow:
		0 32px 64px -16px rgba(0, 0, 0, 0.5),
		0 0 0 1px rgba(0, 0, 0, 0.05);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	opacity: 0;
	/* Sube desde abajo, también en escritorio. */
	transform: translate3d(0, 72px, 0) scale(0.985);
	transition:
		opacity 220ms ease,
		transform 460ms var(--ccx-ease);
	will-change: transform;
}

.ccx-modal.is-open .ccx-modal__panel {
	opacity: 1;
	transform: translate3d(0, 0, 0) scale(1);
}

/* Mientras se arrastra mandan los estilos inline, sin transición. */
.ccx-modal.is-dragging .ccx-modal__panel,
.ccx-modal.is-dragging .ccx-modal__overlay {
	transition: none;
}

/* ---------- Barra superior ---------- */

.ccx-modal__bar {
	position: relative;
	z-index: 2;
	flex: 0 0 auto;
	height: var(--ccx-bar-h);
	display: flex;
	align-items: center;
	justify-content: flex-end;
	padding: 0 8px 0 16px;
	background: var(--ccx-panel-bg, #fff);
	border-bottom: 1px solid transparent;
	transition: border-color 200ms ease, box-shadow 200ms ease;
}

/* El separador solo aparece cuando hay contenido arriba, fuera de vista. */
.ccx-modal__bar.is-scrolled {
	border-bottom-color: rgba(0, 0, 0, 0.07);
	box-shadow: 0 6px 16px -12px rgba(0, 0, 0, 0.5);
}

.ccx-modal__grabber {
	display: none;
	position: absolute;
	top: 9px;
	left: 50%;
	width: 38px;
	height: 4px;
	margin-left: -19px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.16);
	transition: background 160ms ease, width 200ms var(--ccx-ease);
}

.ccx-modal__close {
	width: 30px;
	height: 30px;
	display: grid;
	place-items: center;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: rgba(0, 0, 0, 0.45);
	cursor: pointer;
	transition: background 160ms ease, color 160ms ease, transform 160ms var(--ccx-ease);
	-webkit-tap-highlight-color: transparent;
}

.ccx-modal__close:hover {
	background: rgba(0, 0, 0, 0.06);
	color: rgba(0, 0, 0, 0.8);
}

.ccx-modal__close:active {
	transform: scale(0.92);
}

.ccx-modal__close:focus-visible {
	outline: 2px solid var(--ccx-accent, #6e51ff);
	outline-offset: 2px;
	color: rgba(0, 0, 0, 0.8);
}

.ccx-modal__close svg {
	width: 16px;
	height: 16px;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
	fill: none;
}

/* ---------- Cuerpo ---------- */

.ccx-modal__body {
	position: relative;
	flex: 1 1 auto;
	min-height: 260px;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	/* Sin barra de scroll, pero se sigue pudiendo desplazar. */
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.ccx-modal__body::-webkit-scrollbar {
	width: 0;
	height: 0;
	display: none;
}

.ccx-modal__body.is-measured {
	transition: max-height 280ms var(--ccx-ease);
}

.ccx-modal__frame {
	display: block;
	width: 100%;
	border: 0;
	min-height: 260px;
	opacity: 0;
	transition: opacity 260ms ease;
}

.ccx-modal__frame.is-measured {
	transition: opacity 260ms ease, height 280ms var(--ccx-ease);
}

.ccx-modal__frame.is-visible {
	opacity: 1;
}

/* ---------- Carga: esqueleto del formulario ---------- */

.ccx-modal__loader {
	position: absolute;
	inset: 0;
	background: var(--ccx-panel-bg, #fff);
	opacity: 1;
	transition: opacity 240ms ease;
}

.ccx-modal__loader.is-gone {
	opacity: 0;
	pointer-events: none;
}

.ccx-modal__loader[hidden] {
	display: none;
}

.ccx-modal__skeleton {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 26px 24px;
}

.ccx-sk-row {
	display: flex;
	gap: 12px;
}

.ccx-sk-row .ccx-sk {
	flex: 1;
}

.ccx-sk {
	display: block;
	border-radius: 7px;
	background-color: rgba(0, 0, 0, 0.055);
	background-image: linear-gradient(
		100deg,
		transparent 20%,
		color-mix(in srgb, var(--ccx-accent, #6e51ff) 9%, transparent) 45%,
		transparent 70%
	);
	background-size: 220% 100%;
	background-repeat: no-repeat;
	animation: ccx-shimmer 1500ms ease-in-out infinite;
}

.ccx-sk--title  { height: 20px; width: 45%; border-radius: 6px; }
.ccx-sk--line   { height: 12px; width: 68%; border-radius: 6px; margin-bottom: 10px; }
.ccx-sk--field  { height: 44px; }
.ccx-sk--button { height: 48px; border-radius: 9px; margin-top: 8px; }

/* Escalona el brillo para que recorra el formulario de arriba abajo. */
.ccx-sk--line       { animation-delay: 80ms; }
.ccx-sk--field      { animation-delay: 160ms; }
.ccx-sk-row .ccx-sk { animation-delay: 240ms; }
.ccx-sk--button     { animation-delay: 320ms; }

@keyframes ccx-shimmer {
	0%   { background-position: 180% 0; }
	100% { background-position: -60% 0; }
}

/* Texto solo para lectores de pantalla. */
.ccx-modal__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ---------- Bloqueo de scroll del padre ---------- */

html.ccx-modal-open,
body.ccx-modal-open {
	overflow: hidden !important;
}

/* ---------- Móvil: hoja inferior ---------- */

@media (max-width: 640px) {
	.ccx-modal {
		--ccx-bar-h: 40px;
		padding: 0;
		align-items: flex-end;
	}

	.ccx-modal__panel {
		max-width: none;
		max-height: 92dvh;
		border-radius: var(--ccx-radius, 14px) var(--ccx-radius, 14px) 0 0;
		transform: translate3d(0, 100%, 0);
	}

	.ccx-modal__bar {
		padding: 0 6px 0 12px;
		touch-action: none;
		cursor: grab;
	}

	.ccx-modal.is-dragging .ccx-modal__bar {
		cursor: grabbing;
	}

	.ccx-modal.is-dragging .ccx-modal__grabber {
		width: 46px;
		background: rgba(0, 0, 0, 0.28);
	}

	.ccx-modal__grabber {
		display: block;
	}
}

/* ---------- Accesibilidad ---------- */

@media (prefers-reduced-motion: reduce) {
	.ccx-modal__overlay,
	.ccx-modal__panel,
	.ccx-modal__frame,
	.ccx-modal__body,
	.ccx-modal__loader {
		transition-duration: 1ms;
	}

	.ccx-modal__panel {
		transform: none;
	}

	.ccx-sk {
		animation: none;
	}
}
