@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

:root {
	color-scheme: light dark;

	/* Primary UI colors from AppUIColors.light */
	--primary-color: #1751d0; /* Blue primary */
	--primary-light: #ebf0fb; /* Lighter blue */
	--primary-dark: #0e3ba7; /* Darker blue */
	--secondary-color: #6941c6; /* Purple secondary */
	--error-color: #e53935; /* Red for errors */
	--success-color: #2e7d32; /* Green for success */
	--warning-color: #f57c00; /* Orange for warnings */

	/* Background and surface colors from AppNeutralColors.light */
	--background-color: #f8f9fc; /* Light background with blue tint */
	--card-bg: #ffffff; /* Pure white */
	--light-blue: #ebf0fb; /* Lighter blue matching primaryLight */
	--surface-color: #f5f5f5; /* grey100 from AppNeutralColors */

	/* Text colors from AppNeutralColors.light */
	--text-color: #212121; /* grey900 */
	--text-secondary-color: #616161; /* grey700 */
	--text-disabled: #9e9e9e; /* grey500 */

	/* Accent colors */
	--accent-blue: #3b82f6;

	/* Effect colors */
	--progress-bg: rgba(23, 81, 208, 0.05);
	--progress-shimmer: rgba(255, 255, 255, 0.8);
	--feature-icon-bg: rgba(23, 81, 208, 0.1);

	/* Status background colors */
	--status-info-bg: #ebf0fb; /* statusInfoBackground */
	--status-success-bg: #e1faea; /* statusSuccessBackground */
	--status-error-bg: #fff3e0; /* statusErrorBackground */
}

@media (prefers-color-scheme: dark) {
	:root {
		/* Primary UI colors from AppUIColors.dark */
		--primary-color: #4d89f0; /* More vibrant blue for dark mode */
		--primary-light: #2a4d89; /* Darker blue for dark mode */
		--primary-dark: #2967d1; /* Richer dark blue for dark mode */
		--secondary-color: #9d7fea; /* More vibrant purple for dark mode */
		--error-color: #f55753; /* Brighter red for dark mode */
		--success-color: #43c566; /* More vibrant green for dark mode */
		--warning-color: #ffa726; /* Warmer orange for dark mode */

		/* Background and surface colors from AppNeutralColors.dark */
		--background-color: #1f1f1f; /* Teams-like dark background */
		--card-bg: #2d2d2d; /* Surface color (grey200) */
		--light-blue: #122340; /* Dark blue background */
		--surface-color: #242424; /* grey100 from dark theme */

		/* Text colors from AppNeutralColors.dark */
		--text-color: #e3e3e3; /* grey800 */
		--text-secondary-color: #a1a1a1; /* grey600 */
		--text-disabled: #858585; /* grey500 */

		/* Accent colors */
		--accent-blue: #4d89f0;

		/* Effect colors */
		--progress-bg: rgba(77, 137, 240, 0.1);
		--progress-shimmer: rgba(255, 255, 255, 0.3);
		--feature-icon-bg: rgba(77, 137, 240, 0.2);

		/* Status background colors */
		--status-info-bg: #122340; /* Dark blue background */
		--status-success-bg: #0e2317; /* Dark green background */
		--status-error-bg: #2d1212; /* Dark red background */
	}
}

body {
	margin: 0;
	padding: 0;
	font-family: "Roboto", sans-serif;
	background: var(--background-color);
	height: 100vh;
	overflow: hidden;
	opacity: 0;
	animation: fadeIn 0.5s ease-out forwards;
	color: var(--text-color);
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.loading-container {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	height: 100vh;
	width: 100vw;
	position: relative;
	overflow: hidden;
	padding: 20px;
	box-sizing: border-box;
}

.content-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 1;
	width: 100%;
	max-width: 500px;
}

/* Background ambient elements */
.ambient-background {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	opacity: 0.4;
}

