/* =============================================================================
   WW Contact Finder – Frontend CSS
   WCAG 2.1 AA: Kontrastverhältnis ≥ 4.5:1, Fokusindikatoren, responsive

   Spezifitätsstrategie:
   Alle Card-internen Selektoren werden mit .ww-cf-card als Parent-Klasse
   verschachtelt, um Elementor-Basisstyles zuverlässig zu überschreiben.
   ============================================================================= */

/* ── Custom Properties ─────────────────────────────────────────────────────── */
.ww-cf-finder {
	--ww-cf-primary:        #1a4a8a;
	--ww-cf-primary-hover:  #153d73;
	--ww-cf-border:         #d0d5dd;
	--ww-cf-bg-card:        #ffffff;
	--ww-cf-bg-csm:         #eef3fa;
	--ww-cf-text:           #1a1a1a;       /* Kontrast auf Weiß: 16.1:1 ✓ */
	--ww-cf-text-muted:     #555e6b;       /* Kontrast auf Weiß: 5.7:1  ✓ */
	--ww-cf-csm-title:      #1a4a8a;       /* Kontrast auf #eef3fa: 7.2:1 ✓ */
	--ww-cf-error:          #c0392b;
	--ww-cf-radius:         10px;
	--ww-cf-radius-img:     10px 10px 0 0;
	--ww-cf-shadow:         0 2px 16px rgba(0,0,0,.09);
	--ww-cf-gap:            1.5rem;
	--ww-cf-font-size-base: 18px;

	font-family: inherit;
	color: var(--ww-cf-text);
}

/* ── Suchformular ──────────────────────────────────────────────────────────── */
.ww-cf-finder__title {
	margin-bottom: 1rem;
}

.ww-cf-finder__form-wrap {
	display: block;
	margin-bottom: var(--ww-cf-gap);
}

.ww-cf-finder__label {
	display: block;
	font-weight: 600;
	margin-bottom: .4rem;
}

.ww-cf-finder__input-row {
	display: flex;
	gap: .5rem;
	flex-wrap: wrap;
}

.ww-cf-finder__input {
	flex: 0 0 12rem;
	max-width: 100%;
	padding: .6rem .8rem;
	font-size: 1rem;
	border: 2px solid var(--ww-cf-border);
	border-radius: var(--ww-cf-radius);
	outline: none;
	transition: border-color .2s;
	color: var(--ww-cf-text);
}

.ww-cf-finder__input:focus {
	border-color: var(--ww-cf-primary);
	box-shadow: 0 0 0 3px rgba(26,74,138,.25);
}

.ww-cf-finder__input[aria-invalid="true"] {
	border-color: var(--ww-cf-error);
}

.ww-cf-finder__btn {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	padding: .6rem 1.4rem;
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
	background: var(--ww-cf-primary);
	border: none;
	border-radius: var(--ww-cf-radius);
	cursor: pointer;
	transition: background .2s;
}

.ww-cf-finder__btn:hover {
	background: var(--ww-cf-primary-hover);
}

.ww-cf-finder__btn:focus-visible {
	outline: 3px solid var(--ww-cf-primary);
	outline-offset: 2px;
}

.ww-cf-finder__btn:disabled {
	opacity: .65;
	cursor: not-allowed;
}

