:root {
		--bg-color: #1a1a2e;
		--surface-color: #16213e;
		--primary-color: #0f3460;
		--secondary-color: #9b2337;
		--font-color: #e0e0e0;
		--font-color-muted: #a0a0c0;
		--border-color: #303050;
		--radius: 8px;
		--shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
		font-family: 'Inter', sans-serif;
	}

	body {
		margin: 0;
		background-color: var(--bg-color);
		color: var(--font-color);
	}
    .pagination-input input {
        width: 60px; /* Adjust this value as needed */
        padding: 0.5rem;
        text-align: center;
    }
	main {
		max-width: 1400px;
		margin: 0 auto;
		padding: 2rem;
	}

	header {
		text-align: center;
		margin-bottom: 2rem;
	}

	h1 {
		color: white;
		font-size: 2.5rem;
		font-weight: 700;
	}

	.subtitle {
		font-size: 1.1rem;
		color: var(--font-color-muted);
		margin-top: -1rem;
	}

	section.controls {
		display: flex;
		justify-content: center;
		margin-bottom: 1.5rem;
	}

	.filter-panel {
		background: var(--surface-color);
		padding: 1.5rem 2rem;
		border-radius: var(--radius);
		margin-bottom: 2rem;
		border: 1px solid var(--border-color);
		box-shadow: var(--shadow);
	}

	fieldset {
		border: none;
		padding: 0;
		margin: 0 0 1.5rem 0;
		display: grid;
		gap: 1rem;
		grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	}
	fieldset:last-child {
		margin-bottom: 0;
	}

	.grid-fieldset {
		grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	}

	legend {
		font-weight: 600;
		margin-bottom: 0.75rem;
		font-size: 0.9rem;
		color: var(--font-color-muted);
		text-transform: uppercase;
		letter-spacing: 0.5px;
	}

	.range-inputs {
		display: flex;
		align-items: center;
		gap: 0.5rem;
	}
	.range-inputs span {
		color: var(--font-color-muted);
	}

	.tag-fieldset {
		display: block;
	}

	.tag-container {
		max-height: 120px;
		overflow-y: auto;
		background: var(--bg-color);
		border-radius: var(--radius);
		padding: 0.75rem;
		border: 1px solid var(--border-color);
		margin-bottom: 1rem;
	}

	.tag-checkbox {
		display: inline-flex;
		align-items: center;
		background: var(--primary-color);
		border-radius: 1rem;
		padding: 4px 4px 4px 10px;
		margin: 4px;
		cursor: pointer;
		transition: background 0.2s ease;
		user-select: none;
	}
	.tag-checkbox:hover {
		background: #1c4a85;
	}
	.tag-checkbox input {
		display: none;
	}
	.tag-checkbox span {
		line-height: 1;
	}
	.tag-checkbox input:checked + span {
		position: relative;
		left: -2px;
	}
	.tag-checkbox input:checked::before {
		content: '✓';
		color: var(--secondary-color);
		font-weight: bold;
		margin-right: 6px;
	}

	
	.tag-checkbox.selected {
		background: var(--secondary-color); /* A more prominent color */
		border: 1px solid var(--font-color); /* A border to make it stand out */
		color: white;
	}
	.tag-checkbox.selected:hover {
		background: #660817; /* A slightly darker shade on hover for selected */
	}

	.results-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		flex-wrap: wrap;
		gap: 1rem;
		margin-bottom: 2rem;
		padding: 1rem;
		background: var(--surface-color);
		border-radius: var(--radius);
	}

	.sort-controls,
	.pagination,
	.per-page-controls {
		display: flex;
		align-items: center;
		gap: 0.75rem;
	}

	.pagination {
		flex-grow: 1;
		justify-content: center;
	}
	.pagination.bottom {
		margin-top: 2rem;
		justify-content: center;
	}

	input,
	select {
		width: 100%;
		background: var(--bg-color);
		border: 1px solid var(--border-color);
		border-radius: var(--radius);
		padding: 0.75rem;
		color: var(--font-color);
		font-size: 1rem;
		transition:
			border-color 0.2s,
			box-shadow 0.2s;
		box-sizing: border-box;
	}
	input:focus,
	select:focus {
		outline: none;
		border-color: var(--secondary-color);
		box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.3);
	}

	button {
		background: var(--primary-color);
		color: white;
		border: none;
		padding: 0.75rem 1.25rem;
		border-radius: var(--radius);
		font-weight: 600;
		cursor: pointer;
		transition:
			background-color 0.2s,
			transform 0.1s;
	}
	button:hover {
		background: #1c4a85;
	}
	button:active {
		transform: scale(0.98);
	}
	button:disabled {
		background: var(--border-color);
		color: var(--font-color-muted);
		cursor: not-allowed;
	}
	button.secondary {
		background: transparent;
		border: 1px solid var(--border-color);
		color: var(--font-color);
	}
	button.secondary:hover:not(:disabled) {
		background: var(--border-color);
	}
	button.toggle-filters {
		display: inline-flex;
		align-items: center;
		gap: 0.5rem;
		background: var(--primary-color);
	}

	.grid {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
		gap: 1.5rem;
	}
	.card {
		background: var(--surface-color);
		border-radius: var(--radius);
		overflow: hidden;
		display: flex;
		flex-direction: column;
		border: 1px solid var(--border-color);
		transition:
			transform 0.2s ease-in-out,
			box-shadow 0.2s ease-in-out;
		box-shadow: var(--shadow);
	}
	.card:hover {
		transform: translateY(-5px);
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
	}

	.card-cover {
		position: relative;
		aspect-ratio: 2 / 3;
		background-color: #000;
	}
	.card-cover img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
	}
	.cover-placeholder {
		display: none;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 100%;
		color: var(--font-color-muted);
	}
	.cover-placeholder svg {
		width: 50px;
		height: 50px;
	}
	.cover-placeholder span {
		margin-top: 0.5rem;
	}

	.no-cover .cover-placeholder {
		display: flex;
	}

	.card-content {
		padding: 1rem;
		display: flex;
		flex-direction: column;
		flex-grow: 1;
	}
	.card-content h2 {
		font-size: 1.2rem;
		margin: 0 0 0.25rem;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.card-content .author {
		font-size: 0.9rem;
		color: var(--font-color-muted);
		margin: 0 0 1rem;
	}

	.synopsis {
		font-size: 0.9rem;
		line-height: 1.5;
		color: var(--font-color-muted);
		margin: 0 0 1rem;
		flex-grow: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		line-clamp: 3;
	}

	.tags {
		display: flex;
		flex-wrap: wrap;
		gap: 0.5rem;
		margin-bottom: 1rem;
	}
	.tag {
		background-color: var(--primary-color);
		color: var(--font-color);
		padding: 0.25rem 0.6rem;
		border-radius: 1rem;
		font-size: 0.75rem;
	}

	.card-footer {
		display: flex;
		justify-content: space-between;
		font-size: 0.8rem;
		color: var(--font-color-muted);
		border-top: 1px solid var(--border-color);
		padding-top: 0.75rem;
		margin-top: auto;
	}

	.status-message {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 4rem 2rem;
		text-align: center;
		color: var(--font-color-muted);
	}
	.status-message.error {
		color: var(--secondary-color);
	}

	.spinner {
		border: 4px solid var(--border-color);
		border-top: 4px solid var(--secondary-color);
		border-radius: 50%;
		width: 40px;
		height: 40px;
		animation: spin 1s linear infinite;
		margin-bottom: 1rem;
	}
	@keyframes spin {
		0% {
			transform: rotate(0deg);
		}
		100% {
			transform: rotate(360deg);
		}
	}

	.autocomplete-wrapper {
		position: relative;
	}

	.suggestions-list {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--surface-color);
		border: 1px solid var(--border-color);
		border-top: none;
		border-radius: 0 0 var(--radius) var(--radius);
		margin: 0;
		padding: 0;
		list-style: none;
		z-index: 100;
		max-height: 250px;
		overflow-y: auto;
		box-shadow: var(--shadow);
	}

	.suggestions-list li {
		padding: 0.75rem;
		cursor: pointer;
		border-bottom: 1px solid var(--border-color);
	}
	.suggestions-list li:last-child {
		border-bottom: none;
	}

	.suggestions-list li:hover {
		background-color: var(--primary-color);
	}

	.card-link {
		text-decoration: none;
		color: inherit;
	}
	.card-link:hover .card {
		transform: translateY(-5px);
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
	}

	/* ADDED: R19 Badge Style */
	.adult-badge {
		position: absolute;
		top: 8px;
		right: 8px;
		background-color: var(--secondary-color);
		color: white;
		width: 28px;
		height: 28px;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 0.8rem;
		font-weight: 700;
		border: 2px solid white;
		z-index: 5;
		user-select: none;
	}

	/* Custom Message Box */
	.custom-message {
		position: fixed;
		bottom: 20px;
		left: 50%;
		transform: translateX(-50%);
		background-color: var(--primary-color);
		color: white;
		padding: 15px 25px;
		border-radius: var(--radius);
		box-shadow: var(--shadow);
		z-index: 1000;
		text-align: center;
		font-size: 1rem;
	}
