/**
 * Component — public entry list (20 Nov 2026, DEV batch Item 7)
 *
 * Markup: assets/js/components/entry-list.js (Competition Page "Entry list", Draw Centre Check your ticket).
 * A compact, scrollable grid of ticket chips — ticket number over a privacy-safe holder name — one page at a time.
 */

.ec-competition-entries {
	display: grid;
	gap: var(--ec-space-4);
	border-top: 1px solid var(--ec-color-border);
	scroll-margin-top: calc(var(--ec-header-height, 4rem) + var(--ec-space-4));
}

.ec-competition-entries__head .ec-competition-tail__title {
	margin-bottom: var(--ec-space-1);
}

.ec-competition-entries__lede {
	margin: 0;
	max-width: 48rem;
	color: var(--ec-color-text-secondary);
	font-size: var(--ec-font-size-body-sm);
}

.ec-entry-list {
	display: grid;
	gap: var(--ec-space-3);
	min-width: 0;
	padding: var(--ec-space-4);
	border-radius: var(--ec-radius-lg);
	/* 21 Nov 2026 (refinement): a little more presence — a faint teal wash from the top edge, a lit hairline and a soft halo;
	   deliberately quieter than the active download button. */
	background:
		radial-gradient(120% 70% at 50% -20%, rgba(44, 213, 227, 0.09), transparent 60%),
		var(--ec-color-surface);
	box-shadow:
		inset 0 0 0 1px rgba(124, 236, 243, 0.13),
		inset 0 1px 0 rgba(124, 236, 243, 0.16),
		0 0 0 1px rgba(2, 8, 18, 0.45),
		0 18px 40px -22px rgba(0, 0, 0, 0.75),
		0 0 34px -10px rgba(44, 213, 227, 0.16);
}

.ec-entry-list__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--ec-space-3) var(--ec-space-5);
}

.ec-entry-list__intro {
	display: grid;
	gap: 0.2rem;
	min-width: 0;
}

.ec-entry-list__count {
	margin: 0;
	color: var(--ec-color-text-primary);
	font-variant-numeric: tabular-nums;
}

.ec-entry-list__count strong {
	font-size: var(--ec-font-size-body-lg);
}

.ec-entry-list__count span {
	color: var(--ec-color-text-secondary);
}

.ec-entry-list__note {
	margin: 0;
	color: var(--ec-color-text-tertiary);
	font-size: var(--ec-font-size-caption);
}

.ec-entry-list__tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ec-space-2) var(--ec-space-3);
}

/* Final entry list download (21 Nov 2026; refined the same day). One component in two states, exactly the search
   field's height (3.125rem = 50 px; the field itself is unchanged) and one fixed width, so the row stays level.
   Locked: muted, padlock, a disabled button with no link — until the draw is complete and the result published.
   Ready: the same shape, lit — an icon coin, a teal-edged glass face and a soft glow. */
.ec-entry-list__search {
	width: 22rem; /* a definite width (a % here counts as auto when the toolbar is sized): the input otherwise fell back to its intrinsic ~13rem */
	max-width: 100%;
}

.ec-entry-list__dl-btn {
	--el-dl-edge: linear-gradient(135deg, rgba(124, 236, 243, 0.85), rgba(124, 236, 243, 0.18) 45%, rgba(124, 236, 243, 0.5));
	display: inline-flex;
	align-items: center;
	gap: 0.65rem;
	box-sizing: border-box;
	width: 15.5rem;
	max-width: 100%;
	height: 3.125rem;
	padding: 0 0.95rem 0 0.4rem;
	border: 1px solid transparent;
	border-radius: 0.5rem;
	background:
		linear-gradient(180deg, rgba(124, 236, 243, 0.1), rgba(124, 236, 243, 0.02)) padding-box,
		linear-gradient(var(--ec-color-surface-elevated), var(--ec-color-surface-elevated)) padding-box,
		var(--el-dl-edge) border-box;
	color: var(--ec-color-text-primary);
	font: inherit;
	text-align: left;
	text-decoration: none;
	white-space: nowrap;
}

