/* ── Grants Table Widget ────────────────────────────────────────── */

.gtw-wrap {
	width: 100%;
}

/* ── Filters ────────────────────────────────────────────────────── */

.gtw-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-bottom: 32px;
}

.gtw-filter-item {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.gtw-filter-label {
	font-size: 13px;
	font-weight: 600;
	color: #333;
}

.gtw-filter-select {
	appearance: none;
	-webkit-appearance: none;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	border: 1px solid #ccc;
	border-radius: 4px;
	color: #333;
	cursor: pointer;
	font-size: 14px;
	min-width: 180px;
	padding: 10px 36px 10px 14px;
	transition: border-color 0.15s ease;
}

.gtw-filter-select:focus {
	border-color: #3b82c4;
	outline: 2px solid rgba(59,130,196,0.25);
	outline-offset: 0;
}

/* ── Table wrapper (horizontal scroll on small screens) ─────────── */

.gtw-table-wrap {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ── Table ──────────────────────────────────────────────────────── */

.gtw-table {
	border-collapse: collapse;
	width: 100%;
	min-width: 600px;
}

.gtw-table thead tr {
	background-color: #eef4fb;
}

.gtw-table thead th {
	color: #3b82c4;
	font-size: 14px;
	font-weight: 600;
	padding: 14px 20px;
	text-align: left;
	white-space: nowrap;
}

.gtw-table tbody tr {
	border-bottom: 1px solid #e5e7eb;
	transition: background-color 0.12s ease;
}

.gtw-table tbody tr:last-child {
	border-bottom: none;
}

.gtw-table tbody tr:hover {
	background-color: #f7fafd;
}

.gtw-table tbody td {
	color: #1a1a1a;
	font-size: 14px;
	padding: 18px 20px;
	vertical-align: top;
}

.gtw-table a {
	color: #3b82c4;
	text-decoration: none;
	word-break: break-word;
}

.gtw-table a:hover {
	text-decoration: underline;
}

/* ── No results ─────────────────────────────────────────────────── */

.gtw-no-results {
	color: #6b7280;
	font-size: 14px;
	margin: 24px 0 0;
	text-align: center;
}

/* ── Responsive: card layout ────────────────────────────────────── */

@media ( max-width: 767px ) {

	.gtw-filters {
		flex-direction: column;
	}

	.gtw-filter-select {
		min-width: 100%;
		width: 100%;
	}

	/* Disable horizontal scroll, switch to card layout instead */
	.gtw-table-wrap {
		overflow-x: visible;
	}

	.gtw-table {
		min-width: 0;
		width: 100%;
	}

	.gtw-table,
	.gtw-table thead,
	.gtw-table tbody,
	.gtw-table th,
	.gtw-table td,
	.gtw-table tr {
		display: block;
	}

	.gtw-table thead tr {
		/* Visually hide header row but keep it for screen readers */
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.gtw-table tbody tr {
		background: #fff;
		border: 1px solid #e5e7eb;
		border-radius: 8px;
		margin-bottom: 16px;
		padding: 8px 0;
	}

	.gtw-table tbody tr[style*="display: none"],
	.gtw-table tbody tr[style*="display:none"] {
		display: none !important;
	}

	.gtw-table tbody td {
		border-bottom: 1px solid #f3f4f6;
		display: flex;
		gap: 8px;
		justify-content: space-between;
		padding: 10px 16px;
		text-align: right;
	}

	.gtw-table tbody td:last-child {
		border-bottom: none;
	}

	/* Label shown via data-label attribute */
	.gtw-table tbody td::before {
		color: #6b7280;
		content: attr( data-label );
		flex-shrink: 0;
		font-size: 12px;
		font-weight: 600;
		text-align: left;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		white-space: nowrap;
	}
}
