body {
  font-family: sans-serif;
  margin: 0;
  padding: 0;
  background: #f2f2f2;
}
header {
  background: #30c23f;
  padding: 2px;
  color: #49db57;
  text-align: center;
  text-shadow: 2px 2px 2px #fff;
}
#header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
#logo {
  height: 30px;
  width: auto;
}
#searchBar {
  background: #30c23f;
  padding: 5px 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}
#searchInput {
  width: 92%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 15px;
  outline: none;
  background-color: white;
  padding-left: 20px;
  transition: all 0.3s ease;
  min-width: 300px;
}
#searchInput:focus {
  border-color: #007BFF;
  box-shadow: 0 0 4px rgba(0,123,255,0.3);
}

details.category {
  margin: 5px;
  background: white;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
 
summary {
  font-weight: bold;
  padding: 5px 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
  background: #1b9b28;
  border: 3px solid #fffde9;
  color: #efef98;
}
summary:hover {
  background: #38d247;
}

.arrow {
  transition: transform 0.2s ease;
  display: inline-block;
}
details[open] > summary .arrow {
  transform: rotate(90deg);
}

.sub-container {
  padding: 10px 10px 0px 5px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* Riêng danh mục con (sub-category): hiển thị dạng danh sách, mỗi mục 1 hàng */
.sub-container.sub-category {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.doc-item {
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin: 5px 0;
  transition: transform 0.2s ease;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: center;
}
.doc-item:hover {
  transform: scale(1.02);
}
.doc-item a {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 10px;
}
.thumb {
  width: 15%;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 150px;
}
.doc-text {
  flex-grow: 1;
}
.doc-title {
  font-weight: bold;
  margin-bottom: 4px;
}
.doc-desc {
  font-size: 0.9rem;
  color: #555;
}

/* Responsive cho màn hình nhỏ, ví dụ dưới 600px (điện thoại) */
@media (max-width: 420px) {
  .sub-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px;
  }
  
  .doc-item {
    flex-direction: row;
    align-items: center;
  }
  
  .doc-item img.thumb {
    width: 90%;
    height: auto;
    margin-right: 12px;
  }
  
  .doc-text {
    padding: 0;
    text-align: left;
    flex: 1;
  }
}

.doc-item {
  position: relative;
  overflow: hidden;
}

.doc-item a {
  display: block;
  padding: 0;
}

.doc-item .thumb {
  width: 100%;
  min-width: unset;
  border-radius: 0;
  display: block;
}

/* SỬA LỖI GIỚI HẠN KÝ TỰ - BẮT ĐẦU TỪ ĐÂY */
.doc-popup {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  text-align: center;
}

.doc-popup .doc-title {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 8px;
  color: #ffeb3b;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  /* SỬA: BỎ GIỚI HẠN DÒNG */
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  overflow: visible;
  white-space: normal;
  max-height: none;
}

.doc-popup .doc-desc {
  font-size: 0.85rem;
  line-height: 1.3;
  color: #1b9b41;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.38);
  /* SỬA: BỎ GIỚI HẠN DÒNG */
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  overflow: visible;
  white-space: normal;
  max-height: none;
  word-wrap: break-word;
}

.doc-item:hover .doc-popup {
  opacity: 1;
  pointer-events: auto;
}

/* CSS MỚI CHO PHẦN DESCRIPTION - HIỂN THỊ ĐẸP VÀ ĐẦY ĐỦ */
.doc-desc {
  font-size: 14px;
  line-height: 1.5;
  color: #555;
  /* ĐẢM BẢO HIỂN THỊ ĐẦY ĐỦ */
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-wrap: break-word !important;
  max-height: none !important;
}

.info-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 4px;
  /* ĐẢM BẢO XUỐNG DÒNG KHI CẦN */
  flex-wrap: wrap;
}

.info-icon {
  width: 20px;
  color: #3498db;
  font-weight: bold;
  margin-right: 5px;
  flex-shrink: 0;
}

.info-label {
  font-weight: bold;
  color: #2c3e50;
  min-width: 70px;
  flex-shrink: 0;
}

.info-value {
  color: #34495e;
  flex: 1;
  /* TỰ ĐỘNG XUỐNG DÒNG */
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-wrap: break-word;
}

/* ĐẢM BẢO POPUP HIỂN THỊ ĐẦY ĐỦ */
.doc-popup {
  display: none;
  position: absolute;
  background: #ddffd9e5;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1px;
  width: 99%;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-top: 0px;
  /* CHO PHÉP CUỘN NẾU NỘI DUNG DÀI */
  max-height: 400px;
  overflow-y: auto;
}

.doc-item:hover .doc-popup {
  display: block;
}

.doc-text {
  margin-top: 5px;
}