.ambient-circle {
	position: absolute;
	border-radius: 50%;
	background: radial-gradient(
		circle,
		var(--primary-light) 0%,
		rgba(59, 130, 246, 0) 70%
	);
	animation: float 15s infinite ease-in-out;
}

.circle-1 {
	width: 300px;
	height: 300px;
	top: -150px;
	left: -100px;
}

.circle-2 {
	width: 400px;
	height: 400px;
	bottom: -200px;
	right: -100px;
	animation-delay: -5s;
}

@keyframes float {
	0%,
	100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-15px) translateX(15px);
	}
}

.app-title {
	font-size: 24px;
	font-weight: 700;
	color: var(--primary-color);
	margin-bottom: 25px;
	opacity: 0;
	transform: translateY(20px);
	animation: titleAppear 0.8s ease-out 0.3s forwards;
	position: relative;
}

.app-title::after {
	content: "";
	position: absolute;
	bottom: -8px;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 2px;
	background-color: var(--primary-color);
	animation: titleUnderline 0.6s ease-out 1.1s forwards;
}

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

@keyframes titleUnderline {
	from {
		width: 0;
	}
	to {
		width: 40px;
	}
}

.tagline {
	font-size: 14px;
	color: var(--text-secondary-color);
	margin-bottom: 40px;
	text-align: center;
	max-width: 280px;
	opacity: 0;
	animation: fadeIn 1s ease-out 0.8s forwards;
}

.logo-container {
	position: relative;
	width: 64px;
	height: 64px;
	margin-bottom: 30px;
	opacity: 0;
	transform: scale(0.8);
	animation: logoAppear 0.8s ease-out forwards;
}

@keyframes logoAppear {
	0% {
		opacity: 0;
		transform: scale(0.8) rotate(-10deg);
	}
	100% {
		opacity: 1;
		transform: scale(1) rotate(0deg);
	}
}

.logo-pulse {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: radial-gradient(
		circle,
		rgba(var(--primary-color-rgb), 0.2) 0%,
		rgba(var(--primary-color-rgb), 0) 70%
	);
	animation: pulse 2s infinite;
}

/* Multiple pulse effects with different sizes and timing */
.logo-pulse-outer {
	position: absolute;
	top: -15%;
	left: -15%;
	width: 130%;
	height: 130%;
	border-radius: 50%;
	background: radial-gradient(
		circle,
		rgba(var(--primary-color-rgb), 0.1) 0%,
		rgba(var(--primary-color-rgb), 0) 70%
	);
	animation: pulse 2.5s infinite 0.3s;
}

@keyframes pulse {
	0% {
		transform: scale(1);
		opacity: 1;
	}
	100% {
		transform: scale(2);
		opacity: 0;
	}
}

.progress-container {
	width: 180px;
	height: 4px;
	background-color: var(--progress-bg);
	border-radius: 8px;
	overflow: hidden;
	margin-top: 16px;
	position: relative;
}

.progress-bar {
	height: 100%;
	width: 0%;
	background: linear-gradient(
		to right,
		rgba(var(--primary-color-rgb), 0.6),
		var(--primary-color)
	);
	border-radius: 8px;
	position: relative;
	animation: progressGrow 4s ease-out forwards;
}

.progress-shimmer {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(
		90deg,
		transparent 0%,
		var(--progress-shimmer) 50%,
		transparent 100%
	);
	animation: shimmer 1.5s infinite;
}

.progress-text {
	font-size: 13px;
	color: var(--primary-color);
	margin-top: 12px;
	opacity: 0.8;
	font-weight: 500;
	letter-spacing: 1px;
}

/* Loading dots animation */
.loading-dots {
	display: inline-flex;
	margin-left: 4px;
}

.dot {
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background-color: var(--primary-color);
	margin: 0 2px;
	opacity: 0.8;
}

.dot:nth-child(1) {
	animation: dotPulse 1.5s infinite 0s;
}

