/**
 * Bandenwerbung Tool – Frontend Styles
 * Leicht überschreibbar via Theme-CSS.
 */

:root {
	--bwt-color-primary: #1a7a3a;
	--bwt-color-primary-dark: #145f2d;
	--bwt-color-pitch: #2d8f4e;
	--bwt-color-pitch-lines: rgba(255, 255, 255, 0.85);
	--bwt-color-band-available: #2563eb;
	--bwt-color-band-selected: #f59e0b;
	--bwt-color-band-unavailable: #9ca3af;
	--bwt-color-text: #1f2937;
	--bwt-color-muted: #6b7280;
	--bwt-color-bg: #f8fafc;
	--bwt-color-card: #ffffff;
	--bwt-color-border: #e5e7eb;
	--bwt-radius: 12px;
	--bwt-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
	--bwt-transition: 0.2s ease;
	--bwt-band-margin: 8%;
	--bwt-band-size: 20px;
}

/* Container – volle Breite */
.bwt-tool {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	color: var(--bwt-color-text);
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0;
}

/* Schritt-Layout: gestapelt */
.bwt-step--selection {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

/* Spielfeld-Bereich */
.bwt-field-area {
	width: 100%;
}

.bwt-field {
	position: relative;
	width: 100%;
	margin: 0 auto;
}

/* Hochformat: Tore oben/unten */
.bwt-field--hoch {
	aspect-ratio: 1 / 1.35;
	min-height: 420px;
	max-height: 720px;
}

/* Querformat: Tore links/rechts */
.bwt-field--quer {
	aspect-ratio: 1.55 / 1;
	min-height: 320px;
	max-height: 560px;
}

/* Rasen – Basis */
.bwt-pitch {
	position: absolute;
	background: linear-gradient(135deg, var(--bwt-color-pitch) 0%, #247a3f 50%, var(--bwt-color-pitch) 100%);
	border: 3px solid var(--bwt-color-pitch-lines);
	border-radius: 4px;
	overflow: hidden;
}

.bwt-pitch > * {
	position: absolute;
	pointer-events: none;
}

/* ── Hochformat: Spielfeld & Markierungen ── */
.bwt-pitch--hoch {
	top: var(--bwt-band-size);
	left: var(--bwt-band-size);
	right: var(--bwt-band-size);
	bottom: var(--bwt-band-size);
}

.bwt-pitch--hoch::before {
	content: "";
	position: absolute;
	inset: 0;
	background: repeating-linear-gradient(
		90deg,
		transparent,
		transparent 10%,
		rgba(0, 0, 0, 0.04) 10%,
		rgba(0, 0, 0, 0.04) 20%
	);
	pointer-events: none;
}

.bwt-pitch--hoch .bwt-pitch__center-line {
	top: 50%;
	left: 0;
	right: 0;
	width: auto;
	height: 2px;
	bottom: auto;
	background: var(--bwt-color-pitch-lines);
	transform: translateY(-50%);
}

.bwt-pitch--hoch .bwt-pitch__center-circle {
	top: 50%;
	left: 50%;
	width: 22%;
	height: auto;
	aspect-ratio: 1;
	border: 2px solid var(--bwt-color-pitch-lines);
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

.bwt-pitch--hoch .bwt-pitch__penalty {
	left: 25%;
	right: 25%;
	top: auto;
	bottom: auto;
	width: auto;
	height: 16%;
	border: 2px solid var(--bwt-color-pitch-lines);
}

.bwt-pitch--hoch .bwt-pitch__penalty--top {
	top: 0;
	border-top: none;
}

.bwt-pitch--hoch .bwt-pitch__penalty--bottom {
	bottom: 0;
	border-bottom: none;
}

.bwt-pitch--hoch .bwt-pitch__goal-area {
	left: 38%;
	right: 38%;
	top: auto;
	bottom: auto;
	width: auto;
	height: 7%;
	border: 2px solid var(--bwt-color-pitch-lines);
}

.bwt-pitch--hoch .bwt-pitch__goal-area--top {
	top: 0;
	border-top: none;
}

.bwt-pitch--hoch .bwt-pitch__goal-area--bottom {
	bottom: 0;
	border-bottom: none;
}

.bwt-pitch--hoch .bwt-pitch__goal {
	left: 44%;
	right: 44%;
	width: auto;
	height: 2px;
	background: var(--bwt-color-pitch-lines);
}

.bwt-pitch--hoch .bwt-pitch__goal--top {
	top: 0;
}

.bwt-pitch--hoch .bwt-pitch__goal--bottom {
	bottom: 0;
}

/* ── Querformat: Spielfeld & Markierungen ── */
.bwt-pitch--quer {
	top: var(--bwt-band-size);
	left: var(--bwt-band-size);
	right: var(--bwt-band-size);
	bottom: var(--bwt-band-size);
}

.bwt-pitch--quer::before {
	content: "";
	position: absolute;
	inset: 0;
	background: repeating-linear-gradient(
		0deg,
		transparent,
		transparent 10%,
		rgba(0, 0, 0, 0.04) 10%,
		rgba(0, 0, 0, 0.04) 20%
	);
	pointer-events: none;
}

.bwt-pitch--quer .bwt-pitch__center-line {
	top: 0;
	bottom: 0;
	left: 50%;
	right: auto;
	width: 2px;
	height: auto;
	background: var(--bwt-color-pitch-lines);
	transform: translateX(-50%);
}

.bwt-pitch--quer .bwt-pitch__center-circle {
	top: 50%;
	left: 50%;
	width: auto;
	height: 22%;
	aspect-ratio: 1;
	border: 2px solid var(--bwt-color-pitch-lines);
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

.bwt-pitch--quer .bwt-pitch__penalty {
	top: 25%;
	bottom: 25%;
	left: auto;
	right: auto;
	width: 16%;
	height: auto;
	border: 2px solid var(--bwt-color-pitch-lines);
}

.bwt-pitch--quer .bwt-pitch__penalty--left {
	left: 0;
	border-left: none;
}

.bwt-pitch--quer .bwt-pitch__penalty--right {
	right: 0;
	border-right: none;
}

.bwt-pitch--quer .bwt-pitch__goal-area {
	top: 38%;
	bottom: 38%;
	left: auto;
	right: auto;
	width: 7%;
	height: auto;
	border: 2px solid var(--bwt-color-pitch-lines);
}

.bwt-pitch--quer .bwt-pitch__goal-area--left {
	left: 0;
	border-left: none;
}

.bwt-pitch--quer .bwt-pitch__goal-area--right {
	right: 0;
	border-right: none;
}

.bwt-pitch--quer .bwt-pitch__goal {
	top: 44%;
	bottom: 44%;
	height: auto;
	width: 2px;
	background: var(--bwt-color-pitch-lines);
}

.bwt-pitch--quer .bwt-pitch__goal--left {
	left: 0;
}

.bwt-pitch--quer .bwt-pitch__goal--right {
	right: 0;
}

/* Banden-Container – entlang der Seitenlinie */
.bwt-bands {
	position: absolute;
	display: flex;
	gap: 2px;
}

/* Nord / Süd: horizontal, feste Höhe 20px */
.bwt-bands--nord,
.bwt-bands--sued {
	flex-direction: row;
	align-items: stretch;
	height: var(--bwt-band-size);
	left: var(--bwt-band-size);
	right: var(--bwt-band-size);
}

.bwt-bands--nord {
	top: 0;
}

.bwt-bands--sued {
	bottom: 0;
}

/* Ost / West: vertikal, feste Breite 20px */
.bwt-bands--ost,
.bwt-bands--west {
	flex-direction: column;
	align-items: stretch;
	width: var(--bwt-band-size);
	top: var(--bwt-band-size);
	bottom: var(--bwt-band-size);
}

.bwt-bands--ost {
	right: 0;
}

.bwt-bands--west {
	left: 0;
}

.bwt-bands--custom {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* Einzelne Bande – feste Querseite 20px, Länge entlang der Seitenlinie */
.bwt-band {
	position: relative;
	background: var(--bwt-color-band-available);
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 2px;
	cursor: pointer;
	transition: background var(--bwt-transition), box-shadow var(--bwt-transition), opacity var(--bwt-transition), border-color var(--bwt-transition);
	display: block;
	flex: 1 1 0;
	min-width: 0;
	min-height: 0;
	padding: 0;
	box-sizing: border-box;
	pointer-events: auto;
}

.bwt-bands--nord .bwt-band,
.bwt-bands--sued .bwt-band {
	flex: 1 1 0;
	height: var(--bwt-band-size);
	min-height: var(--bwt-band-size);
	max-height: var(--bwt-band-size);
	width: auto;
}

.bwt-bands--ost .bwt-band,
.bwt-bands--west .bwt-band {
	flex: 1 1 0;
	width: var(--bwt-band-size);
	min-width: var(--bwt-band-size);
	max-width: var(--bwt-band-size);
	height: auto;
}

.bwt-bands--custom .bwt-band {
	position: absolute;
	flex: none;
}

.bwt-band--available:hover {
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.45);
	z-index: 2;
}

.bwt-band--selected {
	background: var(--bwt-color-band-selected) !important;
	border-color: #d97706;
	box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35);
}

.bwt-band--unavailable {
	background: var(--bwt-color-band-unavailable);
	cursor: not-allowed;
	opacity: 0.55;
}

.bwt-band--special {
	border-style: dashed;
	border-color: #7c3aed;
}

/* Viele Banden: noch engere Segmente, weiterhin in einer Linie */
.bwt-bands--many {
	gap: 1px;
}

.bwt-bands--many .bwt-band {
	border-radius: 1px;
}

/* Tooltip – Position per JS (fixed, viewport-sicher) */
.bwt-band__tooltip {
	position: fixed;
	left: 0;
	top: 0;
	background: #1f2937;
	color: #fff;
	font-size: 0.75rem;
	padding: 6px 10px;
	border-radius: 6px;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--bwt-transition), visibility var(--bwt-transition);
	z-index: 1000;
	pointer-events: none;
}

.bwt-band__tooltip--positioning {
	opacity: 0 !important;
	visibility: hidden !important;
}

.bwt-band__tooltip::after {
	content: "";
	position: absolute;
	border: 5px solid transparent;
}

.bwt-band__tooltip[data-placement="top"]::after {
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border-top-color: #1f2937;
}

.bwt-band__tooltip[data-placement="bottom"]::after {
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	border-bottom-color: #1f2937;
}

.bwt-band__tooltip[data-placement="left"]::after {
	top: 50%;
	left: 100%;
	transform: translateY(-50%);
	border-left-color: #1f2937;
}

.bwt-band__tooltip[data-placement="right"]::after {
	top: 50%;
	right: 100%;
	transform: translateY(-50%);
	border-right-color: #1f2937;
}

.bwt-band:hover .bwt-band__tooltip[data-placement],
.bwt-band:focus-visible .bwt-band__tooltip[data-placement] {
	opacity: 1;
	visibility: visible;
}

/* Legende */
.bwt-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	justify-content: center;
	margin-top: 0.75rem;
	font-size: 0.85rem;
}

.bwt-legend__item {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.bwt-legend__item::before {
	content: "";
	width: 16px;
	height: 16px;
	border-radius: 3px;
}

.bwt-legend__item--available::before {
	background: var(--bwt-color-band-available);
}

.bwt-legend__item--selected::before {
	background: var(--bwt-color-band-selected);
}

.bwt-legend__item--unavailable::before {
	background: var(--bwt-color-band-unavailable);
	opacity: 0.55;
}

.bwt-legend__item--special::before {
	background: transparent;
	border: 2px dashed #7c3aed;
}

.bwt-summary__notice {
	flex: 1 1 100%;
	margin: 0;
	padding: 0.65rem 0.85rem;
	background: #f5f3ff;
	border-left: 3px solid #7c3aed;
	border-radius: 0 6px 6px 0;
	font-size: 0.8rem;
	color: #5b21b6;
	line-height: 1.45;
}

/* Zusammenfassung – unterhalb des Spielfelds */
.bwt-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 1.5rem;
	padding: 1.25rem 0;
	border-top: 1px solid var(--bwt-color-border);
}

.bwt-summary__stats {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 2rem;
	flex: 1;
}

.bwt-summary__item {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.bwt-summary__item--highlight .bwt-summary__value {
	color: var(--bwt-color-primary);
	font-size: 1.25rem;
	font-weight: 700;
}

.bwt-summary__label {
	font-size: 0.8rem;
	color: var(--bwt-color-muted);
}

.bwt-summary__value {
	font-weight: 600;
	font-size: 1rem;
}

.bwt-summary .bwt-btn {
	width: auto;
	margin-top: 0;
	min-width: 160px;
	flex-shrink: 0;
}

/* Buttons */
.bwt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.75rem 1.5rem;
	font-size: 1rem;
	font-weight: 600;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background var(--bwt-transition), transform var(--bwt-transition), opacity var(--bwt-transition);
}

.bwt-btn--primary {
	background: var(--bwt-color-primary);
	color: #fff;
}

.bwt-btn--primary:hover:not(:disabled) {
	background: var(--bwt-color-primary-dark);
}

.bwt-btn--primary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.bwt-btn--secondary {
	background: var(--bwt-color-bg);
	color: var(--bwt-color-text);
	border: 1px solid var(--bwt-color-border);
}

.bwt-btn--secondary:hover {
	background: var(--bwt-color-border);
}

/* Formular */
.bwt-form {
	padding: 1.5rem 0;
}

.bwt-form__selection {
	margin-bottom: 1.5rem;
	padding: 1rem 1.25rem;
	background: var(--bwt-color-bg);
	border-radius: 8px;
	border: 1px solid var(--bwt-color-border);
}

.bwt-form__selection-title {
	margin: 0 0 0.75rem;
	font-size: 1rem;
}

.bwt-form__selection-list {
	margin: 0;
	padding-left: 1.25rem;
	font-size: 0.9rem;
	line-height: 1.6;
}

.bwt-form__selection-list li {
	margin-bottom: 0.25rem;
}

.bwt-form__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.25rem;
}

