/* Import font từ Google Fonts (tuỳ chọn) */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

/* Reset CSS mặc định */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif; 
  background-color: #f4f4f4; 
  color: #333; 
  line-height: 1.6;
}

.container {
  width: 90%; 
  margin: 20px auto; 
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); 
  border-radius: 8px; 
  overflow: hidden; 
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #007bff;
  padding: 10px 20px;
  position: relative;
}

h1 {
  text-align: left;
  color: #fff;
  margin: 0;
  flex-grow: 1;
  padding-right: 15px; /* Khoảng cách với cụm nút bên phải */
}

.header-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.premium-icon {
  color: white;
  font-size: 14px;
  line-height: 1;
  margin-bottom: 2px;
}

.premium-text {
  color: white;
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  margin-top: 2px;
  white-space: nowrap;
}


#content {
  padding: 20px;
}

#content ul {
  list-style: none;
  padding: 0;
  margin-bottom: 35px;
}

#content li, #content h6 {
  font-weight: normal;
  font-size: inherit;
  line-height: inherit;
  font-family: inherit;
}

#content img {

 max-width: 500px;
    max-height: 500px;
    width: auto;
    height: auto;
}
#content li .imd img {
  filter: grayscale(100%);
  vertical-align: middle;
      margin: 5px;
}
#content p .imd img {
  vertical-align: middle;
      margin: 3px;
}
.question p {
  font-weight: bold;
  color: #444;
}
ul img {
    filter: grayscale(100%);
	vertical-align: middle;
      margin: 5px;
}

ul {
  list-style-type: none;
  padding: 0;
}

li, h6 {
  background-color: #eee;
  margin: 5px 0;
  padding: 10px;
  cursor: pointer;
  border-radius: 5px;
  transition: background-color: 0.3s ease;
}

li:hover, h6:hover {
  background-color: #ddd;
}

li.selected, h6.selected {
  background-color: #cce5ff;
  color: #004085;
}

li.correct, h6.correct {
  background-color: #d4edda;
  color: #155724;
}

li.incorrect {
  background-color: #f8d7da;
  color: #721c24;
}

h6 {
  
    font-size: 20px;
    font-weight: 100;
   
    margin-block-start: -10px;
    margin-block-end: -10px;
    margin-inline-start: -10px;    
	margin-inline-end: -10px;
  
}

.result {
  margin-top: 20px;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  text-align: center;
}

button {
  display: block;  
  padding: 10px;
  margin-top: 20px;
  background-color: #28a745;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
}

button:hover {
  background-color: #218838;
}
li.disabled, h6.disabled {
  pointer-events: none; 
  opacity: 0.6; 
}

li.correct {
  background-color: #d4edda;
  color: #155724;
}

li.incorrect {
  background-color: #f8d7da;
  color: #721c24;
}

.progress-bar {
  width: 100%;
  background-color: #b7b7b7;
  border-radius: 5px;
  margin-top: 20px;
  overflow: hidden; 
  cursor: pointer;
}

.progress {
  height: 20px;
  background-color: #007bff; 
  border-radius: 5px;
  transition: width 0.6s ease; 
}

.progress-text {
  text-align: center;
  padding: 5px 0;
  color: #fff;
  font-weight: bold;
}

.toolbar-bottom {
  background-color: #f0f0f0; 
  padding: 10px 20px;
  text-align: center;
  font-weight: bold;
  border-top: 1px solid #ddd; 
  margin-top: auto;
}
/* Thiết kế lại nút 'Chọn bài trắc nghiệm khác' */
/* --- NÚT CHỌN BÀI KHÁC (GAME BLUE VERSION) --- */
@keyframes button-shine-blue {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

#chooseAnotherTest {
    /* Bố cục */
    display: block;
    width: fit-content;
    margin: 40px auto 30px auto;

    /* Giao diện & Màu sắc */
    background: linear-gradient(135deg, #00c6ff, #007bff, #0056b3, #007bff, #00c6ff);
    background-size: 250% 250%;
    color: #ffffff;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 50px;
    cursor: pointer;
    position: relative;
    overflow: hidden;

    /* Hiệu ứng & Bóng đổ */
    box-shadow: 0 5px 20px rgba(0, 123, 255, 0.4), 
                inset 0 2px 4px rgba(255, 255, 255, 0.2);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.2s ease;
}

#chooseAnotherTest:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 123, 255, 0.6);
    animation: button-shine-blue 2s linear infinite;
}