.dot:nth-child(2) {
	animation: dotPulse 1.5s infinite 0.2s;
}

.dot:nth-child(3) {
	animation: dotPulse 1.5s infinite 0.4s;
}

@keyframes dotPulse {
	0%,
	100% {
		transform: scale(0.8);
		opacity: 0.6;
	}
	50% {
		transform: scale(1.2);
		opacity: 1;
	}
}

/* Feature icons that appear one by one */
.feature-icons {
	display: flex;
	justify-content: center;
	margin-top: 30px;
	opacity: 0;
	animation: fadeIn 0.8s ease-out 1.2s forwards;
}

.feature-icon {
	width: 32px;
	height: 32px;
	background-color: var(--feature-icon-bg);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 8px;
	transform: scale(0);
	animation: iconPop 0.5s ease-out forwards;
}

.feature-icon svg {
	width: 16px;
	height: 16px;
	fill: var(--primary-color);
}

.feature-icon:nth-child(1) {
	animation-delay: 1.3s;
}

.feature-icon:nth-child(2) {
	animation-delay: 1.5s;
}

.feature-icon:nth-child(3) {
	animation-delay: 1.7s;
}

@keyframes iconPop {
	0% {
		transform: scale(0);
	}
	100% {
		transform: scale(1);
	}
}

/* New styles for smoother transitions */
.loading-container.ready-for-flutter {
	animation: containerPrepare 0.6s ease-out forwards;
}

@keyframes containerPrepare {
	to {
		background-color: var(--light-blue);
	}
}

.flutter-transition-complete {
	opacity: 0;
	transition: opacity 0.8s ease-out;
}

/* Error message styles */
.error-card {
	background: white;
	padding: 40px;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 80, 179, 0.12);
	max-width: 450px;
	width: 90%;
	text-align: center;
	animation: errorAppear 0.5s ease-out forwards;
}

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

.error-button {
	padding: 14px 32px;
	background: #0050b3;
	color: white;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-weight: 500;
	transition: all 0.2s ease;
	box-shadow: 0 4px 12px rgba(0, 80, 179, 0.2);
}

.error-button:hover {
	background: #1751d0;
	box-shadow: 0 6px 16px rgba(0, 80, 179, 0.3);
	transform: translateY(-1px);
}

.error-button:active {
	transform: translateY(1px);
	box-shadow: 0 2px 8px rgba(0, 80, 179, 0.2);
}

