/* FP Tablas CSV — estilos del frontend.
   Personaliza los colores sobrescribiendo estas variables en tu CSS adicional:
   .fpt-wrap { --fpt-accent: #0b5cab; } */

.fpt-wrap {
	--fpt-accent: #0b5cab;
	--fpt-accent-text: #ffffff;
	--fpt-border: #d9dde3;
	--fpt-stripe: #f5f7fa;
	--fpt-hover: #e9f1fb;
	--fpt-text: inherit;
	margin: 1.5em 0;
	color: var(--fpt-text);
	font-size: 0.95em;
}

.fpt-wrap *,
.fpt-wrap *::before,
.fpt-wrap *::after {
	box-sizing: border-box;
}

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

.fpt-controls,
.fpt-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75em 1.25em;
	margin: 0.75em 0;
}

.fpt-controls label {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
}

.fpt-controls input[type="search"],
.fpt-controls select {
	min-height: 2.4em;
	padding: 0.3em 0.6em;
	border: 1px solid var(--fpt-border);
	border-radius: 4px;
	background: #fff;
	font: inherit;
	color: inherit;
}

.fpt-controls input[type="search"] {
	min-width: 220px;
}

.fpt-controls input:focus,
.fpt-controls select:focus,
.fpt-btn:focus-visible,
.fpt-table th:focus-visible {
	outline: 2px solid var(--fpt-accent);
	outline-offset: 1px;
}

.fpt-scroll {
	width: 100%;
	overflow-x: auto;
	border: 1px solid var(--fpt-border);
	border-radius: 4px;
}

.fpt-table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	border: 0;
}

.fpt-table th,
.fpt-table td {
	padding: 0.65em 0.85em;
	text-align: left;
	vertical-align: top;
	border: 0;
	border-bottom: 1px solid var(--fpt-border);
	overflow-wrap: break-word;
	word-break: normal;
}

.fpt-table thead th {
	background: var(--fpt-accent);
	color: var(--fpt-accent-text);
	font-weight: 600;
	white-space: nowrap;
}

.fpt-table tbody tr:nth-child(even) {
	background: var(--fpt-stripe);
}

.fpt-table tbody tr:hover {
	background: var(--fpt-hover);
}

.fpt-table tbody tr:last-child td {
	border-bottom: 0;
}

.fpt-table td a {
	color: var(--fpt-accent);
	text-decoration: underline;
}

.fpt-sortable {
	cursor: pointer;
	user-select: none;
	position: relative;
	padding-right: 1.8em !important;
}

.fpt-sortable::after {
	content: "\2195";
	position: absolute;
	right: 0.6em;
	opacity: 0.45;
	font-size: 0.85em;
}

.fpt-sortable[aria-sort="ascending"]::after {
	content: "\25B2";
	opacity: 1;
}

.fpt-sortable[aria-sort="descending"]::after {
	content: "\25BC";
	opacity: 1;
}

.fpt-empty td {
	text-align: center;
	padding: 1.5em;
	color: #666;
}

.fpt-pager {
	display: inline-flex;
	align-items: center;
	gap: 0.75em;
}

.fpt-btn {
	padding: 0.4em 0.9em;
	border: 1px solid var(--fpt-accent);
	border-radius: 4px;
	background: var(--fpt-accent);
	color: var(--fpt-accent-text);
	font: inherit;
	cursor: pointer;
}

.fpt-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.fpt-download {
	margin: 0.75em 0 0;
	text-align: right;
}

.fpt-download a {
	color: var(--fpt-accent);
	text-decoration: underline;
}

.fpt-aviso {
	padding: 0.75em 1em;
	border-left: 4px solid #d63638;
	background: #fcf0f1;
}

@media (max-width: 600px) {
	.fpt-controls,
	.fpt-footer {
		flex-direction: column;
		align-items: stretch;
	}
	.fpt-controls input[type="search"] {
		min-width: 0;
		width: 100%;
	}
	.fpt-controls label {
		justify-content: space-between;
	}
	.fpt-pager {
		justify-content: space-between;
	}
}

/* Celulares y tablets chicas: cada fila se muestra como tarjeta. */
@media (max-width: 768px) {
	.fpt-mode-cards .fpt-scroll {
		overflow-x: visible;
		border: 0;
	}

	.fpt-mode-cards .fpt-table,
	.fpt-mode-cards .fpt-table tbody,
	.fpt-mode-cards .fpt-table tr,
	.fpt-mode-cards .fpt-table td {
		display: block;
		width: 100%;
	}

	/* El encabezado se oculta visualmente pero sigue disponible para lectores de pantalla. */
	.fpt-mode-cards .fpt-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
	}

	.fpt-mode-cards .fpt-table tbody tr {
		margin: 0 0 1em;
		border: 1px solid var(--fpt-border);
		border-left: 4px solid var(--fpt-accent);
		border-radius: 4px;
		background: #fff;
		overflow: hidden;
	}

	.fpt-mode-cards .fpt-table tbody tr:nth-child(even) {
		background: #fff;
	}

	.fpt-mode-cards .fpt-table td {
		display: grid;
		grid-template-columns: minmax(90px, 38%) 1fr;
		gap: 0.75em;
		padding: 0.55em 0.85em;
		border-bottom: 1px solid var(--fpt-stripe);
	}

	.fpt-mode-cards .fpt-table td::before {
		content: attr(data-label);
		font-weight: 600;
		color: var(--fpt-accent);
	}

	.fpt-mode-cards .fpt-table td:empty {
		display: none;
	}

	.fpt-mode-cards .fpt-empty {
		border: 0;
	}

	.fpt-mode-cards .fpt-empty td {
		display: block;
	}

	.fpt-mode-cards .fpt-empty td::before {
		content: none;
	}

	/* Sin cabecera visible, el orden por columna se ofrece como lista desplegable. */
	.fpt-wrap.fpt-mode-cards .fpt-controls .fpt-sort-select {
		display: inline-flex;
	}
}

.fpt-wrap .fpt-controls .fpt-sort-select {
	display: none;
	align-items: center;
	gap: 0.5em;
}

.fpt-sort-select select {
	min-height: 2.4em;
	padding: 0.3em 0.6em;
	border: 1px solid var(--fpt-border);
	border-radius: 4px;
	background: #fff;
	font: inherit;
	color: inherit;
}

@media print {
	.fpt-controls,
	.fpt-footer,
	.fpt-download {
		display: none;
	}
}
