* { box-sizing: border-box; }

body {
	margin: 0;
	padding: 0;
	background-color: #f8f9fa;
	font-family: 'Poppins', sans-serif;
}

header, main {
	width: 95%;
	max-width: 75rem;
	margin: 0 auto;
}

header {
	padding: 2rem 0;
	border-bottom: 1px solid #eee;
	margin-bottom: 2rem;
}

header h1 {
	margin: 0;
	font-size: 2.5rem;
	font-family: 'Playfair Display', serif;
	font-weight: 700;
	color: #2d3436;
	letter-spacing: -1px;
	text-align: left;
}

header h1::after {
	content: '';
	display: block;
	width: 3.75rem;
	height: 0.25rem;
	background-color: #007bff;
	margin-top: 0.5rem;
	border-radius: 2px;
}

header h1 #hero-accent {
	color: #007bff;
	font-family: 'Poppins', sans-serif;
	font-weight: 500;
	text-shadow: 0 0 6px rgba(0, 123, 255, 0.3);
}

.book-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
	gap: 0.75rem;
	padding: 0.5rem;
	margin: 0 auto;
}

.book-card {
	background-color: #fff;
	border-radius: 8px;
	overflow: hidden;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-card:hover {
	box-shadow: 0 8px 15px rgba(0,0,0,0.15);
	transform: translateY(-5px);
}

.book-info {
	padding: 0.375rem;
	display: flex;
	flex-direction: column;
}

.book-card img,
.details-sidebar img {
	width: 100%;
	max-width: 25rem;
	height: auto;
	aspect-ratio: 2/3;
	border-radius: 6px;
}

.book-info h3 {
	margin: 1rem 0.75rem 0.25rem;
	font-size: 1.1rem;
	color: #2d3436;
	text-align: left;
}

.book-info p {
	margin: 0.25rem 0.75rem;
	font-size: 0.9rem;
	color: #636e72;
}

.book-info p:first-of-type {
	font-weight: 500;
	font-style: italic;
	color: #007bff;
	font-size: 0.85rem;
}

.hidden {
	display: none !important;
}

.genre-button {
	padding: 0.5rem 1rem;
	margin: 0.25rem;
	cursor: pointer;
	background-color: transparent;
	color: #1d1e21;
	font-size: 0.875rem;
	font-weight: 500;
	border: 1.5px solid #e5e7eb;
	border-radius: 6px;
	transition: all 0.25s;
}

.genre-button:hover {
	border-color: #374151;
}

.genre-button.active {
	background-color: #007bff;
    color: #fff;
    border: 1px solid #007bff;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 1000;
}

.modal-content {
	background-color: #fff;
	padding: 1.85rem;
	border-radius: 0.5rem;
	width: 90%;
	min-width: 50%;
	max-width: 56.25rem;
	max-height: 80vh;
	overflow-y: auto;
	overscroll-behavior: contain;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
}

.close-btn {
	position: absolute;
	top: 0.5625rem;
	right: 0.5625rem;
	font-size: 1.4375rem;
	font-weight: bold;
	color: #222;
	transition: 0.3s;
	cursor: pointer;
	line-height: 1;
}

.close-btn:hover{
	color: #444;
}

.modal-content h2 {
	color: #222;
	font-size: 1.4rem;
	margin: 1rem 0.5rem;
}

#history-data-container {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
	width: 100%;
	gap: 0.5rem;
	justify-content: center;
}

#history-data-container li:only-child {
	grid-column: 1 / -1;
	max-width: 20rem;
	margin: 0 auto;
	color: #111;
	font-size: 1.1rem;
	font-style: italic;
	list-style: none;
}

#history-data-container .empty-msg::before {
	content: '\1F4DA';
	display: block;
	font-size: 2rem;
	text-align: center;
	margin-bottom: 1rem;
	opacity: 0.9;
}

.history-item {
	display: flex;
	width: 100%;
}

.history-card {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	width: 100%;
	color: #fff;
	background-color: #555;
	padding: 0.5rem 0.375rem;
	border-radius: 0.5rem;
	border: 2.5px solid transparent;
	border-left: 4px solid var(--status-color);
	transition: border-color 0.4s ease, background-color 0.4s ease, transform 0.3s ease;
	position: relative;
}

.history-card:hover {
	border-color: var(--status-color);
	background-color: #444;
	transform: translateY(-3px);
	box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.3);
}

.history-card.pass {
	--status-color: #4caf50;
}

.history-card.fail {
	--status-color: #f44336;
}

.card-content {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
	padding-right: 0.6rem;
}

.history-book {
	font-size: 1rem;
	font-weight: 700;
	width: 100%;
	min-width: 0;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
	margin-bottom: 0.1875rem;
	display: block;
}

.history-date {
	font-size: 0.8125rem;
	opacity: 0.8;
}

