/* ============================================================================
   AUTH FLOW - Blueprint Authentication Interface
   ============================================================================

   Design: Matches Admin/Provider Blueprint aesthetic
   - Blueprint grid background with amber tint (auth identity)
   - Corner bracket markers
   - JetBrains Mono + DM Sans fonts (consistent with portals)
   - Amber accent for auth (neutral - not cyan/green which are portal-specific)

   ============================================================================ */

/* ============================================================================
   DESIGN TOKENS
   ============================================================================ */

:root {
	/* Background - Same deep navy as admin/provider */
	--auth-bg: #0a0f1a;
	--auth-bg-deep: #060a12;
	--auth-surface: #0d1424;
	--auth-surface-solid: #111827;

	/* Blueprint grid - Amber tinted for auth */
	--auth-grid-minor: rgba(245, 166, 35, 0.03);
	--auth-grid-major: rgba(245, 166, 35, 0.06);
	--auth-line: rgba(245, 166, 35, 0.12);
	--auth-line-strong: rgba(245, 166, 35, 0.25);

	/* Amber accent - Auth identity (neutral, leads to both portals) */
	--auth-accent: #f5a623;
	--auth-accent-bright: #ffc857;
	--auth-accent-dim: #c98b1d;
	--auth-accent-glow: rgba(245, 166, 35, 0.15);
	--auth-accent-subtle: rgba(245, 166, 35, 0.08);

	/* Status colors */
	--auth-success: #34d399;
	--auth-success-glow: rgba(52, 211, 153, 0.15);
	--auth-error: #f87171;
	--auth-error-glow: rgba(248, 113, 113, 0.15);
	--auth-info: #60a5fa;
	--auth-info-glow: rgba(96, 165, 250, 0.15);

	/* Text - Same as admin/provider */
	--auth-text-bright: #f8fafc;
	--auth-text-primary: #e2e8f0;
	--auth-text-secondary: #94a3b8;
	--auth-text-tertiary: #64748b;

	/* Borders */
	--auth-border: rgba(255, 255, 255, 0.08);
	--auth-border-medium: rgba(255, 255, 255, 0.12);

	/* Typography - Same as admin/provider */
	--auth-font-display: 'DM Sans', system-ui, sans-serif;
	--auth-font-mono: 'JetBrains Mono', monospace;

	/* Spacing */
	--auth-space-1: 4px;
	--auth-space-2: 8px;
	--auth-space-3: 12px;
	--auth-space-4: 16px;
	--auth-space-5: 24px;
	--auth-space-6: 32px;
	--auth-space-8: 48px;

	/* Animation */
	--auth-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================================
   RESET
   ============================================================================ */

*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* ============================================================================
   BODY
   ============================================================================ */

.auth-flow {
	min-height: 100vh;
	min-height: 100dvh;
	background: var(--auth-bg);
	font-family: var(--auth-font-display);
	color: var(--auth-text-primary);
	overflow-x: hidden;

	/* Subtle gradient from top */
	&::before {
		content: '';
		position: fixed;
		inset: 0;
		background: radial-gradient(
			ellipse 80% 50% at 50% 0%,
			var(--auth-accent-subtle) 0%,
			transparent 60%
		);
		pointer-events: none;
	}
}

/* ============================================================================
   CONTAINER
   ============================================================================ */

.auth-container {
	position: relative;
	z-index: 1;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	padding: var(--auth-space-4);
	padding-bottom: env(safe-area-inset-bottom, var(--auth-space-4));
	max-width: 420px;
	margin: 0 auto;
}

/* ============================================================================
   STATUS HEADER
   ============================================================================ */

.auth-status {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--auth-space-3) 0;
	margin-bottom: var(--auth-space-6);
	border-bottom: 1px solid var(--auth-border);
	animation: fadeDown 500ms var(--auth-ease) forwards;
	opacity: 0;
}

.status-brand {
	font-family: var(--auth-font-mono);
	font-size: 10px;
	letter-spacing: 0.2em;
	color: var(--auth-text-tertiary);
}

.status-phase {
	display: flex;
	align-items: center;
	gap: var(--auth-space-2);
}

.phase-dot {
	width: 6px;
	height: 6px;
	background: var(--auth-accent);
	border-radius: 50%;
	animation: pulse 2s ease-in-out infinite;
}

.phase-text {
	font-family: var(--auth-font-mono);
	font-size: 10px;
	letter-spacing: 0.15em;
	color: var(--auth-accent);
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

.auth-main {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

/* Hero Section */
.auth-hero {
	margin-bottom: var(--auth-space-6);
	animation: fadeUp 600ms var(--auth-ease) 100ms forwards;
	opacity: 0;
}

.auth-title {
	font-family: var(--auth-font-display);
	font-size: clamp(2rem, 10vw, 2.75rem);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.02em;
	color: var(--auth-text-bright);
	margin-bottom: var(--auth-space-2);
}

.auth-subtitle {
	font-size: 0.9375rem;
	color: var(--auth-text-secondary);
	line-height: 1.5;

	strong {
		color: var(--auth-accent);
		font-weight: 500;
	}
}

/* ============================================================================
   FORM
   ============================================================================ */

.auth-form {
	display: flex;
	flex-direction: column;
	gap: var(--auth-space-5);
	animation: fadeUp 600ms var(--auth-ease) 200ms forwards;
	opacity: 0;
}

/* Form Field */
.form-field {
	display: flex;
	flex-direction: column;
	gap: var(--auth-space-2);
}

.field-label {
	font-family: var(--auth-font-mono);
	font-size: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--auth-text-tertiary);
}

.field-input {
	width: 100%;
	padding: var(--auth-space-4);
	background: var(--auth-surface);
	border: 1px solid var(--auth-border);
	border-radius: 10px;
	font-family: var(--auth-font-display);
	font-size: 1rem;
	color: var(--auth-text-bright);
	transition: all 200ms ease;

	&::placeholder {
		color: var(--auth-text-tertiary);
	}

	&:focus {
		outline: none;
		border-color: var(--auth-accent);
		background: var(--auth-surface-solid);
		box-shadow: 0 0 0 3px var(--auth-accent-glow);
	}

	&.has-error {
		border-color: var(--auth-error);
		box-shadow: 0 0 0 3px var(--auth-error-glow);
	}
}

.field-error {
	font-size: 0.8125rem;
	color: var(--auth-error);
}

/* ============================================================================
   OTP INPUTS
   ============================================================================ */

.otp-field {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--auth-space-3);
}