#chooseAnotherTest:active {
    transform: translateY(0);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.5);
}

#linkList {
  display: none;
  list-style: none;
  padding: 20px;
  background-color: #f9f9f9;
}

#linkList li {
  margin-bottom: 5px;
  border: none;
  background-color: transparent; 
}
#content p { /* Hoặc .question nếu bạn thêm class="question" cho thẻ p */
  
 margin-top: 20px;
  color: #212529; /* Màu chữ đậm hơn */
}
table {
  border-collapse: collapse; /* Gộp đường viền của các ô */
  width: 100%; /* Chiều rộng của bảng */
}

th, td {
  border: 1px solid black; /* Đường viền cho các ô */
  padding: 8px; /* Khoảng cách giữa nội dung và đường viền */
  text-align: left; /* Căn lề trái cho nội dung trong ô */
}

th {
  background-color: #f2f2f2; /* Màu nền cho tiêu đề cột */
}
#studyHistoryTable table {
    width: 100%;
    border-collapse: collapse; /* Xóa khoảng trống giữa các ô */
    margin: 20px 0;
    font-size: 16px;
    text-align: left;
}

#studyHistoryTable th, #studyHistoryTable td {
    padding: 12px 15px; /* Khoảng cách bên trong các ô */
    border: 1px solid #ddd; /* Đường viền cho ô */
}

#studyHistoryTable th {
    background-color: #f4f4f4; /* Màu nền cho tiêu đề */
    font-weight: bold;
    text-align: center;
}

#studyHistoryTable tr:nth-child(even) {
    background-color: #f9f9f9; /* Màu nền cho hàng chẵn */
}

#studyHistoryTable tr:hover {
    background-color: #f1f1f1; /* Hiệu ứng hover */
}

#studyHistoryTable td {
    text-align: center;
}

#studyHistoryTable {
    max-width: 100%;
    overflow-x: auto; /* Thanh cuộn ngang cho màn hình nhỏ */
}
.question-block {
  border: 2px solid transparent;
  border-radius: 10px;
  padding-top: 10px;
  margin-bottom: 20px;
  transition: border-color 0.3s;
  position: relative;
}

.question-block.completed {
  border-color: #28a745; /* màu xanh viền khi đã chọn */
}

.question-block.completed::after {
 
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
}
/* Container chính của hộp chat */
.support-box {
  /* Giữ các thuộc tính vị trí, kích thước, nền, bóng đổ cũ */
  position: fixed;
  /* bottom: 80px; /* Có thể cần điều chỉnh vị trí Y */
  /* right: 20px; */
  bottom: 20px; /* Đặt lại vị trí gần nút gốc hơn nếu muốn */
  right: 20px;
  width: 500px; /* Chiều rộng tổng thể */
  height: 60vh; /* Chiều cao tổng thể */
  background: white;
  border-radius: 16px; /* Bo góc */
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden; /* Quan trọng */
  z-index: 1000;

  /* --- THAY ĐỔI QUAN TRỌNG --- */
  display: none; /* Mặc định ẩn */
  flex-direction: row; /* Sắp xếp con theo hàng ngang (header trái, iframe phải) */
}

/* Khi hộp chat được mở (có class visible) */
.support-box.visible {
  display: flex; /* Hiện và áp dụng flexbox */
}

