/* ==========================================================================
   RETRO PC DESKTOP ENVIRONMENT (WINDOWS 95/98 STYLE)
   ========================================================================== */
:root {
	--win-bg: #008080; /* Klasyczny Windowsowy turkus/teal */
	--win-gray: #c0c0c0;
	--win-dark-gray: #808080;
	--win-blue: #000080;
	--win-light-blue: #1084d0;

	/* Style Terminala */
	--background: #000000; /* Zmieniamy na czarny jak w MS-DOS */
	--primaryTextColor: #c0c0c0;
	--secundaryTextColor: #ffffff;
	--highlightTextColor: #aaaaaa;
	--white: #fff;
	--baseDirectory: 'guest@allegrojacc.ovh> ';
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	height: 100vh;
	width: 100vw;
	overflow: hidden;

	/* Zostawiamy kolor jako tło zapasowe, gdyby obrazek się nie załadował */
	background-color: var(--win-bg) !important;

	/* NOWE: Ścieżka do Twojej tapety */
	background-image: url('../images/tapeta.png') !important;

	/* Ustawienia tapety - do wyboru: */
	background-size: cover; /* Rozciąga tapetę na cały ekran (nowoczesny styl) */
	background-position: center; /* Wyśrodkowuje obrazek */
	background-repeat: no-repeat; /* Zapobiega powielaniu się obrazka */

	font-family: Arial, sans-serif;
}

/* Pulpit komputera */
#desktop {
	width: 100%;
	height: calc(100vh - 40px);
	position: relative;
	padding: 20px;
	box-sizing: border-box;
	display: block;
	user-select: none;
	-webkit-user-select: none;
}

/* ZAZNACZANIE NA PULPICIE */
#selection-box {
	position: fixed; /* ZMIENIONE Z absolute na fixed - rozwiązuje problem przesunięcia! */
	border: 1px dotted #ffffff;
	background-color: rgba(0, 0, 128, 0.3);
	display: none;
	z-index: 5;
	pointer-events: none;
}

/* Ikony na pulpicie */
.desktop-icon {
	width: 80px;
	text-align: center;
	margin-bottom: 25px;
	cursor: pointer;
	color: white;
	text-shadow: 1px 1px 1px #000;
	font-size: 12px;
}
.desktop-icon .icon-img {
	font-size: 32px;
	margin-bottom: 5px;
}
.desktop-icon:hover .icon-label {
	background-color: var(--win-blue);
	outline: 1px dotted #fff;
}

/* Główne ikony na pulpicie */
.custom-icon {
	width: 32px;
	height: 32px;
	margin-bottom: 5px;
	/* TEN TRIK JEST WAŻNY: Sprawia, że przy powiększeniu retro ikony 
       zostają ostre i "pikselowate", zamiast brzydko się rozmazywać */
	image-rendering: pixelated;
	display: block;
	margin-left: auto;
	margin-right: auto;
}

/* Mniejsze ikonki do Menu Start */
.custom-icon-small {
	width: 24px; /* Lekko powiększone, żeby lepiej wyglądały obok tekstu */
	height: 24px;
	/* TA LINIJKA JEST NAJWAŻNIEJSZA - ZABIJA SPRĘŻYNĘ: */
	margin: 0 12px 0 0 !important;

	image-rendering: pixelated;
	flex-shrink: 0;
	object-fit: contain;
	display: block;
}

/* STYLIZACJA OKNA WINDOWS 95/98 */
/* STYLIZACJA OKNA WINDOWS 95/98 */
.win95-window {
	position: absolute;
	top: 10%;
	left: 15%;
	width: 60%;
	height: 60%;
	background: var(--win-gray);
	border: 3px solid;
	border-color: #fff var(--win-dark-gray) var(--win-dark-gray) #fff;
	box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
	display: flex;
	flex-direction: column;
	z-index: 10;

	/* NOWE: Włączenie natywnej zmiany rozmiaru okna */
	resize: both;
	overflow: hidden; /* Wymagane przez właściwość resize */
	min-width: 300px; /* Minimalna szerokość okna */
	min-height: 200px; /* Minimalna wysokość okna */
	will-change: width, height;
}

