/* ==========================================================================
   Thư viện sách — template-thu-vien-sach.php
   ========================================================================== */

.nhb-library {
	padding: 0 0 80px;
}

.nhb-library .nhb-shell {
	max-width: 1400px;
}

/* --- Hero --------------------------------------------------------------- */
.nhb-library-hero {
	position: relative;
	margin: 0 -48px;
	padding: 28px 48px 36px;
	background:
		radial-gradient(circle at 78% 40%, rgba(253, 236, 205, 0.7) 0%, rgba(253, 249, 243, 0) 55%),
		linear-gradient(100deg, #fffdf9 0%, #fdf8f0 60%, #fbf1e2 100%);
	border-radius: 18px;
	overflow: hidden;
	min-height: 380px;
}

.nhb-library-hero .nhb-shell {
	position: relative;
	z-index: 1;
}

.nhb-library-hero__crumbs {
	margin-bottom: 36px;
}

.nhb-library-hero__eyebrow {
	margin: 0 0 14px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: #c3791a;
}

.nhb-library-hero__title {
	margin: 0 0 16px;
	font-family: "Playfair Display", Georgia, "Times New Roman", serif;
	font-size: clamp(40px, 4.6vw, 64px);
	font-weight: 800;
	line-height: 1.1;
	color: #2e1758;
}

.nhb-library-hero__desc {
	max-width: 560px;
	font-size: 16.5px;
	line-height: 1.65;
	color: #334e8f;
	margin: 0 0 26px;
}

.nhb-library-hero__points {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 10px 26px;
}

.nhb-library-hero__points li {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13.5px;
	line-height: 1.4;
	color: #2e1758;
	font-weight: 500;
}

.nhb-library-hero__points li + li {
	padding-left: 26px;
	border-left: 1px solid #e6d9c3;
}

.nhb-library-hero__icon {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	color: #d3923a;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	box-shadow: 0 4px 12px rgba(211, 146, 58, 0.12);
}

.nhb-library-hero__icon svg {
	width: 20px;
	height: 20px;
}

.nhb-library-hero__eyebrow {
	display: flex;
	align-items: center;
	gap: 14px;
}

.nhb-library-hero__eyebrow::before,
.nhb-library-hero__eyebrow::after {
	content: "";
	width: 70px;
	height: 1px;
	background: #d3923a;
}

/* --- Logo nhà sách ------------------------------------------------------ */
.nhb-library-partners {
	background: #ffffff;
	padding: 36px 0;
	margin: 0;
	border-bottom: 1px solid #f1f5f9;
}

.nhb-library-partners__grid {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 28px 36px;
}

.nhb-library-partners__grid img {
	display: block;
	box-sizing: border-box;
	flex: 0 0 calc(20% - 29px);
	max-width: calc(20% - 29px);
	min-width: 0;
	max-height: 44px;
	height: 44px;
	width: auto;
	object-fit: contain;
	filter: grayscale(20%);
	transition: filter 0.2s ease, transform 0.2s ease;
}

.nhb-library-partners__grid img:hover {
	filter: none;
	transform: translateY(-1px);
}

/* --- Bộ lọc & lưới sách ------------------------------------------------- */
.nhb-library-body {
	margin-top: 80px;
}

.nhb-library-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 30px;
}

.nhb-library-filter__tab {
	display: inline-flex;
	align-items: center;
	padding: 9px 18px;
	border-radius: 999px;
	border: 1px solid #e2e8f0;
	background: #ffffff;
	color: #334e8f;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.18s ease;
}

.nhb-library-filter__tab:hover {
	background: #f3edfc;
	border-color: #2e1758;
	color: #2e1758;
}

.nhb-library-filter__tab.is-active {
	background: #2e1758;
	border-color: #2e1758;
	color: #ffffff;
}

.nhb-library-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}

.nhb-book {
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border: 1px solid #f1f5f9;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

.nhb-book__cover {
	display: block;
	aspect-ratio: 4 / 3;
	background: #ffffff;
	overflow: hidden;
}

.nhb-book__cover img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nhb-book__cover-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	padding: 20px;
	text-align: center;
	font-family: "Playfair Display", Georgia, serif;
	font-size: 20px;
	font-weight: 700;
	color: #2e1758;
}

