/* Reset và bố cục chung */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  display: flex;
  height: 100vh;
  background-color: #f5f8fb;
}

/* Sidebar bên trái chứa danh sách chủ đề */
nav {
  width: 260px;
  background: linear-gradient(180deg, #0066cc, #003366);
  color: white;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
  position: relative;
}

/* Tiêu đề của menu (được dùng như nút bật/tắt danh sách) */
nav h2 {
  font-size: 18px;
  margin-bottom: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 10px;
  cursor: pointer;
  position: relative;
  user-select: none;
}

/* Biểu tượng mũi tên chỉ hướng */
nav h2::after {
  content: "▼";
  font-size: 12px;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.3s ease;
}

/* Khi menu mở thì xoay mũi tên */
nav.open h2::after {
  transform: translateY(-50%) rotate(180deg);
}

/* Danh sách các chủ đề - mặc định ẩn */
nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: none;
}

/* Khi mở menu, hiển thị danh sách */
nav.open ul {
  display: block;
}

/* Khoảng cách giữa các dòng chủ đề */
nav li {
  margin-bottom: 12px;
	display: block;
}

/* Giao diện từng mục chủ đề */
nav a {
  color: #e0e0e0;
  text-decoration: none;
  display: block;
  padding: 10px 14px;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.1);
  transition: 0.3s ease;
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
	  width: 100%;
  line-height: 1.4;
}

/* Hiệu ứng hover */
nav a:hover {
  background: #00aaff;
  color: white;
  transform: translateX(5px);
}

/* Mục đang được chọn */
nav a.active {
  background: #0088ff;
  color: white;
  font-weight: bold;
  transform: translateX(5px);
}
/* Tiêu đề từng nhóm chủ đề */
nav h2.toggle-section {
  font-size: 16px;
  margin-top: 10px;
  margin-bottom: 10px;
  text-align: left;
  padding: 10px;
  background-color: rgba(255,255,255,0.1);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
}

/* Mũi tên mở rộng */
nav h2.toggle-section::after {
  content: "▼";
  font-size: 12px;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.3s ease;
}

/* Khi đang mở submenu thì xoay mũi tên */
nav h2.toggle-section.open::after {
  transform: translateY(-50%) rotate(180deg);
}

/* Danh sách submenu */
nav ul.submenu {
  list-style: none;
  padding-left: 10px;
  margin: 0 0 10px 0;
  display: none;
}

nav ul.submenu.show {
  display: block;
}

/* Phần nội dung bên phải */
main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Tiêu đề đầu trang */
header {
  background: linear-gradient(135deg, #0066cc, #004a99);
  color: white;
  padding: 16px;
  text-align: center;
  font-size: 26px;
  font-weight: bold;
}

/* Iframe để tải nội dung */
iframe {
  flex-grow: 1;
  width: 100%;
  border: none;
  background: white;
}

/* Responsive cho thiết bị nhỏ */
@media (max-width: 768px) {
  body {
    margin: 0;
    font-size: 16px;
    font-family: Arial, sans-serif;
  }

  nav {
    width: 100%;
    padding: 10px;
    background-color: #f0f0f0;
  }

  nav h2 {
    font-size: 18px;
    margin: 10px 0;
    cursor: pointer;
  }

  nav ul.submenu {
    list-style: none;
    padding-left: 15px;
    display: none;
  }

  nav ul.submenu.show {
    display: block;
  }

  nav ul.submenu li a {
    display: block;
    padding: 8px 0;
    text-decoration: none;
    color: #333;
    font-size: 16px;
  }

  nav ul.submenu li a.active {
    font-weight: bold;
    color: #0066cc;
  }

  main {
    padding: 0;
  }

  main header {
    font-size: 20px;
    text-align: center;
    padding: 15px;
    background-color: #e0e0e0;
  }

  iframe#contentFrame {
    width: 100%;
    height: 80vh;
    border: none;
    display: block;
  }
}

/* Giữ bố cục desktop khi lớn hơn 768px */
@media (min-width: 769px) {
  body {
    display: flex;
    font-family: Arial, sans-serif;
  }

  nav {
    width: 250px;
    height: 100vh;
    overflow-y: auto;
    padding: 20px;
    background-color: #f0f0f0;
  }

  nav h2 {
    font-size: 18px;
    margin-bottom: 10px;
    cursor: pointer;
  }

  nav ul.submenu {
    list-style: none;
    padding-left: 15px;
    margin-bottom: 15px;
    display: none;
  }

  nav ul.submenu.show {
    display: block;
  }

  nav ul.submenu li a {
    text-decoration: none;
    color: #333;
    display: block;
    margin: 6px 0;
  }

  nav ul.submenu li a.active {
    font-weight: bold;
    color: #0066cc;
  }

  main {
    flex-grow: 1;
  }

  main header {
    font-size: 24px;
    padding: 20px;
    text-align: center;
    background-color: #e0e0e0;
  }

  iframe#contentFrame {
    width: 100%;
    height: calc(100vh - 70px);
    border: none;
    display: block;
  }
}
