/**
 * Frontend-Styles für Pfefferminzia ID Profile.
 */

/* ── Formular-Layout (Flex-Wrap) ─────────────────────────────────── */
.pmz-profile-form {
	display: flex;
	flex-wrap: wrap;
	gap: 20px 0;
	--pmz-field-gutter: 10px;
}

.pmz-profile-field {
	box-sizing: border-box;
	padding: 0 var(--pmz-field-gutter);
}

/* Erzwungener Zeilenumbruch (über Admin-Einstellung pro Feld) */
.pmz-profile-flex-break {
	flex-basis: 100%;
	height: 0;
}

/* Abschnitts-Überschriften immer volle Breite */
.pmz-profile-form h3,
.pmz-profile-form h4 {
	flex: 0 0 100%;
	padding: 0 var(--pmz-field-gutter);
	box-sizing: border-box;
}

/* ── Floating Labels (Text-Inputs) ───────────────────────────────── */
.pmz-profile-field--floating {
	position: relative;
	/* Custom Properties für synchrone Positionierung von Input-Text und Label.
	   --pmz-input-padding: horizontales Padding im Input.
	   --pmz-input-border:  Breite des Input-Borders.
	   Label-left = field-gutter + border + padding, damit das Label exakt
	   über dem Eingabetext steht. Das field-gutter muss eingerechnet werden,
	   weil position:absolute vom Padding-Box-Rand misst (= vor dem Padding). */
	--pmz-input-padding: 12px;
	--pmz-input-border: 1px;
}

.pmz-profile-field--floating .pmz-profile-input {
	width: 100%;
	padding: 22px var(--pmz-input-padding) 8px;
	font-size: 16px;
	line-height: 1.4;
	border: var(--pmz-input-border) solid #ccc;
	border-radius: 4px;
	background-color: #fff;
	box-sizing: border-box;
	transition: border-color 0.2s ease;
}

.pmz-profile-field--floating .pmz-profile-input:focus {
	border-color: #0073aa;
	outline: none;
}

/* Label: Standardposition (Feld ist leer, kein Fokus).
   left = field-gutter + border + padding, identisch mit dem Text-Start im Input. */
.pmz-profile-field--floating .pmz-profile-label {
	position: absolute;
	left: calc(var(--pmz-field-gutter) + var(--pmz-input-border) + var(--pmz-input-padding));
	top: 50%;
	transform: translateY(-50%);
	font-size: 16px;
	color: #555;
	pointer-events: none;
	transition: all 0.2s ease;
	transform-origin: left top;
}

/* Label: Verkleinert (Feld hat Fokus ODER Wert) */
.pmz-profile-field--floating .pmz-profile-input:focus + .pmz-profile-label,
.pmz-profile-field--floating .pmz-profile-input:not(:placeholder-shown) + .pmz-profile-label {
	top: 6px;
	transform: translateY(0);
	font-size: 10px;
	color: #888;
}

/* Fokus-Farbe für Label */
.pmz-profile-field--floating .pmz-profile-input:focus + .pmz-profile-label {
	color: #0073aa;
}

/* ── Select-Box (Array-Traits mit Schema-Optionen) ──────────────── */
.pmz-profile-field--floating .pmz-profile-input--select {
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
	/* Pfeil-Icon als Hintergrund (CSS-only Dropdown-Indikator) */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 12px;
	padding-right: 36px;
}

/* Label bei Select immer in der verkleinerten Position,
   da <select> keinen :placeholder-shown-Trick unterstützt. */
.pmz-profile-field--floating .pmz-profile-input--select + .pmz-profile-label {
	top: 6px;
	transform: translateY(0);
	font-size: 10px;
	color: #888;
}

.pmz-profile-field--floating .pmz-profile-input--select:focus + .pmz-profile-label {
	color: #0073aa;
}

/* ── Pflichtfeld-Kennzeichnung (rotes Sternchen) ─────────────────── */
.pmz-profile-required {
	color: #dc2626;
	font-weight: 600;
}

/* ── Pflichtfeld-Validation (nach erstem Submit-Versuch) ─────────── */
/* Roter Border erst NACH dem ersten Submit-Versuch, nicht sofort
   beim Seitenaufruf. Die CSS-Klasse wird per JS gesetzt. */
.pmz-profile-form--validated .pmz-profile-input:invalid {
	border-color: #dc2626;
}

