/* ==========================================================================
   CHONOOR — Auth Page (animated, premium)
   Login with OTP, password, recovery via SMS & email
   ========================================================================== */

.auth-wrapper {
	min-height: calc(100vh - 200px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-10) var(--space-4);
	position: relative;
	overflow: hidden;
}
/* Ambient background orbs */
.auth-wrapper::before,
.auth-wrapper::after {
	content: '';
	position: absolute;
	border-radius: 50%;
	z-index: 0;
	pointer-events: none;
}
.auth-wrapper::before {
	top: -150px;
	right: -100px;
	width: 400px;
	height: 400px;
	background: radial-gradient(circle, rgba(213, 181, 109, 0.18), transparent 70%);
	animation: float 8s ease-in-out infinite;
}
.auth-wrapper::after {
	bottom: -150px;
	left: -100px;
	width: 450px;
	height: 450px;
	background: radial-gradient(circle, rgba(30, 74, 53, 0.18), transparent 70%);
	animation: float 10s ease-in-out infinite reverse;
}
@keyframes float {
	0%, 100% { transform: translate(0, 0) scale(1); }
	50% { transform: translate(20px, -20px) scale(1.08); }
}

.auth-card {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 440px;
	background: rgba(255, 255, 255, 0.85);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: var(--radius-xl);
	padding: var(--space-8) var(--space-6);
	box-shadow: var(--shadow-xl);
	animation: cardIn 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes cardIn {
	from { opacity: 0; transform: translateY(30px) scale(0.96); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Brand header */
.auth-brand {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-3);
	margin-bottom: var(--space-2);
}
.auth-brand .logo-mark {
	width: 48px;
	height: 48px;
	border-radius: var(--radius-md);
	background: linear-gradient(135deg, var(--color-primary), var(--color-dark-green));
	color: var(--color-gold);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--shadow-green);
	animation: pulseGlow 3s ease-in-out infinite;
}
@keyframes pulseGlow {
	0%, 100% { box-shadow: 0 0 0 0 rgba(213, 181, 109, 0.4); }
	50% { box-shadow: 0 0 0 12px rgba(213, 181, 109, 0); }
}
.auth-brand-fa {
	font-size: var(--fs-xl);
	font-weight: 800;
	color: var(--color-dark-green);
	line-height: 1.1;
}
.auth-brand-en {
	font-size: 0.65rem;
	font-weight: 700;
	color: var(--color-gold-dark);
	letter-spacing: 0.2em;
	margin-top: 2px;
}
.auth-subtitle {
	text-align: center;
	color: var(--color-muted);
	font-size: var(--fs-sm);
	margin-bottom: var(--space-5);
}

/* Tabs */
.auth-tabs {
	display: flex;
	background: var(--color-surface-2);
	border-radius: var(--radius-full);
	padding: 5px;
	margin-bottom: var(--space-5);
	position: relative;
}
.auth-tabs::before {
	content: '';
	position: absolute;
	top: 5px;
	right: 5px;
	width: calc(50% - 5px);
	height: calc(100% - 10px);
	background: linear-gradient(135deg, var(--color-gold), var(--color-gold-dark));
	border-radius: var(--radius-full);
	box-shadow: var(--shadow-gold);
	transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 0;
}
.auth-tabs.is-password::before { transform: translateX(-100%); }
.auth-tab {
	flex: 1;
	background: transparent;
	border: none;
	padding: 0.75rem;
	font-family: inherit;
	font-weight: 700;
	font-size: var(--fs-sm);
	color: var(--color-muted);
	cursor: pointer;
	position: relative;
	z-index: 1;
	transition: color 0.3s ease;
}
.auth-tab.active { color: var(--color-white); }

/* Panels */
.auth-panel { display: none; animation: panelIn 0.4s ease; }
.auth-panel.active { display: block; }
@keyframes panelIn {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

.auth-panel-title {
	font-size: var(--fs-xl);
	color: var(--color-dark-green);
	text-align: center;
	margin-bottom: var(--space-5);
}

/* Fields */
.auth-field {
	margin-bottom: var(--space-4);
}
.auth-field label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: var(--fs-sm);
	font-weight: 700;
	color: var(--color-dark-green);
	margin-bottom: 8px;
}
.auth-field label .icon { color: var(--color-gold-dark); }
.auth-input {
	width: 100%;
	padding: 0.95rem 1.1rem;
	border: 2px solid var(--color-border);
	border-radius: var(--radius-md);
	background: rgba(255, 255, 255, 0.7);
	font-family: inherit;
	font-size: var(--fs-base);
	color: var(--color-text);
	transition: var(--transition);
	outline: none;
}
.auth-input:focus {
	border-color: var(--color-gold);
	background: var(--color-white);
	box-shadow: 0 0 0 4px rgba(213, 181, 109, 0.15);
}
.ltr-input { direction: ltr; text-align: right; }

.password-wrap { position: relative; }
.password-toggle {
	position: absolute;
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
	border: none;
	color: var(--color-muted);
	cursor: pointer;
	padding: 6px;
	display: inline-flex;
	transition: var(--transition-fast);
}
.password-toggle:hover { color: var(--color-gold-dark); }

/* Submit button */
.auth-submit {
	margin-top: var(--space-2);
	position: relative;
	transition: var(--transition);
}
.auth-submit.loading .btn-text { opacity: 0; }
.auth-submit.loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin: -10px 0 0 -10px;
	border: 2.5px solid rgba(255, 255, 255, 0.4);
	border-top-color: var(--color-white);
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
}

