/*
 * Panel styles on top of Bootstrap 5.3. Colors only use Bootstrap's CSS variables,
 * so the light and the dark color mode both work without extra rules.
 */

:root {
	--app-sidebar-width: 240px;
}

/* ---- Layout: menu + main column ---- */

.app-shell {
	display: flex;
	min-height: 100vh;
}

.app-sidebar {
	--bs-offcanvas-width: var(--app-sidebar-width);
}

@media (min-width: 992px) {
	.app-sidebar {
		width: var(--app-sidebar-width);
		flex-shrink: 0;
		position: sticky;
		top: 0;
		height: 100vh;
		overflow-y: auto;
	}

	/* Bootstrap makes .offcanvas-lg transparent on large screens; keep the menu background */
	.app-sidebar.offcanvas-lg {
		background-color: var(--bs-tertiary-bg) !important;
	}
}

.app-brand {
	align-items: center;
	gap: 0.6rem;
	padding: 0.95rem 1.25rem;
	color: var(--bs-emphasis-color);
	font-weight: 600;
	text-decoration: none;
}

.app-brand .bi {
	font-size: 1.35rem;
}

.app-nav-heading {
	padding: 1rem 1.25rem 0.35rem;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--bs-secondary-color);
}

.app-sidebar .nav-link {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	margin-bottom: 2px;
	padding: 0.45rem 0.75rem;
	font-size: 0.925rem;
}

.app-sidebar .nav-link:not(.active):hover {
	background-color: var(--bs-secondary-bg);
}

.app-main {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.app-topbar {
	position: sticky;
	top: 0;
	z-index: 1020;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-height: 3.5rem;
	padding: 0.4rem 1.25rem;
}

.app-content {
	flex: 1 1 auto;
	width: 100%;
	max-width: 1400px;
	padding: 1.5rem 1.5rem 2.5rem;
}

@media (max-width: 575.98px) {
	.app-topbar {
		padding: 0.4rem 0.75rem;
	}

	.app-content {
		padding: 1rem 0.75rem 2rem;
	}
}

/* ---- Currencies of the player in the top bar ---- */

.app-wallet {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1rem;
	min-width: 0;
	font-size: 0.9rem;
	font-variant-numeric: tabular-nums;
}

.wallet-item {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	white-space: nowrap;
}

.currency-icon {
	width: 1.25em;
	height: 1.25em;
	object-fit: contain;
	vertical-align: -0.25em;
}

/* ---- Login ---- */

.guest-card {
	width: 100%;
	max-width: 400px;
}

.guest-logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3.5rem;
	height: 3.5rem;
	border-radius: 1rem;
	font-size: 1.75rem;
	color: var(--bs-primary);
	background: var(--bs-primary-bg-subtle);
}

/* ---- Page header ---- */

.page-header {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	margin-bottom: 1.5rem;
}

.page-header h1 {
	margin: 0;
	font-size: 1.4rem;
	font-weight: 600;
}

.page-subtitle {
	font-size: 0.875rem;
	color: var(--bs-secondary-color);
}

.page-icon {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 2.6rem;
	height: 2.6rem;
	border-radius: 0.6rem;
	font-size: 1.25rem;
	color: var(--bs-primary);
	background: var(--bs-primary-bg-subtle);
}

.section-title {
	margin: 0 0 0.75rem;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--bs-secondary-color);
}

/* ---- Key figures ---- */

.stat-card .stat-label {
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--bs-secondary-color);
}

.stat-card .stat-value {
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.25;
	font-variant-numeric: tabular-nums;
}

.stat-card .stat-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 0.6rem;
	font-size: 1.2rem;
}

/* ---- Shop products: small tiles in a dense grid ---- */

.product-tile {
	height: 100%;
	transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.product-tile:hover {
	border-color: var(--bs-primary-border-subtle);
	box-shadow: var(--bs-box-shadow-sm);
}

.product-tile .card-body {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35rem;
	padding: 0.85rem 0.75rem;
	text-align: center;
}

.product-tile .product-image {
	width: 56px;
	height: 56px;
	object-fit: contain;
}

.product-tile .product-title {
	margin: 0;
	font-size: 0.925rem;
	font-weight: 600;
}

.product-tile .product-text {
	flex-grow: 1;
	font-size: 0.8rem;
	color: var(--bs-secondary-color);
}

.product-tile .btn {
	width: 100%;
	white-space: nowrap;
}

/* Phones: two tiles per row, kept short */
@media (max-width: 575.98px) {
	.product-tile .card-body {
		gap: 0.2rem;
		padding: 0.6rem 0.5rem;
	}

	.product-tile .product-image {
		width: 40px;
		height: 40px;
	}

	.product-tile .product-title {
		font-size: 0.85rem;
	}

	.product-tile .product-text {
		font-size: 0.75rem;
	}
}

/* Portraits: as many small tiles per row as fit */
.portrait-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
	gap: 0.5rem;
}

/* Portraits: the picture on the game's portrait background */
.portrait-thumb {
	position: relative;
	aspect-ratio: 1;
	border-radius: var(--bs-border-radius);
	background: url('../img/special_background.png') center / cover;
	overflow: hidden;
}

.portrait-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Staff-only portraits on the catalog page: smaller tiles, the whole tile ticks its box */
.portrait-grid-sm {
	grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}

.portrait-pick {
	cursor: pointer;
}

.portrait-pick:has(:checked) {
	border-color: var(--bs-primary);
}

.portrait-thumb .badge {
	position: absolute;
	top: 0.35rem;
	left: 0.35rem;
}

/* ---- Tables ---- */

.table-app {
	margin-bottom: 0;
}

.table-app th {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--bs-secondary-color);
	white-space: nowrap;
}

.table-app th a {
	color: inherit;
	text-decoration: none;
}

.table-app td {
	vertical-align: middle;
}

.table-app .num {
	text-align: end;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* Bars of the dashboard distributions */
.dist-row {
	display: grid;
	grid-template-columns: 7.5rem 1fr 3rem;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.875rem;
}

.dist-row + .dist-row {
	margin-top: 0.5rem;
}

.dist-row .progress {
	height: 0.6rem;
}

.dist-row .num {
	text-align: end;
	font-variant-numeric: tabular-nums;
}

/* Tabs remember the open tab in the URL; keep the tab bar scrollable on phones */
@media (max-width: 767.98px) {
	.nav-tabs-scroll {
		flex-wrap: nowrap;
		overflow-x: auto;
		overflow-y: hidden;
	}

	.nav-tabs-scroll .nav-link {
		white-space: nowrap;
	}
}

.min-w-0 {
	min-width: 0;
}