.pmz-profile-form--validated .pmz-profile-input:invalid:focus {
	border-color: #dc2626;
	box-shadow: 0 0 0 1px #dc2626;
}

/* Label-Farbe bei invalidem Feld (nach Validation) */
.pmz-profile-form--validated .pmz-profile-input:invalid + .pmz-profile-label {
	color: #dc2626;
}

/* ── Read-only-Felder ────────────────────────────────────────────── */
.pmz-profile-field--floating .pmz-profile-input[readonly] {
	color: #666;
	background-color: transparent;
	cursor: default;
}

.pmz-profile-field--floating .pmz-profile-input[readonly]:focus {
	outline: none;
	box-shadow: none;
	border-color: #ccc;
}

/* Read-only: Label bleibt oben (kein Fokus-Farbe) */
.pmz-profile-field--floating .pmz-profile-input[readonly]:focus + .pmz-profile-label {
	color: #888;
}

/* ── Checkbox-Felder ─────────────────────────────────────────────── */
.pmz-profile-field--checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
}

.pmz-profile-field--checkbox label {
	cursor: pointer;
	user-select: none;
}

.pmz-profile-field--checkbox .pmz-profile-input {
	margin: 0;
	flex-shrink: 0;
}

/* ── Responsive: Alle Felder einspaltig auf schmalen Viewports ──── */
@media (max-width: 600px) {
	.pmz-profile-field {
		flex: 0 0 100% !important;
	}
}

/* ── Abschnitts-Überschriften ────────────────────────────────────── */
.pmz-profile-section-group {
	margin-top: 2em;
	margin-bottom: 0.5em;
	padding-bottom: 0.3em;
	border-bottom: 2px solid #ccc;
}

/* Erste Überschrift: Reduzierter Abstand nach oben.
   :first-of-type statt :first-child, weil vor dem h3 versteckte
   Inputs liegen (Nonce, Flow-ID etc.), die im DOM Kinder sind. */
.pmz-profile-form h3.pmz-profile-section-group:first-of-type {
	margin-top: 24px;
}

.pmz-profile-section-subgroup {
	margin-top: 1.5em;
	margin-bottom: 0.5em;
	padding-bottom: 0.25em;
	border-bottom: 1px solid #ddd;
}

/* h4 direkt nach h3: Weniger Abstand, da die h3 schon visuell trennt. */
.pmz-profile-form h3.pmz-profile-section-group + h4.pmz-profile-section-subgroup {
	margin-top: 24px;
}

/* ── Passwort-Hinweistext ────────────────────────────────────────── */
.pmz-profile-password-hint {
	flex: 0 0 100%;
	padding: 0 var(--pmz-field-gutter);
	box-sizing: border-box;
	margin: 0 0 0.25em;
	color: #555;
}

/* ── Passwort-Feld: Visibility-Toggle ────────────────────────────── */
.pmz-profile-password-wrap {
	position: relative;
	width: 100%;
}

.pmz-profile-password-wrap .pmz-profile-input {
	padding-right: 44px;
}

.pmz-profile-password-toggle {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: #888;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s ease;
	line-height: 1;
}

.pmz-profile-password-toggle:hover {
	color: #333;
}

/* Icon-Umschaltung: Standard = Auge-offen, sichtbar = Auge-geschlossen */
.pmz-profile-password-toggle .pmz-eye-icon--hide {
	display: none;
}

.pmz-profile-password-toggle--visible .pmz-eye-icon--show {
	display: none;
}

.pmz-profile-password-toggle--visible .pmz-eye-icon--hide {
	display: block;
}

/* ── Passwortstärke-Meter ────────────────────────────────────────── */
.pmz-password-strength {
	flex: 0 0 100%;
	padding: 4px var(--pmz-field-gutter) 0;
	box-sizing: border-box;
}

.pmz-password-strength__bar {
	height: 4px;
	background-color: #e5e7eb;
	border-radius: 2px;
	overflow: hidden;
}

.pmz-password-strength__fill {
	height: 100%;
	width: 0;
	border-radius: 2px;
	transition: width 0.3s ease, background-color 0.3s ease;
	background-color: #e5e7eb;
}

.pmz-password-strength__label {
	display: block;
	font-size: 12px;
	margin-top: 2px;
	color: #888;
	transition: color 0.3s ease;
}

