#page-mod-quiz-view .nice-main > h3 {
  margin-top: 40px !important;
  margin-bottom: 20px !important;
  background-color: #eff3f3;
  padding: 5px 15px !important;
  border-radius: 10px !important;
  color: #0d9488 !important;
  border-left: 5px solid #0d9488;
}

#page-mod-quiz-view .nice-main .list-unstyled {
  gap: 20px !important;
  display: grid !important;
  /* Two column on a row with the same size */
  grid-template-columns: repeat(2, 1fr) !important;
}

#page-mod-quiz-view .nice-main .list-unstyled li {
  padding-right: 0px !important;
  margin-bottom: 0px !important;
  width: 100% !important;
}

#page-mod-quiz-view .nice-main #feedback h3 {
  padding: 0px !important;
  margin-bottom: 0px !important;
  margin-top: 0px !important;
}

/* --- 1. KHUNG CHỨA (CONTAINER) --- */
/* Thiết kế phẳng, viền mỏng, bỏ bóng đổ */
#mod_quiz_navblock {
  background-color: #ffffff !important;
  border: 1px solid #e0e0e0 !important; /* Viền xám nhẹ */
  border-radius: 8px !important; /* Bo góc nhẹ nhàng */
  box-shadow: none !important; /* Bỏ hoàn toàn bóng đổ */
  margin-bottom: 20px !important;
  margin-top: 20px !important;
  overflow: hidden !important; /* Ẩn phần thừa */
}

/* Phần Body bên trong */
#mod_quiz_navblock .card-body {
  padding: 15px 20px !important;
  margin-top: 0 !important;
  border-radius: 0 !important;
}

/* --- 2. TIÊU ĐỀ (HEADER) --- */
/* Đơn giản, chữ đậm vừa phải, kẻ dòng mờ */
#mod_quiz_navblock .card-title {
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: #333333 !important;
  text-transform: none !important; /* Bỏ in hoa toàn bộ cho đỡ nặng nề */
  border-bottom: 1px solid #f0f0f0 !important;
  padding-bottom: 10px !important;
  margin-bottom: 15px !important;
  display: block !important;
}

/* --- 3. LƯỚI NÚT CÂU HỎI --- */
/* Giữ layout Grid để căn chỉnh đều */
.qn_buttons {
  margin-bottom: 0 !important;
}

/* --- 4. NÚT CÂU HỎI (BUTTONS) --- */
/* Style cơ bản: Vuông vức, viền mảnh */
.qnbutton {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 4px !important; /* Bo góc rất nhẹ (gần như vuông) */
  font-size: 13px !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  margin: 0 !important;
  box-shadow: none !important; /* Không bóng đổ */
}

/* -- TRẠNG THÁI 1: CHƯA LÀM (Mặc định) -- */
.qnbutton.notyetanswered {
  background-color: #ffffff !important;
  border: 1px solid #dcdcdc !important;
  color: #555555 !important;
}

/* -- TRẠNG THÁI 2: ĐANG LÀM (Active) -- */
/* Dùng màu đen hoặc xanh đậm phẳng (Flat) */
#page-mod-quiz-attempt .qn_buttons > a,
#page-mod-quiz-summary .qn_buttons > a {
  margin-right: 5px !important;
}
.qnbutton.thispage {
  background-color: #333333 !important; /* Màu tối trung tính */
  color: #ffffff !important;
  border: 1px solid #333333 !important;
  font-weight: 700 !important;
  margin-right: 5px !important;
}

.qnbutton.thispage:hover {
  background-color: #555555 !important; /* Màu xám đậm khi hover */
  border-color: #555555 !important;
}

/* -- TRẠNG THÁI 3: ĐÃ LÀM (Answered) -- */
.qnbutton.answered {
  background-color: #f3f3f3 !important; /* Xám nhạt */
  color: #333 !important;
  border: 1px solid #ccc !important;
}

/* -- HOVER -- */
.qnbutton:hover {
  background-color: #f5f5f5 !important;
  border-color: #999 !important;
  cursor: pointer !important;
}