.history-score {
	font-size: 0.9rem;
	font-weight: bold;
	margin-top: 0.25rem;
	color: var(--status-color);
}

.status-dot {
	display: inline-block;
	width: 0.75rem;
	height: 0.75rem;
	border-radius: 50%;
	background-color: var(--status-color);
}

.rmv-button {
	background: transparent;
	color: #fffaf0;
	border: 1px solid #fffaf0;
	border-radius: 4px;
	padding: 0.1875rem 0.5625rem;
	cursor: pointer;
	font-size: 0.8125rem;
	transition: 0.3s;
	position: absolute;
	right: 0.4rem;
	top: 50%;
	transform: translateY(-50%);
}

.rmv-button:hover {
	color: #f44336;
	border: 1px solid #f44336;
	box-shadow: 0 0 4px #f44336;
}

.danger-btn {
	display: block;
	margin: 1.5rem auto 0.5rem auto;
	padding: 0.625rem 1.5rem;
	background-color: #f44336;
	color: #fff;
	border: none;
	border-radius: 0.3125rem;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.8125rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	transition: all 0.3s ease;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.danger-btn:hover {
	background-color: #d32f2f;
	transform: translateY(-2px);
	box-shadow: 0 6px 12px rgba(244, 67, 54, 0.3);
}

.danger-btn:active {
	transform: translateY(0);
}

.search-container {
	display: flex;
	justify-content: flex-start;
	align-items: center;
	gap: 0.625rem;
	margin-bottom: 1.5625rem;
	flex-wrap: wrap;
}

#search-input {
	padding: 0.625rem 1rem;
	width: 100%;
	max-width: 21.875rem;
	border: 2px solid #e0e0e0;
	border-radius: 25px;
	font-size: 1rem;
	outline: none;
	transition: all 0.3s ease;
}

#search-input:focus {
	border-color: #3498db;
	box-shadow: 0 0 8px rgba(52, 152, 219, 0.2);
}

#open-modal-btn {
	background-color: transparent;
	color: #34495e;
	border: 2px solid #34495e;
	padding: 0.625rem 1rem;
	border-radius: 18px;
	cursor: pointer;
	font-size: 0.875rem;
	font-weight: 600;
	white-space: nowrap;
	transition: all 0.3s ease;
}

#open-modal-btn:hover {
	background-color: #34495e;
	color: #fff;
	transform: translateY(-2px);
}

main h2 {
    color: #2d3436;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 1.25rem;
    border-left: 4px solid #007bff;
    padding-left: 0.75rem;
}

.details-wrapper {
	display: flex;
	align-items: flex-start;
	gap: 1rem;
	margin: 1.5rem 0 0.875rem;
}

.details-sidebar {
	flex: 2;
	max-width: 20rem;
}

.details-content {
	flex: 3;
	line-height: 1.6;
	text-align: justify;
	color: #2d3436;
}

.details-sidebar img {
	width: 100%;
	border-radius: 6px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.details-content h4 {
	border-bottom: 2px solid #007bff;
	display: inline-block;
	margin: 0.2rem 0 0.8rem;
	padding-bottom: 0.3125rem;
}

.meta-info h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 1rem 0 0.5rem;
}

.details-content p {
    color: #1a212b;
    line-height: 1.8;
    font-size: 1rem;
    padding: 0 0.5rem;
    margin: 0.5rem 0;
}

.meta-item {
	display: flex;
	flex-direction: column;
	margin-bottom: 1.25rem;
}

.label {
	font-size: 0.8125rem;
	text-transform: uppercase;
	letter-spacing: 0.05rem;
	color: #6b7280;
	font-weight: 600;
}

.value {
	font-size: 1.1rem;
	color: #111827;
	font-weight: 500;
	margin-top: 0.2rem;
}

#back-button {
    background: none;
    border: 2px solid #d1d5db;
    color: #4b5563;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.2s;
    margin: 0.8rem 0;
}

#back-button:hover {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

#start-quiz-btn {
    background-color: #4caf50;
    color: #fff;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: auto;
    min-width: 7.5rem;
}

#start-quiz-btn:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
}

.quiz-container {
	max-width: 37.5rem;
	margin: 2rem auto;
	padding: 2rem;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.quiz-header {
	text-align: center;
	margin-bottom: 2rem;
	border-bottom: 1px solid #eee;
	padding-bottom: 1rem;
}

.question-count {
	color: #6b7280;
	font-size: 0.9rem;
	font-weight: 500;
}

.question-text {
	font-size: 1.25rem;
	font-weight: 600;
	color: #1f2937;
	margin-bottom: 1.5rem;
	line-height: 1.4;
}

.options-grid {
	display: grid;
	gap: 1rem;
}

.quiz-option {
	padding: 1rem 1.5rem;
	background-color: #f9fafb;
	border: 2px solid #e5e7eb;
	border-radius: 10px;
	text-align: left;
	font-size: 1rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
}

.quiz-option:hover {
	border-color: #007bff;
	background-color: #f0f7ff;
	transform: translateX(5px);
}

.quiz-option.correct {
	background-color: #4caf50 !important;
	color: #fff;
	border-color: #45a049;
	box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
}

.quiz-option.wrong {
	background-color: #f44336 !important;
	color: #fff;
	border-color: #da190b;
	box-shadow: 0 4px 10px rgba(244, 67, 54, 0.3);
}

#cancel-quiz {
	margin-top: 2rem;
	background: none;
	border: none;
	color: #ef4444;
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
}