/* Thanh header dọc bên trái */
.support-header-bar {
  background: #007bff; /* Màu nền xanh */
  color: white;
  width: 55px; /* Chiều rộng cố định cho thanh dọc */
  height: 100%; /* Chiều cao 100% của container */
  padding: 10px 0; /* Padding trên dưới */
  display: flex;
  flex-direction: column; /* Sắp xếp logo và nút đóng theo chiều dọc */
  justify-content: space-between; /* Đẩy logo lên trên, nút đóng xuống dưới */
  align-items: center; /* Căn giữa theo chiều ngang */
  flex-shrink: 0; /* Không cho phép thanh này co lại */
  box-sizing: border-box; /* Tính cả padding vào width */
}

/* Logo/Title trong header */
.support-header-bar .header-logo {
  font-size: 14px;
  font-weight: bold;
  margin-top: 10px; /* Khoảng cách trên */
  /* Có thể xoay chữ nếu muốn */
  /* writing-mode: vertical-rl; */
  /* transform: rotate(180deg); */
}

/* Phần chứa nút đóng */
.support-header-bar .header-controls {
   margin-bottom: 5px; /* Khoảng cách dưới */
}

/* Nút đóng (X) */
.support-header-bar .close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px; /* Kích thước nút X */
  cursor: pointer;
  padding: 0; /* Bỏ padding mặc định */
  line-height: 1; /* Căn chỉnh chiều cao */
}
 .support-header-bar .close-btn:hover {
   opacity: 0.8; /* Hiệu ứng hover đơn giản */
}


/* Iframe chứa nội dung chat */
.support-box iframe {
  flex-grow: 1; /* Chiếm hết không gian ngang còn lại */
  height: 100%; /* Chiếm hết chiều cao */
  border: none; /* Bỏ viền */
  width: auto; /* Để flex-grow kiểm soát chiều rộng */
}

/* --- CSS cho nút bật/tắt gốc --- */
.support-toggle-btn {
  /* Giữ nguyên CSS cũ cho nút này */
  position: fixed;
  bottom: 20px;
  right: 20px;
  /* ... các thuộc tính khác ... */
  z-index: 999; /* Nằm dưới hộp chat khi mở */
}

 /* --- Responsive cho màn hình nhỏ --- */
 @media (max-width: 768px) {
   .support-box {
     width: 95%;
     height: 80vh;
     bottom: 10px; /* Điều chỉnh vị trí */
     right: 2.5%;
   }
   .support-header-bar {
      width: 45px; /* Thu nhỏ thanh header */
   }
    .support-header-bar .header-logo {
       font-size: 12px;
    }
    .support-header-bar .close-btn {
       font-size: 20px;
    }
 }
/* --- CSS Nâng Cấp cho Nút Trợ Lý AI --- */
.support-toggle-btn {
  position: fixed;
  bottom: 25px; /* Hơi nâng lên một chút */
  right: 25px;  /* Hơi cách lề một chút */
  background: linear-gradient(145deg, #0088ff, #0061c5); /* Gradient xanh dương hiện đại */
  color: #fff;
  border: none;
  padding: 10px 20px; /* Điều chỉnh padding */
  border-radius: 12px; /* Bo góc vuông vắn hơn, hiện đại hơn */
  cursor: pointer;
  font-size: 16px;
  font-weight: 600; /* Giữ nguyên hoặc 500 */
  font-family: 'Roboto', sans-serif; /* Đảm bảo font được áp dụng */
  letter-spacing: 0.5px; /* Tăng khoảng cách chữ một chút */
  box-shadow: 0 4px 10px rgba(0, 97, 197, 0.2), /* Bóng mờ chính */
              0 1px 3px rgba(0, 0, 0, 0.1);       /* Bóng nhẹ gần hơn */
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); /* Transition mượt mà hơn */
  z-index: 999;
  display: inline-flex; /* Sử dụng flex để căn chỉnh icon và text */
  align-items: center;
  gap: 8px; /* Khoảng cách giữa icon và text */
  white-space: nowrap; /* Không xuống dòng */
}