.otp-inputs {
	display: flex;
	gap: var(--auth-space-2);
	justify-content: center;
}

.otp-digit {
	width: 48px;
	height: 56px;
	background: var(--auth-surface);
	border: 1px solid var(--auth-border);
	border-radius: 10px;
	font-family: var(--auth-font-mono);
	font-size: 1.5rem;
	font-weight: 600;
	color: var(--auth-text-bright);
	text-align: center;
	text-transform: uppercase;
	transition: all 200ms ease;

	&::placeholder {
		color: var(--auth-text-tertiary);
		opacity: 0.5;
	}

	&:focus {
		outline: none;
		border-color: var(--auth-accent);
		background: var(--auth-surface-solid);
		box-shadow: 0 0 0 3px var(--auth-accent-glow);
		transform: translateY(-2px);
	}

	/* When filled */
	&:not(:placeholder-shown) {
		border-color: var(--auth-accent-dim);
		background: var(--auth-accent-subtle);
	}
}

/* ============================================================================
   BUTTON
   ============================================================================ */

.auth-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--auth-space-3);
	width: 100%;
	padding: var(--auth-space-4) var(--auth-space-5);
	background: var(--auth-accent);
	border: none;
	border-radius: 10px;
	font-family: var(--auth-font-display);
	font-size: 1rem;
	font-weight: 600;
	color: var(--auth-bg);
	cursor: pointer;
	transition: all 200ms ease;

	svg {
		width: 18px;
		height: 18px;
		transition: transform 200ms ease;
	}

	&:hover:not(:disabled) {
		background: var(--auth-accent-bright);
		transform: translateY(-1px);

		svg {
			transform: translateX(4px);
		}
	}

	&:active:not(:disabled) {
		transform: translateY(0);
	}

	&:disabled {
		opacity: 0.5;
		cursor: not-allowed;
	}
}

/* ============================================================================
   MESSAGES
   ============================================================================ */

.auth-message {
	display: flex;
	align-items: flex-start;
	gap: var(--auth-space-3);
	padding: var(--auth-space-4);
	border-radius: 10px;
	font-size: 0.875rem;
	line-height: 1.5;
	animation: fadeUp 400ms var(--auth-ease) forwards;

	svg {
		flex-shrink: 0;
		margin-top: 2px;
	}

	&--info {
		background: var(--auth-info-glow);
		border: 1px solid rgba(96, 165, 250, 0.3);
		color: var(--auth-text-primary);

		svg {
			color: var(--auth-info);
		}
	}

	&--error {
		background: var(--auth-error-glow);
		border: 1px solid rgba(248, 113, 113, 0.3);
		color: var(--auth-text-primary);

		svg {
			color: var(--auth-error);
		}
	}

	&--success {
		background: var(--auth-success-glow);
		border: 1px solid rgba(52, 211, 153, 0.3);
		color: var(--auth-text-primary);

		svg {
			color: var(--auth-success);
		}
	}
}

/* ============================================================================
   ACTIONS / FOOTER
   ============================================================================ */

.auth-actions {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--auth-space-2);
	margin-top: var(--auth-space-5);
	animation: fadeUp 600ms var(--auth-ease) 300ms forwards;
	opacity: 0;
}

.actions-text {
	font-size: 0.875rem;
	color: var(--auth-text-tertiary);
}

.link-btn {
	font-family: var(--auth-font-display);
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--auth-accent);
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	transition: color 200ms ease;

	&:hover:not(:disabled) {
		color: var(--auth-accent-bright);
		text-decoration: underline;
	}

	&:disabled {
		color: var(--auth-text-tertiary);
		cursor: not-allowed;
	}
}

/* ============================================================================
   FOOTER BRAND
   ============================================================================ */

.auth-footer-brand {
	margin-top: var(--auth-space-8);
	padding: var(--auth-space-4) 0;
	text-align: center;
	animation: fadeUp 600ms var(--auth-ease) 400ms forwards;
	opacity: 0;
}

.footer-secure {
	font-family: var(--auth-font-mono);
	font-size: 9px;
	letter-spacing: 0.15em;
	color: var(--auth-text-tertiary);
	opacity: 0.6;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes fadeDown {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes fadeUp {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes pulse {
	0%, 100% {
		opacity: 1;
	}
	50% {
		opacity: 0.5;
	}
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (min-width: 480px) {
	.auth-container {
		padding: var(--auth-space-6);
	}

	.auth-title {
		font-size: 3rem;
	}

	.otp-digit {
		width: 52px;
		height: 60px;
		font-size: 1.75rem;
	}
}

/* ============================================================================
   REDUCED MOTION
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
