/* Shared results-table styling (Phase 6). Used by every [uktri_results]
   shortcode instance and by the My Account -> My Results tab. */

.uktri-results-app {
	padding: 0 16px;
	box-sizing: border-box;
}
.uktri-results-app .dataTables_wrapper {
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* "Filters" toggle button — only shown on tablet/mobile (see the media
   query below) so the 6 filter dropdowns don't all show at once. */
.uktri-filters-toggle {
	display: none;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	margin-bottom: 14px;
	padding: 10px 14px;
	font-size: 15px;
	font-weight: 700;
	color: #003f7f;
	background: #e8f2ff;
	border: 1px solid #005bbb;
	border-radius: 6px;
	cursor: pointer;
}
.uktri-filters-toggle-icon {
	display: inline-block;
	transition: transform .15s ease;
}
.uktri-filters-toggle.uktri-filters-toggle-open .uktri-filters-toggle-icon {
	transform: rotate(180deg);
}

.uktri-results-app .filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 16px 20px;
	margin-bottom: 20px;
}
.uktri-results-app .filter-block {
	display: flex;
	flex-direction: column;
}
.uktri-results-app .filter-heading {
	font-size: 14px;
	font-weight: 700;
	margin-bottom: 4px;
	color: #003f7f;
}
.uktri-results-app .uktri-distance-filter,
.uktri-results-app .uktri-category-filter,
.uktri-results-app .uktri-agegroup-filter,
.uktri-results-app .uktri-club-filter,
.uktri-results-app .uktri-team-filter,
.uktri-results-app .uktri-charity-filter {
	padding: 8px 12px;
	font-size: 15px;
	border-radius: 6px;
	border: 1px solid #005bbb;
	background-color: #e8f2ff;
	cursor: pointer;
	max-width: 220px;
}