.support-toggle-btn:hover {
  background: linear-gradient(145deg, #007ae0, #0055b0); /* Gradient đậm hơn khi hover */
  transform: translateY(-3px); /* Hiệu ứng nhấc lên nhẹ */
  box-shadow: 0 7px 18px rgba(0, 97, 197, 0.3), /* Bóng đổ rõ hơn khi hover */
              0 3px 6px rgba(0, 0, 0, 0.15);
}

.support-toggle-btn:active {
  transform: translateY(0px); /* Hiệu ứng nhấn xuống */
  background: #0056b3; /* Màu nền đậm khi nhấn */
  box-shadow: 0 2px 5px rgba(0, 97, 197, 0.2); /* Bóng đổ nhỏ hơn khi nhấn */
}


#content img {
  max-width: 80vw; /* Tối đa 80% chiều rộng màn hình thiết bị */
  max-height: 80vh; /* Tối đa 80% chiều cao màn hình */
  width: auto;
  height: auto;
}
/* --- HIERARCHY STYLING START --- */
#lessonHierarchyContainer {
    padding: 20px;
    border-bottom: 1px solid #eee; /* Separator line */
}

.folder-node {
    margin-bottom: 5px;
}

.folder-node > summary {
    cursor: pointer;
    font-weight: bold;
    padding: 1px 12px;
    background-color: #f0f0f0;
    border-radius: 4px;
    list-style: none; /* Remove default triangle */
    position: relative;
    transition: background-color 0.2s ease;
    border: 1px solid #ddd;
}
.folder-node > summary:hover {
    background-color: #e0e0e0;
}

/* Custom folder icon */
.folder-node > summary::before {
    content: '📁'; /* Folder icon */
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s ease-in-out;
    font-size: 1em;
}
.folder-node[open] > summary::before {
    content: '📂'; /* Open folder icon */
    /* transform: rotate(90deg); */ /* Optional rotation */
}


/* Indentation for nested levels */
.folder-node > details,
.folder-node > div.lesson-item {
    margin-left: 25px; /* Indent nested items */
    padding-left: 10px;
    border-left: 2px dotted #ccc; /* Vertical line for structure */
    margin-top: 5px;
}
.folder-node > details {
     border-left: none; /* Don't double border details */
     padding-left: 0;
}


.lesson-item {    
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.95em;
    position: relative; /* For viewed marker */
}
.lesson-item::before {
     content: '📄'; /* Document icon for lessons */
     margin-right: 8px;
     font-size: 0.9em;
}


.lesson-item:hover {
    background-color: #e7f3ff; /* Light blue hover */
    border-color: #aaccff;
    box-shadow: 0 1px 3px rgba(0, 123, 255, 0.2);
}

/* Styling for viewed/completed lessons */
.lesson-item.viewed {
    background-color: #f0fff0; /* Light green background */
    border-color: #c0e0c0;
    color: #555; /* Slightly dimmer text */
    font-style: italic;
}
.lesson-item.viewed::after {
    content: '✓'; /* Checkmark */
    color: green;
    font-weight: bold;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
}
.lesson-item.viewed:hover {
     background-color: #e0f0e0; /* Darker green hover */
}

/* --- HIERARCHY STYLING END --- */

/* === NEW HELP BUTTON AND MODAL STYLES === */
.help-button {
  z-index: 1002;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  display: block;
  margin: 0;
  flex-shrink: 0;
  margin-top: 0; /* Override default button margin */
}

.help-button:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

.help-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1010; /* Higher than other elements */
  overflow-y: auto;
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
}

.help-modal-content {
  position: relative;
  background-color: #fff;
  margin: 5% auto;
  padding: 30px;
  border: 1px solid #888;
  width: 90%;
  max-width: 700px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.help-modal-content h2, .help-modal-content h3 {
  color: #333;
  margin-bottom: 15px;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
}

.help-modal-content h2 {
  font-size: 24px;
}
.help-modal-content h3 {
  font-size: 18px;
  margin-top: 20px;
}

.help-modal-content ol, .help-modal-content ul {
  list-style-position: inside;
  padding-left: 5px;
  margin-bottom: 15px;
}

.help-modal-content li {
  background-color: transparent;
  padding: 5px 0;
  margin: 0;
  color: #555;
  font-size: 16px;
  cursor: default;
}

.help-modal-content li b {
  color: #333;
}

.help-modal-content p {
  color: #555;
  font-size: 16px;
  margin-bottom: 10px;
}

.help-close {
  position: absolute;
  top: 15px;
  right: 20px;
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease-in-out;
}

.help-close:hover,
.help-close:focus {
  color: #333;
}

/* === END HELP STYLES === */

.stats-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
}

