/**
 * Carrusel de errores de facturación — HiKapto.
 */

 .hikapto-errors-carousel-section {
	background: #ffffff;
	padding: 4rem 5% 0;
	border-top: 1px solid #e5e7eb;
}

.hikapto-errors-carousel-section .hikapto-lott-legal {
	border-top: 1px solid #e5e7eb;
	margin-top: 0;
	padding-top: clamp(3rem, 6vw, 5rem);
	padding-bottom: clamp(3rem, 6vw, 5rem);
}

.hikapto-errors-carousel-hint {
	font-size: 0.9375rem;
	font-weight: 600;
	color: #008bff;
	margin: 0.75rem auto 0;
	max-width: 40rem;
	text-align: center;
}

.hikapto-errors-carousel-hint--desktop {
	display: block;
}

.billing-errors-carousel {
	position: relative;
}

/* —— Desktop: carrusel horizontal —— */
@media (min-width: 768px) {
	
	/* Hacemos el contenedor del carrusel más ancho que el resto del contenido */
	.billing-errors-carousel {
		position: relative;
		overflow: hidden;
		
		/* Truco: Expandimos el carrusel hacia los extremos de la pantalla */
		margin-left: -4%;
		margin-right: -4%;
		
		/* El desvanecido ahora ocurre más afuera, lejos de las tarjetas */
		-webkit-mask-image: linear-gradient(
			to right,
			transparent 0px,
			#000000 40px,
			#000000 calc(100% - 40px),
			transparent 100%
		);
		mask-image: linear-gradient(
			to right,
			transparent 0px,
			#000000 40px,
			#000000 calc(100% - 40px),
			transparent 100%
		);
		
		transform: translateZ(0);
		will-change: mask-image, -webkit-mask-image;
	}

	.billing-errors-carousel__track {
		display: flex;
		gap: 24px;
		overflow-x: auto;
		overflow-y: visible;
		scroll-snap-type: x proximity;
		
		/* Compensamos la expansión con padding para que las tarjetas mantengan su alineación visual original */
		padding: 20px 5%;
		
		cursor: grab;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		-ms-overflow-style: none;
		align-items: flex-start;
		scroll-behavior: auto;
	}

	.billing-errors-carousel__track::-webkit-scrollbar {
		display: none;
	}

	.billing-errors-carousel__track.is-dragging {
		cursor: grabbing;
		user-select: none;
		scroll-snap-type: none;
	}

	.category-card {
		flex-shrink: 0;
		width: var(--card-width, 320px);
		scroll-snap-align: start;
		background: #ffffff;
		border: 1px solid #e5e7eb;
		border-radius: 12px;
		box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
		align-self: flex-start;
		transition:
			width 0.45s cubic-bezier(0.33, 1, 0.68, 1),
			box-shadow 0.3s ease,
			border-color 0.3s ease;
	}

	.category-card.is-open {
		box-shadow: 0 12px 32px rgba(0, 139, 255, 0.12);
		border-color: rgba(0, 139, 255, 0.35);
	}

	.category-card__details[open] {
		box-shadow: none;
	}
}

/* —— Tarjeta y acordeón (todas las vistas) —— */
.category-card__summary {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 1.125rem 1.25rem;
	cursor: pointer;
	list-style: none;
	font-weight: 700;
	color: #111827;
}

.category-card__summary::-webkit-details-marker {
	display: none;
}

.category-card__summary::marker {
	display: none;
	content: '';
}

.category-card__summary-text {
	flex: 1;
	font-size: 0.95rem;
	line-height: 1.35;
	text-align: left;
}

.category-card__chevron {
	flex-shrink: 0;
	width: 0.55rem;
	height: 0.55rem;
	margin-top: 0.4rem;
	border-right: 2px solid #008bff;
	border-bottom: 2px solid #008bff;
	transform: rotate(45deg);
	transition: transform 0.35s cubic-bezier(0.33, 1, 0.68, 1);
}

.category-card__details[open] .category-card__chevron {
	transform: rotate(-135deg);
	margin-top: 0.55rem;
}

