* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;

	--main-text: #f5f5f5;
	--secondary-text: #ccc;
	--accent-color: #5ad65f;
	--accent-color-dark: #499f4d;
	--background-color: #1e1e1e;
}

ul, ol {
	list-style: none;
}

html {
	scrollbar-gutter: stable;
}

body {
	font-family: Montserrat, sans-serif;
	margin: 0;
	background: var(--background-color);
	color: var(--main-text);
	min-height: 100dvh;
}

header {
	background: #333;
	padding: 1em;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

nav {
	display: flex;
	gap: 10px;
}

nav a {
	display: flex;
	height: 50px;
	width: 150px;
	text-decoration: none;
	color: var(--main-text);
	border-radius: 25px;
	justify-content: center;
	align-items: center;
	font-weight: bold;
	font-size: 1.2em;
	transition: all 0.2s ease;

	&.active {
		background-color: hsl(from var(--accent-color-dark) h s l / 0.7);
	}

	&:hover {
		background-color: var(--accent-color-dark);;
	}
}


main {
	padding: 2em;
	max-width: 1200px;
	margin: 0 auto;
}

.main-btn {
	padding: 10px 15px 10px 10px;
	background: transparent;
	border-radius: 10px;
	border: 2px solid var(--accent-color);
	color: var(--accent-color);
	cursor: pointer;
	font-weight: bold;
	font-size: 1em;
	display: flex inline;
	gap: 5px;
	align-items: center;
	white-space: nowrap;
	transition: all 0.2s ease;

	& svg {
		fill: var(--accent-color);
		transition: fill 0.2s ease;
	}

	&:focus-visible {
		outline: var(--accent-color) solid 3px;
	}
}

.main-btn:disabled {
	background-color: #222;
	cursor: not-allowed;
	color: rgba(from var(--accent-color-dark) r g b / 0.5);
	border-color: rgba(from var(--accent-color-dark) r g b / 0.5);

	& svg {
		fill: rgba(from var(--accent-color-dark) r g b / 0.5);
	}
}


.main-btn:not(:disabled):hover {
	background: rgba(0, 0, 0, 0.1);
	border-color: var(--accent-color-dark);
	color: var(--accent-color-dark);

	& svg {
		fill: var(--accent-color-dark);
	}
}

.red-btn {
	border-color: #ff5555;
	color: #ff5555;
	outline-color: #ff5555;

	& > svg {
		fill: #ff5555;
	}

	&:focus-visible {
		outline-color: #ff5555;
	}

	&:not(:disabled):hover {
		border-color: #912a2a;
		color: #912a2a;

		& > svg {
			fill: #912a2a;
		}
	}
}

select {
	padding: 10px;
	border-radius: 14px;
	border: 4px solid #222;
	background: #333;
	color: var(--secondary-text);
	font-size: 1em;
	transition: all 0.2s ease;
	outline: none;
	cursor: pointer;

	&:focus-visible {
		border-color: var(--accent-color);
	}
}

/* search bar */
#search-input-container {
	display: flex;
	align-items: center;
	gap: 20px;
	position: relative;
	margin-bottom: 0.5em;

	& > svg {
		position: absolute;
		left: 12px;
		fill: #757575;
		pointer-events: none;
		transition: all 0.2s ease;
	}
}

#search-input {
	padding: 10px 10px 10px 40px;
	border-radius: 14px;
	border: 4px solid #222;
	background: #333;
	color: var(--main-text);
	font-size: 1em;
	width: 100%;
	transition: all 0.2s ease;
	outline: none;

	&:focus-visible {
		border-color: var(--accent-color);

		:has(+ &) {
			fill: var(--secondary-text);
		}
	}
}

/* pagination */
.pagination {
	display: flex;
	gap: 15px;
	justify-content: end;
	margin-left: auto;
}

.pagination > * {
	min-width: 40px;
	height: 40px;
	border-radius: 40px;
	display: flex block;
	align-items: center;
	justify-content: center;
}