.ww-cf-finder__btn-spinner {
	width: 1rem;
	height: 1rem;
	border: 2px solid rgba(255,255,255,.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ww-cf-spin .7s linear infinite;
}

@keyframes ww-cf-spin {
	to { transform: rotate(360deg); }
}

.ww-cf-finder__hint {
	margin: .3rem 0 0;
	font-size: 1rem;
	color: var(--ww-cf-text-muted);
}

.ww-cf-finder__error {
	margin: .3rem 0 0;
	font-size: 1rem;
	color: var(--ww-cf-error);
	font-weight: 600;
}

/* ── Ergebnis-Fallback ─────────────────────────────────────────────────────── */
.ww-cf-finder__fallback {
	padding: 1rem 1.25rem;
	background: #fef9e7;
	border-left: 4px solid #e6a817;
	border-radius: var(--ww-cf-radius);
	color: var(--ww-cf-text);
}

/* ── Grid: 4 Spalten → 2 Spalten (Tablet) → 1 Spalte (Mobil) ──────────────── */
.ww-cf-grid {
	display: grid;
	grid-template-columns: repeat( 4, 1fr );
	gap: var(--ww-cf-gap);
}

@media ( max-width: 1024px ) {
	.ww-cf-grid {
		grid-template-columns: repeat( 2, 1fr );
	}
}

@media ( max-width: 600px ) {
	.ww-cf-grid {
		grid-template-columns: 1fr;
	}
}

/* ── ADM-Karte ─────────────────────────────────────────────────────────────── */
.ww-cf-card {
	font-size: var(--ww-cf-font-size-base);
	background: var(--ww-cf-bg-card);
	border: 1px solid var(--ww-cf-border);
	border-radius: var(--ww-cf-radius);
	box-shadow: var(--ww-cf-shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	color: var(--ww-cf-text);
}

.ww-cf-card:focus {
	outline: 3px solid var(--ww-cf-primary);
	outline-offset: 2px;
}

/* ── Foto ──────────────────────────────────────────────────────────────────── */
.ww-cf-card .ww-cf-card__photo {
	width: 100%;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	border-radius: var(--ww-cf-radius-img);
	position: relative;
}

.ww-cf-card .ww-cf-card__photo img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
	display: block;
	max-width: none; /* Elementor setzt oft max-width:100% – hier überschreiben */
}

/* ── Karteninhalt ──────────────────────────────────────────────────────────── */
.ww-cf-card .ww-cf-card__body {
	padding: .833em 1em;
}

.ww-cf-card .ww-cf-card__name {
	font-size: 1em;
	font-weight: 700;
	margin: 0 0 .167em;
	color: var(--ww-cf-text);       /* #1a1a1a auf Weiß: 16.1:1 ✓ */
	line-height: 1.3;
}

.ww-cf-card .ww-cf-card__position {
	font-size: 1em;
	color: var(--ww-cf-text-muted); /* #555e6b auf Weiß: 5.7:1 ✓ */
	margin: 0 0 .667em;
	line-height: 1.4;
}

/* ── Kontaktliste ──────────────────────────────────────────────────────────── */
.ww-cf-card .ww-cf-contact-list {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 1em;
	display: flex;
	flex-direction: column;
	gap: .333em;
}

.ww-cf-card .ww-cf-contact-list a {
	color: var(--ww-cf-primary);    /* #1a4a8a auf Weiß: 7.8:1 ✓ */
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	transition: border-color .2s;
}

.ww-cf-card .ww-cf-contact-list a:hover {
	border-color: transparent;
}

.ww-cf-card .ww-cf-contact-list a:focus-visible {
	outline: 2px solid var(--ww-cf-primary);
	outline-offset: 2px;
	border-radius: 2px;
	border-bottom-color: transparent;
}

.ww-cf-card .ww-cf-contact-list__label {
	color: var(--ww-cf-text-muted); /* #555e6b auf Weiß: 5.7:1 ✓ */
	font-size: 1em;
}

/* ── CSM-Bereich ───────────────────────────────────────────────────────────── */
.ww-cf-card .ww-cf-card__csm {
	background: var(--ww-cf-bg-csm);
	border-top: 1px solid var(--ww-cf-border);
	padding: .833em 1em;
}

.ww-cf-card .ww-cf-card__csm-title {
	font-size: 1em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--ww-cf-csm-title);  /* #1a4a8a auf #eef3fa: 7.2:1 ✓ */
	margin: 0 0 .5em;
}

.ww-cf-card .ww-cf-csm-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: .667em;
}

.ww-cf-card .ww-cf-csm-item {
	display: flex;
	flex-direction: column;
	gap: .111em;
}

.ww-cf-card .ww-cf-csm-item__name {
	font-size: 1em;
	font-weight: 600;
	color: var(--ww-cf-text);       /* #1a1a1a auf #eef3fa: 14.9:1 ✓ */
}

