/*  */
/* Search bar */
/*  */
#search-container {
	margin: .5rem;
	display: flex;
	gap: .5rem;
	justify-content: center;
	align-items: center;

	border-bottom: 1px solid var(--nav-background-color);
}

#start-search,
#clear-search {
	width: 2rem;
	padding: .5rem;
}

#clear-search {
	opacity: 0;

	padding: .55rem;

	transition: opacity 0.3s ease-out;
}

#search-container:focus-within #clear-search {
	opacity: 1;
}

#search-input {
	width: min(20vw, 12rem);
	padding-block: .3rem;
	outline: 0;
	background-color: transparent;
	color: var(--nav-background-color);
	font-size: .9rem;
	transition: border 0.3s ease-out;
}

#search-input::placeholder {
	color: var(--nav-background-color);
	transition: color 0.2s ease-out;
}

#search-input:focus::placeholder {
	color: transparent;
}

/*  */
/* Library Views */
/*  */
main:has(#massedit-toggle:checked) #list-library,
main:not(
	:has(#massedit-toggle:checked)
):has(#view-button > option[value="posters"]:checked) #table-container,
main:not(
	:has(#massedit-toggle:checked)
):has(#view-button > option[value="table"]:checked) #list-library {
	display: none;
}

#library-container {
	padding: 1.5rem;
}

main:has(#massedit-toggle:checked) #library-container {
	overflow-y: hidden;
}

/*  */
/* Library List */
/*  */
#list-library {
	--entry-width: clamp(7rem, 11%, 9rem);
	display: flex;
	align-items: flex-start;
	flex-wrap: wrap;
	gap: 1rem;
}

.list-entry {
	flex-grow: 1;
	width: var(--entry-width);
	display: flex;
	flex-direction: column;
	justify-content: center;

	text-decoration: none;
	color: var(--dimmed-text-color);
	background-color: var(--foreground-color);
	border-radius: 1px;

	transition: box-shadow 200ms ease-in;
}

.list-entry:hover {
	box-shadow: 0 0 12px #000;
	text-decoration: none;
}

.list-img {
	aspect-ratio: 2/3;
}

.list-entry > :where(h2, p) {
	padding: .1rem .2rem;
	text-align: center;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow-x: hidden;
	font-size: clamp(.65rem, .8vw, .75rem);
	font-weight: 400;
}

.list-entry[monitored] .list-unmonitored,
.list-entry:not([monitored]) .list-monitored {
	display: none;
}

.list-prog-container,
.table-prog-container {
	position: relative;

	overflow: hidden;
	display: flex;
	justify-content: center;

	color: var(--light-color);
	background-color: var(--tool-bar-color);

	text-align: center;
	font-size: clamp(.65rem, .8vw, .75rem);
}

.list-prog-bar,
.table-prog-bar {
	position: absolute;
	inset: 0;
	background-color: var(--error-color);
}

.list-prog-num,
.table-prog-num {
	z-index: 1;
}

.space-taker {
	height: 1rem;
	max-width: 100%;
	width: var(--entry-width);
	flex-grow: 127;
}

/*  */
/* Library Table */
/*  */
#table-container {
	width: 100%;
	overflow-x: auto;

	color: var(--text-color);
}

main:has(#massedit-toggle:checked) #table-container {
	height: 100%;
}

#table-container > table {
	width: max(100%, 25rem);
	border-collapse: collapse;
}

.table-volume {
    min-width: 6.2rem;
}

.table-entry {
	border-top: 1px solid var(--border-color);
	transition: background-color 200ms ease-in-out;
}

.table-entry:hover {
	background-color: var(--hover-color);
}

#table-container :where(th, td) {
	padding-inline: 1rem;
	padding-block: .5rem;
}

.table-prog-container {
	min-width: 5rem;
	border-radius: 4px;
}

.table-monitored-container {
	width: min-content;
	display: flex;
	justify-content: center;
	align-items: center;
}

.table-monitored {
	width: 1.5rem;
}

.table-monitored > svg {
	fill: var(--dimmed-text-color);
}

/*  */
/* Lib stats */
/*  */
#lib-stats {
	width: 100%;
	display: flex;
	flex-wrap: wrap;
	gap: clamp(.5rem, 4vw, 3rem);

	padding-top: 2rem;
	color: var(--text-color);

	font-size: .8rem;
}

#lib-stats th {
	padding-right: 1rem;
	padding-block: .25rem;
	text-align: right;
}

/*  */
/* Mass Editor */
/*  */
main:not(:has(#massedit-toggle:checked)) #table-container :where(td, th):first-child {
	display: none;
}

.action-bar {
	margin-bottom: 1rem;
	position: sticky;
	top: 0px;
	z-index: 2;

	display: none;
	flex-wrap: wrap;
	gap: 1rem;

	padding: .5rem;
	border-radius: 4px;
	background-color: var(--tool-bar-color);
}

main:has(#massedit-toggle:checked) .action-bar {
	display: flex;
}

.action-divider {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
}

.action-bar button {
	min-width: 5rem;

	border: 2px solid var(--border-color);
	border-radius: 4px;
	padding: .4rem .5rem;
	color: var(--text-color);
	background-color: var(--background-color);

	transition: background-color 100ms linear;
}

.action-bar button:hover {
	background-color: var(--foreground-color);
}

.option-container {
    display: flex;
    justify-content: space-between;

	overflow: hidden;
	border-radius: 4px;
	border: 2px solid var(--border-color);
	background-color: var(--background-color);
}

.option-container button {
    min-width: 6.8rem;
	border-radius: 0px;
	border: none;
}

.option-container select {
    flex-grow: 1;
	height: 100%;
	background-color: var(--background-color);
	color: var(--text-color);
}

#cancel-massedit {
	background-color: var(--error-color);
	border-color: var(--error-color);
}

main:has(#massedit-toggle:checked) #lib-stats {
	display: none;
}

@media (max-width: 860px) {
	.action-bar {
        flex-direction: column;
		justify-content: center;
	}
	.action-divider {
		width: 100%;
	}
	.action-divider > *,
	.action-divider  {
        flex: 1 1 0;
	}
    .action-divider > .option-container {
        flex: 1 1 auto;
    }
}

@media (max-width: 535px) {
	header {
		justify-content: flex-start;
	}

	#lib-stats {
		flex-direction: column;
	}

	#lib-stats th {
		width: 50%;
	}
}

@media (max-width: 442px) {
	#library-container {
		padding: 1rem;
	}

	#list-library {
		gap: .75rem;
	}
}