.pagination > button {
	background: #333;
	transition: all 0.2s ease;
	border: none;
	cursor: pointer;

	&:focus-visible {
		outline: var(--accent-color) solid 4px;
	}

	&:not(:disabled):hover {
		background: #444;
	}

	& svg {
		fill: var(--secondary-text);
	}

	&:disabled {
		background-color: #222;
		cursor: not-allowed;
	}

	/* le svg n'est pas centré ça clc du coup faut mettre un peu de padding */

	&:nth-child(2) svg {
		padding-left: 2px;
	}
}

.pagination > span {
	background-color: var(--accent-color);
	color: var(--background-color);
	font-weight: bold;
	font-size: 1.2em;
	padding: 10px;
}

#pagination-section {
	justify-content: right;
}

/* mods list */
#mods-list li, #results > ul > li {
	background: #2a2a2a;
	margin: 0.7em 0;
	padding: 1em;
	border-radius: 14px;
}

#mods-list > div {
	margin-top: 0.5em;
}

#results-container img {
	width: 100px;
	height: 100px;
}

#results-container .description {
	flex: 1;
}

#results-container .right-info {
	flex-direction: column;
	justify-content: space-between;
	align-items: end;

	& button {
		margin-top: 5px;
	}
}

#results-container > li,
#mods-container > li {
	font-size: 1.1em;

	& > div {
		display: flex;
		gap: 15px;
	}

	& a:has(> img) {
		display: flex;
		align-items: center;
	}

	& img {
		object-fit: cover;
		border-radius: 5px;
	}

	& > div > div:nth-of-type(1) {
		flex: 1;
		display: flex;
		flex-direction: column;
		gap: 10px;
		min-width: 0;

		& > p {
			font-size: 0.9em;
		}
	}

	& div.header {
		display: flex;
		gap: 7px;
		align-items: baseline;
	}

	& div ul {
		display: flex;
		gap: 7px;
		flex-wrap: wrap;
		font-size: 0.9em;
		color: var(--secondary-text);

		& > li.environment-tag {
			color: var(--main-text);
		}
	}

	& div.right-info {
		font-size: 0.9em;
		display: flex;
		text-align: right;
		color: var(--secondary-text);

		& .value {
			color: var(--main-text);
			font-weight: bold;
			font-size: 1.2em;
		}

		& button {
			padding: 7px 10px 7px 7px;
			font-size: 0.9em;
		}
	}

	.link {
		text-decoration: none;
		transition: all 0.2s ease;

		&:hover {
			transform: scale(1.05);
		}
	}
}

#mods-container > li > div > a {
	width: 75px;
	height: 75px;

	& img {
		height: 100%;
		width: 100%;
		aspect-ratio: 1;
	}
}

#mods-container .description {
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
	height: 1lh;
	min-width: 0;
}

#mods-container .right-info {
	flex-direction: row;
	align-items: center;
	justify-content: center;
	gap: 20px;
}

.toggle-btn-label {
	width: 80px;
	height: calc(1lh + 20px);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;

	& span {
		height: 50%;
		width: 70%;
		border-radius: 50px;
		position: relative;

		transition: background-color 0.2s ease-out;

		&::after {
			content: "";
			display: inline-block;
			height: 150%;
			aspect-ratio: 1;
			background: #fff;
			border-radius: 50%;
			position: absolute;
			top: -25%;
			box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);

			transition: left 0.2s ease-out, transform 0.2s ease;
		}
	}

	&:hover span::after {
		transform: scale(1.1);
	}

	&:active span::after {
		transform: scale(0.9);
	}
}

.right-info input[type="checkbox"]:checked + .toggle-btn-label {
	& span {
		background-color: var(--accent-color);

		&::after {
			left: 62.5%;
		}
	}
}

.right-info input[type="checkbox"]:not(:checked) + .toggle-btn-label {
	& span {
		background-color: #222;

		&::after {
			left: -12.5%;
		}
	}
}

.title {
	color: var(--main-text);
	font-size: 1.3em;
	transition: color 0.2s ease;
}

