/**
 * KeksWächter – Banner-, Modal- und Floating-Button-Styles.
 */

:root {
	--kw-primary: #1d4ed8;
	--kw-primary-contrast: #ffffff;
	--kw-radius: 12px;
	--kw-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	--kw-bg: #ffffff;
	--kw-fg: #1f2937;
	--kw-muted: #6b7280;
	--kw-border: #e5e7eb;
	--kw-z: 999999;
}

.kw-theme-dark {
	--kw-bg: #111827;
	--kw-fg: #f3f4f6;
	--kw-muted: #9ca3af;
	--kw-border: #374151;
}

#kw-root,
#kw-root * {
	box-sizing: border-box;
}

/* Overlay (optionale Interaktionssperre) */
.kw-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	z-index: calc(var(--kw-z) - 1);
}

/* ------------------------------------------------------------------ */
/* Banner                                                              */
/* ------------------------------------------------------------------ */
.kw-banner {
	position: fixed;
	z-index: var(--kw-z);
	background: var(--kw-bg);
	color: var(--kw-fg);
	border: 1px solid var(--kw-border);
	border-radius: var(--kw-radius);
	box-shadow: var(--kw-shadow);
	padding: 20px 22px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.55;
	animation: kw-fade-in 0.25s ease;
}

@keyframes kw-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Layout: Box (kompakt) */
.kw-layout-box {
	width: 420px;
	max-width: calc(100vw - 32px);
}

/* Layout: Bar (volle Breite) */
.kw-layout-bar {
	left: 16px;
	right: 16px;
	width: auto;
	max-width: 1200px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 24px;
}
.kw-layout-bar .kw-banner__body { flex: 1; }
.kw-layout-bar .kw-banner__actions { flex-shrink: 0; }

/* Layout: Center (mittiges Modal) */
.kw-layout-center {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 520px;
	max-width: calc(100vw - 32px);
}

/* Positionen */
.kw-pos-bottom-left { bottom: 16px; left: 16px; }
.kw-pos-bottom-right { bottom: 16px; right: 16px; }
.kw-pos-bottom-center { bottom: 16px; left: 50%; transform: translateX(-50%); }
.kw-pos-top { top: 16px; left: 50%; transform: translateX(-50%); }
.kw-layout-bar.kw-pos-bottom-left,
.kw-layout-bar.kw-pos-bottom-right,
.kw-layout-bar.kw-pos-bottom-center { bottom: 16px; left: 16px; right: 16px; transform: none; }

.kw-banner__title {
	margin: 0 0 8px;
	font-size: 17px;
	font-weight: 700;
}
.kw-banner__message { margin: 0 0 8px; color: var(--kw-fg); }
.kw-banner__message p { margin: 0 0 8px; }
.kw-banner__links { margin: 4px 0 0; font-size: 13px; }
.kw-banner__links a { color: var(--kw-primary); margin-right: 14px; }

.kw-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 16px;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
.kw-btn {
	appearance: none;
	border: 1px solid transparent;
	border-radius: 8px;
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: filter 0.15s ease, background 0.15s ease;
	font-family: inherit;
}
.kw-btn--primary { background: var(--kw-primary); color: var(--kw-primary-contrast); }
.kw-btn--primary:hover { filter: brightness(1.08); }
.kw-btn--secondary { background: transparent; color: var(--kw-fg); border-color: var(--kw-border); }
.kw-btn--secondary:hover { background: rgba(125, 125, 125, 0.1); }
.kw-btn--ghost { background: transparent; color: var(--kw-primary); text-decoration: underline; }
.kw-btn:focus-visible { outline: 3px solid var(--kw-primary); outline-offset: 2px; }

/* ------------------------------------------------------------------ */
/* Modal                                                               */
/* ------------------------------------------------------------------ */
.kw-modal {
	position: fixed;
	inset: 0;
	z-index: calc(var(--kw-z) + 1);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.kw-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.6);
}
.kw-modal__dialog {
	position: relative;
	background: var(--kw-bg);
	color: var(--kw-fg);
	border-radius: var(--kw-radius);
	box-shadow: var(--kw-shadow);
	width: 640px;
	max-width: 100%;
	max-height: 90vh;
	overflow: auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
}
.kw-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 22px;
	border-bottom: 1px solid var(--kw-border);
}
.kw-modal__header h2 { margin: 0; font-size: 18px; }
.kw-modal__close {
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: var(--kw-muted);
}
.kw-modal__intro { padding: 16px 22px; color: var(--kw-muted); }
.kw-modal__intro p { margin: 0 0 8px; }
.kw-modal__categories { padding: 0 22px; }
.kw-modal__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
	padding: 18px 22px;
	border-top: 1px solid var(--kw-border);
	position: sticky;
	bottom: 0;
	background: var(--kw-bg);
}