/* Farbstufen */
.pmz-password-strength--weak .pmz-password-strength__fill {
	background-color: #ef4444;
}
.pmz-password-strength--weak .pmz-password-strength__label {
	color: #ef4444;
}

.pmz-password-strength--fair .pmz-password-strength__fill {
	background-color: #f59e0b;
}
.pmz-password-strength--fair .pmz-password-strength__label {
	color: #f59e0b;
}

.pmz-password-strength--good .pmz-password-strength__fill {
	background-color: #3b82f6;
}
.pmz-password-strength--good .pmz-password-strength__label {
	color: #3b82f6;
}

.pmz-password-strength--strong .pmz-password-strength__fill {
	background-color: #22c55e;
}
.pmz-password-strength--strong .pmz-password-strength__label {
	color: #22c55e;
}

/* ── Passwort-Bestätigung (Reauthentifizierung) ──────────────────── */
.pmz-profile-reauth-hint {
	margin-bottom: 0.5em;
	color: #555;
}

.pmz-profile-message {
	padding: 10px 14px;
	border-radius: 4px;
	margin-bottom: 1em;
	font-weight: 600;
}

.pmz-profile-message--error {
	background-color: #fef2f2;
	border: 1px solid #fca5a5;
	color: #991b1b;
}

.pmz-profile-message--info {
	background-color: #eff6ff;
	border: 1px solid #93c5fd;
	color: #1e40af;
}

/* ── Registrierung: Newsletter-Section ──────────────────────────── */
.pmz-profile-section--newsletter {
	flex: 0 0 100%;
	padding: 0 var(--pmz-field-gutter);
	box-sizing: border-box;
}

.pmz-profile-section--newsletter .pmz-profile-section__subtitle {
	font-size: 1em;
	font-weight: 600;
	margin: 0.5em 0 0.4em;
	padding: 0;
	border: none;
}

.pmz-profile-newsletter-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px 24px;
}

@media (max-width: 600px) {
	.pmz-profile-newsletter-grid {
		grid-template-columns: 1fr;
	}
}

/* ── Registrierung: Legal-Section ──────────────────────────────── */
.pmz-profile-section--legal {
	flex: 0 0 100%;
	margin-top: 40px;
	padding: 0 var(--pmz-field-gutter);
	box-sizing: border-box;
}

/* ── Recovery: Sekundärer Button (Code erneut senden) ──────────── */
.pmz-profile-submit--secondary {
	background: none;
	border: 1px solid #ccc;
	color: #555;
	font-size: 0.9em;
	cursor: pointer;
	padding: 8px 16px;
	border-radius: 4px;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.pmz-profile-submit--secondary:hover {
	border-color: #0073aa;
	color: #0073aa;
}

/* ── Anti-Doppel-Submit: Loading-State ────────────────────────────
 *
 * Wird per JS gesetzt, sobald ein Form abgeschickt wurde. Visuell wie
 * ein disabled-Button (gedimmt, cursor=wait, pointer-events blockiert),
 * aber OHNE die HTMLButton-disabled-Property zu setzen. Grund: ein
 * `disabled` Submit-Button wird vom Browser aus der Entry-List
 * ausgeschlossen — sein name/value-Paar (z.B. method=password) fehlt
 * dann im POST-Body. Mit CSS-only-Loading bleibt das Form-Daten-
 * Verhalten unveraendert.
 */
.pmz-profile-submit--loading {
	opacity: 0.6;
	pointer-events: none;
	cursor: wait;
}

/* ── Feld-Validierungsmeldungen ──────────────────────────────────── */
.pmz-profile-field-message {
	display: block;
	font-size: 0.85em;
	margin-top: 0.3em;
}

.pmz-profile-field-message--error {
	color: #dc2626;
	font-weight: 600;
}

.pmz-profile-field-message--info {
	color: #2563eb;
}

/* ── Honeypot (Bot-Schutz fuer Registrierung) ───────────────────────
   Fuer Menschen komplett unsichtbar; fuer DOM-lesende Bots aber ein
   scheinbar echtes Eingabefeld. Mehrere Tarn-Techniken kombiniert,
   damit Bots die "Unsichtbar"-Heuristik nicht umgehen koennen.
*/
.pmz-honeypot-wrap {
	position: absolute !important;
	left: -10000px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
}