.auth-note {
	text-align: center;
	font-size: var(--fs-xs);
	color: var(--color-muted);
	margin-top: var(--space-4);
	line-height: 1.7;
}

/* OTP inputs */
.auth-otp-sent {
	text-align: center;
	color: var(--color-muted);
	font-size: var(--fs-sm);
	margin-bottom: var(--space-4);
}
.auth-otp-inputs {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-bottom: var(--space-5);
	direction: ltr;
}
.otp-digit {
	width: 52px;
	height: 60px;
	text-align: center;
	font-size: var(--fs-2xl);
	font-weight: 800;
	color: var(--color-dark-green);
	border: 2px solid var(--color-border);
	border-radius: var(--radius-md);
	background: rgba(255, 255, 255, 0.8);
	font-family: inherit;
	outline: none;
	transition: var(--transition);
}
.otp-digit:focus {
	border-color: var(--color-gold);
	box-shadow: 0 0 0 4px rgba(213, 181, 109, 0.15);
	transform: translateY(-2px);
}
.otp-digit.filled { border-color: var(--color-gold); background: var(--color-gold-soft); }

.auth-resend {
	display: block;
	margin: var(--space-4) auto 0;
	background: transparent;
	border: none;
	color: var(--color-gold-dark);
	font-family: inherit;
	font-size: var(--fs-sm);
	font-weight: 700;
	cursor: pointer;
	transition: var(--transition-fast);
}
.auth-resend:hover:not(:disabled) { text-decoration: underline; }
.auth-resend:disabled { opacity: 0.5; cursor: not-allowed; }

/* Back link */
.auth-back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--color-muted);
	font-size: var(--fs-sm);
	font-weight: 600;
	background: transparent;
	border: none;
	cursor: pointer;
	margin-bottom: var(--space-4);
	transition: var(--transition-fast);
	font-family: inherit;
	padding: 0;
}
.auth-back:hover { color: var(--color-gold-dark); gap: 8px; }

.auth-links {
	display: flex;
	justify-content: space-between;
	gap: var(--space-2);
	margin-top: var(--space-4);
	flex-wrap: wrap;
}
.auth-link {
	background: transparent;
	border: none;
	color: var(--color-gold-dark);
	font-family: inherit;
	font-size: var(--fs-sm);
	font-weight: 600;
	cursor: pointer;
	transition: var(--transition-fast);
}
.auth-link:hover { text-decoration: underline; }

/* Steps within panel */
.auth-step { display: none; animation: panelIn 0.4s ease; }
.auth-step.active { display: block; }

/* Already logged in */
.auth-already .auth-card { text-align: center; }
.auth-success-icon { margin-bottom: var(--space-4); }
.auth-success-icon .icon { color: var(--color-success); animation: popIn 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes popIn {
	0% { transform: scale(0); }
	70% { transform: scale(1.15); }
	100% { transform: scale(1); }
}
.auth-logout {
	display: block;
	margin: var(--space-4) auto 0;
	color: var(--color-danger);
	font-size: var(--fs-sm);
	font-weight: 600;
}

/* Loader overlay */
.auth-loader {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.6);
	backdrop-filter: blur(4px);
	border-radius: var(--radius-xl);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 10;
}
.auth-card.loading .auth-loader { display: flex; }
.auth-loader-circle {
	width: 48px;
	height: 48px;
	border: 4px solid var(--color-primary-soft);
	border-top-color: var(--color-primary);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

/* Dev note */
.auth-dev-note {
	text-align: center;
	font-size: var(--fs-xs);
	color: var(--color-gold-dark);
	margin-top: var(--space-4);
	padding: var(--space-2);
	background: var(--color-gold-soft);
	border-radius: var(--radius-sm);
}

/* Toast within auth */
.auth-toast {
	position: fixed;
	top: var(--space-6);
	left: 50%;
	transform: translateX(-50%);
	background: var(--color-white);
	color: var(--color-text);
	padding: var(--space-3) var(--space-5);
	border-radius: var(--radius-full);
	box-shadow: var(--shadow-lg);
	font-size: var(--fs-sm);
	font-weight: 600;
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: 8px;
	animation: toastIn 0.3s ease;
	border-right: 4px solid var(--color-success);
}
.auth-toast.error { border-right-color: var(--color-danger); }
.auth-toast.error .icon { color: var(--color-danger); }
.auth-toast .icon { color: var(--color-success); }
@keyframes toastIn {
	from { opacity: 0; transform: translate(-50%, -20px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}

/* Shake animation for errors */
.shake { animation: shake 0.4s ease; }
@keyframes shake {
	0%, 100% { transform: translateX(0); }
	20%, 60% { transform: translateX(-8px); }
	40%, 80% { transform: translateX(8px); }
}

/* Responsive */
@media (max-width: 480px) {
	.auth-card { padding: var(--space-5) var(--space-4); }
	.otp-digit { width: 44px; height: 52px; font-size: var(--fs-xl); }
	.auth-tabs { font-size: var(--fs-xs); }
	.auth-links { justify-content: center; }
}
