/* Freizeitliga Badminton – Frontend (theme-neutral, erbt Schrift und Farben vom Theme) */
.flb-liga {
	--flb-border: rgba(127, 127, 127, 0.3);
	--flb-stripe: rgba(127, 127, 127, 0.07);
	--flb-accent: currentColor;
	--flb-bg: var(--wp--preset--color--base, #fff);
	--flb-font-size: 0.8em; /* Schriftgröße der Tabellen, im Theme überschreibbar */
	/* Farben der Spieltag-Buttons (im Theme überschreibbar) */
	--flb-md-top: #fe0000;
	--flb-md-bg: #1177aa;
	--flb-md-bg-hover: #0c5a81;
	--flb-md-active: #fe0000;
	--flb-md-text: #fff;
	margin: 1.5em 0;
}
.flb-liga .flb-title { margin: 1.2em 0 0.5em; }

/* Saison- und Spieltagsauswahl */
.flb-liga .flb-season { margin-bottom: 1em; }
.flb-liga .flb-md-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em; margin-bottom: 0.5em; }
.flb-liga .flb-md-nav ul { display: flex; flex-wrap: wrap; gap: 0.3em; list-style: none; margin: 0; padding: 0; }
.flb-liga .flb-md-nav li { margin: 0; padding: 0; }
.flb-liga .flb-md-nav a {
	/* Gestaltung wie die Datumsfelder im Kalender-Widget (My Calendar): blau mit rotem Streifen oben */
	display: inline-block; min-width: 2.2em; padding: 0.45em 0.55em 0.3em; text-align: center;
	background: linear-gradient(to bottom, var(--flb-md-top) 0 7px, var(--flb-md-bg) 7px 100%);
	color: var(--flb-md-text); font-weight: 700; line-height: 1.4;
	border: 0; border-radius: 3px; text-decoration: none;
}
.flb-liga .flb-md-nav a:hover,
.flb-liga .flb-md-nav a:focus-visible {
	background: linear-gradient(to bottom, var(--flb-md-top) 0 7px, var(--flb-md-bg-hover) 7px 100%);
	color: var(--flb-md-text);
}
.flb-liga .flb-md-nav a.flb-active { background: var(--flb-md-active); color: var(--flb-md-text); }
.flb-liga .flb-md-select { display: none; margin-bottom: 0.5em; }
.flb-liga .flb-md-select select, .flb-liga .flb-season select { max-width: 100%; }

/* Tabellen */
.flb-liga .flb-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.flb-liga .flb-table { width: 100%; border-collapse: collapse; margin: 0; font-size: var(--flb-font-size); line-height: 1.4; }
.flb-liga .flb-table th, .flb-liga .flb-table td { padding: 0.45em 0.4em; border-bottom: 1px solid var(--flb-border); text-align: left; vertical-align: top; }
.flb-liga .flb-table thead th { border-bottom-width: 2px; white-space: nowrap; }
.flb-liga .flb-table abbr { text-decoration: none; border: 0; cursor: help; }
.flb-liga .flb-table tbody tr:nth-child(even) td { background: var(--flb-stripe); }
.flb-liga .flb-c-num { text-align: center !important; white-space: nowrap; }
.flb-liga .flb-c-date, .flb-liga .flb-c-time { white-space: nowrap; }
.flb-liga .flb-c-rank { text-align: right !important; width: 2.5em; }
.flb-liga .flb-winner { font-weight: 700; }
.flb-liga .flb-note { display: block; font-size: 0.85em; opacity: 0.75; font-weight: 400; }
.flb-liga .flb-cancelled td { opacity: 0.6; }
.flb-liga .flb-cancelled .flb-c-team { text-decoration: line-through; }
.flb-liga .flb-bye { margin-top: 0.5em; font-style: italic; }
.flb-liga .flb-short { display: none; }

/* Handy */
@media (max-width: 640px) {
	.flb-liga .flb-md-nav { display: none; }
	.flb-liga .flb-md-select { display: block; }
	.flb-liga .flb-long { display: none; }
	.flb-liga .flb-short { display: inline; }
	.flb-liga .flb-table th, .flb-liga .flb-table td { padding: 0.4em 0.35em; }

	/* Platz und Mannschaft bleiben beim seitlichen Scrollen stehen */
	.flb-liga .flb-standings-table .flb-sticky { position: sticky; left: 0; z-index: 1; background: var(--flb-bg); }
	.flb-liga .flb-standings-table .flb-sticky-2 { left: 2.5em; box-shadow: 1px 0 0 var(--flb-border); }
	.flb-liga .flb-standings-table .flb-c-rank { width: 2.5em; min-width: 2.5em; max-width: 2.5em; box-sizing: border-box; }
}
@media (max-width: 640px) {
	.flb-liga .flb-standings-table tbody tr:nth-child(even) .flb-sticky { background: linear-gradient(var(--flb-stripe), var(--flb-stripe)), var(--flb-bg); }
}