/* NOWE: Styl dla zmaksymalizowanego okna */
.win95-window.maximized {
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: calc(100vh - 40px) !important; /* Wypełnia ekran minus pasek zadań */
	resize: none !important; /* Blokujemy ręczną zmianę rozmiaru w pełnym ekranie */
}

/* Belka tytułowa okna */
.win95-titlebar {
	background: linear-gradient(90deg, var(--win-blue), var(--win-light-blue));
	color: white;
	padding: 4px 6px;
	font-weight: bold;
	font-size: 13px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	cursor: default;
}

.titlebar-controls {
	display: flex;
	gap: 3px;
}

.win95-btn-ctrl {
	background: var(--win-gray);
	border: 2px solid;
	border-color: #fff var(--win-dark-gray) var(--win-dark-gray) #fff;
	font-size: 10px;
	font-weight: bold;
	padding: 0px 5px;
	cursor: pointer;
}
.win95-btn-ctrl:active {
	border-color: var(--win-dark-gray) #fff #fff var(--win-dark-gray);
}

/* Wnętrze okna MS-DOS */
.win95-window-body {
	flex: 1;
	background: var(--background) !important;
	margin: 4px;
	border: 2px inset #fff;
	padding: 10px;
	overflow-y: auto;
	position: relative;
	display: block; /* Zmienione z 'flex' na 'block', żeby tekst zaczynał się na górze */
	color: var(--primaryTextColor);
	font-family: cursor, monospace;
	user-select: text; /* Pozwala zaznaczać tekst wewnątrz okienka */
	-webkit-user-select: text;
}

/* PASEK ZADAŃ (TASKBAR) */
#taskbar {
	position: fixed;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 40px;
	background: var(--win-gray);
	border-top: 3px solid #fff;
	display: flex;
	align-items: center;
	padding: 2px 5px;
	box-sizing: border-box;
	z-index: 100;
	gap: 10px;
}

#start-button {
	background: var(--win-gray);
	border: 2px solid;
	border-color: #fff var(--win-dark-gray) var(--win-dark-gray) #fff;
	padding: 3px 15px;
	cursor: pointer;
	display: flex;
	align-items: center;
	font-weight: bold;
}
#start-button:active {
	border-color: var(--win-dark-gray) #fff #fff var(--win-dark-gray);
}

#running-tasks {
	flex: 1;
	display: flex;
	gap: 5px;
}

.task-tab {
	background: var(--win-gray);
	border: 2px solid;
	border-color: #fff var(--win-dark-gray) var(--win-dark-gray) #fff;
	font-size: 12px;
	padding: 4px 15px;
	max-width: 150px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
}
.task-tab.active-task {
	background: #e0e0e0;
	border-color: var(--win-dark-gray) #fff #fff var(--win-dark-gray);
	font-weight: bold;
}

#system-tray {
	background: var(--win-gray);
	border: 2px inset #fff;
	padding: 4px 10px;
	font-size: 12px;
}

/* ==========================================================================
   STYLE KONSOLI (wewnątrz okna)
   ========================================================================== */
::selection {
	color: var(--background);
	background-color: var(--primaryTextColor);
}
::-moz-selection {
	color: #211830;
	background-color: var(--primaryTextColor);
}
textarea {
	position: absolute;
	left: -100vw;
	background-color: var(--background);
	border: none;
	color: white;
}

b {
	font-weight: bold;
	text-decoration: underline;
}

.cursor {
	font-size: 0.75rem;
	color: var(--secundaryTextColor);
	background-color: var(--secundaryTextColor);
	position: relative;
	opacity: 1;
	height: 1.5em;
	width: 10px;
	max-width: 10px;
	transform: translateY(4px);
	overflow: hidden;
	text-indent: -5px;
	display: inline-block;
	text-decoration: blink;
	animation: blinker 1s linear infinite;
}
@keyframes blinker {
	50% {
		opacity: 0;
	}
}

