/**
 * HDSV Ligaverwaltung – mobile Ergebniseingabe.
 * NUR formular-spezifische Styles: Basis-Komponenten (hlv-card, hlv-table,
 * hlv-btn, hlv-alert, Farb-Custom-Properties) kommen aus base.css; hier nur
 * Schritt-Badges, Leg-Grid, Fehler-/Gewinnerzellen, Sticky-Speicherleiste
 * und Touch-Größen. Mobile First: Basis für schmale Viewports,
 * min-width-Queries aufwärts.
 */

/* --- Kopf & Status-Ampel ------------------------------------------------- */

.hlv-report {
	/* Platz für die Sticky-Speicherleiste am Seitenende. */
	padding-bottom: 5.5rem;
}

.hlv-report__meta {
	margin: 0.25rem 0 0.75rem;
}

.hlv-report__hint {
	font-size: 0.875rem;
	opacity: 0.85;
}

.hlv-report-status {
	display: inline-block;
	width: 0.875rem;
	height: 0.875rem;
	margin-left: 0.375rem;
	border-radius: 50%;
	vertical-align: middle;
}

.hlv-report-status--red {
	background: var(--hlv-red, #e30613);
}

.hlv-report-status--yellow {
	background: #dba617;
}

.hlv-report-status--green {
	background: var(--hlv-green, #2fa05a);
}

/* --- Schritt-Badges (cyan, wie Alt) --------------------------------------- */

.hlv-step {
	margin: 1.5rem 0;
}

.hlv-step__title {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	margin: 0 0 0.375rem;
}

.hlv-step__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	background: var(--hlv-blue, #009fe3);
	color: #fff;
	font-family: "Barlow Condensed", "Nunito", sans-serif;
	font-size: 1.375rem;
	font-weight: 600;
	line-height: 1;
}

.hlv-step__description {
	margin: 0 0 0.75rem;
	font-size: 0.9rem;
	opacity: 0.85;
}

/* --- Schritt 1: Aufstellung ------------------------------------------------ */

.hlv-report-teams {
	display: grid;
	gap: 1rem;
	margin-bottom: 0.75rem;
}

.hlv-report-lineup__team {
	margin: 0 0 0.5rem;
	text-align: center;
}

.hlv-report-lineup__noshow {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 44px;
	margin-bottom: 0.5rem;
}

.hlv-report-lineup__noshow input {
	width: 1.375rem;
	height: 1.375rem;
}

.hlv-report-lineup__row {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	margin-bottom: 0.375rem;
}

.hlv-report-lineup__pos {
	flex: 0 0 2.5rem;
	font-weight: 700;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.hlv-report-lineup__select {
	flex: 1 1 auto;
	width: 100%;
	min-height: 44px;
}

.hlv-report-lineup__select--substitution-locked:disabled {
	border-color: var(--hlv-yellow);
	background: var(--hlv-yellow-soft);
	color: var(--hlv-text);
	opacity: 1;
	cursor: not-allowed;
}

/* --- Schritte 2/3: Auswechslungen & Highscores ------------------------------ */

.hlv-report-subs__lock-hint {
	margin-top: 0.75rem;
	color: var(--hlv-text-muted);
}

.hlv-report-subs__row--conflict > td {
	background: var(--hlv-yellow-soft);
}

.hlv-report-subs__row--conflict > td:first-child {
	box-shadow: inset 4px 0 0 var(--hlv-yellow);
}

.hlv-report-subs__conflict-label {
	display: block;
	margin-top: 0.2rem;
	color: var(--hlv-text);
	font-size: 0.8rem;
	font-weight: 700;
}

.hlv-report-subs__form,
.hlv-report-highscores__form {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75rem;
	margin-top: 0.75rem;
}

.hlv-field {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	flex: 1 1 100%;
}

.hlv-field select,
.hlv-field input {
	min-height: 44px;
}

.hlv-field--num {
	flex: 1 1 5.5rem;
}

.hlv-field--num input {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.hlv-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* --- Schritt 5: Spielberichtsfoto -------------------------------------------- */

.hlv-report-photo__img {
	max-width: min(100%, 20rem);
	height: auto;
	border-radius: 6px;
	border: 1px solid rgba(0, 0, 0, 0.15);
}

.hlv-report-photo__upload {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-top: 0.75rem;
}

/* --- Schritt 6: Spiele & Leg-Grid ---------------------------------------------- */

.hlv-report-round {
	margin: 1.25rem 0 0.5rem;
}

.hlv-report-games {
	display: grid;
	gap: 1rem;
}

.hlv-game__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.hlv-page-report-form .hlv-game__title {
	margin: 0;
}

.hlv-game__pairing {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 0.5rem;
	margin: 0.625rem 0;
	text-align: center;
}

.hlv-game__side {
	min-width: 0;
	overflow-wrap: anywhere;
	font-weight: 600;
}

/* Großer berechneter Satzstand (Scoreboard-Ziffern). */
.hlv-page-report-form .hlv-game__sets {
	display: flex;
	align-items: center;
	gap: 0.375rem;
}

.hlv-game__set {
	min-width: 1.75rem;
	font-family: "Barlow Condensed", "Nunito", sans-serif;
	font-size: 1.75rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.hlv-game__set--winner {
	color: var(--hlv-green, #2fa05a);
}

.hlv-leg-table {
	width: 100%;
	border-collapse: collapse;
}

.hlv-leg-table th,
.hlv-leg-table td {
	padding: 0.125rem 0.1875rem;
	text-align: center;
}

.hlv-leg-table__label {
	white-space: nowrap;
	font-size: 0.8125rem;
	text-align: right;
}

/* Touch-Ziele ≥ 44 px, Zahlen-Eingabe rechtsbündig. */
.hlv-leg-table input[type="number"],
.hlv-game__easy-row input[type="number"] {
	width: 100%;
	min-width: 3rem;
	min-height: 44px;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* Fehler- und Gewinnerzellen (Alt: error-leg-* rot, winner grün). */
.hlv-leg-error {
	border-color: var(--hlv-red, #e30613) !important;
	background: color-mix(in srgb, var(--hlv-red, #e30613) 12%, transparent);
}

.hlv-leg-won {
	border-color: var(--hlv-green, #2fa05a) !important;
	background: color-mix(in srgb, var(--hlv-green, #2fa05a) 12%, transparent);
}

.hlv-game--error {
	border-color: var(--hlv-red, #e30613);
}

.hlv-game__errors {
	color: var(--hlv-red, #e30613);
	font-size: 0.875rem;
	margin: 0.375rem 0 0;
}

.hlv-game__options-trigger {
	padding-inline: 0.75rem;
	color: var(--hlv-text-muted);
	border-color: transparent;
	font-size: 0.8125rem;
	font-weight: 600;
}

.hlv-game__options-trigger:hover,
.hlv-game__options-trigger.is-active {
	border-color: var(--hlv-border-strong);
}

.hlv-game__options-trigger.is-active {
	background: var(--hlv-yellow-soft);
	color: var(--hlv-text);
}

.hlv-game__forfeit-status {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.3rem;
	margin: 0 0 0.625rem;
	padding: 0.375rem 0.625rem;
	border: 1px solid color-mix(in srgb, var(--hlv-yellow) 45%, var(--hlv-border));
	border-radius: var(--hlv-radius-s);
	background: var(--hlv-yellow-soft);
	font-size: 0.8125rem;
	text-align: center;
}

.hlv-game-options {
	width: min(32rem, calc(100% - 2rem));
	max-height: calc(100dvh - 2rem);
	padding: 0;
	overflow: auto;
	border: 1px solid var(--hlv-border-strong);
	border-radius: var(--hlv-radius);
	background: var(--hlv-surface);
	color: var(--hlv-text);
	box-shadow: var(--hlv-shadow-raised);
}

.hlv-game-options::backdrop {
	background: rgba(18, 35, 48, 0.58);
}

.hlv-game-options__body {
	display: grid;
	gap: 1rem;
	padding: 1.25rem;
}

.hlv-game-options__body h5,
.hlv-game-options__body p {
	margin: 0;
}

.hlv-game-options__body h5 {
	font-size: 1.125rem;
}

.hlv-game-options__actions {
	display: grid;
	gap: 0.625rem;
}

.hlv-game-options__forfeit {
	display: grid;
	gap: 0.75rem;
	margin: 0;
	padding: 1rem;
	border: 1px solid var(--hlv-border);
	border-radius: var(--hlv-radius-s);
}

.hlv-game-options__forfeit legend {
	padding-inline: 0.35rem;
	font-weight: 700;
}

.hlv-game-options__forfeit p {
	color: var(--hlv-text-muted);
	font-size: 0.875rem;
}

.hlv-game-options__close {
	justify-self: end;
}

.hlv-game__easy-row {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	margin-top: 0.375rem;
}

.hlv-game__easy-label {
	flex: 0 0 auto;
	font-size: 0.875rem;
}

.hlv-report-easymode {
	margin-bottom: 1rem;
}

/* --- Freigabe (Prüfer) ----------------------------------------------------------- */

.hlv-report-check__toggle {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 44px;
	font-weight: 600;
}

.hlv-report-check__toggle input {
	width: 1.375rem;
	height: 1.375rem;
}

/* --- Entwurfs-Leiste ----------------------------------------------------------- */

.hlv-report-draft {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.625rem;
}

/* --- Sticky-Speicherleiste -------------------------------------------------------- */

.hlv-report-savebar {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 0.75rem;
	padding: 0.625rem max(1rem, env(safe-area-inset-right)) max(0.625rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
	background: var(--hlv-surface, #fff);
	border-top: 1px solid rgba(0, 0, 0, 0.12);
	box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
}

.hlv-report-savebar__status {
	font-size: 0.875rem;
	color: var(--hlv-text-muted, #5d6b77);
}

.hlv-report-savebar__status[data-state="saved"] {
	color: var(--hlv-green, #2fa05a);
}

.hlv-report-savebar__status[data-state="error"] {
	color: var(--hlv-red, #e30613);
}

.hlv-report-savebar__btn {
	min-height: 44px;
}

/* --- Spinner-Overlay „Bitte warten“ ----------------------------------------------- */

/* display: flex würde das hidden-Attribut (UA-Priorität) übersteuern. */
.hlv-report-overlay[hidden] {
	display: none;
}

.hlv-report-overlay {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.35);
	backdrop-filter: blur(2px);
}

.hlv-report-overlay__box {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	color: #fff;
	font-size: 1.5rem;
	font-weight: 600;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.hlv-report-overlay__spinner {
	width: 2.75rem;
	height: 2.75rem;
	border: 4px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: hlv-report-spin 1s linear infinite;
}

@keyframes hlv-report-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hlv-report-overlay__spinner {
		animation-duration: 4s;
	}
}

/* --- Breitere Viewports -------------------------------------------------------------- */

@media (min-width: 700px) {
	.hlv-report-teams {
		grid-template-columns: 1fr 1fr;
	}

	.hlv-report-games {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.hlv-field {
		flex: 1 1 14rem;
	}
}

/* --- Dark Mode (Custom Properties aus base.css) ---------------------------------------- */

@media (prefers-color-scheme: dark) {
	.hlv-report-savebar {
		background: var(--hlv-surface, #23272b);
		border-top-color: rgba(255, 255, 255, 0.15);
	}
}