.qn_buttons .qnbutton.flagged {
  position: relative; /* Để định vị tam giác */
  overflow: hidden;
}

/* Tạo hình tam giác ở góc trên bên phải */
.qn_buttons .qnbutton.flagged::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 15px 15px 0; /* Kích thước tam giác */
  border-color: transparent #dc3545 transparent transparent; /* Màu đỏ */
  z-index: 1;
}

/* --- 5. ẨN THÀNH PHẦN THỪA --- */
.qnbutton .trafficlight,
.qnbutton .thispageholder,
.qnbutton .accesshide {
  display: none !important;
}

/* --- 6. LINK NỘP BÀI (FINISH ATTEMPT) --- */
/* Đơn giản hóa thành nút viền (Outline button) */
.othernav {
  margin-top: 20px !important;
  text-align: center !important;
}

.endtestlink {
  display: inline-block !important;
  padding: 8px 20px !important;
  background-color: transparent !important;
  color: #555 !important;
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  font-size: 0.85rem !important;
  text-decoration: none !important;
  transition: all 0.2s !important;
}

.endtestlink:hover {
  background-color: #333 !important;
  color: #fff !important;
  border-color: #333 !important;
}

/* --- 1. KHUNG CÂU HỎI (CONTAINER) --- */
/* Biến mỗi câu hỏi thành một khối sạch sẽ, tách biệt */
.que {
  background-color: #ffffff !important;
  border: 1px solid #e5e7eb !important; /* Viền xám mỏng */
  border-radius: 12px !important;
  margin-bottom: 2rem !important;
  padding: 0 !important; /* Reset padding để xử lý bên trong */
  overflow: hidden !important; /* Để bo góc hoạt động tốt */
  gap: 0 !important;
}

/* --- 2. CỘT THÔNG TIN BÊN TRÁI (INFO COLUMN) --- */
/* Chứa số thứ tự câu hỏi, điểm số */
.que .info {
  background-color: #f9fafb !important; /* Xám rất nhạt */
  padding: 20px 15px !important;
  width: 160px !important; /* Cố định chiều rộng vừa đủ */
  float: left !important; /* Giữ layout truyền thống của Moodle */
  box-sizing: border-box !important;
  min-height: 200px !important; /* Đảm bảo chiều cao */
  border-left: none !important;
  border-right: 1px solid #e5e7eb !important; /* Viền phân cách */
  border-top: none !important;
  border-bottom: 1px solid #e5e7eb !important;
}

/* Số thứ tự câu hỏi (Question 1) */
.que .info .no {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  color: #1f2937 !important;
  margin-bottom: 10px !important;
}

/* Trạng thái (Not answered / Marked out of...) */
.que .info .state,
.que .info .grade {
  font-size: 0.8rem !important;
  color: #6b7280 !important;
  margin-bottom: 5px !important;
}

/* Nút gắn cờ (Flag question) */
.que .info .questionflag {
  margin-top: 15px !important;
}
.que .info .questionflag a {
  color: #9ca3af !important;
  text-decoration: none !important;
  font-size: 0.85rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
}

/* --- 3. KHUNG NỘI DUNG CHÍNH BÊN PHẢI (CONTENT COLUMN) --- */
.que .content {
  margin-left: 0px !important; /* Né cột Info bên trái */
  padding: 25px 30px !important;
  background-color: #fff !important;
  border: none !important;
}

/* --- 4. VĂN BẢN CÂU HỎI (QUESTION TEXT) --- */
.que .qtext {
  font-size: 1.05rem !important;
  line-height: 1.6 !important;
  color: #111827 !important; /* Màu đen dịu */
  margin-bottom: 25px !important;
  font-weight: 500 !important;
}

/* --- 5. VÙNG TRẢ LỜI (ANSWER AREA) --- */
/* Reset style danh sách */
.que .answer {
  margin-bottom: 1rem !important;
}

