/* ProSwim Aktionsbanner
   Desktop (> 800px): schmale Leiste oben, Header rutscht darunter.
   Mobil (<= 800px): Sheet, das unten einfährt. */

:root {
	--pswa-h: 44px;
	--pswa-bg: #0c1626;
	--pswa-fg: #fff;
	--pswa-muted: rgba(255, 255, 255, .7);
	--pswa-accent: #b3ddff;
	--pswa-blue: #004f9f;
	--pswa-admin: var(--wp-admin--admin-bar--height, 0px);
}

.pswa {
	font-family: "Source Sans 3", Helvetica, sans-serif;
	background: var(--pswa-bg);
	color: var(--pswa-fg);
	z-index: 240; /* über dem Header (100), unter Overlay/Seitenmenü (250/300) */
	line-height: 1.3;
}

.pswa a {
	color: inherit;
	text-decoration: none;
}

.pswa__titel {
	font-family: "Montserrat", sans-serif;
	font-weight: 700;
	letter-spacing: .02em;
	text-transform: uppercase;
}

.pswa__text:hover,
.pswa__titel:hover {
	text-decoration: underline;
}

/* Code-Button (Banner und Detailseite) */
.pswa-code {
	display: inline-flex;
	align-items: center;
	gap: .4em;
	padding: .3em 1em;
	border: 0;
	border-radius: 20px; /* wie die Buttons der Seite */
	background: var(--pswa-accent);
	color: var(--pswa-blue);
	font: inherit;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color .3s ease-out, color .3s ease-out;
}

.pswa-code:hover,
.pswa-code:focus-visible {
	background: var(--pswa-blue);
	color: #fff;
}

.pswa-code__label {
	font-weight: 400;
}

.pswa-code__value {
	font-weight: 700;
	letter-spacing: .04em;
}

.pswa-code__icon {
	width: 1em;
	height: 1em;
}

.pswa-code.is-copied .pswa-code__icon {
	display: none;
}

/* Countdown */
.pswa-countdown {
	display: inline-flex;
	gap: .5em;
	font-variant-numeric: tabular-nums;
}

.pswa-countdown__block {
	display: inline-flex;
	flex-shrink: 0;
	white-space: nowrap;
	align-items: baseline;
	gap: .1em;
}

.pswa-countdown__num {
	font-family: "Montserrat", sans-serif;
	font-weight: 700;
}

.pswa-countdown__label {
	font-size: .75em;
	opacity: .7;
}

/* Button mit Pfeil */
.pswa__btn {
	display: inline-flex;
	align-items: center;
	gap: .3em;
	padding: .3em 1em;
	border-radius: 20px;
	background: transparent;
	border: 1px solid rgba(255, 255, 255, .5);
	color: var(--pswa-fg) !important;
	font-weight: 700;
	white-space: nowrap;
	transition: background-color .3s ease-out, color .3s ease-out, border-color .3s ease-out;
}

.pswa__btn:hover,
.pswa__btn:focus-visible {
	background: var(--pswa-accent);
	border-color: var(--pswa-accent);
	color: var(--pswa-blue) !important;
}

.pswa__btn svg {
	width: 1em;
	height: 1em;
}

.pswa__close {
	display: none;
	background: none;
	border: 0;
	color: inherit;
	cursor: pointer;
	padding: 8px;
	line-height: 0;
}

.pswa__close svg {
	width: 14px;
	height: 14px;
}

.pswa__aktion {
	display: inline-flex;
	align-items: center;
	gap: 1em;
}

.pswa :focus-visible {
	outline: 2px solid var(--pswa-accent);
	outline-offset: 2px;
}

/* ---------- Desktop: Leiste oben ---------- */
@media screen and (min-width: 801px) {
	.pswa {
		position: fixed;
		top: var(--pswa-admin);
		left: 0;
		right: 0;
		height: var(--pswa-h);
		font-size: 15px;
	}

	.pswa__inner {
		height: 100%;
		max-width: calc(100% - 4rem);
		width: 1200px;
		margin: auto;
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 1.25em;
	}

	.pswa__text {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		min-width: 0;
	}

	body.pswa-on #site-header {
		top: calc(var(--pswa-admin) + var(--pswa-h));
	}

	body.pswa-on .header-spacer {
		margin-top: var(--pswa-h);
	}
}

