:root {
	--text-dark: #1f2937;
	--text-muted: #6b7280;
	--glass: rgba(255, 255, 255, 0.1);
	--glass-border: rgba(255, 255, 255, 0.2);
	--shadow-light: rgba(0, 0, 0, 0.1);
	--shadow-medium: rgba(0, 0, 0, 0.15);
	--shadow-heavy: rgba(0, 0, 0, 0.3);
}

/* Animation keyframe */
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Apply fade animation to all main elements */
.profile-container {
	opacity: 0;
	animation: fadeIn 0.4s ease-out forwards;
}

.profile-header {
	opacity: 0;
	animation: fadeIn 0.4s ease-out forwards;
}

.profile-stat-card {
	opacity: 0;
	animation: fadeIn 0.4s ease-out forwards;
}

.profile-detailed-card {
	opacity: 0;
	animation: fadeIn 0.4s ease-out forwards;
}

.profile-session-history {
	opacity: 0;
	animation: fadeIn 0.4s ease-out forwards;
}

.profile-emoji-collection {
	opacity: 0;
	animation: fadeIn 0.4s ease-out forwards;
}

.profile-container {
	max-width: 1200px;
	margin: 0 auto;
	position: relative;
	z-index: 1;
	color: var(--text-light);
	background: var(--primary-gradient);
	min-height: 100vh;
	padding: 20px;
	/* font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; */
}

.profile-container::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
		radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
		radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
	pointer-events: none;
}

.profile-floating-elements {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.profile-floating-circle {
	position: absolute;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
}

.profile-floating-circle:nth-child(1) {
	width: 80px;
	height: 80px;
	top: 10%;
	left: 10%;
}
.profile-floating-circle:nth-child(2) {
	width: 120px;
	height: 120px;
	top: 20%;
	right: 15%;
}
.profile-floating-circle:nth-child(3) {
	width: 60px;
	height: 60px;
	bottom: 30%;
	left: 20%;
}
.profile-floating-circle:nth-child(4) {
	width: 100px;
	height: 100px;
	bottom: 20%;
	right: 10%;
}

.profile-glass {
	background: var(--glass);
	backdrop-filter: blur(20px);
	border: 1px solid var(--glass-border);
	border-radius: 20px;
	box-shadow: 0 8px 32px var(--shadow-medium);
}

.profile-header {
	padding: 40px;
	margin-bottom: 30px;
	position: relative;
	overflow: hidden;
}

.profile-header::before {
	content: '';
	position: absolute;
	top: -50%;
	left: -50%;
	width: 200%;
	height: 200%;
	background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.1), transparent);
	pointer-events: none;
}

.profile-header-content {
	position: relative;
	/* z-index: 2; */
	display: flex;
	align-items: center;
	gap: 40px;
}

.profile-avatar-section {
	position: relative;
}

.profile-avatar-container {
	width: 150px;
	height: 150px;
	position: relative;
	user-select: none;
}

.profile-avatar {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	box-shadow: 0 4px 15px var(--shadow-heavy);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 5rem;
	position: relative;
	cursor: pointer;
	z-index: 2;
	transition: transform 0.15s ease;
}

/* Animated colorful ring - larger than the element */
.profile-avatar.my-profile::before {
	content: '';
	position: absolute;
	top: -12px;
	left: -12px;
	right: -12px;
	bottom: -12px;
	border-radius: 50%;
	background: conic-gradient(
		from 0deg,
		#ff006e,
		/* Neon Pink */ #8338ec,
		/* Electric Purple */ #3a86ff,
		/* Bright Blue */ #06ffa5,
		/* Neon Green */ #ffbe0b,
		/* Electric Yellow */ #ff006e /* Back to Pink */
	);
	z-index: -1;
	animation: rotate 6s linear infinite;
}

/* Mask the center to create ring effect */
.profile-avatar.my-profile::after {
	content: '';
	position: absolute;
	top: -4px;
	left: -4px;
	right: -4px;
	bottom: -4px;
	border-radius: 50%;
	background: inherit; /* Uses the same background as parent */
	z-index: -1;
}

