html,
body {
  height: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: sans-serif;
  background-color: #f9f9f9;
  color: #333;
}

.topbar {
  background-color: #000;
  color: #fff;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-left {
  display: flex;
  align-items: center;
}

.topbar h1 {
  font-size: 1.2rem;
  margin: 0 0 0 0.5rem;
}

.topbar nav a {
  color: #fff;
  margin-left: 1rem;
  text-decoration: none;
  font-size: 0.9rem;
}

.menu-toggle {
  display: none;
  font-size: 1.4rem;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 50px);
}

.sidebar {
  background-color: #1b2b34;
  color: #fff;
  padding: 1rem;
  padding-top: 10%;
  height: 100%;
  position: relative;
  transition: transform 0.3s ease;
  overflow-y: auto;
  /* ✅ Cho phép cuộn dọc */
  -webkit-overflow-scrolling: touch;
  /* ✅ Mượt mà trên iOS */
  scroll-behavior: smooth;
}

.sidebar h2 {
  display: block;
  font-size: 1.1rem;
  margin: 0rem auto 1rem auto;
}

.sidebar input {
  width: 100%;
  padding: 6px;
  margin: 10px 0 20px 0;
  border-radius: 4px;
  border: none;
  font-size: 0.9rem;
}

.sidebar h3 {
  margin-top: 1rem;
  color: #50fa7b;
  font-size: 1rem;
  border-left: 3px solid #50fa7b;
  padding-left: 10px;
  cursor: pointer;
}

.sidebar ul {
  list-style: none;
  padding-left: 1rem;
  margin: 0;
}

.sidebar ul li {
  margin: 0.3rem 0;
}

.sidebar a {
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
}

.sidebar a:hover {
  text-decoration: underline;
}

.content {
  padding: 1rem;
  width: 100%;
  max-width: none;
  overflow-x: hidden;
}

.breadcrumb {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: #666;
}

.breadcrumb a {
  color: #666;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #ddd;
}

.pagination a {
  background: #eee;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
}

.pagination a:hover {
  background: #ddd;
}

.footer {
  text-align: center;
  margin-top: 2rem;
  padding: 1rem;
  font-size: 0.8rem;
  color: #888;
  border-top: 1px solid #eee;
}

img {
  max-width: 100%;
}

pre {
  overflow-x: auto;
  white-space: pre;
}

pre code {
  display: block;
  white-space: pre;
  word-break: break-word;
  min-width: 100%;
}

.code-block-wrapper {
  position: relative;
  margin-bottom: 1rem;
}

.code-block-wrapper pre {
  margin: 0;
  overflow-x: auto;
  background: #f4f4f4;
  padding: 1rem;
  border-radius: 6px;
}

.code-block-wrapper pre code {
  display: block;
  min-width: 100%;
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  padding: 4px 8px;
  font-size: 0.75rem;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.copy-btn:hover {
  opacity: 1;
}

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

.sidebar-header h2 {
  font-size: 1.3rem;
  margin-bottom: 0.4rem;
  color: #fff;
}

.sidebar-header p {
  font-size: 0.85rem;
  color: #bbb;
  margin: 0;
}

details summary {
  cursor: pointer;
  font-weight: bold;
  color: #50fa7b;
  margin-bottom: 0.5rem;
}

.tool-group {
  list-style: none;
  padding-left: 1rem;
  margin: 0 0 1rem 0;
}

.tool-group li {
  margin: 0.3rem 0;
}

.tool-group a {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.tool-group a:hover {
  text-decoration: underline;
}

.subcat {
  color: #ccc;
  font-size: 0.9rem;
  margin: 0.6rem 0 0.2rem;
}

.tool-subgroup summary {
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95rem;
  margin-top: 0.8rem;
  padding-left: 0.2rem;
  color: #ccc;
}

.tool-subgroup[open] summary {
  color: #fff;
}

.sidebar-search {
  margin-bottom: 1rem;
}

.sidebar-search input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  border-radius: 999px;
  border: 1px solid #ccc;
  outline: none;
  background-color: #f9f9f9;
  color: #333;
  font-family: inherit;
}

.sidebar-search input:focus {
  border-color: #50fa7b;
  background-color: #fff;
}

.qr-wrapper {
  margin-left: 2%;
}

.qr-img {
  width: 200px;
  border-radius: 16px;
}

.qr-note {
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.menu-left {
  position: absolute;
  left: 0.5rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.desktop-links {
  display: flex;
  gap: 1rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
}