/* ------------------------------------------------------------------ */
/* Kategorien                                                          */
/* ------------------------------------------------------------------ */
.kw-category {
	border: 1px solid var(--kw-border);
	border-radius: 10px;
	margin-bottom: 12px;
	overflow: hidden;
}
.kw-category__head {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
}
.kw-category__toggle {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 10px;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 15px;
	font-weight: 600;
	color: var(--kw-fg);
	text-align: left;
	font-family: inherit;
}
.kw-category__badge {
	font-size: 11px;
	font-weight: 600;
	color: var(--kw-muted);
	background: rgba(125, 125, 125, 0.12);
	padding: 2px 8px;
	border-radius: 999px;
}
.kw-category__chevron { margin-left: auto; color: var(--kw-muted); transition: transform 0.2s; }
.kw-category__toggle[aria-expanded="true"] .kw-category__chevron { transform: rotate(180deg); }
.kw-category__detail {
	padding: 0 16px 16px 16px;
	color: var(--kw-muted);
	font-size: 13px;
}
.kw-category__cookies {
	width: 100%;
	border-collapse: collapse;
	margin-top: 10px;
	font-size: 12px;
}
.kw-category__cookies th,
.kw-category__cookies td {
	text-align: left;
	padding: 6px 8px;
	border-bottom: 1px solid var(--kw-border);
}

/* Toggle-Switch */
.kw-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.kw-switch input { opacity: 0; width: 0; height: 0; }
.kw-switch__slider {
	position: absolute;
	cursor: pointer;
	inset: 0;
	background: #cbd5e1;
	border-radius: 999px;
	transition: 0.2s;
}
.kw-switch__slider::before {
	content: "";
	position: absolute;
	height: 18px;
	width: 18px;
	left: 3px;
	bottom: 3px;
	background: #fff;
	border-radius: 50%;
	transition: 0.2s;
}
.kw-switch input:checked + .kw-switch__slider { background: var(--kw-primary); }
.kw-switch input:checked + .kw-switch__slider::before { transform: translateX(20px); }
.kw-switch input:disabled + .kw-switch__slider { opacity: 0.6; cursor: not-allowed; }

/* ------------------------------------------------------------------ */
/* Floating-Button                                                     */
/* ------------------------------------------------------------------ */
.kw-floating {
	position: fixed;
	bottom: 18px;
	left: 18px;
	z-index: calc(var(--kw-z) - 2);
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: none;
	background: var(--kw-primary);
	color: var(--kw-primary-contrast);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.kw-floating:hover { filter: brightness(1.08); }

/* ------------------------------------------------------------------ */
/* Cookie-Erklärung (Shortcode)                                        */
/* ------------------------------------------------------------------ */
.kw-cookie-declaration { font-size: 14px; }
.kw-decl-heading { margin-top: 24px; }
.kw-decl-table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; }
.kw-decl-table th,
.kw-decl-table td { text-align: left; padding: 8px 10px; border: 1px solid var(--kw-border); vertical-align: top; }
.kw-decl-table th { background: rgba(125, 125, 125, 0.08); }
.kw-decl-meta { font-size: 12px; color: var(--kw-muted); }