#command {
	cursor: text;
	height: 50px;
	color: var(--secundaryTextColor);
}
#liner {
	line-height: 1.3em;
	margin-top: -2px;
	animation: show 0.5s ease forwards;
	animation-delay: 1.2s;
	opacity: 0;
}
#liner::before {
	color: var(--highlightTextColor);
	content: var(--baseDirectory);
}

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

p {
	display: block;
	line-height: 1.3em;
	margin: 0;
	overflow: hidden;
	white-space: nowrap;
	letter-spacing: 0.05em;
	animation: typing 0.5s steps(30, end);
}
.no-animation {
	animation: none !important;
}
.typing-animation {
	animation: typing 0.5s steps(30, end);
}
.margin {
	margin-left: 20px;
}
@keyframes typing {
	from {
		width: 0;
	}
	to {
		width: 100%;
	}
}

.highlightColor {
	color: var(--highlightTextColor);
}
.command {
	color: var(--secundaryTextColor);
	text-shadow: 0 0 5px var(--secundaryTextColor);
}
.error {
	color: var(--highlightTextColor);
}
.white {
	color: var(--white);
}
.inherit,
a {
	color: #9c8394;
}
a {
	text-decoration: inherit;
}
a:hover {
	background: var(--secundaryTextColor);
	color: var(--background);
}
a:focus {
	outline: 0;
}

#mobileInput {
	display: none;
}
#terminal {
	width: 100%;
}

/* ==========================================================================
   MENU START
   ========================================================================== */
#start-menu {
	position: fixed;
	bottom: 40px; /* Wyświetla się idealnie nad paskiem zadań */
	left: 0;
	width: 250px;
	background: var(--win-gray);
	border: 3px solid;
	border-color: #fff var(--win-dark-gray) var(--win-dark-gray) #fff;
	display: flex;
	flex-direction: column;
	z-index: 1000;
	box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.start-menu-header {
	background: linear-gradient(90deg, var(--win-blue), var(--win-light-blue));
	color: white;
	padding: 10px;
	display: flex;
	align-items: center;
	font-weight: bold;
	font-size: 16px;
}

.start-menu-header .user-avatar {
	font-size: 24px;
	margin-right: 10px;
	background: #fff;
	border: 2px solid var(--win-dark-gray);
	border-radius: 3px;
	padding: 2px;
}

.start-menu-items {
	padding: 3px;
	display: flex;
	flex-direction: column;
}

.start-menu-item {
	padding: 8px 10px;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	cursor: pointer;
	font-size: 14px;
	color: black;
}

.start-menu-item:hover {
	background-color: var(--win-blue);
	color: white;
}

.start-menu-item .icon {
	margin-right: 10px;
	font-size: 18px;
}

.start-menu-divider {
	height: 2px;
	background: var(--win-dark-gray);
	border-bottom: 1px solid #fff;
	margin: 5px 2px;
}