@keyframes rotate {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

.my-profile-badge {
	display: none; /* Hidden by default */
	position: absolute;
	bottom: -20px;
	right: 0px;
	left: 0px;
	margin: 0 auto;
	text-align: center;
	max-width: 85px;
	background: var(--success);
	color: white;
	font-size: 0.75rem;
	font-weight: 700;
	padding: 6px 12px;
	border-radius: 20px;
	box-shadow: 0 2px 8px var(--shadow-medium);
	user-select: none;
	z-index: 3;
}

.profile-avatar:hover {
	transform: scale(1.02);
}

.profile-avatar * {
	cursor: pointer;
}

/* .profile-online-indicator {
	position: absolute;
	bottom: 10px;
	right: 10px;
	width: 24px;
	height: 24px;
	background: var(--success);
	border-radius: 50%;
	border: 4px solid white;
	box-shadow: 0 0 0 2px var(--success);
} */

.profile-info {
	flex: 1;
	color: var(--text-light);
}

.profile-name {
	font-size: 3rem;
	font-weight: 700;
	margin-bottom: 10px;
	background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
	background-clip: text;
	-webkit-background-clip: text;
	/* -webkit-text-fill-color: transparent; */
}

.profile-currency {
	display: flex;
	align-items: center;
	gap: 12px;
	user-select: none;
	font-size: 1.4rem;
	font-weight: 600;
	margin-bottom: 20px;
	padding: 12px 24px;
	background: rgba(255, 255, 255, 0.15);
	border-radius: 50px;
	width: fit-content;
	cursor: pointer;
}

.profile-currency-icon {
	width: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: inherit;
}

.profile-gem-icon {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	cursor: inherit;
}

.profile-dates {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 15px;
	margin-top: 20px;
}

.profile-date-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 20px;
	background: rgba(255, 255, 255, 0.15);
	border-radius: 15px;
	/* backdrop-filter: blur(10px); */
	transition: all 0.15s ease;
}

.profile-date-item:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: translateY(-2px);
}

.profile-date-icon {
	font-size: 1.2rem;
}

.profile-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
	gap: 25px;
	margin-bottom: 40px;
}

.profile-stat-card {
	position: relative;
	padding: 30px;
	border-radius: 24px;
	background: rgba(255, 255, 255, 0.08);
	backdrop-filter: blur(20px);
	border: 1px solid rgba(255, 255, 255, 0.12);
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.profile-stat-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.profile-stat-card:hover {
	transform: translateY(-8px);
	background: rgba(255, 255, 255, 0.12);
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.profile-stat-card:hover::before {
	left: 100%;
}

.profile-stat-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 5px;
	color: var(--text-light);
}

.profile-stat-icon {
	font-size: 2rem;
	opacity: 0.8;
}

.profile-stat-title {
	font-size: 1.3rem;
	font-weight: 600;
	color: var(--text-light);
}

.profile-stat-value {
	font-size: 2.5rem;
	font-weight: 700;
	color: var(--text-light);
	margin-bottom: 5px;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.profile-stat-description {
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.9rem;
}

.profile-progress-bar {
	width: 100%;
	height: 6px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 3px;
	overflow: hidden;
	margin-top: 15px;
}

.profile-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, #10b981, #34d399);
	border-radius: 3px;
	transition: width 2s ease;
	width: 0%;
	position: relative;
	overflow: hidden;
}

.profile-progress-fill::after {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

.profile-win-rate-card {
	position: relative;
}

.profile-win-rate-card .profile-progress-bar {
	position: absolute;
	bottom: 10px;
	left: 50%;
	transform: translateX(-50%);
	width: 70%;
}

.profile-detailed-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
	gap: 30px;
	margin-bottom: 40px;
}

.profile-detailed-card {
	padding: 30px;
	border-radius: 24px;
	background: rgba(255, 255, 255, 0.08);
	backdrop-filter: blur(20px);
	border: 1px solid rgba(255, 255, 255, 0.12);
}

.profile-detailed-title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 25px;
	color: var(--text-light);
	font-size: 1.3rem;
	font-weight: 600;
}

.profile-stat-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	transition: all 0.15s ease;
}

.profile-stat-row:hover {
	background: rgba(255, 255, 255, 0.05);
	margin: 0 -15px;
	padding: 15px;
	border-radius: 12px;
}

.profile-stat-row:last-child {
	border-bottom: none;
}

.profile-stat-row-label {
	display: flex;
	align-items: center;
	gap: 10px;
	color: rgba(255, 255, 255, 0.9);
	font-size: 1rem;
}

.profile-stat-row-value {
	font-weight: 600;
	color: var(--text-light);
	font-size: 1.1rem;
}

/* Session Details */
.profile-session-details {
	padding: 30px;
	border-radius: 24px;
	backdrop-filter: blur(20px);
	margin-bottom: 30px;
}

.profile-last-session-card {
	border-radius: 20px;
	padding: 25px;
	position: relative;
	overflow: hidden;
}

.profile-last-session-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	position: relative;
	z-index: 1;
}

.profile-session-date {
	color: var(--text-light);
	font-size: 1.4rem;
	font-weight: 700;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
	background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
	background-clip: text;
	/* -webkit-background-clip: text;
	-webkit-text-fill-color: transparent; */
}

.profile-session-status {
	padding: 10px 20px;
	border-radius: 25px;
	font-size: 0.95rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.profile-session-status.completed {
	background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(52, 211, 153, 0.3));
	color: #ffffff;
	border: 1px solid rgba(16, 185, 129, 0.5);
	box-shadow: 0 0 15px rgba(16, 185, 129, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2);
}

.profile-session-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 15px;
	position: relative;
	z-index: 1;
}

.profile-session-stat {
	border-radius: 16px;
	padding: 20px 15px;
	text-align: center;
	transition: all 0.15s ease;
	backdrop-filter: blur(10px);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	min-height: 100px;
}

