/* =============================================================================
 * UBICACIÓN:		/assets/css/pages/02-directory-members.css
 * ARCHIVO:		02-directory-members.css
 * DESCRIPCIÓN TÉCNICA:	Base visual compartida de directorios:
 *			/members, /clubs, /teams, /groups.
 *			Incluye cabecera, filtros, grid, tarjetas, estado vacío,
 *			paginación y utilidades específicas de layout para evitar
 *			estilos inline en las vistas.
 *			Añade chips visuales para resumir filtros activos y
 *			micro-mejoras premium de interacción y accesibilidad.
 *			Incluye soporte para pills semánticas y metadatos más ricos.
 *			Corrección UX F12:
 *			- más aire visual en cabecera y filtros
 *			- cards más equilibradas en desktop
 *			- mejor ritmo visual de paginación y chips
 *			- se mantiene apariencia nativa de select y flecha del navegador
 * DESCRIPCIÓN FÁCIL:	Estilos principales de los directorios de MercaFut,
 *			ajustados para verse más limpios, cómodos y premium
 *			sin romper el diseño base ni el comportamiento actual.
 * =============================================================================
 * ÍNDICE
 * 1. Page header
 * 2. Filter bar
 * 3. Active filters chips
 * 4. Grid
 * 5. Card premium
 * 6. Semantic pills
 * 7. Empty state
 * 8. Pagination
 * 9. Utilities directory
 * 10. Responsive
 * 11. Motion accessibility
 * ============================================================================= */

/* =============================================================================
 * 1. PAGE HEADER
 * ============================================================================= */

.page {
	padding: var(--space-4) 0 var(--space-5);
}

.page__head {
	margin-bottom: var(--space-4);
}

.page__title {
	font-size: clamp(var(--text-xl), 2.6vw, 2rem);
	line-height: 1.12;
	margin: 0;
	letter-spacing: -0.02em;
}

.page__subtitle {
	margin: var(--space-2) 0 0;
	color: var(--muted);
	font-size: var(--text-sm);
}

/* =============================================================================
 * 2. FILTER BAR (APP-LIKE)
 * ============================================================================= */

.filter-panel {
	margin-bottom: var(--space-4);
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
	background: var(--surface-1);
	box-shadow: var(--shadow-1);
	overflow: hidden;
}

.filter-panel__summary {
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-4);
	cursor: pointer;
	user-select: none;
	background: color-mix(in srgb, var(--surface-1) 86%, var(--surface-2) 14%);
}

.filter-panel__summary::-webkit-details-marker {
	display: none;
}

.filter-panel__title {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 800;
	line-height: 1.2;
}

.filter-panel__hint {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 28px;
	padding: 4px 10px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--brand) 10%, var(--surface-2) 90%);
	border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--border) 80%);
	font-size: var(--text-xs);
	font-weight: 700;
	color: var(--text);
	white-space: nowrap;
}

.filter-bar {
	background: var(--surface-1);
}

.filter-bar__row {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-3);
	padding: var(--space-4);
}

.filter-bar__field {
	min-width: 0;
}

.filter-bar__label {
	display: block;
	font-size: var(--text-xs);
	color: var(--muted);
	margin-bottom: var(--space-1);
	font-weight: 700;
}

.filter-bar__input,
.filter-bar__select {
	width: 100%;
	height: 46px;
	padding: 0 var(--space-3);
	border-radius: var(--radius-lg);
	border: 1px solid var(--border);
	background: var(--surface-2);
	color: var(--text);
	box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 24%, transparent 76%);
}

.filter-bar__input:focus,
.filter-bar__select:focus {
	outline: none;
	border-color: color-mix(in srgb, var(--brand) 42%, var(--border) 58%);
	box-shadow:
		0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent 86%),
		inset 0 1px 0 color-mix(in srgb, #fff 24%, transparent 76%);
}

.filter-bar__input::placeholder {
	color: color-mix(in srgb, var(--muted) 70%, transparent 30%);
}

/* ---------------------------------------------------------------------------
 * FIX QUIRÚRGICO DE VISIBILIDAD EN SELECTS NATIVOS
 * Mantiene la flecha original del navegador y fuerza texto visible
 * --------------------------------------------------------------------------- */

.filter-bar__select {
	color: var(--text) !important;
	-webkit-text-fill-color: var(--text) !important;
	opacity: 1;
}

.filter-bar__select option {
	color: #111827 !important;
	background-color: #ffffff !important;
	-webkit-text-fill-color: #111827 !important;
}

.filter-bar__select optgroup {
	color: #111827 !important;
	background-color: #ffffff !important;
	-webkit-text-fill-color: #111827 !important;
}

.filter-bar__select:disabled {
	color: var(--muted) !important;
	-webkit-text-fill-color: var(--muted) !important;
	opacity: 1;
}

