/**
 * AppHub Auth Styles
 *
 * Update v1.0.9: Styles für Login-, Registrierungs-, Passwort-vergessen-
 * und Passwort-Reset-Formulare.
 *
 * @since 1.0.9
 */

/* =========================================================================
   Reset & Grundgerüst
   ========================================================================= */

.apphub-login-body {
	margin: 0;
	padding: 0;
	min-height: 100vh;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #333;
	-webkit-font-smoothing: antialiased;
}

/* =========================================================================
   Wrapper (Hintergrund)
   ========================================================================= */

.apphub-auth-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 20px;
	box-sizing: border-box;
	background-color: var(--apphub-content-bg, #F5F5F5);
	background-image: var(--apphub-auth-bg-image, none);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

/* =========================================================================
   View-Switching
   ========================================================================= */

.apphub-auth-view {
	display: none;
	width: 100%;
	max-width: 420px;
}

.apphub-auth-view.apphub-auth-active {
	display: block;
}

/* =========================================================================
   Card
   ========================================================================= */

.apphub-auth-card {
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
	padding: 40px 36px;
	width: 100%;
}

/* =========================================================================
   Logo
   ========================================================================= */

.apphub-auth-logo {
	text-align: center;
	margin-bottom: 24px;
}

.apphub-auth-logo img {
	max-width: 180px;
	max-height: 60px;
	height: auto;
	object-fit: contain;
}

.apphub-auth-logo-text {
	font-size: 22px;
	font-weight: 700;
	color: var(--apphub-sidebar-bg, #1E1E2F);
}

/* =========================================================================
   Titel & Willkommenstext
   ========================================================================= */

.apphub-auth-title {
	font-size: 20px;
	font-weight: 600;
	text-align: center;
	margin: 0 0 16px 0;
	color: #1a1a1a;
}

.apphub-auth-welcome {
	text-align: center;
	color: #666;
	margin-bottom: 24px;
	font-size: 14px;
	line-height: 1.6;
}

.apphub-auth-welcome p {
	margin: 0 0 8px 0;
}

/* =========================================================================
   Nachrichten (Fehler / Erfolg)
   ========================================================================= */

.apphub-auth-message {
	padding: 10px 14px;
	border-radius: 6px;
	margin-bottom: 16px;
	font-size: 13px;
	line-height: 1.5;
}

.apphub-auth-error {
	background: #fef2f2;
	color: #b91c1c;
	border: 1px solid #fecaca;
}

.apphub-auth-success {
	background: #f0fdf4;
	color: #15803d;
	border: 1px solid #bbf7d0;
}

/* =========================================================================
   Formular-Felder
   ========================================================================= */

.apphub-auth-form {
	margin: 0;
}

.apphub-auth-field {
	margin-bottom: 16px;
}

.apphub-auth-field label {
	display: block;
	font-size: 13px;
	font-weight: 500;
	color: #374151;
	margin-bottom: 6px;
}

.apphub-auth-field label .required {
	color: #dc2626;
}

.apphub-auth-field input[type="text"],
.apphub-auth-field input[type="email"],
.apphub-auth-field input[type="password"] {
	display: block;
	width: 100%;
	padding: 10px 14px;
	font-size: 14px;
	line-height: 1.5;
	color: #1a1a1a;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	box-sizing: border-box;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.apphub-auth-field input:focus {
	outline: none;
	border-color: var(--apphub-accent, #4A90D9);
	box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.apphub-auth-field input.apphub-auth-field-error {
	border-color: #dc2626;
	box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* =========================================================================
   Passwort-Toggle
   ========================================================================= */

.apphub-auth-password-wrap {
	position: relative;
}

.apphub-auth-password-wrap input {
	padding-right: 44px;
}

.apphub-auth-password-toggle {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
	color: #9ca3af;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s;
}

.apphub-auth-password-toggle:hover {
	color: #4b5563;
}

.apphub-auth-password-toggle .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

/* =========================================================================
   Passwort-Stärke-Anzeige
   ========================================================================= */

.apphub-auth-password-strength {
	margin-top: 6px;
	height: 4px;
	border-radius: 2px;
	background: #e5e7eb;
	overflow: hidden;
	display: none;
}

.apphub-auth-password-strength.active {
	display: block;
}

.apphub-auth-password-strength-bar {
	height: 100%;
	border-radius: 2px;
	transition: width 0.3s ease, background-color 0.3s ease;
	width: 0;
}

.apphub-auth-password-strength-bar.strength-weak {
	width: 25%;
	background: #dc2626;
}

.apphub-auth-password-strength-bar.strength-fair {
	width: 50%;
	background: #f59e0b;
}

.apphub-auth-password-strength-bar.strength-good {
	width: 75%;
	background: #3b82f6;
}

.apphub-auth-password-strength-bar.strength-strong {
	width: 100%;
	background: #16a34a;
}

/* =========================================================================
   Checkbox (Angemeldet bleiben)
   ========================================================================= */

.apphub-auth-remember {
	margin-bottom: 20px !important;
}

.apphub-auth-remember label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 400;
	cursor: pointer;
}

.apphub-auth-remember input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: var(--apphub-accent, #4A90D9);
}

/* =========================================================================
   Submit-Button
   ========================================================================= */

.apphub-auth-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 12px 20px;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	background: var(--apphub-accent, #4A90D9);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: opacity 0.2s, transform 0.1s;
	-webkit-appearance: none;
	appearance: none;
}

.apphub-auth-submit:hover {
	opacity: 0.9;
}

.apphub-auth-submit:active {
	transform: scale(0.98);
}

.apphub-auth-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Spinner im Button */
.apphub-auth-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: apphub-auth-spin 0.6s linear infinite;
}

@keyframes apphub-auth-spin {
	to { transform: rotate(360deg); }
}

/* =========================================================================
   Links (Passwort vergessen, Registrieren)
   ========================================================================= */

.apphub-auth-links {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid #e5e7eb;
}

.apphub-auth-link {
	font-size: 13px;
	color: var(--apphub-accent, #4A90D9);
	text-decoration: none;
	transition: opacity 0.2s;
}

.apphub-auth-link:hover {
	opacity: 0.8;
	text-decoration: underline;
}

/* =========================================================================
   Shake-Animation (Fehler)
   ========================================================================= */

@keyframes apphub-auth-shake {
	0%, 100% { transform: translateX(0); }
	10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
	20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.apphub-auth-card.shake {
	animation: apphub-auth-shake 0.5s ease-in-out;
}

/* =========================================================================
   Responsive (Mobile)
   ========================================================================= */

@media (max-width: 480px) {
	.apphub-auth-wrapper {
		padding: 16px;
		align-items: flex-start;
		padding-top: 40px;
	}

	.apphub-auth-card {
		padding: 28px 24px;
		border-radius: 10px;
	}

	.apphub-auth-logo img {
		max-width: 140px;
	}

	.apphub-auth-field input[type="text"],
	.apphub-auth-field input[type="email"],
	.apphub-auth-field input[type="password"] {
		padding: 12px 14px;
		font-size: 16px; /* Verhindert Zoom auf iOS */
	}

	.apphub-auth-submit {
		padding: 14px 20px;
		font-size: 16px;
	}
}

@media (max-width: 360px) {
	.apphub-auth-card {
		padding: 24px 18px;
	}

	.apphub-auth-links {
		flex-direction: column;
		gap: 10px;
		align-items: center;
	}
}