.bwt-form__field--full {
	grid-column: 1 / -1;
}

.bwt-form__field label {
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
	margin-bottom: 0.4rem;
}

.bwt-form__field input,
.bwt-form__field select,
.bwt-form__field textarea {
	width: 100%;
	padding: 0.65rem 0.85rem;
	font-size: 1rem;
	border: 1px solid var(--bwt-color-border);
	border-radius: 8px;
	background: #fff;
	transition: border-color var(--bwt-transition), box-shadow var(--bwt-transition);
	box-sizing: border-box;
}

.bwt-form__field input:focus,
.bwt-form__field select:focus,
.bwt-form__field textarea:focus {
	outline: none;
	border-color: var(--bwt-color-primary);
	box-shadow: 0 0 0 3px rgba(26, 122, 58, 0.15);
}

.bwt-form__notice {
	margin: 1.25rem 0;
	padding: 0.85rem 1rem;
	background: var(--bwt-color-bg);
	border-left: 3px solid var(--bwt-color-primary);
	border-radius: 0 8px 8px 0;
	font-size: 0.875rem;
	color: var(--bwt-color-muted);
	line-height: 1.5;
}

.bwt-required {
	color: #dc2626;
}

.bwt-form__privacy {
	margin: 1.5rem 0;
	font-size: 0.875rem;
}