/* --- Test Area Styling --- */
#testArea {
    padding: 20px;
}

/* --- Stats and History Section --- */
.stats-section {
  margin-top: 30px;
  padding: 30px 20px;
  border-top: 1px solid #dee2e6;
  background-color: #f8f9fa; /* Light background for section */
}
.stats-section h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}
.chart-container {
  max-width: 800px;
  margin: 0 auto 30px auto;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border: 1px solid #eee;
}
#studyHistoryTable {
    max-width: 100%;
    overflow-x: auto; /* Horizontal scroll for small screens */
    margin-top: 20px;
}
#studyHistoryTable table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em; /* Slightly smaller font */
}
#studyHistoryTable th, #studyHistoryTable td {
    padding: 10px 12px;
    border: 1px solid #ddd;
    text-align: center;
}
#studyHistoryTable th {
    background-color: #e9ecef;
    font-weight: bold;
}
#studyHistoryTable tr:nth-child(even) {
    background-color: #f8f9fa;
}
#studyHistoryTable tr:hover {
    background-color: #f1f1f1;
}
#studyHistoryTable td:nth-child(3) { /* Align lesson title left */
    text-align: left;
}

/* --- AUTHENTICATION SECTION (FINGERPRINT & MEMBERSHIP) --- */
#auth-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #eee;
}

.auth-block {
    text-align: center;
}

.auth-block h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #6c757d;
    font-weight: normal;
}

#fingerprint-container, 
#membership-input-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #e9ecef;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

#fingerprint-display {
    font-size: 0.9rem;
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', Courier, monospace;
}

#membership-code-input {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 8px;
    background-color: #fff;
    color: #333;
    width: 250px; /* Give it a fixed width */
}

#copy-fingerprint-btn, #save-membership-btn {
    display: inline-block;
    margin: 0;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #fff;
    background-color: #007bff;
    border: 1px solid #007bff;
    border-radius: 4px;
    line-height: 1.5;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

#copy-fingerprint-btn:hover, #save-membership-btn:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

#membership-status {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: bold;
    min-height: 1.2em;
}

/* --- BACKUP & RESTORE SECTION --- */
.backup-restore {
    padding: 30px 20px;
    margin-top: 10px;
    background-color: #fff;
    border-top: 1px solid #eee;
    text-align: center;
}

.backup-restore h3 {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 20px;
}

.backup-restore-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center; /* Căn giữa các nút theo chiều dọc */
}

/* Quy tắc chung cho cả button và label để đảm bảo đồng nhất */
.backup-restore-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background-color: #007bff; /* MÀU XANH ĐỒNG NHẤT */
    margin: 0; /* Ghi đè margin từ quy tắc button chung */
    line-height: 1.5; /* Đảm bảo chiều cao dòng nhất quán */
}

.backup-restore-actions .btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}


.backup-restore .note {
    font-size: 0.85rem;
    color: #6c757d;
}


/* Responsive Adjustments */
@media (max-width: 768px) {
  .container {
    width: 95%;
    margin: 10px auto; /* Adjust margin */
  }
  #pageTitle {
      font-size: 1.5em;
  }
  .folder-node > summary, .lesson-item {
      padding: 8px 10px;
      font-size: 0.9em;
  }
   .folder-node > details, .folder-node > div.lesson-item {
        margin-left: 15px; /* Reduce indent on mobile */
        padding-left: 8px; /* Reduce padding */
   }


   .stats-section, .backup-restore {
       padding: 15px;
   }
   #studyHistoryTable th, #studyHistoryTable td {
        padding: 8px 10px;
   }
   #content li, #content h6 { /* Options size */
       padding: 10px 12px;
   }
   #content p { /* Question text size */
       font-size: 0.95em;
   }
    .help-modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 20px;
  }

}
/* FILE: style.css (Thêm vào cuối) */