/* Dostosowanie dla telefonów */
@media (max-width: 600px) {
	/* 1. Okna na pełny ekran! */
	.win95-window {
		width: 100% !important;
		height: calc(100vh - 45px) !important; /* Zostawiamy 45px miejsca na pasek zadań */
		top: 0 !important;
		left: 0 !important;
		resize: none !important; /* Blokuje ręczną zmianę rozmiaru */
		border-radius: 0; /* Usuwamy zaokrąglenia, idealnie przylega do krawędzi */
	}

	#window-folder .desktop-icon {
		display: block !important;
	}
	/* Ukrywanie elementów z klasą hide-on-mobile (np. gra DOOM) */
	.hide-on-mobile {
		display: none !important;
	}

	/* Wyłączamy przycisk maksymalizacji na telefonie (bo i tak jest na pełnym ekranie) */
	.win95-titlebar .win95-btn-ctrl:nth-child(2) {
		display: none;
	}

	/* 2. Twoja logika konsoli na mobile */
	#cursor,
	textarea,
	.cursor {
		display: none;
	}
	#mobileInput {
		display: block;
	}
	#mobileInput input {
		border: none;
		background-color: var(--background);
		width: 85%;
		color: var(--primaryTextColor);
		font-family: monospace;
		font-size: 1rem;
		outline: none;
	}
	#mobileInput::before {
		content: '>';
		color: var(--primaryTextColor);
		margin-right: 10px;
	}

	/* 3. Powiększamy przyciski, by łatwo trafić palcem */
	.win95-btn-ctrl {
		padding: 6px 14px;
		font-size: 14px;
	}

	/* 4. Zmniejszamy czcionkę BIOSu */
	#boot-screen {
		font-size: 12px;
		padding: 10px;
	}

	/* 5. Wyłączamy lasso na telefonach */
	#selection-box {
		display: none !important;
	}

	/* 6. Zwiększamy wysokość paska zadań */
	#taskbar {
		height: 45px;
	}
	#start-button {
		padding: 5px 15px;
	}
	#start-menu {
		bottom: 45px;
	}
	/* --- UKRYWANIE ELEMENTÓW WINDOWS --- */
	.desktop-icon,
	#taskbar,
	#start-menu,
	#selection-box {
		display: none !important;
	}

	/* Zmieniamy tapetę na pionową (zrób sobie plik tapeta-android.png) */
	body {
		background-image: url('../images/tapeta-android.png') !important;
		background-position: center top;
	}

	/* --- POKAZYWANIE ELEMENTÓW ANDROID --- */
	#android-status-bar {
		display: flex !important;
		justify-content: space-between;
		align-items: center;
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 25px;
		background-color: transparent;
		color: white;
		padding: 0 15px;
		font-size: 12px;
		font-weight: bold;
		z-index: 2000;
		text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
	}

	#android-nav-bar {
		display: flex !important;
		justify-content: space-around;
		align-items: center;
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 45px;
		background-color: rgba(0, 0, 0, 0.5); /* Półprzezroczysty czarny */
		color: white;
		z-index: 2000;
		backdrop-filter: blur(5px);
	}

	.nav-btn {
		font-size: 22px;
		cursor: pointer;
		padding: 10px 20px;
		user-select: none;
	}

	#android-home {
		display: grid !important;
		grid-template-columns: repeat(4, 1fr); /* 4 ikony w rzędzie */
		gap: 15px;
		padding: 40px 15px 15px 15px; /* Margines od góry na pasek statusu */
		width: 100%;
	}

	.android-app {
		display: flex;
		flex-direction: column;
		align-items: center;
		cursor: pointer;
	}

	.android-app img {
		width: 50px;
		height: 50px;
		margin-bottom: 5px;
		background-color: #fff;
		border-radius: 12px; /* Kształt ikony z Androida/iOS */
		padding: 8px;
		box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
	}

	.android-app span {
		color: white;
		font-size: 11px;
		text-shadow: 1px 1px 3px black;
		text-align: center;
	}

	/* Poprawka dla okien MS-DOS / A-NET na mobilce - żeby nie wchodziły pod pasek statusu i nawigacji */
	.win95-window {
		top: 25px !important;
		height: calc(100vh - 70px) !important; /* 100% ekranu minus wysokość statusu i paska nawigacji */
	}
}
/* ==========================================================================
   EKRAN BOOTOWANIA (START SYSTEMU)
   ========================================================================== */
#boot-screen {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-color: #000000;
	color: #c0c0c0; /* Klasyczny, jasnoszary kolor BIOSu */
	font-family: 'Courier New', Courier, monospace;
	font-size: 16px;
	z-index: 9999; /* Ważne: 9999 sprawia, że ekran jest na samym wierzchu, nad oknami i paskiem */
	padding: 20px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Pojedyncza linijka tekstu w BIOSie */
.boot-line {
	margin: 2px 0;
}

/* Animacja płynnego znikania ekranu po załadowaniu */
.fade-out {
	animation: fadeOutScreen 1s forwards;
}

@keyframes fadeOutScreen {
	from {
		opacity: 1;
	}
	to {
		opacity: 0;
		visibility: hidden; /* Wyłącza klikanie w ten ekran po zniknięciu */
	}
}

/* Domyślnie ukrywamy interfejs Androida na komputerach PC */
.only-mobile {
	display: none !important;
}
