/* Game Roulette - Stylesheet */
:root {
	/* Colors */
	--primary: #49b7a9;
	--accent: #ff4757;
	--success: #5cb85c;
	--warning: #f0ad4e;
	--info: #007bff;
	--secondary: #6c757d;

	/* Hover Colors */
	--primary-hover: #3a9e92;
	--accent-hover: #e63546;
	--success-hover: #4a9e4a;
	--warning-hover: #d99a3e;
	--info-hover: #0062cc;
	--secondary-hover: #565e64;

	/* Glass Morphism */
	--glass-bg: rgba(255, 255, 255, 0.1);
	--glass-border: rgba(255, 255, 255, 0.2);

	/* Shadows & Effects */
	--text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
	--card-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
	--button-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);

	/* Transitions & Animations */
	--transition: all 0.15s ease;
	--transition-slow: all 0.3s ease;

	/* Spacing */
	--padding-xs: 8px;
	--padding-sm: 12px;
	--padding-md: 16px;
	--padding-lg: 20px;
	--gap-sm: 10px;
	--gap-md: 15px;

	/* Border Radius */
	--radius-sm: 6px;
	--radius-md: 8px;
	--radius-lg: 15px;

	/* Font Sizes */
	--font-lg: 1.1rem;
	--font-xl: 1.2rem;
	--font-2xl: 1.5rem;
	--font-3xl: 2rem;
	--font-4xl: 2.5rem;
}

/* Base styles */
* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
	background: #111 url('../uploads/liquid-background.jpg') center / cover no-repeat fixed;
	min-height: 100vh;
	overflow-x: hidden;
	color: white;
}

body::before {
	position: fixed;
	inset: 0;
	z-index: 0;
	backdrop-filter: blur(8px);
	background: rgba(0, 0, 0, 0.45);
	content: '';
}

.container {
	position: relative;
	z-index: 1;
	margin: 0 auto;
	padding: 40px 20px;
	max-width: 1200px;
	text-align: center;
}

/* Typography */
h1 {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-bottom: var(--gap-sm);
	font-size: var(--font-4xl);
	line-height: 1;
	text-shadow: var(--text-shadow);
}

h2,
h3 {
	margin-bottom: var(--gap-md);
	color: white;
	line-height: 1.2;
}

h2 {
	display: flex;
	align-items: center;
	gap: var(--gap-sm);
	font-size: 1.3rem;
}

h3 {
	display: flex;
	align-items: center;
	gap: var(--padding-xs);
	font-size: var(--font-xl);
}

header p {
	opacity: 0.9;
	font-size: var(--font-lg);
}

.title-container {
	display: flex;
	justify-content: center;
	align-items: center;
}

.description-container {
	margin-bottom: 40px;
}

/* Material Icons */
.material-icons {
	vertical-align: bottom;
	font-size: 18px;
	line-height: 1;
}

h2 .material-icons {
	font-size: 24px;
}

.icon-large {
	font-size: 4rem;
}

/* Emoji styling for Noto Color Emoji */
.emoji {
	display: inline-block;
	font-style: normal;
	font-family: 'Noto Color Emoji', sans-serif;
}

h1 .emoji {
	vertical-align: middle;
	margin-right: 0.3em;
	font-size: 1.3em;
}

/* Main layout */
.main-content {
	display: grid;
	grid-template-columns: 1fr min(400px, 40vw);
	gap: 30px;
	align-items: start;
}

/* Global Glass Morphism Card */
.controls-panel {
	backdrop-filter: blur(10px);
	box-shadow: var(--card-shadow);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-lg);
	background: var(--glass-bg);
	padding: var(--padding-lg);
}

/* Global Button System */
button {
	display: flex;
	align-items: center;
	gap: var(--padding-xs);
	transition: var(--transition);
	cursor: pointer;
	border: none;
	border-radius: var(--radius-md);
	padding: var(--padding-sm) var(--padding-md);
	font-weight: 500;
	font-size: 14px;
	font-family: inherit;
}

button:hover {
	box-shadow: var(--button-shadow);
}

button:disabled {
	background: #666;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

/* Button Color Variants */
.btn-primary {
	background: var(--primary);
	color: white;
}

.btn-primary:hover {
	background: var(--primary-hover);
}

.btn-info {
	background: var(--info);
	color: white;
}

.btn-info:hover {
	background: var(--info-hover);
}

.btn-success {
	background: var(--success);
	color: white;
}

.btn-success:hover {
	background: var(--success-hover);
}

.btn-warning {
	background: var(--warning);
	color: white;
}

.btn-warning:hover {
	background: var(--warning-hover);
}

.btn-danger {
	background: var(--accent);
	color: white;
}

.btn-danger:hover {
	background: var(--accent-hover);
}

.btn-secondary {
	background: var(--secondary);
	color: white;
}

.btn-secondary:hover {
	background: var(--secondary-hover);
}

/* Wheel Section */
.wheel-section {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--padding-lg);
}

