/* KÍCH HOẠT HIỆU ỨNG CUỘN MƯỢT */
html {
	scroll-behavior: smooth;
}
body{
	background-color: #fff;
}

/* NAVIGATION BAR / BACK LINK */
nav.top-nav {
	max-width: 720px;
	margin: 90px auto 0 auto;
	padding: 0 20px;
}
nav.top-nav a {
	color: #2563eb;
	text-decoration: none;
	font-size: 14px;
	line-height: 26px;
	font-weight: bold;
}
nav.top-nav a::before {
	content: "__ ";
}
nav.top-nav a:hover {
	text-decoration: underline;
}

/* ARTICLE HEADER */
div.post-header {
	max-width: 720px;
	margin: 20px auto 20px auto;
	padding: 0 20px;
}
div.post-header span.catalog label {
	display: inline-block;
	font-size: 11px;
	color: grey;
	border-radius: 4px;
	border: 1px solid gray;
	padding: 2px 6px;
	margin-bottom: 15px;
}
div.post-header span.catalog label::before {
	content: "● ";
}
div.post-header h1 {
	font-size: 36px;
	line-height: 1.3;
	margin-bottom: 20px;
	color: #111;
}
.post-meta {
	display: flex;
	align-items: center;
	font-size: 13px;
	color: grey;
	border-bottom: 1px solid #eaeaea;
	padding-bottom: 20px;
}
.post-meta img {
	border-radius: 50%;
	margin-right: 10px;
	width: 32px;
	height: 32px;
}
.post-meta span {
	margin-right: 15px;
}

/* FEATURED IMAGE */
.featured-image {
	max-width: 720px;
	margin: 30px auto;
	padding: 0 20px;
	text-align: center;
}
.featured-image img {
	width: 100%;
	max-height: 450px;
	object-fit: cover;
	border-radius: 8px;
}

/* MAIN CONTENT */
main.post-content {
	max-width: 720px;
	margin: 0 auto 60px auto;
	padding: 0 20px;
	font-size: 18px;
}
main.post-content p {
	margin-bottom: 25px;
	text-align: justify;
}
main.post-content h2 {
	font-size: 24px;
	font-weight: 700;
	margin-top: 45px;
	margin-bottom: 16px;
	color: #111;
	border-bottom: 2px solid #f1f5f9;
	padding-bottom: 8px;
}

main.post-content h3 {
	font-size: 19px;
	font-weight: 700;
	margin-top: 30px;
	margin-bottom: 12px;
	color: #1e293b;
	padding-left: 12px;
	border-left: 3px solid #2563eb;
}
/* Cấp 3 (H4) */
main.post-content h4 {
	font-size: 17px;
	font-weight: 700;
	margin-top: 20px;
	margin-bottom: 8px;
	color: #334155;
}
main.post-content h4::before {
	content: "▪ ";
	color: #2563eb;
	margin-right: 4px;
}

main.post-content blockquote {
	border-left: 4px solid #2563eb;
	margin: 30px 0;
	padding: 10px 20px;
	color: #555;
	background-color: #f9fafb;
	font-style: italic;
}
.callout-box {
	background-color: #eff6ff;
	border-left: 4px solid #2563eb;
	padding: 16px 20px;
	margin: 10px 0 30px 0;
	border-radius: 0 8px 8px 0;
	color: #1e3a8a;
}

main.post-content ul, ol {
	margin-left: 20px;
	margin-bottom: 20px;
}

/* CODE STYLES (PRISMJS) */
/*main.post-content code:not([class*="language-"]) {
	font-family: Consolas, Monaco, 'Courier New', monospace;
	background-color: #f1f5f9;
	color: #0f172a;
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 0.88em;
	border: 1px solid #e2e8f0;
}*/
main.post-content code.language-vi {
	font-family: Consolas, Monaco, 'Courier New', monospace;
	background-color: #f1f5f9;
	color: #0f172a;
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 0.88em;
	border: 1px solid #e2e8f0;
}

.code-container {
	margin: 30px 0;
	border-radius: 8px;
	overflow: hidden;
	background-color: #1d1d1d;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.code-header {
	background-color: #111827;
	padding: 8px 16px;
	font-family: system-ui, -apple-system, sans-serif;
	font-size: 12px;
	color: #9ca3af;
/*			text-transform: uppercase;*/
	font-weight: bold;
	letter-spacing: 0.5px;
	border-bottom: 1px solid #1f2937;
}

.code-container pre[class*="language-"] {
	margin: 0 !important;
	padding: 16px 20px !important;
	border-radius: 0 !important;
	background: #1d1d1d !important;
	font-size: 14.5px !important;
	line-height: 1.6 !important;
}

div.code-toolbar > .toolbar .toolbar-item > button {
	background: #374151 !important;
	color: #f3f4f6 !important;
	border-radius: 4px !important;
	padding: 4px 8px !important;
	font-size: 11px !important;
	box-shadow: none !important;
	text-shadow: none !important;
	margin-right: 8px;
}
div.code-toolbar > .toolbar .toolbar-item > button:hover {
	background: #4b5563 !important;
	color: #fff !important;
}

/* KHỐI DIỄN GIẢI LOGIC / DIAGRAM BOX */
.logic-container {
    margin: 25px 0;
    border-radius: 8px;
    background-color: #0f172a; /* Nền tối sang trọng */
    border: 1px solid #1e293b;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.logic-header {
    background-color: #1e293b;
    color: #94a3b8;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #334155;
    font-family: system-ui, -apple-system, sans-serif;
}