.error-icon {
	width: 72px;
	height: 72px;
	margin: 0 auto 24px;
	background-color: rgba(0, 80, 179, 0.08);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.error-title {
	color: #0050b3;
	font-size: 24px;
	font-weight: 500;
	margin-bottom: 16px;
}

.error-message {
	color: #5a6a85;
	line-height: 1.6;
	margin-bottom: 32px;
}

.error-footer {
	margin-top: 32px;
	font-size: 13px;
	color: #828fa3;
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 768px) {
	.ambient-circle.circle-1 {
		width: 200px;
		height: 200px;
	}

	.ambient-circle.circle-2 {
		width: 250px;
		height: 250px;
	}

	.feature-icon {
		width: 28px;
		height: 28px;
		margin: 0 6px;
	}

	.feature-icon svg {
		width: 14px;
		height: 14px;
	}

	.error-card {
		padding: 30px;
		width: 85%;
	}
}

@media (max-width: 480px) {
	.logo-container {
		width: 56px;
		height: 56px;
		margin-bottom: 24px;
	}

	.progress-container {
		width: 160px;
	}

	.ambient-circle.circle-1 {
		width: 180px;
		height: 180px;
	}

	.ambient-circle.circle-2 {
		width: 220px;
		height: 220px;
	}

	.feature-icon {
		width: 24px;
		height: 24px;
		margin: 0 5px;
	}

	.feature-icon svg {
		width: 12px;
		height: 12px;
	}

	.app-title {
		font-size: 20px;
		margin-bottom: 18px;
	}

	.tagline {
		font-size: 12px;
		margin-bottom: 30px;
		max-width: 240px;
	}

	.error-card {
		padding: 24px;
		width: 90%;
	}

	.error-icon {
		width: 60px;
		height: 60px;
		margin-bottom: 20px;
	}

	.error-icon svg {
		width: 28px;
		height: 28px;
	}

	.error-title {
		font-size: 20px;
		margin-bottom: 12px;
	}

	.error-message {
		font-size: 14px;
		margin-bottom: 24px;
	}

	.error-button {
		padding: 12px 24px;
		font-size: 14px;
	}

	.error-footer {
		margin-top: 24px;
		font-size: 12px;
	}
}

@media (max-width: 360px) {
	.progress-container {
		width: 140px;
	}

	.logo-container {
		width: 48px;
		height: 48px;
	}

	.feature-icons {
		margin-top: 20px;
	}

	.feature-icon {
		width: 20px;
		height: 20px;
		margin: 0 4px;
	}

	.error-card {
		padding: 20px;
		width: 95%;
	}

	.error-icon {
		width: 50px;
		height: 50px;
	}

	.error-icon svg {
		width: 24px;
		height: 24px;
	}

	.error-button {
		padding: 10px 20px;
	}
}

@keyframes shimmer {
	from {
		transform: translateX(-100%);
	}
	to {
		transform: translateX(100%);
	}
}

@keyframes progressGrow {
	0% {
		width: 0%;
	}
	50% {
		width: 50%;
	}
	100% {
		width: 90%;
	}
}

#flutter_target {
	width: 100%;
	height: 100%;
	position: absolute;
	top: 0;
	left: 0;
}

/* ===== App Interstitial (Teams-like launch page) ===== */
.app-interstitial {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: var(--background-color);
	opacity: 0;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	padding: 2rem;
	font-family:
		"Inter",
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.app-interstitial--visible {
	opacity: 1;
}

.app-interstitial--hiding {
	opacity: 0;
	pointer-events: none;
}

/* Top-left brand wordmark (like Teams "Microsoft Teams") */
.app-interstitial__brand {
	position: absolute;
	top: 1.5rem;
	left: 2rem;
	font-size: 1.5rem;
	font-weight: 400;
	font-family:
		"Inter",
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		sans-serif;
	color: var(--primary-color);
	letter-spacing: -0.01em;
	user-select: none;
}

/* Centered content container — no card, content floats on background */
.app-interstitial__content {
	max-width: 520px;
	width: 100%;
	text-align: center;
	animation: interstitialFadeUp 0.4s ease-out;
}

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

.app-interstitial__logo {
	width: 80px;
	height: 80px;
	margin-bottom: 1.75rem;
	border-radius: 18px;
}

.app-interstitial__title {
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--text-color);
	margin: 0 0 0.625rem;
	letter-spacing: -0.02em;
	line-height: 1.3;
}

.app-interstitial__subtitle {
	color: var(--text-secondary-color);
	font-size: 1rem;
	line-height: 1.5;
	margin: 0 0 2.25rem;
}

/* Horizontal button row on desktop, stacked on mobile */
.app-interstitial__actions {
	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: center;
	gap: 1rem;
}

.app-interstitial__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.75rem 2rem;
	font-size: 0.95rem;
	font-weight: 600;
	border-radius: 24px;
	cursor: pointer;
	border: none;
	text-decoration: none;
	font-family: inherit;
	transition:
		background 0.15s ease,
		box-shadow 0.15s ease;
	white-space: nowrap;
}

.app-interstitial__btn:focus-visible {
	outline: 2px solid var(--primary-color);
	outline-offset: 2px;
}

.app-interstitial__btn--primary {
	background: var(--primary-color);
	color: #fff;
}

.app-interstitial__btn--primary:hover {
	background: var(--primary-dark);
	box-shadow: 0 2px 8px rgba(23, 81, 208, 0.25);
}