.wheel-container {
	position: relative;
	width: min(400px, 85vw);
	height: min(400px, 85vw);
	background: var(--glass-bg);
	border-radius: 50%;
	backdrop-filter: blur(10px);
	border: 1px solid var(--glass-border);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.wheel-wrapper {
	width: 87.5%;
	height: 87.5%;
	position: relative;
	touch-action: none;
	user-select: none;
}

.wheel-pointer {
	position: absolute;
	top: -15px;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 20px solid transparent;
	border-right: 20px solid transparent;
	border-top: 40px solid var(--accent);
	z-index: 10;
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.empty-wheel {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: rgba(255, 255, 255, 0.6);
	font-size: var(--font-xl);
	text-align: center;
	line-height: 1.6;
}

.empty-wheel .icon-large {
	margin-bottom: var(--padding-lg);
	opacity: 0.5;
}

/* Spin Controls */
.spin-controls {
	display: flex;
	gap: var(--gap-md);
	flex-wrap: wrap;
	justify-content: center;
}

.spin-controls > * {
	padding: var(--padding-sm) var(--padding-lg);
	border-radius: var(--radius-md);
	font-size: 15px;
	display: flex;
	align-items: center;
	gap: var(--padding-xs);
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.manual-spin {
	color: white;
}

.auto-spin-btn {
	display: none;
}

/* Instruction Box */
.instruction {
	text-align: left;
	padding: var(--padding-lg);
	background: var(--glass-bg);
	border-radius: var(--radius-lg);
	max-width: 400px;
	width: 100%;
	line-height: 1.6;
	backdrop-filter: blur(10px);
	border: 1px solid var(--glass-border);
}

/* Search Section */
.search-section {
	margin-bottom: var(--gap-md);
}

.action-container,
.search-container {
	display: flex;
	gap: var(--gap-sm);
	margin-bottom: var(--gap-md);
	flex-wrap: wrap;
}

.search-container input {
	flex: 1;
	min-width: 200px;
	transition: var(--transition);
	border: none;
	border-radius: var(--radius-md);
	background: rgba(255, 255, 255, 0.9);
	padding: var(--padding-sm);
	color: #333;
	font-size: 1rem;
}

.search-container input:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.search-container button {
	padding: var(--padding-sm) var(--padding-lg);
	font-weight: bold;
	font-size: 1rem;
	white-space: nowrap;
}

/* Search Results */
.search-results {
	max-height: 200px;
	overflow-y: auto;
	margin-bottom: var(--gap-md);
	backdrop-filter: blur(10px);
	border-radius: var(--radius-lg);
	background: rgba(255, 255, 255, 0.05);
	padding: var(--gap-md);
}

.search-results .loading {
	padding: 0;
	justify-content: flex-start;
}

.search-result {
	display: flex;
	align-items: center;
	gap: var(--gap-sm);
	padding: var(--padding-xs);
	margin-bottom: 5px;
	background: var(--glass-bg);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: var(--transition);
}

.search-result:hover {
	background: rgba(255, 255, 255, 0.2);
}

.search-result img {
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: var(--radius-sm);
}

.search-result-placeholder {
	width: 40px;
	height: 40px;
	background: var(--glass-bg);
	border-radius: var(--radius-sm);
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Placeholder Icons */
.placeholder-icon {
	color: rgba(255, 255, 255, 0.6);
	font-size: 24px;
	opacity: 0.4;
}

/* Games List */
.games-list {
	margin: 25px 0;
}

.games-list h3 {
	margin-bottom: var(--gap-md);
}

#games-list {
	max-height: 200px;
	overflow: auto;
}

#games-list.empty {
	backdrop-filter: blur(10px);
	border: 2px dashed rgba(255, 255, 255, 0.3);
	border-radius: var(--radius-lg);
	background: rgba(255, 255, 255, 0.05);
}

.game-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--gap-sm);
	margin-bottom: var(--padding-xs);
	background: var(--glass-bg);
	border-radius: var(--radius-md);
	transition: var(--transition);
}

.game-info {
	display: flex;
	align-items: center;
	gap: var(--gap-sm);
	flex: 1;
	text-align: left;
}

.game-info img {
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: var(--radius-sm);
}

.game-placeholder {
	width: 40px;
	height: 40px;
	background: var(--glass-bg);
	border-radius: var(--radius-sm);
	display: flex;
	align-items: center;
	justify-content: center;
}

.remove-btn {
	background: var(--accent);
	border: none;
	color: white;
	border-radius: 50%;
	width: 30px;
	height: 30px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: var(--transition);
	padding: 0;
}

.game-item:has(.remove-btn:hover) {
	background: rgba(255, 255, 255, 0.15);
}

.remove-btn:hover {
	background: var(--accent-hover);
}

/* Action Buttons */
.actions {
	display: flex;
	gap: var(--gap-md);
	margin: var(--padding-lg) 0 calc(var(--padding-lg) + var(--padding-sm)) 0;
}