.nhb-book__body {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 22px 24px 24px;
	flex: 1;
}

.nhb-book__title {
	margin: 0;
	font-family: "Playfair Display", Georgia, serif;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
}

.nhb-book__title a {
	color: #2e1758;
	text-decoration: none;
}

.nhb-book__excerpt {
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
	color: #475569;
}

.nhb-book__tag {
	align-self: flex-start;
	padding: 4px 12px;
	border-radius: 999px;
	background: #f3edfc;
	color: #2e1758;
	font-size: 12px;
	font-weight: 600;
}

.nhb-book__btn {
	margin-top: auto;
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 18px;
	border-radius: 999px;
	border: 1px solid #c7c9e8;
	color: #2e1758;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.18s ease;
}

.nhb-book__btn:hover {
	background: #2e1758;
	border-color: #2e1758;
	color: #ffffff;
}

.nhb-library-empty {
	grid-column: 1 / -1;
	text-align: center;
	color: #646da0;
	padding: 40px 0;
}

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 1080px) {
	.nhb-library-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.nhb-library-partners__grid img {
		flex: 0 0 calc(33.333% - 16px);
		max-width: calc(33.333% - 16px);
	}
}

@media (max-width: 768px) {
	.nhb-library-hero {
		margin: 0 -16px;
		padding: 20px 16px 32px;
	}

	.nhb-library-partners {
		margin: 0;
		padding: 24px 0;
	}

	.nhb-library-grid {
		grid-template-columns: 1fr;
	}

	.nhb-library-partners__grid {
		gap: 20px 16px;
	}

	.nhb-library-partners__grid img {
		flex: 0 0 calc(50% - 8px);
		max-width: calc(50% - 8px);
		box-sizing: border-box;
		height: 36px;
		max-height: 36px;
	}

	.nhb-library-partners__grid img[src$="phuong-nam.png"] {
		padding: 6px 10px;
	}
}

/* Hero: ảnh chân dung, trích dẫn và chữ ký bên phải */
.nhb-library-hero .nhb-shell {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
	align-items: center;
	gap: 24px;
}

.nhb-library-hero__media {
	position: relative;
	min-height: 360px;
}

.nhb-library-hero__portrait {
	position: absolute;
	right: 8%;
	bottom: 0;
	height: 100%;
	width: auto;
	object-fit: contain;
}

.nhb-library-hero__quote {
	position: absolute;
	top: 6%;
	right: 0;
	width: 40%;
	height: auto;
	z-index: 1;
}

.nhb-library-hero__sign {
	position: absolute;
	right: 6%;
	top: 56%;
	width: 22%;
	height: auto;
	z-index: 1;
}

@media (max-width: 1024px) {
	.nhb-library-hero .nhb-shell {
		grid-template-columns: 1fr;
	}

	.nhb-library-hero__media {
		min-height: 280px;
	}
}

.nhb-library-hero__text {
	min-width: 0;
}

.nhb-library-hero .nhb-shell {
	align-items: stretch;
}

.nhb-library-hero__media {
	min-height: 320px;
}

/* Giữ 3 điểm nổi bật trên một hàng (ghi đè flex-wrap ở trên) */
.nhb-library-hero__points {
	flex-wrap: nowrap;
	gap: 0;
}

.nhb-library-hero__points li {
	white-space: nowrap;
	font-size: 13px;
}

.nhb-library-hero__points li + li {
	padding-left: 18px;
	margin-left: 18px;
}

@media (max-width: 1024px) {
	.nhb-library-hero__points {
		flex-wrap: wrap;
		row-gap: 14px;
	}
}

/* Chân dung nằm bên trái khối ảnh, trích dẫn và chữ ký ở bên phải */
.nhb-library-hero__portrait {
	left: 0;
	right: auto;
	bottom: 0;
	top: auto;
	width: 56%;
	height: auto;
	max-height: none;
}