.ec-entry-list__dl-coin {
	display: grid;
	flex: 0 0 auto;
	place-items: center;
	width: 2.125rem;
	height: 2.125rem;
	border-radius: 0.375rem;
	background: radial-gradient(120% 120% at 30% 20%, #9ff4fa, var(--ec-color-energy-300, #67e6f0) 45%, #1fb5c6);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 12px -4px rgba(44, 213, 227, 0.7);
	color: #04131f;
}

.ec-entry-list__dl-icon {
	display: block;
}

.ec-entry-list__dl-text {
	display: grid;
	min-width: 0;
	line-height: 1.2;
}

.ec-entry-list__dl-label {
	overflow: hidden;
	font-size: var(--ec-font-size-body-sm);
	font-weight: var(--ec-font-weight-bold);
	letter-spacing: 0.01em;
	text-overflow: ellipsis;
}

.ec-entry-list__dl-sub {
	overflow: hidden;
	color: var(--ec-color-accent-strong);
	font-size: 0.6875rem;
	font-weight: var(--ec-font-weight-semibold, 600);
	letter-spacing: 0.06em;
	text-overflow: ellipsis;
	text-transform: uppercase;
}

.ec-entry-list__dl-btn--ready {
	box-shadow: 0 0 22px -8px rgba(44, 213, 227, 0.55);
	cursor: pointer;
	transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.ec-entry-list__dl-btn--ready:hover {
	box-shadow: 0 0 26px -6px rgba(44, 213, 227, 0.75);
	transform: translateY(-1px);
}

.ec-entry-list__dl-btn--ready:focus-visible {
	outline: none;
	box-shadow: var(--ec-focus-ring), 0 0 22px -8px rgba(44, 213, 227, 0.55);
}

.ec-entry-list__dl-btn--locked {
	--el-dl-edge: linear-gradient(135deg, rgba(150, 192, 228, 0.3), rgba(150, 192, 228, 0.1));
	background:
		linear-gradient(var(--ec-color-surface-elevated), var(--ec-color-surface-elevated)) padding-box,
		var(--el-dl-edge) border-box;
	color: var(--ec-color-text-secondary);
	cursor: not-allowed;
}

.ec-entry-list__dl-btn--locked .ec-entry-list__dl-coin {
	background: rgba(150, 192, 228, 0.1);
	box-shadow: inset 0 0 0 1px rgba(150, 192, 228, 0.16);
	color: var(--ec-color-text-tertiary);
}

.ec-entry-list__dl-btn--locked .ec-entry-list__dl-sub {
	color: var(--ec-color-text-tertiary);
}

.ec-entry-list__search .ec-input {
	width: 100%; /* of the 22rem label — the whole "Search ticket number or name" placeholder fits (17rem clipped it) */
	min-height: 2.5rem;
}

.ec-entry-list__panel {
	max-height: 26rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-radius: var(--ec-radius-md);
	background-color: rgba(4, 12, 24, 0.42);
	box-shadow: inset 0 0 0 1px rgba(124, 236, 243, 0.07), inset 0 10px 24px -18px rgba(44, 213, 227, 0.35);
	scrollbar-color: rgba(150, 192, 228, 0.35) transparent;
}

.ec-entry-list__panel:focus-visible {
	outline: none;
	box-shadow: var(--ec-focus-ring);
}

.ec-entry-list__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
	gap: 0.45rem;
	margin: 0;
	padding: var(--ec-space-3);
	list-style: none;
}

/* 21 Nov 2026 (refinement): ticket-shaped tiles — smaller, with notched sides and a perforation between the number and the
   holder. The notches are a mask, so the outline is an inset shadow (a border would be cut at the notch). */
.ec-entry-list__item {
	--el-notch: 0.34rem;
	position: relative;
	display: grid;
	grid-template-rows: 1fr 1fr;
	align-items: center;
	min-width: 0;
	height: 2.875rem;
	padding: 0 0.6rem;
	background: linear-gradient(180deg, rgba(124, 236, 243, 0.05), transparent 55%), var(--ec-color-surface-elevated);
	box-shadow: inset 0 0 0 1px rgba(150, 192, 228, 0.14);
	border-radius: 0.375rem;
	-webkit-mask: radial-gradient(circle at 0 50%, transparent var(--el-notch), #000 calc(var(--el-notch) + 0.5px)) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent var(--el-notch), #000 calc(var(--el-notch) + 0.5px)) right / 51% 100% no-repeat;
	mask: radial-gradient(circle at 0 50%, transparent var(--el-notch), #000 calc(var(--el-notch) + 0.5px)) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent var(--el-notch), #000 calc(var(--el-notch) + 0.5px)) right / 51% 100% no-repeat;
}

.ec-entry-list__item::before {
	content: '';
	position: absolute;
	top: 50%;
	right: calc(var(--el-notch) + 0.2rem);
	left: calc(var(--el-notch) + 0.2rem);
	border-top: 1px dashed rgba(150, 192, 228, 0.2);
}

.ec-entry-list__ticket {
	align-self: end;
	padding-bottom: 0.15rem;
	color: var(--ec-color-accent-strong);
	font-size: 0.8125rem;
	font-weight: var(--ec-font-weight-bold);
	line-height: 1;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
}

.ec-entry-list__name {
	align-self: start;
	overflow: hidden;
	padding-top: 0.2rem;
	color: var(--ec-color-text-secondary);
	font-size: 0.6875rem;
	line-height: 1.1;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ec-entry-list__item--winner {
	background: linear-gradient(160deg, rgba(44, 213, 227, 0.3), rgba(44, 213, 227, 0.08)), var(--ec-color-surface-elevated);
	box-shadow: inset 0 0 0 1px rgba(124, 236, 243, 0.75), inset 0 0 14px rgba(44, 213, 227, 0.25);
}

.ec-entry-list__item--winner::before {
	border-top-color: rgba(124, 236, 243, 0.45);
}

.ec-entry-list__item--winner .ec-entry-list__name {
	color: var(--ec-color-text-primary);
	font-weight: var(--ec-font-weight-semibold);
}

.ec-entry-list__item--void {
	opacity: 0.6;
}

.ec-entry-list__item--void .ec-entry-list__ticket {
	color: var(--ec-color-text-tertiary);
	text-decoration: line-through;
}

/* The flag sits in the stub's top half, beside the number, so every tile keeps the same height. */
.ec-entry-list__flag {
	position: absolute;
	top: 0.3rem;
	right: 0.45rem;
	display: grid;
	place-items: center;
	width: 0.95rem;
	height: 0.95rem;
	border-radius: 50%;
	background: radial-gradient(120% 120% at 30% 20%, #9ff4fa, #2cd5e3 60%);
	box-shadow: 0 0 8px rgba(44, 213, 227, 0.6);
	color: #04131f;
	font-size: 0.55rem;
	line-height: 1;
}

.ec-entry-list__flag--void {
	background-color: rgba(150, 192, 228, 0.2);
	color: var(--ec-color-text-secondary);
}

.ec-entry-list__empty {
	margin: 0;
	padding: var(--ec-space-5) var(--ec-space-3);
	color: var(--ec-color-text-secondary);
	text-align: center;
}

.ec-entry-list__pager {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ec-space-3);
}

.ec-entry-list__page {
	color: var(--ec-color-text-tertiary);
	font-size: var(--ec-font-size-body-sm);
	font-variant-numeric: tabular-nums;
}

.ec-entry-list[aria-busy='true'] .ec-entry-list__grid {
	opacity: 0.6;
}

/* Draw Centre: beneath the checker, inside its card. */
.ec-dc-check__entries {
	display: grid;
	gap: var(--ec-space-2);
	margin-top: var(--ec-space-5);
	padding-top: var(--ec-space-4);
	border-top: 1px solid var(--ec-dc-panel-border, var(--ec-color-border));
}

.ec-dc-check__entries-title {
	margin: 0;
	color: var(--ec-color-text-primary);
	font-size: var(--ec-font-size-body-lg);
	font-weight: var(--ec-font-weight-bold);
}

.ec-dc-check__entries .ec-entry-list {
	padding: 0;
	box-shadow: none;
	background: none;
}

@media (max-width: 639px) {
	.ec-entry-list {
		padding: var(--ec-space-3);
	}

	.ec-entry-list__tools,
	.ec-entry-list__search,
	.ec-entry-list__search .ec-input {
		width: 100%;
	}

	.ec-entry-list__dl,
	.ec-entry-list__dl-btn {
		width: 100%;
		max-width: none;
	}

	.ec-entry-list__grid {
		grid-template-columns: repeat(auto-fill, minmax(5.9rem, 1fr));
		padding: var(--ec-space-2);
	}

	.ec-entry-list__panel {
		max-height: 22rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ec-entry-list[aria-busy='true'] .ec-entry-list__grid {
		opacity: 1;
	}

	.ec-entry-list__dl-btn--ready,
	.ec-entry-list__dl-btn--ready:hover {
		transform: none;
		transition: none;
	}
}