.filter-bar__actions {
	display: flex;
	gap: var(--space-2);
	align-items: end;
	flex-wrap: wrap;
}

.filter-panel__hint-open {
	display: none;
}

.filter-panel[open] .filter-panel__hint-closed {
	display: none;
}

.filter-panel[open] .filter-panel__hint-open {
	display: inline;
}

/* =============================================================================
 * 3. ACTIVE FILTERS CHIPS
 * ============================================================================= */

.filter-bar__active {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	padding: 0 var(--space-4) var(--space-4);
	border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent 28%);
	background: color-mix(in srgb, var(--surface-1) 78%, var(--surface-2) 22%);
}

.filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 32px;
	padding: 5px 11px;
	border-radius: 999px;
	border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--border) 80%);
	background: color-mix(in srgb, var(--brand) 8%, var(--surface-2) 92%);
	color: var(--text);
	font-size: var(--text-xs);
	line-height: 1.2;
	white-space: nowrap;
}

.filter-chip strong {
	font-weight: 800;
}

.filter-chip--clear {
	text-decoration: none;
	background: var(--surface-1);
	border-color: var(--border);
	box-shadow: var(--shadow-1);
}

.filter-chip--clear:hover {
	background: color-mix(in srgb, var(--surface-1) 82%, var(--surface-2) 18%);
}

/* =============================================================================
 * 4. GRID
 * ============================================================================= */

.entity-grid {
	margin-top: var(--space-4);
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-3);
}

/* =============================================================================
 * 5. CARD (PREMIUM)
 * ============================================================================= */

.entity-card {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	min-height: 92px;
	padding: var(--space-3);
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
	box-shadow: var(--shadow-1);
	text-decoration: none;
	color: inherit;
	position: relative;
	overflow: hidden;
	isolation: isolate;
	-webkit-tap-highlight-color: transparent;
	transition:
		transform .16s ease,
		box-shadow .16s ease,
		border-color .16s ease,
		background-color .16s ease;
}

.entity-card::before {
	content: "";
	position: absolute;
	inset: -40% -40% auto auto;
	width: 220px;
	height: 220px;
	background: radial-gradient(
		circle,
		color-mix(in srgb, var(--brand) 22%, transparent 78%),
		transparent 65%
	);
	opacity: .55;
	pointer-events: none;
	transform: translate(20%, -10%);
	transition: opacity .16s ease, transform .16s ease;
}

.entity-card::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 18%, transparent 82%);
	opacity: .8;
}

.entity-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-2);
	border-color: color-mix(in srgb, var(--border) 52%, var(--brand) 48%);
	background: color-mix(in srgb, var(--surface-1) 92%, var(--surface-2) 8%);
}

.entity-card:hover::before {
	opacity: .72;
	transform: translate(14%, -8%);
}

.entity-card:active {
	transform: translateY(0);
}

.entity-card:focus-visible {
	outline: none;
	border-color: color-mix(in srgb, var(--brand) 68%, var(--border) 32%);
	box-shadow:
		0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent 82%),
		var(--shadow-2);
}

.entity-card__media {
	flex: 0 0 auto;
	position: relative;
	z-index: 1;
}

.entity-card__avatar,
.entity-card__avatar--placeholder {
	width: 56px;
	height: 56px;
	border-radius: 999px;
}

.entity-card__avatar {
	object-fit: cover;
	display: block;
	border: 2px solid color-mix(in srgb, var(--border) 70%, transparent 30%);
	background: var(--surface-2);
	box-shadow: 0 2px 10px color-mix(in srgb, #000 8%, transparent 92%);
}

.entity-card__avatar--placeholder {
	display: grid;
	place-items: center;
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--muted);
	box-shadow: 0 2px 10px color-mix(in srgb, #000 6%, transparent 94%);
}

.entity-card__body {
	min-width: 0;
	flex: 1 1 auto;
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.entity-card__title {
	font-weight: 800;
	font-size: var(--text-base);
	line-height: 1.22;
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.entity-card__meta {
	margin-top: 3px;
	color: var(--muted);
	font-size: var(--text-sm);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.entity-card__submeta {
	margin-top: var(--space-2);
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	max-width: 100%;
	padding: 4px 10px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--brand) 10%, var(--surface-2) 90%);
	border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--border) 82%);
	font-size: var(--text-xs);
	line-height: 1.2;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.entity-card__submeta img {
	flex: 0 0 auto;
	border-radius: 999px;
	background: #fff;
	object-fit: contain;
}

.entity-card__submeta--spaced {
	margin-top: 8px;
}

.entity-card__chev {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	display: grid;
	place-items: center;
	border-radius: 999px;
	color: var(--muted);
	background: color-mix(in srgb, var(--surface-2) 78%, transparent 22%);
	position: relative;
	z-index: 1;
	transition: transform .16s ease, color .16s ease, background-color .16s ease;
}

.entity-card:hover .entity-card__chev,
.entity-card:focus-visible .entity-card__chev {
	transform: translateX(2px);
	color: var(--text);
	background: color-mix(in srgb, var(--brand) 12%, var(--surface-2) 88%);
}

/* =============================================================================
 * 6. SEMANTIC PILLS
 * ============================================================================= */

.entity-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	max-width: 100%;
	margin-top: var(--space-2);
	padding: 4px 10px;
	border-radius: 999px;
	font-size: var(--text-xs);
	line-height: 1.2;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.entity-pill--member {
	background: color-mix(in srgb, var(--brand) 12%, var(--surface-2) 88%);
	border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--border) 76%);
}