.nhb-library-hero__quote {
	top: 2%;
	right: 0;
	width: 42%;
}

.nhb-library-hero__sign {
	top: 52%;
	right: 4%;
}

/* Chân dung to hơn; trích dẫn và chữ ký nằm trên ảnh */
.nhb-library-hero__portrait {
	width: 84%;
	left: 2%;
}

.nhb-library-hero__quote,
.nhb-library-hero__sign {
	z-index: 2;
}

/* Chỉnh tay theo yêu cầu: chân dung */
.nhb-library-hero__portrait {
	width: 77%;
	left: -13%;
	bottom: -15%;
}

/* Chỉnh tay theo yêu cầu: trích dẫn và chữ ký */
.nhb-library-hero__quote {
	top: 2%;
	right: -30px;
	width: 60%;
}

.nhb-library-hero__sign {
	top: 68%;
	right: 0%;
	width: 40%;
}

@media (max-width: 1024px) {
	.nhb-library-hero .nhb-shell {
		grid-template-columns: 1fr;
	}
	.nhb-library-hero__media {
		width: 100%;
		max-width: 460px;
		min-height: 320px;
		margin: 28px auto 0;
	}
	.nhb-library-hero__portrait {
		bottom: 0;
		left: -8%;
	}
	.nhb-library-hero__quote {
		right: -10px;
	}
}

@media (max-width: 600px) {
	.nhb-library-hero__media {
		max-width: 340px;
		min-height: 250px;
		margin: 20px auto 0;
	}
	.nhb-library-hero__portrait {
		width: 76%;
		left: -6%;
	}
	.nhb-library-hero__quote {
		width: 58%;
		right: 0;
	}
	.nhb-library-hero__sign {
		width: 38%;
	}
}


/* Logo có tỷ lệ vuông hoặc khoảng trắng lớn -> scale để cân đối thị giác */
.nhb-library-partners__grid img[src$="amazon-books.png"] {
	transform: scale(1.65);
}
.nhb-library-partners__grid img[src$="amazon-books.png"]:hover {
	transform: scale(1.65) translateY(-1px);
}
.nhb-library-partners__grid img[src$="apple-books.png"] {
	transform: scale(1.18);
}
.nhb-library-partners__grid img[src$="apple-books.png"]:hover {
	transform: scale(1.18) translateY(-1px);
}

/* Logo Nhà sách Phương Nam: nền xanh #2e1758 (logo chữ trắng cần nền tối) */
.nhb-library-partners__grid img[src$="phuong-nam.png"] {
	background-color: #2e1758;
	padding: 8px 14px;
	box-sizing: border-box;
	border-radius: 4px;
	filter: none;
}

/* Thanh tìm kiếm và icon trên tab "Tất cả" */
.nhb-library-filter {
	align-items: center;
}

.nhb-library-search {
	flex: 0 1 260px;
	width: 260px;
	max-width: 100%;
	display: flex;
	align-items: center;
	gap: 10px;
	height: 46px;
	padding: 0 16px;
	margin: 0;
	border: 1px solid #e2e8f0;
	border-radius: 999px;
	background: #ffffff;
	box-sizing: border-box;
}

.nhb-library-search svg {
	width: 18px;
	height: 18px;
	color: #646da0;
	flex-shrink: 0;
}

.nhb-library-search input {
	flex: 1;
	min-width: 0;
	border: 0;
	outline: none;
	background: transparent;
	font: inherit;
	font-size: 14px;
	color: #1e293b;
}

.nhb-library-search input::placeholder {
	color: #94a3b8;
}

.nhb-library-filter__tab {
	gap: 8px;
}

.nhb-library-filter__tab svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.nhb-library-filter__tab.is-active svg {
	color: #ffffff;
}

/* Lưới sách theo mẫu thiết kế: khung ngoài, 3 cột, bìa bên trái */
.nhb-library-body {
	background: #f7f8fc;
	border: 1px solid #e6e9f4;
	border-radius: 18px;
	padding: 22px 24px 28px;
	box-shadow: 0 6px 22px rgba(18, 49, 146, 0.05);
}