.app-interstitial__btn--secondary {
	background: transparent;
	color: var(--text-color);
	border: 1.5px solid rgba(0, 0, 0, 0.15);
}

.app-interstitial__btn--secondary:hover {
	background: var(--surface-color);
}

/* "Already have the app? Launch it now" line */
.app-interstitial__launch-hint {
	margin-top: 2rem;
	font-size: 0.9rem;
	color: var(--text-secondary-color);
}

.app-interstitial__launch-link {
	color: var(--primary-color);
	text-decoration: none;
	font-weight: 500;
	cursor: pointer;
}

.app-interstitial__launch-link:hover {
	text-decoration: underline;
}

.app-interstitial__remember {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin: 1.25rem auto 0;
	font-size: 0.85rem;
	font-weight: 400;
	color: var(--text-secondary-color);
	cursor: pointer;
	font-family: inherit;
	user-select: none;
}

.app-interstitial__remember-input {
	width: 16px;
	height: 16px;
	accent-color: var(--primary-color);
	cursor: pointer;
	margin: 0;
}

/* Coming Soon notice (mobile interstitial) */
.app-interstitial__coming-soon {
	text-align: center;
	padding: 1.25rem;
	background: rgba(0, 0, 0, 0.03);
	border-radius: 12px;
	margin-bottom: 0.5rem;
}

.app-interstitial__coming-soon-badge {
	display: inline-block;
	font-size: 0.65rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--text-disabled);
	background: rgba(0, 0, 0, 0.06);
	padding: 3px 10px;
	border-radius: 100px;
	margin-bottom: 0.5rem;
}

.app-interstitial__coming-soon-text {
	font-size: 0.85rem;
	color: var(--text-secondary-color);
	line-height: 1.5;
	margin: 0;
}

@media (prefers-color-scheme: dark) {
	.app-interstitial__coming-soon {
		background: rgba(255, 255, 255, 0.05);
	}
	.app-interstitial__coming-soon-badge {
		background: rgba(255, 255, 255, 0.08);
	}
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
	.app-interstitial__btn--secondary {
		border-color: rgba(255, 255, 255, 0.15);
	}
	.app-interstitial__btn--secondary:hover {
		background: rgba(255, 255, 255, 0.06);
	}
	.app-interstitial__btn--primary:hover {
		box-shadow: 0 2px 8px rgba(77, 137, 240, 0.3);
	}
}

/* Tablet & mobile: stack buttons, improve touch targets */
@media (max-width: 768px) {
	.app-interstitial {
		padding: 1.25rem;
		padding-top: 4rem;
		justify-content: flex-start;
	}
	.app-interstitial__brand {
		top: 1rem;
		left: 1.25rem;
		font-size: 1rem;
	}
	.app-interstitial__content {
		max-width: 100%;
		margin-top: auto;
		margin-bottom: auto;
		padding-bottom: 15vh;
	}
	.app-interstitial__logo {
		width: 72px;
		height: 72px;
		border-radius: 16px;
	}
	.app-interstitial__title {
		font-size: 1.5rem;
	}
	.app-interstitial__actions {
		flex-direction: column;
		gap: 1rem;
	}
	.app-interstitial__btn {
		width: 100%;
		padding: 1rem 1.5rem;
		font-size: 1rem;
		border-radius: 16px;
		box-sizing: border-box;
		white-space: normal;
	}
	.app-interstitial__remember {
		font-size: 0.9rem;
		margin-top: 1.5rem;
	}
}

/* Small phones: tighter spacing */
@media (max-width: 360px) {
	.app-interstitial__logo {
		width: 60px;
		height: 60px;
	}
	.app-interstitial__title {
		font-size: 1.3rem;
	}
	.app-interstitial__btn {
		padding: 0.875rem 1.25rem;
	}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.app-interstitial,
	.app-interstitial__content {
		transition: none;
		animation: none;
	}
}