/* Despliegue suave del panel (altura + opacidad, controlado por JS) */
.category-card__panel {
	height: 0;
	overflow: hidden;
	opacity: 0;
	border-top: 1px solid transparent;
	padding: 0 1rem;
	transition:
		height 0.55s cubic-bezier(0.33, 1, 0.68, 1),
		opacity 0.45s cubic-bezier(0.33, 1, 0.68, 1),
		padding 0.55s cubic-bezier(0.33, 1, 0.68, 1),
		border-color 0.35s ease;
	will-change: height, opacity;
}

.category-card__details[open] .category-card__panel {
	border-top-color: #e5e7eb;
}

.category-card__details[open]:not(.is-animating) .category-card__panel {
	height: auto;
	opacity: 1;
	overflow: visible;
	padding-bottom: 1rem;
}

.category-card__panel > .hikapto-errors-table-wrap {
	margin-top: 0;
	transform: translateY(-6px);
	transition: transform 0.5s cubic-bezier(0.33, 1, 0.68, 1);
}

.category-card__details[open] .category-card__panel > .hikapto-errors-table-wrap,
.category-card__details.is-opening .category-card__panel > .hikapto-errors-table-wrap {
	transform: translateY(0);
}

/* Sin scroll interno: tabla a ancho natural */
.hikapto-errors-carousel-section .category-card__panel .hikapto-errors-table-wrap {
	overflow: visible !important;
	max-height: none !important;
	-webkit-overflow-scrolling: auto;
}

.hikapto-errors-carousel-section .category-card__details[open] .category-card__panel > .hikapto-errors-table-wrap {
	overflow: visible !important;
}

.hikapto-errors-carousel-section .category-card__panel .hikapto-errors-table {
	width: max-content;
	max-width: none;
	font-size: 0.8125rem;
	table-layout: auto;
}

.hikapto-errors-carousel-section .category-card__panel .hikapto-errors-table thead th {
	font-size: 0.75rem;
	padding: 0.65rem 0.75rem;
	background: linear-gradient(180deg, #f3f4f6 0%, #e8f4ff 100%);
	white-space: nowrap;
}

.hikapto-errors-carousel-section .category-card__panel .hikapto-errors-table tbody td {
	padding: 0.65rem 0.75rem;
	white-space: normal;
	word-break: break-word;
	vertical-align: top;
}

.hikapto-errors-carousel-section .category-card__panel .hikapto-errors-table tbody td:first-child {
	min-width: 11rem;
	max-width: 14rem;
}

.hikapto-errors-carousel-section .category-card__panel .hikapto-errors-table tbody td:nth-child(2) {
	min-width: 18rem;
	max-width: 28rem;
}

.hikapto-errors-carousel-section .category-card__panel .hikapto-errors-table tbody td:nth-child(3) {
	min-width: 16rem;
	max-width: 26rem;
}

/* —— Mobile: lista vertical, sin carrusel —— */
@media (max-width: 767px) {
	.hikapto-errors-carousel-section {
		padding: 3rem 1.25rem;
	}

	.hikapto-errors-carousel-hint--desktop {
		display: none;
	}

	.billing-errors-carousel__track {
		display: flex;
		flex-direction: column;
		width: 100%;
		gap: 16px;
		overflow-x: visible;
		overflow-y: visible;
		scroll-snap-type: none;
		padding: 0;
		cursor: default;
	}

	.category-card {
		width: 100%;
		flex-shrink: 1;
		scroll-snap-align: none;
		background: #ffffff;
		border: 1px solid #e5e7eb;
		border-radius: 12px;
		box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
	}

	.category-card__panel .hikapto-errors-table-wrap {
		opacity: 1;
	}

	.hikapto-errors-carousel-section .category-card__panel .hikapto-errors-table {
		width: 100%;
	}

	.category-card__panel .hikapto-errors-table thead {
		display: none;
	}

	.category-card__panel .hikapto-errors-table tbody tr {
		display: block;
		margin-bottom: 0.75rem;
		border: 1px solid #e5e7eb;
		border-radius: 8px;
	}

	.category-card__panel .hikapto-errors-table tbody td {
		display: block;
		padding: 0.65rem 0.875rem;
		border-bottom: 1px solid #f3f4f6;
		max-width: none;
	}

	.category-card__panel .hikapto-errors-table tbody td::before {
		content: attr(data-label);
		display: block;
		font-size: 0.7rem;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		color: #008bff;
		margin-bottom: 0.35rem;
	}
}