/* Position circles */
.pos-circle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	font-weight: 700;
	color: #fff;
	font-size: 13px;
}
.pos-circle.pos-gold   { background: #d4a017; }
.pos-circle.pos-silver { background: #9aa0a6; }
.pos-circle.pos-bronze { background: #b5651d; }
.pos-plain { font-weight: 600; color: #333; }

/* Name + bib */
.uktri-name { font-weight: 600; }
.uktri-bib  { font-size: 12px; color: #6c757d; margin-top: 1px; }

/* Category / gender badges with position underneath */
.cat-badge, .gender-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 12px;
	font-weight: 600;
	background: #e8f2ff;
	color: #003f7f;
}
.gender-badge.gender-female { background: #ffe8f2; color: #99235c; }
.gender-badge.gender-male   { background: #e8f2ff; color: #003f7f; }
.pos-subline { font-size: 12px; color: #6c757d; margin-top: 2px; }

/* Star (fav) + share buttons — reset with `all: unset` because the theme's
   global button styling (large teal padding/background) otherwise bleeds
   through onto these small icon buttons and blows out their table column
   widths. */
.uktri-results-table .uktri-star,
.uktri-results-table .uktri-share {
	all: unset;
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	cursor: pointer;
	line-height: 0;
}
.uktri-star {
	color: #c9ccd1;
}
.uktri-star.uktri-star-active,
.uktri-star:hover {
	color: #f1b400;
}

.uktri-share {
	color: #6c757d;
}
.uktri-share:hover { color: #005bbb; }

/* Status badges (expand row) */
.status-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 12px; color: #fff; }
.status-FIN   { background: #28a745; }
.status-QRY   { background: #17a2b8; }
.status-DNF   { background: #fd7e14; }
.status-STD   { background: #6f42c1; }
.status-DQ    { background: #dc3545; }
.status-OTHER { background: #6c757d; }

/* Details expand */
.uktri-results-table .details-control { cursor: pointer; text-align: center; font-weight: 700; }
table.dataTable tbody tr.shown td.details-control { background: #f0f8ff; }
table.dataTable tbody tr.shown td { background: #fbfdff; }
.uktri-child-row { padding: 10px; }
.uktri-child-row-splits {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 10px;
	padding-bottom: 10px;
	border-bottom: 1px solid #e2e6ea;
}
.uktri-child-row-splits > div {
	display: flex;
	justify-content: space-between;
	max-width: 220px;
}
.uktri-split-label { font-weight: 700; color: #003f7f; }
.uktri-split-value { color: #333; }
.uktri-child-row-meta { line-height: 1.7; }

/* Table appearance: styled header row, alternating stripes, hover state,
   cell padding, rounded/bordered container, and tidy narrow widths for
   the accessory columns (star / position / share / expand-arrow — these
   have no header label and previously rendered as blank, oversized
   cells). */
table.uktri-results-table {
	width: 100% !important;
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid #e2e6ea;
	border-radius: 10px;
	overflow: hidden;
}
table.uktri-results-table thead th {
	background: #003f7f;
	color: #fff;
	text-align: left;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	padding: 12px 14px;
	border-bottom: none;
	border-right: none;
	white-space: nowrap;
}
table.uktri-results-table thead th:first-child { border-top-left-radius: 9px; }
table.uktri-results-table thead th:last-child  { border-top-right-radius: 9px; }
table.uktri-results-table tbody td {
	padding: 10px 14px;
	border-bottom: 1px solid #eef1f4;
	border-right: none;
	vertical-align: middle;
}
table.uktri-results-table tbody tr:last-child td { border-bottom: none; }
table.uktri-results-table tbody tr:nth-child(even) { background: #f7fafd; }
table.uktri-results-table tbody tr:hover td { background: #eaf2ff; }

table.uktri-results-table th.fav-col, table.uktri-results-table td.fav-col,
table.uktri-results-table th.share-col, table.uktri-results-table td.share-col,
table.uktri-results-table th.details-control, table.uktri-results-table td.details-control {
	width: 32px;
	padding-left: 6px;
	padding-right: 6px;
	text-align: center;
}
table.uktri-results-table th.pos-col, table.uktri-results-table td.pos-col {
	width: 50px;
	text-align: center;
}
table.uktri-results-table th.time-col, table.uktri-results-table td.time-col {
	padding-left: 8px;
	padding-right: 8px;
	font-size: 13px;
	white-space: nowrap;
}
table.uktri-results-table th.status-col, table.uktri-results-table td.status-col {
	text-align: center;
}

/* Toast */
.uktri-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translate(-50%, 10px);
	background: #1a1a1a;
	color: #fff;
	padding: 10px 18px;
	border-radius: 6px;
	font-size: 14px;
	opacity: 0;
	transition: opacity .25s ease, transform .25s ease;
	z-index: 9999;
}
.uktri-toast.uktri-toast-in { opacity: .95; transform: translate(-50%, 0); }

/* My Account -> My Results cards */
.uktri-my-results-list { display: flex; flex-direction: column; gap: 12px; }
.uktri-saved-card {
	border: 1px solid #e2e6ea;
	border-radius: 8px;
	padding: 12px 16px;
}
.uktri-saved-header { font-size: 12px; color: #6c757d; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.uktri-saved-body {
	display: grid;
	grid-template-columns: auto 1fr auto auto auto auto;
	align-items: center;
	gap: 14px;
}
.uktri-saved-time { font-weight: 600; }
.uktri-saved-placeholder { opacity: .6; }

@media (min-width: 1025px) {
	/* Desktop already shows Swim/T1/Cycle/T2/Run as their own columns, so
	   the vertical split list in the expand panel would just repeat them. */
	.uktri-child-row-splits { display: none; }
}

@media (max-width: 1024px) {
	.uktri-filters-toggle { display: flex; }
	.uktri-results-app .filter-bar {
		display: none;
		flex-direction: column;
		align-items: stretch;
	}
	.uktri-results-app .filter-bar.uktri-filters-open { display: flex; }
	.uktri-results-app .uktri-distance-filter,
	.uktri-results-app .uktri-category-filter,
	.uktri-results-app .uktri-agegroup-filter,
	.uktri-results-app .uktri-club-filter,
	.uktri-results-app .uktri-team-filter,
	.uktri-results-app .uktri-charity-filter { width: 100%; max-width: none; }
	.uktri-results-table td.share-col, .uktri-results-table th.share-col,
	.uktri-results-table td.cat-col, .uktri-results-table th.cat-col,
	.uktri-results-table td.swim-col, .uktri-results-table th.swim-col,
	.uktri-results-table td.t1-col, .uktri-results-table th.t1-col,
	.uktri-results-table td.cycle-col, .uktri-results-table th.cycle-col,
	.uktri-results-table td.t2-col, .uktri-results-table th.t2-col,
	.uktri-results-table td.run-col, .uktri-results-table th.run-col,
	.uktri-results-table td.status-col, .uktri-results-table th.status-col {
		display: none !important;
	}
	.uktri-saved-body { grid-template-columns: auto 1fr auto; row-gap: 6px; }
	.uktri-saved-cat, .uktri-saved-gender { grid-column: span 3; }
}

/* Single result page: the event name already appears once in the theme's
   red page-title banner above the content, so remove this duplicate
   in-content title + byline entirely. */
body.single-uktri_result .entry-header {
	display: none;
}
body.single-uktri_result .entry-content {
	margin-top: 10px;
}
body.single-uktri_result .uktri-results-app {
	margin-top: 10px;
}

/* Single result page: image banner + provisional heading */
.uktri-result-banner { text-align: center; margin: 4px 0 32px; }
.uktri-result-banner-image {
	max-width: 640px;
	width: 100%;
	height: auto;
	border-radius: 10px;
	box-shadow: 0 6px 20px rgba(0, 63, 127, 0.12);
}
.uktri-provisional-heading {
	margin-top: 16px;
	color: #b5651d;
	font-size: 34px;
	font-weight: 800;
	letter-spacing: .02em;
	text-transform: uppercase;
}

/* Results index (listing) + year archive */
.uktri-results-index-heading { margin-bottom: 18px; }
.uktri-results-index-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 18px;
	margin-bottom: 24px;
}
.uktri-results-index-card {
	display: block;
	position: relative;
	border: 1px solid #e2e6ea;
	border-radius: 8px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	background: #fff;
	transition: box-shadow .15s ease, transform .15s ease;
}
.uktri-results-index-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); transform: translateY(-2px); }
.uktri-results-index-card-image { display: block; width: 100%; height: 140px; object-fit: cover; }
.uktri-results-index-card-title { padding: 12px 14px; font-weight: 600; color: #003f7f; }
.uktri-results-index-card-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	background: #b5651d;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .02em;
	padding: 3px 8px;
	border-radius: 10px;
}
.uktri-results-index-years {
	border-top: 1px solid #e2e6ea;
	padding-top: 16px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}
.uktri-results-index-years-label { font-weight: 600; color: #003f7f; margin-right: 4px; }
.uktri-results-index-year-link {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 14px;
	background: #e8f2ff;
	color: #003f7f;
	font-weight: 600;
	text-decoration: none;
}
.uktri-results-index-year-link:hover { background: #d3e6ff; }