.description {
	transition: color 0.2s ease;
}

.thumbnail {
	transition: filter 0.2s ease;
}

#mods-container li:has(input[type="checkbox"]:not(:checked)) .title {
	color: #6a6a6a;
}

#mods-container li:has(input[type="checkbox"]:not(:checked)) .description {
	color: #4a4a4a;
}

#mods-container li:has(input[type="checkbox"]:not(:checked)) .thumbnail {
	filter: grayscale(100%);
}

.author, .description {
	color: var(--secondary-text);
}


/* loading */
#loading {
	color: var(--accent-color);
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	margin-top: 15%;
}

#loading-text {
	font-size: 2em;
	text-shadow: 0 0 10px var(--accent-color);
}

#loading-square {
	width: 50px;
	height: 50px;
	border: 6px solid var(--accent-color);
	border-radius: 4px;
	box-shadow: 0 0 8px var(--accent-color), 0 0 8px var(--accent-color) inset;
	margin-bottom: 20px;

	animation: 2s loading ease-in-out infinite;
}

@keyframes loading {
	0% {
		transform: rotateX(0) rotateY(0) rotateZ(0);
	}
	33% {
		transform: rotateX(180deg) rotateY(0) rotateZ(0);
	}
	66% {
		transform: rotateX(180deg) rotateY(180deg) rotateZ(0);
	}
	100% {
		transform: rotateX(180deg) rotateY(180deg) rotateZ(180deg);
	}
}

/* no mods message */
#no-mods,
#no-last-update {
	display: flex;
	justify-content: center;
	align-items: center;
	padding-top: 7vh;
	color: #555555;
	font-style: italic;
	font-size: 1.5em;
}

/* modal */
.modal {
	display: none;
	position: fixed;
	z-index: 100;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: auto;
	background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
	background-color: #222;
	margin: 15% auto;
	padding: 20px;
	border-radius: 10px;
}

.close {
	float: right;
	font-size: 24px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 1lh;
	width: 1lh;
	border-radius: 50%;
	transition: all 0.2s ease;

	&:hover {
		background-color: #444;
	}
}

body.modal-open {
	overflow: hidden;
}

#not-found-list {
	overflow-y: auto;
	max-height: 30vh;
	scrollbar-color: #8b8b8b transparent;

	& li {
		padding: 10px;
		border-bottom: 1px solid #444;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	& li:nth-child(odd) {
		background-color: #333;
	}

	& li:nth-child(even) {
		background-color: #2a2a2a;
	}
}

#not-found-modal .modal-content {
	max-width: 400px;

	& h2 {
		margin-bottom: 10px;
	}
}

#update-mods-modal .modal-content {
	width: max-content;

	& h2 {
		margin-bottom: 25px;
	}
}

#update-mods-modal .form-group {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 1em;
}

#update-mods-modal .modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 20px;
	margin-top: 1.5em;
}

#update-mods-modal .modal-actions button {
	padding: 10px;
}

#update-mods-modal .folder-selection {
	display: flex;
	flex-direction: column;
}

#update-mods-modal .folder-selection button {
	margin-bottom: 10px;
	margin-inline: auto;
	padding: 8px 20px;
	font-size: 1em;
	border-radius: 10px;
	border: none;
	background: #333;
	cursor: pointer;
	color: var(--secondary-text);
	outline: transparent solid 4px;
	transition: background-color 0.2s ease, outline-color 0.2s ease;

	&:hover {
		background: #444;
	}

	&:focus-visible {
		outline-color: var(--accent-color);
	}
}

#update-mods-modal .folder-selection input {
	display: block;
	width: 100%;
	background: #333;
	border: none;
	border-radius: 10px;
	padding: 5px;
	color: var(--secondary-text);
	outline: transparent solid 4px;
	transition: outline-color 0.2s ease;

	&:hover {
		background: #444;
	}

	&:focus-visible {
		outline: var(--accent-color) solid 4px;
	}
}