/* Từng dòng đáp án (Option) */
.que .answer div.r0,
.que .answer div.r1 {
  padding: 12px 15px !important;
  margin-bottom: 8px !important;
  border-radius: 8px !important;
  border: 1px solid #e5e7eb !important; /* Viền mờ cho từng đáp án */
  transition: all 0.2s ease !important;
  background-color: #fff !important;
  display: flex !important;
  align-items: center !important;
}

/* Hiệu ứng khi di chuột vào đáp án */
.que .answer div.r0:hover,
.que .answer div.r1:hover {
  background-color: #f0f9ff !important; /* Xanh dương rất nhạt */
  border-color: #bae6fd !important;
  cursor: pointer !important;
}

/* Input Radio/Checkbox - Phóng to để dễ bấm */
.que .answer input[type="radio"],
.que .answer input[type="checkbox"] {
  margin-right: 12px !important;
  transform: scale(1.3) !important; /* To lên 1.3 lần */
  cursor: pointer !important;
  accent-color: #0f6cbf !important; /* Màu xanh thương hiệu khi chọn */
}

/* Chữ của đáp án */
.que .answer label,
.que .answer div {
  cursor: pointer !important;
  font-size: 1rem !important;
  color: #374151 !important;
}

/* --- 6. PHẦN FEEDBACK (PHẢN HỒI SAU KHI NỘP) --- */
/* Thay vì nguyên khối màu vàng, dùng viền màu để tinh tế hơn */
.que .outcome,
.que .comment {
  margin-top: 20px !important;
  padding: 15px 20px !important;
  border-radius: 8px !important;
  background-color: #f8fafc !important; /* Nền xám xanh rất nhẹ */
  border: 1px solid #e2e8f0 !important;
  border-left: 4px solid #64748b !important; /* Viền trái mặc định */
  color: #334155 !important;
}

/* Feedback ĐÚNG */
.que.correct .outcome {
  background-color: #f0fdf4 !important; /* Nền xanh lá cực nhạt */
  border-color: #bbf7d0 !important;
  border-left-color: #22c55e !important; /* Viền trái xanh lá */
  color: #15803d !important;
}

/* Feedback SAI */
.que.incorrect .outcome {
  background-color: #fef2f2 !important; /* Nền đỏ cực nhạt */
  border-color: #fecaca !important;
  border-left-color: #ef4444 !important; /* Viền trái đỏ */
  color: #b91c1c !important;
}

/* --- 7. MOBILE RESPONSIVE (QUAN TRỌNG) --- */
/* Khi màn hình nhỏ, cột Info nhảy lên trên */
@media (max-width: 767px) {
  .que .info {
    float: none !important;
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid #f3f4f6 !important;
    min-height: auto !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  .que .content {
    margin-left: 0 !important;
    padding: 15px !important;
  }
  .que .info .questionflag {
    margin-top: 0 !important;
  }
}

/* --- 1. CONTAINER BAO NGOÀI --- */
/* Cố định timer ở góc hoặc giữ nguyên vị trí nhưng căn chỉnh đẹp hơn */
#quiz-timer-wrapper {
  position: relative !important;
  top: 0 !important;
  width: fit-content !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important; /* Luôn căn phải */
  padding: 10px 0 !important;
  margin-bottom: 20px !important;
  /* Nếu muốn timer trôi theo khi cuộn chuột, bỏ comment dòng dưới: */
  /* position: sticky !important; top: 15px; z-index: 1000; */
}

/* --- 2. HỘP HIỂN THỊ THỜI GIAN (TIMER BOX) --- */
#quiz-timer {
  background-color: #ffffff !important;
  color: #374151 !important; /* Chữ màu xám đậm dễ đọc */
  border: 1px solid #e5e7eb !important; /* Viền xám mỏng tinh tế */
  border-radius: 50px !important; /* Bo tròn hoàn toàn dạng viên thuốc */
  padding: 8px 20px !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important; /* Bóng đổ nhẹ tạo độ nổi */
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

/* --- 3. SỐ GIỜ ĐẾM NGƯỢC --- */
#quiz-time-left {
  font-weight: 700 !important;
  font-size: 1.1rem !important;
  color: #0f6cbf !important; /* Màu xanh dương chủ đạo */
  font-variant-numeric: tabular-nums !important; /* Giúp các con số thẳng hàng, không bị nhảy khi đếm */
  letter-spacing: 0.5px !important;
}