/* ------------------------------------------------------------------ */
/* Content-Blocker: „Klick zum Laden"-Platzhalter für iframes          */
/* ------------------------------------------------------------------ */
.kw-embed {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 220px;
	width: 100%;
	padding: 24px;
	box-sizing: border-box;
	background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
	color: #f9fafb;
	border-radius: 10px;
	text-align: center;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.kw-embed__inner { max-width: 460px; }
.kw-embed__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	margin-bottom: 12px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}
.kw-embed__title { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.kw-embed__text { margin: 0 0 16px; font-size: 13px; line-height: 1.5; color: #d1d5db; }
.kw-embed .kw-btn--primary {
	background: var(--kw-primary);
	color: var(--kw-primary-contrast);
	border: none;
	border-radius: 8px;
	padding: 10px 20px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}
.kw-embed .kw-btn--primary:hover { filter: brightness(1.08); }
.kw-embed__always {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 14px;
	font-size: 12px;
	color: #d1d5db;
	cursor: pointer;
}

/* Consent-Gate: transparenter Wrapper, damit der Inhalt nach Freigabe
   ohne zusätzliches Layout-Element erscheint. */
.kw-gate-content { display: contents; }

/* Responsive */
@media (max-width: 600px) {
	.kw-layout-box,
	.kw-layout-center { width: calc(100vw - 24px); left: 12px; right: 12px; transform: none; bottom: 12px; top: auto; }
	.kw-layout-bar { flex-direction: column; align-items: stretch; }
	.kw-banner__actions .kw-btn { flex: 1; }
	.kw-embed { min-height: 180px; }
}

/* ================================================================== */
/* Design-Presets (Stil)                                              */
/* ================================================================== */

/* Modern (Standard) */
#kw-root.kw-style-modern { --kw-radius: 14px; --kw-shadow: 0 10px 34px rgba(0, 0, 0, 0.14); }

/* Glas / Glassmorphism – durchscheinend + Hintergrund-Blur */
#kw-root.kw-style-glass { --kw-radius: 18px; --kw-shadow: 0 16px 50px rgba(0, 0, 0, 0.18); }
#kw-root.kw-style-glass .kw-banner,
#kw-root.kw-style-glass .kw-modal__dialog {
	background: var(--kw-bg); /* Fallback für Browser ohne color-mix */
	background: color-mix(in srgb, var(--kw-bg) 70%, transparent);
	-webkit-backdrop-filter: blur(16px) saturate(1.5);
	backdrop-filter: blur(16px) saturate(1.5);
	border: 1px solid rgba(255, 255, 255, 0.28);
}
#kw-root.kw-style-glass .kw-overlay { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

/* Soft – große, weiche Rundungen, kein Rahmen */
#kw-root.kw-style-soft { --kw-radius: 22px; --kw-shadow: 0 18px 44px rgba(17, 24, 39, 0.16); --kw-border: transparent; }
#kw-root.kw-style-soft .kw-banner,
#kw-root.kw-style-soft .kw-modal__dialog { border: none; }

/* Minimal – flach, dünner Rahmen, kaum Schatten */
#kw-root.kw-style-minimal { --kw-radius: 4px; --kw-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
#kw-root.kw-style-minimal .kw-banner,
#kw-root.kw-style-minimal .kw-modal__dialog { border: 1px solid var(--kw-border); }

/* Solid – kräftig, mit Akzentkante */
#kw-root.kw-style-solid { --kw-radius: 12px; --kw-shadow: 0 14px 40px rgba(0, 0, 0, 0.22); }
#kw-root.kw-style-solid .kw-banner { border-top: 4px solid var(--kw-primary); }

/* ================================================================== */
/* Button-Formen                                                      */
/* ================================================================== */
#kw-root.kw-btns-rounded .kw-btn { border-radius: 10px; }
#kw-root.kw-btns-pill .kw-btn { border-radius: 999px; }
#kw-root.kw-btns-square .kw-btn { border-radius: 0; }

/* ================================================================== */
/* Schriftarten                                                       */
/* ================================================================== */
#kw-root.kw-font-system .kw-banner, #kw-root.kw-font-system .kw-modal__dialog { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
#kw-root.kw-font-sans .kw-banner, #kw-root.kw-font-sans .kw-modal__dialog { font-family: "Helvetica Neue", Arial, "Liberation Sans", sans-serif; }
#kw-root.kw-font-serif .kw-banner, #kw-root.kw-font-serif .kw-modal__dialog { font-family: Georgia, "Times New Roman", "Liberation Serif", serif; }
#kw-root.kw-font-rounded .kw-banner, #kw-root.kw-font-rounded .kw-modal__dialog { font-family: "Segoe UI", "Trebuchet MS", Avenir, "Century Gothic", system-ui, sans-serif; }

/* ================================================================== */
/* Einblend-Animationen (ease-out, 240–300ms)                         */
/* ================================================================== */
@keyframes kw-slide-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes kw-zoom { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

.kw-anim-fade .kw-banner { animation: kw-fade-in 0.26s ease-out; }
.kw-anim-slide .kw-banner { animation: kw-slide-up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.kw-anim-zoom .kw-banner { animation: kw-zoom 0.24s ease-out; }
.kw-anim-none .kw-banner { animation: none; }

/* Modal erscheint dezent (außer „keine Animation") */
.kw-modal__dialog { animation: kw-zoom 0.2s ease-out; }
.kw-anim-none .kw-modal__dialog { animation: none; }

/* Barrierefreiheit: reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
	#kw-root, #kw-root * { animation: none !important; transition: none !important; }
}

/* ================================================================== */
/* Granulare Dienste (im Einstellungs-Modal)                          */
/* ================================================================== */
.kw-services { list-style: none; margin: 6px 0 10px; padding: 0; border-top: 1px solid var(--kw-border); }
.kw-service { display: flex; align-items: flex-start; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--kw-border); }
.kw-service__info { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.kw-service__name { font-weight: 600; color: var(--kw-fg); }
.kw-service__provider { font-size: 11px; color: var(--kw-muted); }
.kw-service__desc { font-size: 12px; color: var(--kw-muted); }
.kw-switch--sm { width: 38px; height: 21px; flex-shrink: 0; margin-top: 2px; }
.kw-switch--sm .kw-switch__slider::before { height: 15px; width: 15px; }
.kw-switch--sm input:checked + .kw-switch__slider::before { transform: translateX(17px); }
