/* Styl dla przycisku plecaka (toggle inwentarza) */
.inventory {
	display: none;
}

.inventory.open {
	display: block;
}

.inventory-toggler {
	display: none;
	position: fixed;
	top: 10px;
	left: 10px;
	width: 50px;
	height: 50px;
	background: none;
	border: none;
	cursor: pointer;
	z-index: 120;
	transition: transform 0.3s ease, filter 0.3s ease;
}

.inventory-toggler img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: filter 0.3s ease;
}

.inventory-toggler:hover {
	transform: scale(1.2) rotate(-10deg);
}

.inventory-toggler:hover img {
	filter: brightness(1.5) sepia(0.5);
}

/* Panel inwentarza – zawsze renderowany, ale schowany poza ekranem (góra) */
.inventory-panel {
	position: fixed;
	top: -300px; /* Przesuwamy początkowo poza ekran (góra) */
	left: 50%;
	transform: translateX(-50%);
	width: 90%;
	max-width: 600px;
	height: auto;
	border-radius: 0 0 20px 20px;
	background: rgba(0, 0, 0, 0.9);
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
	z-index: 130;
	padding: 20px;
	display: flex;
	flex-direction: column;
	align-items: center;
	opacity: 0;
	transition: top 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Panel widoczny (po dodaniu klasy "open") */
.inventory-panel.open {
	top: 0;
	opacity: 1;
}

/* Nagłówek inwentarza */
.inventory-panel h2 {
	margin: 0 0 15px;
	text-align: center;
	font-size: 1.4rem;
	color: white;
	text-transform: uppercase;
}

/* Sloty w inwentarzu (ułożone w rządach) */
.inventory-items {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	width: 100%;
}

/* Pojedynczy slot */
.inventory-slot {
	width: 60px;
	height: 60px;
	background-color: rgba(255, 255, 255, 0.2);
	border: 2px solid rgba(255, 255, 255, 0.5);
	border-radius: 8px;
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 2.4rem;
	color: white;
	transition: background-color 0.3s ease, transform 0.2s ease;
}

.inventory-slot:hover {
	background-color: rgba(255, 255, 255, 0.4);
	transform: scale(1.05);
}

/* Ikona/grafika przedmiotu w slocie */
.inventory-item {
	width: 100%;
	height: 100%;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
}

/* Klasa wyróżniająca slot (np. do craftingu) */
.crafting-selected {
	border: 2px solid rgb(3, 91, 173);
}

/* ===================== */
/* KONTEKSTOWE MENU      */
/* ===================== */

/* Stan domyślny – niewidoczne menu (bez .show) */
.inventory-context-menu {
	position: fixed;
	margin-left: -50px;
	margin-top: 25px;
	background: rgba(0, 0, 0, 0.3);
	border-radius: 10px;
	box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
	padding: 5px;
	flex-direction: column;
	width: 100px;
	z-index: 140;

	/* Zamiast display: none – używamy visibility + opacity, by działały animacje */
	visibility: hidden;
	opacity: 0;
	transform: scale(0.9);
	transition: visibility 0.3s, opacity 0.3s ease, transform 0.3s ease;
}

/* Klasa "show" – menu staje się widoczne z animacją fade + scale */
.inventory-context-menu.show {
	visibility: visible;
	opacity: 1;
	transform: scale(1);
}

/* Przycisk w menu kontekstowym */
.inventory-context-menu button {
	color: white;
	font-size: 1.2rem;
	border: none;
	padding: 10px;
	border-radius: 10px;
	width: 100%;
	text-align: center;
	cursor: pointer;
	transition: background 0.3s ease-in-out;
	margin-bottom: 4px; /* odrobinę miejsca między przyciskami */
}

/* Użyj – zielony */
.context-use {
	background-color: #039325;
}
.context-use:hover {
	background: rgb(33, 183, 3);
}

/* Usuń – czerwony */
.context-remove {
	background-color: #760707;
}
.context-remove:hover {
	background: rgba(255, 0, 0, 1);
}

/* Połącz – niebieski */
.context-combine {
	background-color: #0056b3;
	border-radius: 10px;
	color: white;
}
.context-combine:hover {
	background-color: #007bff;
}

/* Anuluj – przezroczysty/szary */
.context-cancel {
	background-color: transparent;
	color: black;
}
.context-cancel:hover {
	background: rgba(255, 255, 255, 0.4);
}

/* ===================== */
/* Media queries telefon */
/* ===================== */
@media (max-width: 926px) {
	.inventory-toggler {
		width: 35px;
		height: 35px;
	}

	.inventory-panel {
		width: 100%;
		border-radius: 0;
		padding: 10px;
	}

	.inventory-slot {
		width: 30px !important;
		height: 30px !important;
	}

	.inventory-context-menu button {
		font-size: 10px;
	}
}