/* Khi thời gian sắp hết (Moodle thường thêm class 'timerwarning' hoặc đổi màu inline) 
   Ta ép nó sang màu đỏ để cảnh báo rõ ràng */
#quiz-timer.timerwarning #quiz-time-left,
#quiz-timer span[style*="color: red"] {
  color: #dc2626 !important;
}

/* --- 4. NÚT ẨN (HIDE BUTTON) --- */
#toggle-timer {
  background-color: #f3f4f6 !important; /* Nền xám nhẹ */
  border: 1px solid #e5e7eb !important; /* Viền mỏng cùng tông */
  color: #6b7280 !important; /* Chữ màu xám vừa phải */
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  padding: 6px 16px !important; /* Tăng độ rộng để nút trông cân đối hơn */
  margin-left: 10px !important;
  border-radius: 20px !important; /* Bo tròn viên thuốc */
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  box-shadow: none !important;
}

/* Hiệu ứng khi di chuột vào */
#toggle-timer:hover {
  background-color: #e5e7eb !important; /* Đậm hơn một chút */
  color: #374151 !important; /* Chữ đậm hơn */
  border-color: #d1d5db !important;
}

/* Hiệu ứng khi bấm */
#toggle-timer:active {
  transform: translateY(
    1px
  ) !important; /* Nhún nhẹ xuống tạo cảm giác bấm thật */
}

#page-mod-quiz-summary #quiz-timer-wrapper #quiz-timer {
  margin-top: 0 !important;
}

#page-mod-quiz-summary #page-mod-quiz-summary .submitbtns {
  margin-bottom: 2em !important;
}

#page-mod-quiz-summary .page-section-title-hide {
  font-size: 18px !important;
  margin-top: 35px !important;
  margin-bottom: 10px !important;
}

/* 1. Tổng thể bảng: Bo tròn nhẹ và đổ bóng để nổi bật trên nền trắng */
table.quizsummaryofattempt {
  width: 100%;
  border-collapse: separate; /* Để hỗ trợ border-radius */
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  background-color: #fff;
}

/* 2. Phần Tiêu đề (Header): Màu nền xám nhẹ, chữ đậm */
table.quizsummaryofattempt thead th {
  background-color: #f8f9fa;
  color: #333;
  font-weight: 600;
  padding: 15px 20px;
  border-bottom: 2px solid #eaeaea;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

/* 3. Các ô nội dung (Cells): Tăng khoảng cách và kẻ dòng mờ */
table.quizsummaryofattempt tbody td {
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
  color: #555;
  vertical-align: middle;
}

/* 4. Hiệu ứng khi di chuột vào từng hàng (Hover) */
table.quizsummaryofattempt tbody tr:hover {
  background-color: #f1f7ff; /* Màu xanh rất nhạt khi hover */
  transition: background-color 0.2s ease;
}

/* 5. Tùy chỉnh cột "Question" (c0) */
table.quizsummaryofattempt td.c0 a {
  font-weight: bold;
  color: #0056b3; /* Màu xanh tiêu chuẩn cho link */
  text-decoration: none;
}

/* 6. Tùy chỉnh cột "Status" (c1) để trạng thái rõ ràng hơn */
table.quizsummaryofattempt td.c1 {
  font-weight: 500;
}

/* (Tùy chọn) Ẩn dòng kẻ cuối cùng của bảng để đẹp hơn */
table.quizsummaryofattempt tbody tr:last-child td {
  border-bottom: none;
}

/* --- 1. KHUNG BAO NGOÀI (CONTAINER) --- */
/* Tạo giao diện dạng thẻ (Card), nền trắng, tách biệt với nền trang */
#page-mod-quiz-edit .mod_quiz-edit-top-controls {
  background-color: #ffffff !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 8px !important;
  padding: 15px 20px !important;
  margin-bottom: 20px !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial,
    sans-serif !important;
  padding-bottom: 5px !important;
}