.nhb-library-grid {
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px;
}

.nhb-book {
	flex-direction: row;
	align-items: stretch;
	border-radius: 14px;
	border-color: #eceef6;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
	min-height: 220px;
}

.nhb-book__cover {
	flex: 0 0 38%;
	max-width: 38%;
	aspect-ratio: auto;
	background: #ffffff;
	padding: 12px;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nhb-book__img {
	width: 100%;
	height: auto;
	max-height: 100%;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.nhb-book__cover-placeholder {
	font-size: 15px;
}

.nhb-book__body {
	flex: 1;
	min-width: 0;
	padding: 18px 18px 16px;
	gap: 8px;
}

.nhb-book__title {
	font-size: 17px;
	line-height: 1.3;
}

.nhb-book__excerpt {
	font-size: 12.5px;
	line-height: 1.55;
	color: #475569;
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.nhb-book__tag {
	font-size: 11.5px;
	padding: 3px 10px;
}

.nhb-book__actions {
	margin-top: auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding-top: 6px;
}

.nhb-book__btn {
	margin-top: 0;
	padding: 7px 14px;
	font-size: 12.5px;
}


@media (max-width: 1080px) {
	.nhb-library-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 768px) {
	.nhb-library-grid {
		grid-template-columns: 1fr;
	}

	.nhb-library-body {
		padding: 16px;
	}
}

/* ==========================================================================
   Chi tiết sách — section 1 (single-nhb_book.php)
   ========================================================================== */
.nhb-book-single {
	padding: 0 0 60px;
}

.nhb-book-single .nhb-shell {
	max-width: 1400px;
}

.nhb-book-hero {
	margin: 0 -48px;
	padding: 28px 48px 44px;
	background:
		radial-gradient(circle at 20% 40%, rgba(253, 236, 205, 0.55) 0%, rgba(253, 249, 243, 0) 55%),
		linear-gradient(100deg, #fffdf9 0%, #fdf8f0 70%, #fbf1e2 100%);
	border-radius: 18px;
}

.nhb-book-hero__crumbs {
	margin-bottom: 32px;
}

.nhb-book-hero__grid {
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
	align-items: center;
	gap: 56px;
}

.nhb-book-hero__cover {
	display: flex;
	justify-content: center;
}

.nhb-book-hero__cover img {
	display: block;
	width: 100%;
	max-width: 420px;
	height: auto;
	border-radius: 6px;
	box-shadow: 0 22px 50px rgba(18, 49, 146, 0.22), 0 6px 14px rgba(0, 0, 0, 0.12);
}

.nhb-book-hero__cover-placeholder {
	width: 100%;
	max-width: 420px;
	aspect-ratio: 3 / 4;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	text-align: center;
	border-radius: 6px;
	background: #f3edfc;
	font-family: "Playfair Display", Georgia, serif;
	font-size: 26px;
	font-weight: 700;
	color: #2e1758;
}

.nhb-book-hero__eyebrow {
	margin: 0 0 14px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: #c3791a;
}

.nhb-book-hero__title {
	margin: 0 0 14px;
	font-family: "Playfair Display", Georgia, serif;
	font-size: clamp(34px, 3.6vw, 52px);
	font-weight: 800;
	line-height: 1.12;
	color: #2e1758;
}

.nhb-book-hero__subtitle {
	margin: 0 0 14px;
	font-size: 17px;
	font-weight: 600;
	color: #1e293b;
}

.nhb-book-hero__desc {
	font-size: 15px;
	line-height: 1.7;
	color: #475569;
	margin-bottom: 22px;
}

.nhb-book-hero__desc p {
	margin: 0;
}

.nhb-book-hero__meta {
	list-style: none;
	margin: 0 0 22px;
	padding: 18px 0;
	border-top: 1px solid #e6d9c3;
	border-bottom: 1px solid #e6d9c3;
	display: flex;
	flex-wrap: wrap;
	gap: 16px 28px;
}

.nhb-book-hero__meta li {
	display: flex;
	align-items: center;
	gap: 12px;
}

.nhb-book-hero__meta-icon {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	color: #d3923a;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(211, 146, 58, 0.12);
	flex-shrink: 0;
}

.nhb-book-hero__meta-icon svg {
	width: 18px;
	height: 18px;
}

.nhb-book-hero__meta strong {
	display: block;
	font-size: 14.5px;
	color: #2e1758;
	font-weight: 700;
}

.nhb-book-hero__meta small {
	display: block;
	font-size: 12.5px;
	color: #646da0;
}

.nhb-book-hero__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 12px;
	margin-bottom: 20px;
}

.nhb-book-hero__price-now {
	font-size: 30px;
	font-weight: 800;
	color: #b91c1c;
}

.nhb-book-hero__price-old {
	font-size: 16px;
	color: #94a3b8;
	text-decoration: line-through;
}

.nhb-book-hero__price-tag {
	padding: 4px 12px;
	border-radius: 999px;
	background: #fde8e8;
	color: #b91c1c;
	font-size: 12.5px;
	font-weight: 700;
}

.nhb-book-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin-bottom: 24px;
}

.nhb-book-hero__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-width: 220px;
	height: 52px;
	padding: 0 26px;
	border-radius: 10px;
	font-size: 15.5px;
	font-weight: 700;
	text-decoration: none;
	transition: all 0.2s ease;
}

.nhb-book-hero__btn svg {
	width: 18px;
	height: 18px;
}

.nhb-book-hero__btn.is-primary {
	background: #2e1758;
	color: #ffffff;
	border: 1px solid #2e1758;
}

.nhb-book-hero__btn.is-primary:hover {
	background: #1d0d3d;
	border-color: #1d0d3d;
}

.nhb-book-hero__btn.is-outline {
	background: #ffffff;
	color: #2e1758;
	border: 1px solid #2e1758;
}

.nhb-book-hero__btn.is-outline:hover {
	background: #f3edfc;
}

.nhb-book-hero__trust {
	list-style: none;
	margin: 0;
	padding: 18px 0 0;
	border-top: 1px solid #e6d9c3;
	display: flex;
	flex-wrap: wrap;
	gap: 12px 28px;
}

.nhb-book-hero__trust li {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13.5px;
	color: #334e8f;
	font-weight: 500;
}

.nhb-book-hero__trust svg {
	width: 18px;
	height: 18px;
	color: #d3923a;
	flex-shrink: 0;
}

@media (max-width: 1024px) {
	.nhb-book-hero__grid {
		grid-template-columns: 1fr;
		gap: 36px;
	}

	.nhb-book-hero__cover img,
	.nhb-book-hero__cover-placeholder {
		max-width: 340px;
	}
}

@media (max-width: 768px) {
	.nhb-book-hero {
		margin: 0 -16px;
		padding: 20px 16px 32px;
	}

	.nhb-book-hero__title {
		font-size: 32px;
	}

	.nhb-book-hero__btn {
		min-width: 0;
		flex: 1 1 100%;
	}
}

/* Sửa bố cục trang chi tiết sách: giới hạn ảnh bìa, khoảng cách với khung theme */
.nhb-book-single {
	padding: 40px 0 60px;
}

@media (min-width: 1025px) {
	.nhb-book-hero__grid {
		grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
		justify-content: space-between;
	}

	.nhb-book-hero__cover img {
		width: 100%;
		max-width: 420px;
		max-height: 620px;
		object-fit: contain;
	}

	.nhb-book-hero__info {
		min-width: 0;
	}
}

@media (max-width: 1024px) {
	.nhb-book-hero__grid {
		grid-template-columns: 1fr;
		gap: 28px;
	}

	.nhb-book-hero__cover {
		display: flex;
		justify-content: center;
		width: 100%;
	}

	.nhb-book-hero__cover img,
	.nhb-book-hero__cover-placeholder {
		max-width: 220px;
		max-height: 320px;
		width: auto;
		height: auto;
	}
}

@media (max-width: 600px) {
	.nhb-book-hero__cover img,
	.nhb-book-hero__cover-placeholder {
		max-width: 180px;
		max-height: 260px;
	}
}