/* === CSS MỚI CHO THANH TÌM KIẾM === */
.search-bar-container {
    display: block; /* Đảm bảo container chiếm đủ chiều rộng */
    padding: 15px 20px; /* Giữ hoặc điều chỉnh padding nếu cần */
    margin-bottom: 15px; /* Khoảng cách dưới */
    background-color: #f8f9fa; /* Màu nền cũ */
    border-bottom: 1px solid #eee; /* Đường kẻ dưới cũ */
    box-sizing: border-box; /* Quan trọng */
}

.search-bar-input {
    display: block; /* Hiển thị dạng khối */
    width: 100%; /* Chiếm toàn bộ chiều rộng của container */
    padding: 10px 15px; /* Padding bên trong ô input */
    font-size: 1rem; /* Kích thước chữ */
    line-height: 1.5; /* Chiều cao dòng */
    color: #495057; /* Màu chữ */
    background-color: #fff; /* Màu nền ô input */
    background-clip: padding-box;
    border: 1px solid #ced4da; /* Viền ô input */
    border-radius: 0.25rem; /* Bo góc nhẹ */
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); /* Bóng đổ nhẹ bên trong */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; /* Hiệu ứng chuyển động */
    box-sizing: border-box; /* Rất quan trọng: đảm bảo width 100% bao gồm cả padding và border */
    margin: 0; /* Bỏ margin mặc định nếu có */
}

.search-bar-input:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff; /* Đổi màu viền khi focus */
    outline: 0; /* Bỏ đường viền focus mặc định */
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0 0.2rem rgba(0, 123, 255, 0.25); /* Thêm hiệu ứng bóng đổ khi focus */
}
/* === HẾT CSS MỚI === */

/* Optional: Add margin below filter before hierarchy starts */
#lessonHierarchyContainer {
    /* padding-top: 10px; */ /* Adjust existing padding if needed */
}

/* Optional: Add margin below filter before hierarchy starts */
#lessonHierarchyContainer {
    /* padding-top: 10px; */ /* Adjust existing padding if needed */
}
/* FILE: style.css (Thêm vào) */

.lesson-item.highlighted {
    background-color: #fff3cd; /* Màu vàng nhạt làm nổi bật */
    border-color: #ffeeba;
    font-weight: bold; /* Chữ đậm hơn */
}

/* Có thể thêm hiệu ứng khi hover vào mục đã highlight */
.lesson-item.highlighted:hover {
    background-color: #ffeeba;
    border-color: #ffdb8b;
}

}
/* === THÊM CSS CHO NÚT TOÀN MÀN HÌNH === */

/* Style chung cho các nút điều khiển trong header AI */
.support-header-bar .control-btn,
.support-header-bar .close-btn {
    background: none !important; /* SỬA LỖI MÀU NỀN VỚI !important */
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: opacity 0.2s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}


.support-header-bar .control-btn:hover,
.support-header-bar .close-btn:hover {
    opacity: 0.8;
}

/* Sắp xếp các nút điều khiển trong header */
.support-header-bar .header-controls {
   display: flex;
   flex-direction: column; /* Xếp chồng dọc */
   align-items: center;
   gap: 8px; /* Khoảng cách giữa nút toàn màn hình và nút đóng */
   margin-bottom: 10px; /* Khoảng cách với đáy */
}


/* CSS cho container khi ở chế độ toàn màn hình */
#supportContainer:fullscreen {
    /* Có thể thêm style khác nếu muốn, ví dụ nền khác */
    background-color: #ffffff;
    padding: 0; /* Bỏ padding khi fullscreen */
    border-radius: 0; /* Bỏ bo góc khi fullscreen */
}