.profile-session-stat:hover {
	background: rgba(255, 255, 255, 0.15);
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.profile-session-stat-label {
	color: rgba(255, 255, 255, 0.8);
	font-size: 0.9rem;
	margin-bottom: 8px;
	font-weight: 500;
}

.profile-session-stat-value {
	color: var(--text-light);
	font-size: 1.3rem;
	font-weight: 700;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
}

.profile-session-history {
	padding: 30px;
	border-radius: 24px;
	background: rgba(255, 255, 255, 0.08);
	backdrop-filter: blur(20px);
	border: 1px solid rgba(255, 255, 255, 0.12);
	margin-bottom: 40px;
}

.profile-session-item {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 20px;
	margin-bottom: 15px;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 16px;
	border-left: 4px solid transparent;
	transition: all 0.15s ease;
}

.profile-session-item:hover {
	background: rgba(255, 255, 255, 0.1);
	transform: translateX(5px);
}

.profile-session-item.win {
	border-left-color: var(--success);
}

.profile-session-content {
	display: flex;
	align-items: center;
	gap: 15px;
	flex: 1;
}

.profile-session-index {
	width: 45px;
	height: 45px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--text-light);
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
	border: 1px solid rgba(255, 255, 255, 0.2);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.profile-session-info {
	flex: 1;
	color: rgba(255, 255, 255, 0.95);
	font-weight: 600;
	font-size: 1.05rem;
}

.profile-session-meta {
	font-size: 0.95rem;
	color: rgba(255, 255, 255, 0.8);
	margin-top: 5px;
	font-weight: 500;
}

.profile-session-results {
	display: flex;
	align-items: center;
	gap: 15px;
}

.profile-session-result {
	padding: 8px 18px;
	border-radius: 25px;
	font-size: 0.9rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.profile-session-result.win {
	background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(52, 211, 153, 0.3));
	color: #ffffff;
	border: 1px solid rgba(16, 185, 129, 0.5);
	box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.profile-session-placement {
	font-weight: 800;
	font-size: 1.2rem;
	color: var(--text-light);
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
	background-clip: text;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	/* border-radius: 25px;
	padding: 10px 14px;
	background: rgba(255, 255, 255, 0.1); */
}

.profile-emoji-collection {
	padding: 30px;
	border-radius: 24px;
	background: rgba(255, 255, 255, 0.08);
	backdrop-filter: blur(20px);
	border: 1px solid rgba(255, 255, 255, 0.12);
}

.profile-emoji-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
	gap: 15px;
	margin-bottom: 25px;
}

.profile-emoji-item {
	aspect-ratio: 1;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2rem;
}

.profile-emoji-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	padding-top: 20px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-emoji-stat {
	text-align: center;
	color: var(--text-light);
}

.profile-emoji-stat-value {
	font-size: 1.5rem;
	font-weight: 700;
	margin-bottom: 5px;
	background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
	background-clip: text;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
}

.profile-emoji-stat-label {
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.7);
}

.profile-loading {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 1.1rem;
}

.profile-loading::after {
	content: '';
	width: 20px;
	height: 20px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top: 2px solid var(--text-light);
	border-radius: 50%;
	margin-left: 10px;
}

.profile-loading-spinner {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 1.1rem;
}

.profile-loading-spinner::after {
	content: '';
	width: 20px;
	height: 20px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top: 2px solid var(--text-light);
	border-radius: 50%;
	margin-left: 10px;
}

/* Mobile responsive */
@media (max-width: 768px) {
	.profile-container {
		padding: 10px;
	}

	.profile-header-content {
		flex-direction: column;
		text-align: center;
		gap: 30px;
	}

	.profile-name {
		font-size: 2rem;
	}

	/* Updated stats grid - minimum 2 per row, maintaining equal size */
	.profile-stats-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 20px;
	}

	.profile-stat-card {
		min-height: 180px; /* Ensure consistent height */
	}

	/* Updated detailed stats - also ensure minimum 2 per row */
	.profile-detailed-stats {
		grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	}

	.profile-session-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 12px;
	}

	.profile-session-stat {
		padding: 15px 10px;
		min-height: 85px;
	}

	.profile-session-stat-value {
		font-size: 1.1rem;
	}

	.profile-session-item {
		flex-direction: column;
		align-items: stretch;
		gap: 15px;
	}

	.profile-session-results {
		justify-content: center;
	}
}

@media (max-width: 700px) {
	.profile-stats-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 15px;
	}
}

@media (max-width: 480px) {
	.profile-last-session-header {
		flex-direction: column;
		gap: 10px;
		text-align: center;
	}

	.profile-stat-card {
		padding: 20px 15px;
		min-height: 160px;
	}

	.profile-stat-value {
		font-size: 2rem;
	}

	.profile-session-grid {
		grid-template-columns: 1fr 1fr;
		gap: 10px;
	}

	.profile-session-stat {
		padding: 12px 8px;
		min-height: 75px;
	}

	/* For detailed stats on very small screens, allow single column */
	.profile-detailed-stats {
		grid-template-columns: 1fr;
	}

	.profile-session-result.win {
		display: none;
	}
}
