/* Veřejná výsledková tabulka — FishMaraton */

.fm-results-root {
	position: relative;
	margin: 1.5rem 0;
	font-size: 1.0625rem;
	line-height: 1.45;
	box-sizing: border-box;
}

.fm-results-root *,
.fm-results-root *::before,
.fm-results-root *::after {
	box-sizing: inherit;
}

.fm-results-heading {
	margin: 0;
	padding: 0.85rem 1.25rem;
	font-size: 1.125rem;
	font-weight: 700;
	color: #101828;
	border-bottom: 1px solid #e4e7ec;
	background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.fm-results-inner {
	border: 1px solid #d0d5dd;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	overflow: hidden;
}

.fm-results-loading,
.fm-results-error-msg,
.fm-results-msg {
	margin: 0;
	padding: 1rem 1.25rem;
}

.fm-results-error-msg {
	color: #b42318;
	background: #fef3f2;
	border-top: 1px solid #fecdca;
}

.fm-results-msg--error {
	color: #b42318;
}

.fm-results-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.fm-results-table {
	width: 100%;
	min-width: 560px;
	border-collapse: collapse;
}

.fm-results-table thead th {
	text-align: left;
	padding: 0.85rem 1.15rem;
	background: #f8fafc;
	font-weight: 600;
	font-size: 1rem;
	color: #1d2939;
	border-bottom: 1px solid #e4e7ec;
	white-space: nowrap;
}

.fm-results-table tbody td {
	padding: 1rem 1.15rem;
	min-height: 3.35rem;
	box-sizing: border-box;
	border-bottom: 1px solid #e4e7ec;
	vertical-align: middle;
}

.fm-results-table tbody tr:nth-child(even) td {
	background: #eef2f7;
}

.fm-results-table tbody tr:hover td {
	background: #e0f2fe;
}

.fm-results-table tbody tr.fm-results-row--clickable {
	cursor: pointer;
}

.fm-results-table tbody tr.fm-results-row--clickable:focus-visible {
	outline: 2px solid #1570ef;
	outline-offset: -2px;
}

.fm-col-rank {
	width: 4.5rem;
	text-align: center;
}

.fm-col-start {
	width: 4.75rem;
	text-align: center;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.fm-col-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.fm-col-team {
	min-width: 8rem;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	hyphens: auto;
}

.fm-col-sector {
	width: 5rem;
}

/* Tablety: tabulka na šířku stránky, kompaktnější buňky */
@media (min-width: 640px) and (max-width: 899.98px) {
	.fm-results-root {
		margin-left: max(0px, env(safe-area-inset-left, 0px));
		margin-right: max(0px, env(safe-area-inset-right, 0px));
	}

	.fm-results-scroll {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

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

	.fm-results-table thead th,
	.fm-results-table tbody td {
		padding: 0.72rem 0.55rem;
		font-size: 0.9375rem;
	}

}

/* Mobil: karty bez vodorovného posuvu, popisky u hodnot */
@media (max-width: 639.98px) {
	.fm-results-root {
		margin-left: max(0px, env(safe-area-inset-left, 0px));
		margin-right: max(0px, env(safe-area-inset-right, 0px));
		margin-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
		font-size: clamp(0.9375rem, 3.4vw, 1.0625rem);
	}

	.fm-results-inner {
		border-radius: 12px;
		border-color: #cdd5e0;
	}

	.fm-results-heading {
		padding: 0.75rem 1rem;
		font-size: clamp(1rem, 4.2vw, 1.125rem);
		line-height: 1.35;
		overflow-wrap: anywhere;
		hyphens: auto;
	}

	.fm-results-loading,
	.fm-results-error-msg {
		padding: 0.85rem 1rem;
	}

	.fm-results-scroll {
		overflow-x: visible;
		padding: 0 0.35rem 0.85rem;
	}

	.fm-results-table {
		min-width: 0;
		width: 100%;
		display: block;
		border-collapse: separate;
		border-spacing: 0;
	}

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

	.fm-results-table tbody {
		display: block;
	}

	.fm-results-table tbody tr {
		display: block;
		margin-bottom: 0.85rem;
		border: 1px solid #d0d5dd;
		border-radius: 12px;
		background: #fff;
		box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
		overflow: hidden;
	}

	.fm-results-table tbody tr:nth-child(even):not(.fm-results-row--empty) {
		background: #f4f7fb;
	}

	.fm-results-table tbody tr.fm-results-row--clickable {
		-webkit-tap-highlight-color: rgba(21, 112, 239, 0.18);
		touch-action: manipulation;
		cursor: pointer;
	}

	.fm-results-table tbody tr.fm-results-row--clickable:active {
		opacity: 0.96;
	}

	.fm-results-table tbody tr.fm-results-row--empty {
		margin-bottom: 0;
		border-style: dashed;
		background: #fcfcfd;
	}

	.fm-results-table tbody td {
		display: grid;
		grid-template-columns: minmax(6.5rem, 40%) 1fr;
		gap: 0.2rem 0.65rem;
		align-items: baseline;
		padding: 0.62rem 0.9rem;
		min-height: 0;
		border-bottom: 1px solid #eef2f6;
		text-align: start !important;
		font-size: inherit;
	}

	.fm-results-table tbody td:last-child {
		border-bottom: 0;
	}

	.fm-results-table tbody td::before {
		content: attr(data-label);
		font-size: 0.6875rem;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.035em;
		color: #667085;
		line-height: 1.35;
	}

	.fm-results-table tbody tr:nth-child(even):not(.fm-results-row--empty) td {
		background: transparent;
	}

	.fm-results-table tbody tr:hover td {
		background: transparent;
	}

	.fm-results-table tbody tr.fm-results-row--clickable:hover {
		box-shadow: 0 4px 14px rgba(21, 112, 239, 0.12);
		border-color: #84caff;
	}

	.fm-results-table .fm-col-team {
		font-weight: 700;
		font-size: 1.06em;
		color: #101828;
		padding-top: 0.72rem;
		padding-bottom: 0.48rem;
		grid-template-columns: 1fr;
		border-bottom: 1px solid #e4e7ec;
		background: linear-gradient(180deg, #f8fafc 0%, #fff 50%);
	}

	.fm-results-table .fm-col-team::before {
		margin-bottom: 0.12rem;
	}

	.fm-results-table .fm-col-rank,
	.fm-results-table .fm-col-start,
	.fm-results-table .fm-col-num {
		font-variant-numeric: tabular-nums;
		justify-self: end;
		text-align: end !important;
	}

	.fm-results-table .fm-col-rank {
		font-weight: 700;
		font-size: 1.12em;
		color: #1570ef;
	}

	.fm-results-row--empty td.fm-results-empty {
		display: block;
		padding: 1.65rem 1rem;
		text-align: center;
		color: #667085;
		border: 0;
		grid-template-columns: 1fr;
	}

	.fm-results-row--empty td.fm-results-empty::before {
		content: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fm-results-table tbody tr.fm-results-row--clickable:active {
		opacity: 1;
	}
}

/* Panel detailu týmu (nad tabulkou, vhodné pro palec) */
.fm-results-drawer {
	position: fixed;
	inset: 0;
	z-index: 99900;
	pointer-events: none;
}

.fm-results-drawer:not([hidden]) {
	pointer-events: auto;
}

.fm-results-drawer[hidden] {
	display: none !important;
}

.fm-results-drawer__backdrop {
	position: absolute;
	inset: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(15, 23, 42, 0.52);
	cursor: pointer;
}

.fm-results-drawer__sheet {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 92vh;
	max-height: min(92vh, 100dvh);
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 14px 14px 0 0;
	box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
	overflow: hidden;
	padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (min-width: 640px) {
	.fm-results-drawer__sheet {
		left: auto;
		top: 0;
		bottom: 0;
		right: 0;
		width: min(440px, 100%);
		max-height: none;
		border-radius: 0;
		box-shadow: -6px 0 28px rgba(0, 0, 0, 0.12);
		padding-bottom: env(safe-area-inset-bottom, 0px);
		padding-right: env(safe-area-inset-right, 0px);
	}
}

.fm-results-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid #e4e7ec;
	flex-shrink: 0;
}

.fm-results-drawer__title {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
	color: #101828;
}

.fm-results-drawer__close {
	flex-shrink: 0;
	width: 3rem;
	height: 3rem;
	border: 0;
	border-radius: 10px;
	background: #f2f4f7;
	color: #101828;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

.fm-results-drawer__close:hover,
.fm-results-drawer__close:focus-visible {
	background: #e4e7ec;
	outline: none;
}

.fm-results-drawer__loading,
.fm-results-drawer__error {
	margin: 0;
	padding: 1rem 1.25rem;
}

.fm-results-drawer__error {
	color: #b42318;
	background: #fef3f2;
}

.fm-results-drawer__body {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	min-height: 0;
}

/* Náhledy v draweru — drobně větší než základní 72px, stále jen po kliknutí plná galerie */
.fm-results-drawer__body .fm-team-gallery img {
	width: 80px;
	height: 80px;
}

@media (max-width: 520px) {
	.fm-results-drawer__body .fm-team-gallery img {
		width: 72px;
		height: 72px;
	}
}