/* Căn chỉnh lại header và iframe khi fullscreen */
#supportContainer:fullscreen .support-header-bar {
   border-radius: 0;
}

#supportContainer:fullscreen iframe {
   border-radius: 0;
}

/* Ẩn nút bật/tắt gốc khi AI đang ở chế độ toàn màn hình */
/* Lưu ý: Selector này có thể không hoạt động 100% trên mọi trình duyệt */
#supportContainer:fullscreen ~ .support-toggle-btn {
    display: none !important; /* Ưu tiên ẩn nút gốc */
}

/* === KẾT THÚC CSS THÊM === */

/* --- Membership Modal Styles --- */
@keyframes modal-pop-in {
  0% { transform: scale(0.7); opacity: 0; }
  80% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes button-glow {
  0%, 100% { box-shadow: 0 0 10px #f7b733, 0 0 20px #f7b733, inset 0 0 5px #f7b733; }
  50% { box-shadow: 0 0 20px #fc4a1a, 0 0 40px #fc4a1a, inset 0 0 10px #fc4a1a; }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 2, 30, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1050;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-overlay.visible .modal-content {
  animation: modal-pop-in 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

.modal-content {
  background: linear-gradient(145deg, #4158D0, #2a3a8a);
  color: #fff;
  padding: 30px 35px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.1);
  text-align: center;
  max-width: 420px;
  width: 90%;
  border: 3px solid #7971ea;
  position: relative;
  overflow: hidden;
}

.modal-content::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    transparent,
    rgba(178, 127, 255, 0.2),
    transparent 30%
  );
  animation: rotate 5s linear infinite;
}

@keyframes rotate {
  100% { transform: rotate(360deg); }
}

.modal-icon {
  font-size: 50px;
  margin-bottom: 15px;
  animation: float 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.modal-content h3 {
  margin-top: 0;
  font-size: 1.8rem;
  font-weight: 900;
  color: #f7b733;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.modal-content p {
  margin: 15px 0 25px 0;
  font-size: 1rem;
  line-height: 1.6;
  opacity: 0.9;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.modal-buttons button {
  padding: 12px 25px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
  margin: 0;
  outline: none;
}

#modalCancelBtn {
  background-color: transparent;
  color: #c4c1ff;
  border: 2px solid #5a52a5;
}

#modalCancelBtn:hover {
  background-color: #5a52a5;
  color: #fff;
  transform: scale(1.05);
}

#modalOkBtn {
  background: linear-gradient(45deg, #fc4a1a, #f7b733);
  color: #fff;
  border: 2px solid transparent;
  box-shadow: 0 0 10px #f7b733, 0 0 20px #f7b733;
  animation: button-glow 2.5s ease-in-out infinite;
}

#modalOkBtn:hover {
  transform: scale(1.05) translateY(-2px);
  animation-play-state: paused;
  box-shadow: 0 0 15px #f7b733, 0 0 30px #f7b733;
}
/* Thêm vào cuối tệp style.css */
.support-toggle-btn,
#page-capture-btn {
    display: none; /* Ẩn các nút theo mặc định */
}

/* ----- LOADING SCREEN (GAME VERSION) ----- */
@keyframes spinner-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes text-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(13, 17, 23, 0.9); /* Màu nền tối hơn */
  display: none; /* Ẩn mặc định */
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-spinner {
  width: 80px;
  height: 80px;
  border: 5px solid rgba(0, 229, 255, 0.2);
  border-top-color: #00e5ff;
  border-radius: 50%;
  animation: spinner-rotate 1.2s linear infinite;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
}

.loading-message {
  color: white;
  text-align: center;
}

.loading-message p {
  font-size: 1.2em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 5px;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.7);
}

.loading-message span {
  font-size: 0.9em;
  opacity: 0.8;
  animation: text-pulse 2s ease-in-out infinite;
}

body.loading-active > .container {
  filter: blur(5px);
  transition: filter 0.3s ease-in-out;
}