.bwt-form__privacy label {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	cursor: pointer;
}

.bwt-form__actions {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
}

.bwt-form__actions .bwt-btn {
	flex: 1;
	min-width: 180px;
}

.bwt-form__message {
	margin-top: 1rem;
	padding: 0.85rem 1rem;
	border-radius: 8px;
	font-size: 0.9rem;
}

.bwt-form__message--error {
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.bwt-form__message--success {
	background: #f0fdf4;
	color: #166534;
	border: 1px solid #bbf7d0;
}

.bwt-honeypot {
	position: absolute;
	left: -9999px;
	height: 0;
	overflow: hidden;
}

/* Erfolgsanzeige */
.bwt-success {
	text-align: center;
	padding: 3rem 2rem;
}

.bwt-success__icon {
	width: 64px;
	height: 64px;
	background: var(--bwt-color-primary);
	color: #fff;
	font-size: 2rem;
	line-height: 64px;
	border-radius: 50%;
	margin: 0 auto 1.5rem;
}

.bwt-success h2 {
	margin: 0 0 0.75rem;
}

.bwt-success p {
	color: var(--bwt-color-muted);
	margin: 0;
}

.bwt-loading .bwt-field {
	opacity: 0.5;
	pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
	.bwt-field--hoch {
		min-height: 340px;
		max-height: none;
	}

	.bwt-field--quer {
		min-height: 260px;
		max-height: none;
	}

	.bwt-summary {
		flex-direction: column;
		align-items: stretch;
	}

	.bwt-summary__stats {
		flex-direction: column;
		gap: 0.75rem;
	}

	.bwt-summary .bwt-btn {
		width: 100%;
	}

	.bwt-form__grid {
		grid-template-columns: 1fr;
	}

	.bwt-form__actions {
		flex-direction: column;
	}

	.bwt-form__actions .bwt-btn {
		width: 100%;
	}

}