/* Handy: Ansetzungen als Karten statt breiter Tabelle */
@media (max-width: 640px) {
	.flb-liga .flb-fixtures-table thead { display: none; }
	.flb-liga .flb-fixtures-table,
	.flb-liga .flb-fixtures-table tbody { display: block; }
	.flb-liga .flb-fixtures-table tr {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
		grid-template-areas: "date date time time" "heim gast pkt spiele" "halle halle halle halle";
		column-gap: 0.6em;
		padding: 0.5em 0.35em;
		border-bottom: 1px solid var(--flb-border);
	}
	.flb-liga .flb-fixtures-table tbody tr:nth-child(even) { background: var(--flb-stripe); }
	.flb-liga .flb-fixtures-table td { display: block; border: 0; padding: 0.1em 0; background: none !important; }
	.flb-liga .flb-fixtures-table .flb-c-date { grid-area: date; font-size: 0.9em; opacity: 0.8; }
	.flb-liga .flb-fixtures-table .flb-c-time { grid-area: time; font-size: 0.9em; opacity: 0.8; text-align: right; }
	.flb-liga .flb-fixtures-table .flb-c-heim { grid-area: heim; }
	.flb-liga .flb-fixtures-table .flb-c-heim::after { content: " –"; font-weight: 400; }
	.flb-liga .flb-fixtures-table .flb-c-gast { grid-area: gast; }
	.flb-liga .flb-fixtures-table .flb-c-pkt { grid-area: pkt; }
	.flb-liga .flb-fixtures-table .flb-c-spiele { grid-area: spiele; opacity: 0.8; }
	.flb-liga .flb-fixtures-table .flb-c-spiele::before { content: "("; }
	.flb-liga .flb-fixtures-table .flb-c-spiele::after { content: ")"; }
	.flb-liga .flb-fixtures-table .flb-c-halle { grid-area: halle; font-size: 0.85em; opacity: 0.7; }
	.flb-liga .flb-fixtures-table .flb-c-halle:empty { display: none; }
}

/* Hallen-Link und Adress-Popup */
.flb-liga .flb-hall-link { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.flb-liga .flb-dialog {
	box-sizing: border-box;
	max-width: min(90vw, 420px); padding: 1.2em 1.4em; border: 1px solid var(--flb-border); border-radius: 6px;
	background: var(--flb-bg); color: inherit; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.flb-liga .flb-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.flb-liga .flb-dialog p { margin: 0 0 0.6em; }
.flb-liga .flb-dialog-title { font-weight: 700; }
.flb-liga .flb-dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8em; margin: 1em 0 0 !important; }
.flb-liga .flb-dialog-close { cursor: pointer; font: inherit; padding: 0.3em 0.9em; }

/* Einzelergebnisse (Popup) */
.flb-liga .flb-detail-link {
	font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
	text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px;
}
.flb-liga .flb-dialog-detail { max-width: min(94vw, 460px); }
.flb-liga .flb-dialog-sub { font-size: 0.9em; opacity: 0.75; }
.flb-liga .flb-detail-table { font-size: 0.9em; margin-top: 0.4em; }
.flb-liga .flb-detail-table td, .flb-liga .flb-detail-table th { white-space: nowrap; }
.flb-liga .flb-detail-table tfoot th { border-bottom: 0; font-weight: 600; }
.flb-liga .flb-dialog-actions-end { justify-content: flex-end; }
/* Im Popup keine Handy-Kartenansicht */
@media (max-width: 640px) {
	.flb-liga .flb-detail-table thead { display: table-header-group; }
	.flb-liga .flb-detail-table td, .flb-liga .flb-detail-table th { white-space: normal; }
}

/* Link „Alle Spiele der Saison“ */
.flb-liga .flb-all-link { margin: 0.3em 0 0.8em; font-size: 0.95em; }
.flb-liga .flb-all-link a.flb-active { font-weight: 700; text-decoration: none; }
@media (max-width: 640px) {
	.flb-liga .flb-all-link { display: none; } /* auf dem Handy über das Dropdown */
}
.flb-liga .flb-md-nav-label { font-weight: 700; }

/*
 * Schutz gegen Plugins, die auf dem Handy alle Tabellen ausblenden
 * (z. B. „Automatic Responsive Tables“: table { display: none !important; }).
 */
.flb-liga table.flb-table { display: table !important; }
@media (max-width: 640px) {
	.flb-liga table.flb-fixtures-table { display: block !important; }
	.flb-liga table.flb-fixtures-table thead { display: none !important; }
	.flb-liga table.flb-fixtures-table tbody { display: block !important; }
	.flb-liga table.flb-fixtures-table tr { display: grid !important; }
	.flb-liga table.flb-fixtures-table td { display: block !important; }
	.flb-liga table.flb-fixtures-table .flb-c-halle:empty { display: none !important; }
}
/* Kopien, die „Automatic Responsive Tables“ per JavaScript erzeugt, innerhalb der Liga ausblenden */
.flb-liga .art-table { display: none !important; }