/* --- 2. CÁC NÚT BẤM (BUTTONS) --- */
/* Style chung cho nút Repaginate, Select multiple, Save, Delete... */
#page-mod-quiz-edit .mod_quiz-edit-top-controls .btn {
  background-color: #f8f9fa !important;
  border: 1px solid #ced4da !important;
  color: #495057 !important;
  padding: 6px 16px !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  box-shadow: none !important;
  margin-right: 8px !important; /* Tạo khoảng cách giữa các nút */
}

/* Hiệu ứng khi di chuột vào nút */
#page-mod-quiz-edit .mod_quiz-edit-top-controls .btn:hover {
  background-color: #e2e6ea !important;
  border-color: #adb5bd !important;
  color: #212529 !important;
}

/* Riêng nút "Delete selected" khi được kích hoạt (cần nổi bật để cảnh báo) */
#page-mod-quiz-edit
  .mod_quiz-edit-top-controls
  #selectmultipledeletecommand:not([disabled]) {
  background-color: #dc3545 !important;
  color: #fff !important;
  border-color: #dc3545 !important;
}

#page-mod-quiz-edit
  .mod_quiz-edit-top-controls
  #selectmultipledeletecommand:not([disabled]):hover {
  background-color: #bb2d3b !important;
}

/* --- 3. Ô NHẬP ĐIỂM SỐ (INPUT TEXT) --- */
/* Style cho ô nhập Maximum grade */
#page-mod-quiz-edit
  .mod_quiz-edit-top-controls
  input[type="text"]#inputmaxgrade {
  border: 1px solid #ced4da !important;
  border-radius: 4px !important;
  padding: 6px 10px !important;
  font-size: 14px !important;
  color: #495057 !important;
  width: 80px !important; /* Độ rộng vừa đủ */
  text-align: center !important;
  margin: 0 8px !important;
}

#page-mod-quiz-edit
  .mod_quiz-edit-top-controls
  input[type="text"]#inputmaxgrade:focus {
  border-color: #86b7fe !important;
  outline: 0 !important;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* --- 4. CÁC THÀNH PHẦN THÔNG TIN (TEXT) --- */
/* Dòng trạng thái (Questions: 4 | This quiz is open) */
#page-mod-quiz-edit .mod_quiz-edit-top-controls .statusbar {
  font-size: 14px !important;
  color: #6c757d !important;
  margin-bottom: 5px !important;
}

#page-mod-quiz-edit .mod_quiz-edit-top-controls .quizopeningstatus {
  color: #198754 !important; /* Màu xanh lá biểu thị trạng thái mở */
  font-weight: 500 !important;
}

/* Nhãn "Maximum grade" */
#page-mod-quiz-edit .mod_quiz-edit-top-controls label[for="inputmaxgrade"] {
  font-weight: 600 !important;
  color: #343a40 !important;
  margin-right: 5px !important;
}

/* Tổng điểm (Total of marks) */
#page-mod-quiz-edit .mod_quiz-edit-top-controls .totalpoints {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #0d6efd !important; /* Màu xanh dương để nhấn mạnh */
  background-color: #e7f1ff !important;
  padding: 5px 12px !important;
  border-radius: 20px !important; /* Bo tròn dạng pill */
  display: inline-block !important;
}

/* --- 5. BỐ CỤC (LAYOUT ADJUSTMENTS) --- */
/* Căn chỉnh lại Flexbox để các hàng thẳng thớm hơn */
#page-mod-quiz-edit .mod_quiz-edit-top-controls .d-flex {
  align-items: center !important;
  gap: 10px !important;
}

/* Ẩn các phần tử thừa hoặc khoảng trắng không cần thiết nếu có */
#page-mod-quiz-edit .mod_quiz-edit-top-controls fieldset.invisiblefieldset {
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

/* --- TỔNG QUAN DANH SÁCH --- */
/* Xóa style mặc định của danh sách và tạo khoảng cách */
#page-mod-quiz-edit ul.section {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  background-color: transparent;
}