/* Bei schmalen Desktops Text kürzen, damit alles in eine Zeile passt */
@media screen and (min-width: 801px) and (max-width: 1100px) {
	.pswa-countdown__block:last-child {
		display: none;
	}
	.pswa-code__label {
		display: none;
	}
}

/* ---------- Mobil: Sheet unten ---------- */
@media screen and (max-width: 800px) {
	.pswa {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		border-radius: 18px 18px 0 0;
		box-shadow: 0 -6px 24px rgba(0, 0, 0, .2);
		padding: 1.4em 1.25em calc(1.1em + env(safe-area-inset-bottom, 0px));
		font-size: 16px;
		text-align: center;
		transform: translateY(110%);
		transition: transform .45s cubic-bezier(.2, .8, .2, 1);
	}

	.pswa.is-open {
		transform: translateY(0);
	}

	.pswa__inner {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: .55em;
	}

	.pswa__titel {
		font-size: 1.15em;
		padding: 0 2em;
	}

	.pswa__text {
		padding: 0 .5em;
	}

	.pswa__close {
		display: block;
		position: absolute;
		top: 8px;
		right: 8px;
	}

	.pswa__aktion {
		margin-top: .2em;
	}

	.pswa-countdown {
		font-size: 1.1em;
	}


	body.pswa-closed .pswa,
	body.pswa-no-sheet .pswa {
		display: none;
	}

	/* Chat-Button (KI-Assistent, falls installiert) über das Sheet schieben */
	.epc {
		transition: transform .45s cubic-bezier(.2, .8, .2, 1);
	}

	body.pswa-sheet-open .epc {
		transform: translateY(calc(-1 * var(--pswa-sheet-h, 0px)));
	}
}

@media (prefers-reduced-motion: reduce) {
	.pswa {
		transition: none;
	}
}

/* ---------- Detailseite: [proswim_aktion] ---------- */
.pswa-box {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: .75em;
	margin: 1.5em 0;
	padding: 1.25em;
	border-radius: 14px;
	background: var(--pswa-bg);
	color: var(--pswa-fg);
}

.pswa-box p {
	margin: 0;
}

.pswa-box .pswa-code {
	font-size: 1.1em;
	max-width: 100%;
}

.pswa-box .pswa-countdown {
	font-size: 1.15em;
}

.pswa-box--vorbei {
	background: #eceff1;
	color: #333;
}

/* Code-Box im Titelbild (Cover-Block) der Detailseite */
.wp-block-cover .pswa-box {
	background: rgba(255, 255, 255, .12);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, .2);
	max-width: 520px;
}

.wp-block-cover:has(.pswa-box) .wp-block-cover__inner-container {
	min-width: 0;
}

@media screen and (max-width: 600px) {
	.pswa-box {
		padding: 1em;
	}
	.pswa-box .pswa-code {
		font-size: 1em;
	}
	.pswa-box .pswa-code__label {
		display: none;
	}
	.pswa-box .pswa-countdown {
		font-size: 1em;
		flex-wrap: wrap;
	}
}

.wp-block-cover .pswa-box {
	font-size: .9em;
	padding: 1.1em 1.25em;
}

/* ---------- Detailseite: [proswim_aktion stil="schlicht"] ---------- */
.pswa-schlicht {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: .6em;
	margin-top: 1.5em;
}

.pswa-schlicht .pswa-code {
	font-size: 1.1em;
}

.pswa-schlicht__hinweis {
	margin: 0;
	font-size: .85em;
	opacity: .7;
}

.pswa-schlicht .pswa-countdown {
	font-size: 1.15em;
}

.pswa-schlicht {
	min-width: 0;
	max-width: 100%;
}

@media screen and (max-width: 600px) {
	.pswa-schlicht .pswa-code,
	.pswa-schlicht .pswa-countdown {
		font-size: 1em;
	}
	.pswa-schlicht .pswa-countdown {
		flex-wrap: wrap;
	}
}