.entity-pill--club {
	background: color-mix(in srgb, #198754 10%, var(--surface-2) 90%);
	border: 1px solid color-mix(in srgb, #198754 22%, var(--border) 78%);
}

.entity-pill--team {
	background: color-mix(in srgb, #0d6efd 10%, var(--surface-2) 90%);
	border: 1px solid color-mix(in srgb, #0d6efd 22%, var(--border) 78%);
}

.entity-pill--group {
	background: color-mix(in srgb, #6f42c1 10%, var(--surface-2) 90%);
	border: 1px solid color-mix(in srgb, #6f42c1 22%, var(--border) 78%);
}

/* =============================================================================
 * 7. EMPTY STATE
 * ============================================================================= */

.empty-state {
	margin-top: var(--space-4);
	padding: var(--space-5);
	border-radius: var(--radius-xl);
	border: 1px solid var(--border);
	background: var(--surface-1);
	box-shadow: var(--shadow-1);
	text-align: center;
}

.empty-state__icon {
	width: 44px;
	height: 44px;
	border-radius: 999px;
	display: grid;
	place-items: center;
	margin: 0 auto var(--space-3);
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--muted);
}

.empty-state__title {
	font-weight: 800;
}

.empty-state__text {
	margin-top: var(--space-2);
	color: var(--muted);
}

/* =============================================================================
 * 8. PAGINATION
 * ============================================================================= */

.pagination {
	margin: var(--space-5) 0 var(--space-2);
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--space-3);
}

.pagination__btn {
	text-decoration: none;
	border: 1px solid var(--border);
	background: var(--surface-1);
	border-radius: var(--radius-lg);
	padding: 10px 12px;
	color: inherit;
	box-shadow: var(--shadow-1);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	transition:
		transform .16s ease,
		background-color .16s ease,
		border-color .16s ease,
		box-shadow .16s ease;
}

.pagination__btn:hover {
	transform: translateY(-1px);
	background: color-mix(in srgb, var(--surface-1) 84%, var(--surface-2) 16%);
	box-shadow: var(--shadow-2);
}

.pagination__btn.is-disabled {
	opacity: .5;
	pointer-events: none;
}

.pagination__info {
	color: var(--muted);
	font-size: var(--text-sm);
	text-align: center;
}

/* =============================================================================
 * 9. UTILITIES DIRECTORY
 * ============================================================================= */

.directory-sentinel {
	height: 1px;
}

/* =============================================================================
 * 10. RESPONSIVE
 * ============================================================================= */

@media (max-width: 420px) {
	.pagination {
		justify-content: center;
		gap: var(--space-2);
	}

	.pagination__btn {
		padding: 10px;
		min-width: 40px;
		justify-content: center;
		gap: 0;
	}

	.pagination__label {
		display: none;
	}

	.pagination__info {
		white-space: nowrap;
	}

	.filter-bar__active {
		padding-left: var(--space-3);
		padding-right: var(--space-3);
	}

	.entity-card {
		min-height: 88px;
		padding: 12px;
	}

	.entity-card__chev {
		width: 24px;
		height: 24px;
	}
}

@media (min-width: 768px) {
	.page {
		padding-top: var(--space-5);
	}

	.filter-bar__row {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		align-items: end;
	}

	.entity-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--space-4);
	}
}

@media (min-width: 1100px) {
	.filter-bar__row {
		grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(150px, 1fr));
		gap: var(--space-3);
	}

	.entity-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* =============================================================================
 * 11. MOTION ACCESSIBILITY
 * ============================================================================= */

@media (prefers-reduced-motion: reduce) {
	.entity-card,
	.entity-card::before,
	.entity-card__chev,
	.pagination__btn {
		transition: none;
	}

	.entity-card:hover,
	.entity-card:active,
	.pagination__btn:hover {
		transform: none;
	}

	.entity-card:hover .entity-card__chev,
	.entity-card:focus-visible .entity-card__chev {
		transform: none;
	}
}