/* ============================================================
   Book Library — showcase grid  (green & white theme)
   No modal styles here — the reader is its own page now.
   ============================================================ */

.bl-library {
	background: #fff;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 2rem 1.5rem 3rem;
	font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
	box-sizing: border-box;
}
.bl-library * { box-sizing: border-box; }

/* Header */
.bl-header { text-align: center; margin-bottom: 1.5rem; max-width: 900px; width: 100%; }
.bl-header h1 { font-size: 2.2rem; font-weight: 400; color: #1b4332; margin: 0; }
.bl-header p { color: #4c7a5b; font-size: 1rem; margin-top: 0.4rem; border-top: 1px solid #d7ead9; padding-top: 0.6rem; }

/* Filter bar */
.bl-filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.7rem 1rem;
	margin: 0.8rem 0 0.4rem;
	background: #fff;
	padding: 0.7rem 1.5rem;
	border-radius: 80px;
	box-shadow: 0 3px 12px rgba(46,125,50,0.08);
	border: 1px solid #cdeacf;
	max-width: 1300px;
	width: 100%;
}
.bl-search-wrapper {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	background: #f1faf2;
	border-radius: 60px;
	padding: 0.4rem 1rem;
	border: 1px solid #cdeacf;
}
.bl-search-wrapper:focus-within { border-color: #2e7d32; box-shadow: 0 0 0 3px #2e7d3222; }
.bl-search-input {
	border: none; background: transparent;
	padding: 0.3rem 0.4rem; font-size: 1rem;
	min-width: 180px; outline: none; color: #1b4332;
}
.bl-category-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.bl-cat-btn {
	background: #fff; border: 1px solid #bfe3c3; border-radius: 40px;
	padding: 0.3rem 1rem; font-size: 0.85rem; font-weight: 500;
	color: #245c37; cursor: pointer; transition: 0.15s; white-space: nowrap;
}
.bl-cat-btn:hover { background: #eaf7ec; border-color: #2e7d32; }
.bl-cat-btn.active { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.bl-clear-cat { background: transparent; border: none; color: #6a9a76; font-size: 1.1rem; cursor: pointer; padding: 0 0.3rem; }
.bl-clear-cat:hover { color: #1b4332; }

/* Grid */
.bl-book-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
	gap: 2rem 1.4rem;
	width: 100%; max-width: 1300px;
	margin: 1.6rem auto 0;
}
.bl-book-card {
	background: #fff;
	border-radius: 22px;
	box-shadow: 0 10px 24px rgba(46,125,50,0.07), 0 3px 8px rgba(0,0,0,0.03);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	padding: 1.1rem 1rem 1.3rem;
	display: flex; flex-direction: column; align-items: center; text-align: center;
	border: 1px solid #e3f4e5;
}
.bl-book-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 20px 36px rgba(46,125,50,0.13);
	border-color: #bfe3c3;
}
.bl-book-cover {
	width: 100%; aspect-ratio: 2/3;
	background: #eef8ef; border-radius: 16px;
	display: flex; align-items: center; justify-content: center;
	margin-bottom: 1rem; overflow: hidden;
	box-shadow: 0 6px 14px rgba(46,125,50,0.07);
}
.bl-book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bl-fallback-icon { font-size: 3rem; opacity: 0.4; }
.bl-book-title { font-size: 1rem; font-weight: 600; color: #1b3a1e; line-height: 1.3; }
.bl-book-category {
	font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.6px;
	background: #e3f4e5; padding: 0.12rem 0.8rem; border-radius: 40px;
	color: #23572f; margin: 0.35rem 0 0.6rem; font-weight: 500; display: inline-block;
}
.bl-book-actions { display: flex; justify-content: center; gap: 0.5rem; margin-top: 0.3rem; width: 100%; flex-wrap: wrap; }

/* Read Online — this is now a normal link, opens real new tab */
a.bl-btn-read {
	background: #2e7d32; border: none; padding: 0.5rem 1.2rem;
	border-radius: 60px; font-size: 0.85rem; font-weight: 500;
	color: #fff; cursor: pointer; transition: 0.15s ease;
	flex: 1 1 auto; text-decoration: none; text-align: center;
	display: inline-block;
}
a.bl-btn-read:hover { background: #1b5e20; color: #fff; }

.bl-no-pdf { font-size: 0.8rem; color: #9aa89e; font-style: italic; }

/* Account bar */
.bl-account-bar {
	width: 100%; max-width: 1300px;
	display: flex; align-items: center; justify-content: flex-end;
	gap: 1rem; font-size: 0.85rem; color: #4c7a5b;
	padding: 0 0.2rem 0.6rem;
}
.bl-account-bar strong { color: #1b4332; }
.bl-logout-link {
	color: #2e7d32; text-decoration: none; font-weight: 500;
	border: 1px solid #bfe3c3; padding: 0.25rem 0.9rem; border-radius: 40px;
	transition: 0.15s ease;
}
.bl-logout-link:hover { background: #eaf7ec; border-color: #2e7d32; }

/* Login screen */
.bl-login-wrap {
	display: flex; align-items: center; justify-content: center;
	min-height: 60vh; width: 100%; padding: 2rem 1rem;
}
.bl-login-box {
	background: #fff; border: 1px solid #cdeacf; border-radius: 22px;
	box-shadow: 0 10px 30px rgba(46,125,50,0.1);
	padding: 2.4rem 2rem; max-width: 360px; width: 100%; text-align: center;
}
.bl-login-icon { font-size: 2.4rem; margin-bottom: 0.4rem; }
.bl-login-box h2 { margin: 0 0 0.4rem; color: #1b4332; font-weight: 600; }
.bl-login-box p { color: #4c7a5b; font-size: 0.9rem; margin: 0 0 1.3rem; }
.bl-login-error {
	background: #fdecea; color: #b32d2e; border: 1px solid #f5c6c2;
	border-radius: 8px; padding: 0.5rem 0.8rem; font-size: 0.85rem; margin-bottom: 1rem;
}
.bl-login-form { display: flex; flex-direction: column; gap: 0.7rem; }
.bl-login-form input {
	border: 1px solid #cdeacf; border-radius: 10px; padding: 0.65rem 0.9rem;
	font-size: 0.95rem; outline: none; background: #f1faf2; color: #1b4332;
}
.bl-login-form input:focus { border-color: #2e7d32; box-shadow: 0 0 0 3px #2e7d3222; }
.bl-login-form button {
	background: #2e7d32; color: #fff; border: none; border-radius: 10px;
	padding: 0.7rem; font-size: 0.95rem; font-weight: 600; cursor: pointer;
	margin-top: 0.3rem; transition: 0.15s ease;
}
.bl-login-form button:hover { background: #1b5e20; }
.bl-no-results { grid-column: 1/-1; text-align: center; padding: 3rem 1rem; color: #4c7a5b; }

@media (max-width: 600px) {
	.bl-header h1 { font-size: 1.7rem; }
	.bl-filter-bar { border-radius: 24px; padding: 0.7rem 1rem; flex-direction: column; align-items: stretch; }
	.bl-search-input { width: 100%; }
	.bl-category-group { justify-content: center; }
}