#quiz-section {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 80vh;
}

.quiz-results-card {
	background: #1e1e26;
	padding: 3rem;
	border-radius: 10px;
	text-align: center;
	max-width: 25rem;
	margin: 2rem 0;
	border: 1px solid #333;
	box-shadow: 0 10px 30px rgba(0,0,0,0.5);
	animation: slideUp 0.5s ease-out;
}

.score-display {
	margin: 1.5rem 0;
}

.score-number {
	font-size: 3.5rem;
	font-weight: bold;
	color: #4caf50;
}

.score-total {
	font-size: 1.5rem;
	color: #888;
}

.results-message {
	color: #bbb;
	margin-bottom: 2rem;
	font-style: italic;
}

.primary-btn {
	background-color: #4caf50;
	color: #fff;
	padding: 0.625rem 1.375rem;
	border: none;
	border-radius: 5px;
	font-size: 1rem;
	font-weight: bold;
	cursor: pointer;
	transition: background-color 0.3s ease, transform 0.2s ease;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.primary-btn:hover {
	background-color: #45a049;
	transform: translateY(-2px);
}

.primary-btn:active {
	transform: translateY(0);
}

footer {
	width: 100%;
	padding: 2rem 0;
	margin-top: 3rem;
	border-top: 1px solid #eee;
}

.footer-container {
	width: 95%;
	max-width: 75rem;
	margin: 0 auto;
	text-align: center;
}

.footer-container p {
	font-size: 0.875rem;
	color: #636e72;
	letter-spacing: 0.05rem;
	font-family: 'Poppins', sans-serif;
	margin: 0;
}

@keyframes slideUp {
	from { opacity: 0; transform: translateY(20px); }
	to {opacity: 1; transform: translateY(0); }
}

@media (min-width: 1600px) {
	html { font-size: 125%; }
	header, main { max-width: 93.75rem; }
}

@media (max-width: 1200px) {
	header { padding: 1.5rem 0; margin-bottom: 0; }
	main h2 { margin: 1rem 0 1.25rem; }
	.book-grid { grid-template-columns: repeat(auto-fill, minmax(13.75rem, 1fr)); gap: 0.875rem; }
}

@media (max-width: 1024px) {
	.book-grid { grid-template-columns: repeat(auto-fill, minmax(13.75rem, 1fr)); }
	.book-card img { max-width: 100%; }
	.book-info h3 { margin: 0.5rem 0.25rem 0; }
	.book-info p { margin: 0.25rem; }
}

@media (max-width: 768px) {
	header h1 { font-size: 1.8rem; }
	main h2 { margin: 1rem 0 1.25rem; }
	.modal-content { width: 90%; padding: 1rem; }
	.book-grid { grid-template-columns: repeat(auto-fill, minmax(11.875rem, 1fr)); gap: 0.625rem; }
	.details-wrapper { gap: 1.3rem; }
	.details-sidebar { max-width: none; text-align: center; }
	.details-sidebar img { margin: 0; }
	#history-data-container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
	header, main { width: 95%; }
	header { padding: 1rem 0; margin-bottom: 0; }
	main h2 { margin: 1.5rem 0 1.25rem; }
	.book-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; padding: 0; }
	.book-card img { max-width: 100%; }
	.book-info h3 { font-size: 0.95rem; }
	.details-sidebar { margin: 0 auto; }
	#history-data-container { grid-template-columns: repeat(1, minmax(0, 1fr)); width: 90%; }
	.history-item { width: 100%; margin: 0 auto; }
	.history-book { font-size: 0.9375rem; }
}

@media (max-width: 480px) {
	#book-details-container { width: 100%; max-width: none; }
	.details-wrapper { flex-direction: column; align-items: center; }
	.details-content h4 { display: block; width: fit-content; margin: 0.2rem auto 0.8rem; }
	.details-sidebar img { width: clamp(11.25rem, 75%, 17.5rem); }
}

@media (max-width: 320px) {
	header h1 { font-size: 1.8rem; }
	.book-grid { grid-template-columns: 1fr; gap: 1.25rem; }
	.book-card { padding: 0.625rem; }
	.history-card { gap: 0; }
	.card-content { transform: translateX(8px); }
	.history-book { font-size: 0.9375rem; }
}