/* Phần chứa nội dung chính */
.logic-content {
    margin: 0;
    padding: 16px 20px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 14.5px;
    line-height: 1.7;
    color: #e2e8f0;
    
    /* QUAN TRỌNG: Giữ nguyên khoảng trắng + Cuộn ngang khi tràn */
    white-space: pre; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; /* Cuộn mượt trên iOS */
}

/* Điểm nhấn màu sắc cho các đường minh họa (Tùy chọn) */
.logic-content .highlight {
    color: #38bdf8; /* Màu xanh cyan làm nổi bật kết quả */
    font-weight: bold;
}
.logic-content .comment {
    color: #f43f5e; /* Màu hồng/đỏ nhẹ cho phần ghi chú chi phí */
}

/*1009*/
/* MỤC LỤC BÀI VIẾT (TABLE OF CONTENTS) */
.toc-box {
	background-color: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 18px 22px;
	margin: 35px 0;
	font-family: Tahoma, -apple-system, sans-serif;
}

.toc-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.toc-title {
	font-size: 15px;
	font-weight: 700;
	color: #0f172a;
	display: flex;
	align-items: center;
	gap: 8px;
}

.toc-toggle-btn {
	background: none;
	border: none;
	color: #2563eb;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	padding: 2px 6px;
}

.toc-toggle-btn:hover {
	text-decoration: underline;
}

.toc-list {
	margin: 14px 0 0 0;
	padding-left: 20px;
	list-style-type: decimal;
	font-size: 14.5px;
	line-height: 1.7;
}

.toc-list ul {
	list-style-type: circle;
	padding-left: 20px;
	margin: 4px 0;
}

.toc-list a {
	color: #334155;
	text-decoration: none;
	transition: color 0.2s;
}

.toc-list a:hover {
	color: #2563eb;
	text-decoration: underline;
}

.toc-list.collapsed {
	display: none;
}

/* ========================================== */
/* THIẾT KẾ NÚT BACK TO TOP (TRỞ VỀ ĐẦU TRANG) */
/* ========================================== */
.back-to-top-btn {
	position: fixed;
	bottom: 30px;
	right: 30px;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background-color: #0f172a; /* Nền tối sang trọng */
	color: #ffffff;
	border: none;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: all 0.3s ease;
	z-index: 999;
}

/* Trạng thái hiển thị khi cuộn xuống */
.back-to-top-btn.show {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* Hiệu ứng rê chuột */
.back-to-top-btn:hover {
	background-color: #2563eb; /* Đổi sang màu xanh điểm nhấn */
	transform: translateY(-3px);
	box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.back-to-top-btn svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}
/*1009----*/

/* FOOTER NAVIGATION / BACK TO LIST */
div.post-footer {
	max-width: 720px;
	margin: 0 auto 80px auto;
	padding: 20px 20px;
	border-top: 1px solid #eaeaea;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 14px;
}
div.post-footer a {
	color: #2563eb;
	text-decoration: none;
}
div.post-footer a:hover {
	text-decoration: underline;
}

/* TABLE STYLING */
.table-wrapper {
	width: 100%;
	overflow-x: auto;
	margin: 30px 0;
	-webkit-overflow-scrolling: touch;
}

.custom-table {
	width: 100%;
	min-width: 650px;
	border-collapse: collapse;
	font-size: 17px;
	text-align: left;
	background-color: #fff;
}

.custom-table th, .custom-table td {
	padding: 12px 16px;
	border: 1px solid #e5e7eb;
	min-width: 100px;
}

.custom-table th {
	background-color: #f8fafc;
	color: #1e293b;
	font-weight: bold;
}

.custom-table tr:nth-child(even) {
	background-color: #f9fafb;
}

/*SHAREICONS*/
.share-container {
	display: flex;
	align-items: center;
	gap: 10px;
}

.share-title {
	font-size: 13px;
	color: #64748b;
	font-weight: 600;
}

.share-buttons {
	display: flex;
	align-items: center;
	gap: 8px;
}

.share-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background-color: #f1f5f9;
	color: #475569;
	text-decoration: none;
	border: none;
	cursor: pointer;
	transition: all 0.2s ease;
}

.share-btn:hover {
	background-color: #2563eb;
	color: #ffffff;
	transform: translateY(-2px);
}

.share-btn svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

/* TOAST NOTIFICATION */
.copy-toast {
	position: fixed;
	bottom: 30px;
	left: 50%;
	transform: translateX(-50%);
	background-color: #0f172a;
	color: #fff;
	padding: 10px 20px;
	border-radius: 20px;
	font-size: 13px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
	z-index: 1000;
}

.copy-toast.show {
	opacity: 1;
}

/* HIGHLIGHT STYLES */
.highlight-yellow {
	background-color: #fef08a;
	color: #713f12;
	padding: 2px 6px;
	border-radius: 4px;
}

.highlight-text {
	color: #1d4ed8;
	font-weight: 600;
}

/* RESPONSIVE DESIGN */
@media(max-width: 768px) {
	div.post-header h1 {
		font-size: 28px;
	}
	main.post-content {
		font-size: 14pt;
	}
}