.actions button {
	flex: 1;
	justify-content: center;
	padding: var(--padding-sm) var(--padding-lg);
	font-weight: bold;
	font-size: 15px;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

.actions .btn-primary.copied {
	background-color: var(--success);
	background-image: linear-gradient(45deg, var(--success), #4cae4c);
	transform: scale(1.05);
	box-shadow: var(--button-shadow);
}

/* Toggle Section */
.toggle-section {
	border-top: 1px solid var(--glass-border);
	padding-top: var(--padding-lg);
}

.toggle-container {
	color: white;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--padding-xs);
	cursor: pointer;
}

.toggle-container + .toggle-container {
	margin-top: 15px;
}

.toggle-switch {
	position: relative;
	width: 50px;
	height: 24px;
}

.toggle-switch input {
	opacity: 0;
	width: 0;
	height: 0;
}

.slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(255, 255, 255, 0.2);
	transition: var(--transition-slow);
	border-radius: 24px;
}

.slider:before {
	position: absolute;
	content: "";
	height: 18px;
	width: 18px;
	left: 3px;
	bottom: 3px;
	background-color: white;
	transition: var(--transition-slow);
	border-radius: 50%;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
	background-color: var(--accent);
}

input:checked + .slider:before {
	transform: translateX(26px);
}

.slider:hover {
	background-color: rgba(255, 255, 255, 0.3);
}

input:checked + .slider:hover {
	background-color: var(--accent-hover);
}

/* Modal System (Winner Popup) */
.modal-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	justify-content: center;
	align-items: center;
	z-index: 1000;
	backdrop-filter: blur(5px);
	background: rgba(0, 0, 0, 0.8);
	width: 100%;
	height: 100%;
}

.modal-content {
	animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
	border-radius: var(--radius-lg);
	background: white;
	padding: 30px;
	width: 90%;
	max-width: 400px;
	color: #333;
	text-align: center;
}

.modal-content h2 {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: var(--gap-sm);
	margin-bottom: 20px;
	color: var(--accent);
	font-size: var(--font-2xl);
}

.modal-content h2 .emoji {
	font-size: 1em;
	margin: 0 0.2em;
}

.winner-game {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--gap-md);
	margin-bottom: var(--padding-lg);
}

.winner-game img {
	width: 100%;
	max-width: 320px;
	aspect-ratio: 4/3;
	object-fit: cover;
	border-radius: var(--radius-lg);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.winner-placeholder {
	width: 100px;
	height: 100px;
	background: #f0f0f0;
	border-radius: var(--radius-lg);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #666;
}

.winner-placeholder .placeholder-icon {
	font-size: 2rem;
	opacity: 1;
}

.winner-name {
	font-size: 1.25rem;
	font-weight: bold;
	color: #333;
}

.modal-buttons {
	display: flex;
	gap: var(--gap-sm);
}

.modal-buttons button {
	flex: 1;
	justify-content: center;
	padding: var(--padding-sm) var(--padding-lg);
	font-weight: bold;
	font-size: 14px;
	text-transform: uppercase;
}

/* Animations */
@keyframes popIn {
	0% {
		transform: scale(0.7) translateY(50px);
		opacity: 0;
	}

	100% {
		transform: scale(1) translateY(0);
		opacity: 1;
	}
}

/* Utility classes */
.loading {
	display: flex;
	justify-content: center;
	align-items: center;
	opacity: 0.7;
	font-style: italic;
	text-align: center;
}

#games-list .loading {
	padding: var(--padding-lg) 0;
}

.error-message {
	border: 1px solid rgba(255, 107, 107, 0.3);
	border-radius: var(--radius-md);
	background: rgba(255, 107, 107, 0.1);
	padding: var(--gap-sm);
	color: #ff6b6b;
	font-size: 14px;
	text-align: center;
}

/* Custom scrollbar */
.search-results::-webkit-scrollbar,
#games-list::-webkit-scrollbar {
	width: 8px;
}

.search-results::-webkit-scrollbar-track,
#games-list::-webkit-scrollbar-track {
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.1);
}

.search-results::-webkit-scrollbar-thumb,
#games-list::-webkit-scrollbar-thumb {
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.3);
}

.search-results::-webkit-scrollbar-thumb:hover,
#games-list::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 255, 255, 0.5);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
	h1 {
		font-size: var(--font-3xl);
	}

	.container {
		padding: 20px 10px;
	}

	.main-content {
		grid-template-columns: 1fr;
		gap: var(--padding-lg);
	}

	.controls-panel {
		order: -1;
		padding: var(--padding-md);
	}

	.spin-controls {
		flex-direction: column;
	}

	.actions {
		flex-direction: column;
		align-items: center;
	}

	.actions button {
		width: 100%;
		max-width: 300px;
	}

	.modal-buttons {
		flex-direction: column;
	}

	.wheel-section {
		margin-top: 30px;
	}

	.search-container {
		flex-direction: column;
	}

	.search-container input {
		min-width: unset;
	}
}

@media (max-width: 480px) {
	.wheel-pointer {
		border-left-width: 14px;
		border-right-width: 14px;
		border-top-width: 28px;
		top: -10px;
	}

	.modal-content {
		padding: var(--padding-md);
		width: 95%;
	}

	.spin-controls > * {
		font-size: 13px;
		padding: var(--gap-sm) var(--gap-md);
	}
}