/* --- PHÂN CHIA TRANG (PAGE HEADERS) --- */
/* Làm nổi bật tiêu đề Trang 1, Trang 2... */
#page-mod-quiz-edit li.pagenumber {
  background-color: #e9ecef; /* Màu xám nhẹ */
  padding: 10px 15px;
  margin-top: 25px;
  margin-bottom: 10px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-left: 5px solid #0f6cbf; /* Viền xanh bên trái tạo điểm nhấn */
  color: #495057;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#page-mod-quiz-edit li.pagenumber h4 {
  margin: 0;
  font-size: 1.1rem;
  color: #333;
}

/* --- THẺ CÂU HỎI (QUESTION SLOT) --- */
/* Biến mỗi câu hỏi thành một "Card" riêng biệt */
#page-mod-quiz-edit li.activity.slot {
  background: #ffffff;
  border: 1px solid #dfe1e5;
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 15px;
  transition: box-shadow 0.2s, transform 0.1s;
  position: relative;
}

/* Hiệu ứng khi di chuột vào câu hỏi */
#page-mod-quiz-edit li.activity.slot:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: #0f6cbf;
  z-index: 10;
}

/* Căn chỉnh nội dung bên trong thẻ câu hỏi */
#page-mod-quiz-edit .mod-indent-outer {
  display: flex;
  align-items: center;
  width: 100%;
  flex-wrap: wrap; /* Đảm bảo hiển thị tốt trên màn hình nhỏ */
}

/* --- SỐ THỨ TỰ CÂU HỎI --- */
#page-mod-quiz-edit .slotnumber {
  background-color: #f1f3f4;
  color: #333;
  min-width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 15px;
  font-size: 0.9rem;
  border-radius: 5px;
}

/* --- ICON VÀ TÊN CÂU HỎI --- */
#page-mod-quiz-edit .activityinstance {
  flex-grow: 1; /* Chiếm khoảng trống còn lại */
  padding-right: 20px;
  display: flex;
  align-items: center;
}

#page-mod-quiz-edit .activityinstance a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #212529;
}

/* Tên câu hỏi (Câu 1, Câu 2...) đậm lên */
#page-mod-quiz-edit .questionname {
  font-weight: 700;
  color: #0f6cbf;
}

/* Nội dung rút gọn của câu hỏi nhạt hơn một chút */
#page-mod-quiz-edit .questiontext {
  color: #666;
  font-style: normal;
  font-size: 0.95rem;
  margin-left: 5px;
}

/* Icon loại câu hỏi (trắc nghiệm, đúng sai...) */
#page-mod-quiz-edit img.activityicon {
  width: 24px;
  height: 24px;
  margin-right: 10px;
}

/* --- KHU VỰC CHỨC NĂNG (ĐIỂM, XOÁ, PREVIEW) --- */
#page-mod-quiz-edit .actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto; /* Đẩy về phía bên phải */
}

/* Ô nhập điểm số */
#page-mod-quiz-edit .instancemaxmarkcontainer {
  background-color: #e8f5e9;
  border: 1px solid #c8e6c9;
  color: #2e7d32;
  padding: 4px 10px;
  border-radius: 15px;
  font-weight: bold;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Các icon hành động (preview, delete) */
#page-mod-quiz-edit .actions a {
  color: #777;
  transition: color 0.2s;
}

#page-mod-quiz-edit .actions a:hover {
  color: #0f6cbf; /* Đổi màu xanh khi hover */
}
#page-mod-quiz-edit .actions a.editing_delete:hover {
  color: #dc3545; /* Đổi màu đỏ khi hover nút xoá */
}

/* --- NÚT "ADD" (THÊM CÂU HỎI) --- */
/* Làm nút thêm câu hỏi gọn gàng hơn */
#page-mod-quiz-edit .add-menu-outer {
  text-align: right;
  margin: 5px 0;
  opacity: 0.6;
  transition: opacity 0.2s;
  margin-right: 20px !important;
}

#page-mod-quiz-edit .add-menu-outer:hover {
  opacity: 1;
}