.ww-cf-card .ww-cf-csm-item__pos {
	font-size: 1em;
	color: var(--ww-cf-text-muted); /* #555e6b auf #eef3fa: 5.3:1 ✓ */
}

/* Links im CSM-Bereich */
.ww-cf-card .ww-cf-card__csm .ww-cf-contact-list a {
	color: var(--ww-cf-primary);    /* #1a4a8a auf #eef3fa: 7.2:1 ✓ */
}

.ww-cf-card .ww-cf-contact-list--compact {
	margin-top: .333em;
}

/* ── Verzeichnis ───────────────────────────────────────────────────────────── */
.ww-cf-directory__count {
	margin: 0 0 var(--ww-cf-gap);
	font-size: 1rem;
	color: var(--ww-cf-text-muted);
}

.ww-cf-directory__search-info {
	margin: 0 0 var(--ww-cf-gap);
	font-size: 1rem;
	color: var(--ww-cf-text-muted);
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: .5rem;
}

.ww-cf-directory__reset,
.ww-cf-directory__reset-btn {
	color: var(--ww-cf-primary);
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	border-top: none;
	border-left: none;
	border-right: none;
	transition: border-color .2s;
	background: none;
	padding: 0;
	cursor: pointer;
	font-size: inherit;
	font-family: inherit;
}

.ww-cf-directory__reset:hover,
.ww-cf-directory__reset-btn:hover {
	border-bottom-color: transparent;
}

/* ── Paginierung ───────────────────────────────────────────────────────────── */
.ww-cf-pagination {
	margin-top: calc( var(--ww-cf-gap) * 1.5 );
}

.ww-cf-pagination .page-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.ww-cf-pagination .page-numbers li {
	margin: 0;
}

.ww-cf-pagination .page-numbers a,
.ww-cf-pagination .page-numbers span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	height: 2.5rem;
	padding: 0 .75rem;
	font-size: 1rem;
	border-radius: var(--ww-cf-radius);
	border: 1px solid var(--ww-cf-border);
	text-decoration: none;
	color: var(--ww-cf-primary);
	background: #fff;
	transition: background .15s, color .15s, border-color .15s;
	white-space: nowrap;
}

.ww-cf-pagination .page-numbers a:hover {
	background: var(--ww-cf-primary);
	color: #fff;
	border-color: var(--ww-cf-primary);
}

.ww-cf-pagination .page-numbers .current {
	background: var(--ww-cf-primary);
	color: #fff;
	border-color: var(--ww-cf-primary);
	font-weight: 700;
}

.ww-cf-pagination .page-numbers .dots {
	border-color: transparent;
	background: transparent;
	color: var(--ww-cf-text-muted);
	cursor: default;
}

.ww-cf-pagination .page-numbers a:focus-visible {
	outline: 3px solid var(--ww-cf-primary);
	outline-offset: 2px;
}

/* ── Responsive: Formular ──────────────────────────────────────────────────── */
@media ( max-width: 600px ) {
	.ww-cf-finder__input {
		flex: 1 0 auto;
	}

	.ww-cf-finder__btn {
		width: 100%;
		justify-content: center;
	}

	.ww-cf-finder__input-row {
		flex-direction: column;
	}
}

/* ── Reduced Motion ────────────────────────────────────────────────────────── */
@media ( prefers-reduced-motion: reduce ) {
	.ww-cf-finder__btn-spinner {
		animation: none;
		border-top-color: rgba(255,255,255,.8);
	}

	.ww-cf-card .ww-cf-contact-list a {
		transition: none;
	}
}

/* ── High Contrast Mode ────────────────────────────────────────────────────── */
@media ( forced-colors: active ) {
	.ww-cf-card {
		border: 2px solid ButtonText;
	}
	.ww-cf-finder__btn {
		border: 2px solid ButtonText;
	}
	.ww-cf-card .ww-cf-contact-list a {
		border-bottom: 1px solid ButtonText;
	}
}