#page-mod-quiz-edit .add-menu-outer .dropdown-toggle {
  font-size: 0.9rem;
  color: #0f6cbf;
  text-decoration: none;
  font-weight: 600;
}
#page-mod-quiz-edit ul.slots li.section {
  margin-bottom: 10px !important;
}

#page-mod-quiz-edit ul.slots li.section .content {
  padding: 30px 15px 15px !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  border-radius: 5px !important;
}

/* #page-mod-quiz-edit .moodle-actionmenu #action-menu-2-menubar {
  border: none !important;
} */

#page-mod-quiz-edit .slotnumber .inplaceeditable {
  margin: 0 !important;
  border-radius: 5px !important;
}

#page-mod-quiz-edit h2.page-section-title-hide {
  margin-top: 40px !important;
    border-left: 5px solid #009688 !important;
  border-radius: 10px !important;
}

#page-mod-quiz-edit .content .section-heading {
  margin-bottom: 20px !important;
}

#page-mod-quiz-edit ul.slots li.section li.activity.page {
  padding: 5px 0px !important;
}

#page-mod-quiz-edit .mod_quiz-edit-top-controls .selectmultiplecommand {
  margin: 0 !important;
  margin-bottom: 10px !important;
}

#page-mod-quiz-edit .mod_quiz-edit-top-controls .btn-toolbar {
  margin: 0 !important;
}

#page-mod-quiz-edit
  .mod_quiz-edit-top-controls
  .btn-toolbar
  .selectmultiplecommandbuttons {
  margin-bottom: 15px !important;
}

/* --- FIX LỖI JS KHI ẤN NÚT BÚT CHÌ (QUAN TRỌNG) --- */
/* Bắt buộc phải thêm đoạn này để Moodle JS nhận diện được vị trí chèn ô input */

/* 1. Trả container chính về dạng block truyền thống để tránh lỗi tính toán tọa độ của JS */
#page-mod-quiz-edit .section-heading {
  display: block !important;
  width: 100% !important;
  padding-bottom: 15px !important;
  margin-bottom: 20px !important;
  border-bottom: 1px solid #e0e0e0 !important; /* Giữ đường kẻ mờ thẩm mỹ */
  position: relative !important;
}

/* 2. Container chứa Tiêu đề và Nút bút chì phải là inline-block */
#page-mod-quiz-edit .instancesectioncontainer {
  display: inline-block !important;
  vertical-align: middle !important;
}

/* 3. Tiêu đề (H3) phải hiển thị inline để nằm ngang hàng với bút chì */
#page-mod-quiz-edit .instancesectioncontainer h3,
#page-mod-quiz-edit .instancesectioncontainer h4 {
  display: inline-block !important;
  margin: 0 10px 0 0 !important; /* Cách bút chì 10px */
  font-size: 1.25rem !important;
  color: #333 !important;
  vertical-align: middle !important;
}

/* 4. Đảm bảo nút bút chì hiển thị đúng và không bị Flexbox làm méo */
#page-mod-quiz-edit .editing_section {
  display: inline-block !important;
  vertical-align: middle !important;
  float: none !important; /* Tắt float nếu theme gốc có dùng */
}

/* 5. Đẩy phần nút Shuffle (Trộn câu hỏi) sang bên phải hoặc nằm gọn gàng */
#page-mod-quiz-edit .instanceshufflequestions {
  display: inline-block !important;
  margin-left: 20px !important;
  vertical-align: middle !important;
  float: right !important; /* Đẩy sang phải cho đẹp */
}

/* 6. Fix lỗi trên Mobile: Khi màn hình nhỏ thì Shuffle xuống dòng */
@media (max-width: 768px) {
  #page-mod-quiz-edit .instanceshufflequestions {
    display: block !important;
    float: none !important;
    margin-left: 0 !important;
    margin-top: 10px !important;
  }

  #page-mod-quiz-view .nice-main .list-unstyled {
    grid-template-columns: 1fr !important;
  }
}

#page-mod-quiz-edit .statusdisplay {
  margin-bottom: 15px !important;
  border-radius: 8px !important;
}
