/*
 * =========================================
 * GIAO DIỆN QUIZ HIỆN ĐẠI (EDUCATION STYLE)
 * =========================================
 */

/* --- 1. TỔNG THỂ & NỀN TRANG --- */
body {
  /* Nền xám nhạt để làm nổi bật các "thẻ" câu hỏi */
  background-color: #f8f9fa;
}

.qmn-reading {
  /* Sử dụng font hệ thống hiện đại */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  color: #1f2937;
  max-width: 1600px; /* Thêm giới hạn chiều rộng cho màn hình lớn */
  margin: 0 auto;
}

/* --- 2. THANH HEADER DÍNH (STICKY TOP) --- */
#qmn-sticky-top {
  /* Hiệu ứng "kính mờ" (glassmorphism) hiện đại */
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 16px; /* Tăng padding cho thoáng */
}

/* Đồng hồ đếm ngược */
.qmn-topbar .qmn-timer {
  background: #fef3c7; /* Nền vàng nhạt */
  color: #92400e; /* Chữ màu nâu đậm */
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 600;
  border: 1px solid #fde68a;
}
.qmn-topbar .qmn-timer-text {
  background: rgba(255, 255, 255, 0.5);
  padding: 2px 8px;
  border-radius: 6px;
}
/* Khi hết giờ */
.qmn-topbar .qmn-timer.timeup {
  background: #fecaca;
  color: #991b1b;
  border-color: #fca5a5;
}

/* --- 3. THANH TABS (PART 1...7) --- */
.qmn-tabs {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 16px;
  /* Giữ tabs dính bên dưới header */
  position: sticky;
  top: var(--qmn-offset, 0px); /* Đã được JS tính toán */
  z-index: 998;
}

/* Thay đổi style tabs từ "viên thuốc" (pill) sang "gạch chân" (underline) */
.qmn-tabs a {
  font-size: 14px;
  font-weight: 600;
  padding: 10px 4px; /* Tăng không gian click */
  margin: 0 12px;
  border-radius: 0;
  background: transparent;
  color: #6b7280; /* Màu text xám */
  text-decoration: none;
  border-bottom: 3px solid transparent; /* Gạch chân ẩn */
  transition: all 0.2s ease;
}
.qmn-tabs a:hover {
  color: #374151;
}
.qmn-tabs a.active {
  color: #3b82f6; /* Màu xanh chủ đạo */
  border-bottom-color: #3b82f6;
  background: transparent;
}

/* --- 4. THẺ CÂU HỎI (Q-ITEM) & SEGMENT --- */
/* Đây là thay đổi quan trọng nhất */
.q-item,
.seg-pair {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  margin: 16px 0;
  padding: 20px 24px;
  /* Thêm hiệu ứng chuyển động mượt khi được trỏ tới */
  transition: box-shadow 0.2s ease;
}
.q-item:target, /* Khi click từ thanh nav */
.seg-pair:target {
  box-shadow: 0 0 0 2px #3b82f6; /* Highlight màu xanh */
}

/* Huy hiệu số câu (1, 2, 3...) */
.q-item .qno-badge {
  background: #3b82f6; /* Màu xanh chủ đạo */
  border-color: #3b82f6;
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 14px;
}

/* Nội dung câu hỏi */
.q-item .qtext {
  font-size: 16px;
  line-height: 1.6;
  color: #1f2937;
  margin: 12px 0;
}
.seg-pass {
  font-size: 16px;
  line-height: 1.7;
  background: #f9fafb;
  padding: 12px;
  border-radius: 8px;
}

/* --- 5. TÙY CHỌN (RADIO BUTTONS) --- */
.qopt {
  font-size: 16px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  cursor: pointer;
}

/* Nâng cấp: Tùy chỉnh radio button cho hiện đại */
.qopt input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  margin-right: 12px;
  transition: all 0.1s ease-in-out;
  position: relative;
  top: -2px; /* Căn chỉnh với text */
}

.qopt input[type="radio"]:checked {
  border-color: #3b82f6;
}

/* Dấu chấm tròn bên trong */
.qopt input[type="radio"]:after {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0); /* Ẩn đi */
  transition: all 0.1s ease-in-out;
}
.qopt input[type="radio"]:checked:after {
  background: #3b82f6;
  transform: translate(-50%, -50%) scale(1); /* Hiện ra */
}
.qopt:hover input[type="radio"] {
  border-color: #9ca3af;
}

/* --- 6. THANH ĐIỀU HƯỚNG BÊN PHẢI (Q-RIGHT) --- */
.qmn-col.q-right {
  /* Cho thanh nav dính lại */
  position: sticky;
  top: calc(var(--qmn-offset, 0px) + 70px); /* 70px = chiều cao tab */
  align-self: start;
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e5e7eb;
}
.q-right .nav-part > div {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #f3f4f6;
}

/* Nút số câu (circular) */
.q-right .qnum {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-weight: 600;
  transition: all 0.2s ease;
}
.q-right .qnum:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

/* Trạng thái: Đã trả lời */
.q-right .qnum.answered {
  background: #def7ec; /* Xanh lá nhạt */
  border-color: #10b981;
  color: #065f46; /* Xanh lá đậm */
}

/* Trạng thái: Đã đánh dấu */
.q-right .qnum.flagged {
  background: #fef3c7; /* Vàng nhạt */
  border-color: #f59e0b;
  color: #92400e; /* Nâu đậm */
  box-shadow: none; /* Bỏ shadow cũ */
}
.q-right .qnum.flagged::after {
  /* Tùy chỉnh lại cờ */
  color: #d97706;
  top: -4px;
  right: -4px;
  background: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  text-align: center;
  font-size: 10px;
  border: 1px solid #fde68a;
}

/* --- 7. NÚT HÀNH ĐỘNG (SUBMIT/RESET) --- */
.qmn-actions {
  padding: 16px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  margin-top: 24px;
  border-radius: 0 0 12px 12px; /* Bo góc dưới */
}

/* Nút Nộp bài (Chính) */
#qmn-submit {
  background: #3b82f6;
  color: #ffffff;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  /* Đổ bóng nhẹ cho nút chính */
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
}
#qmn-submit:hover {
  background: #2563eb;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

/* Nút Làm lại (Phụ) */
#qmn-reset {
  background: #ffffff;
  color: #374151;
  font-weight: 600;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}
#qmn-reset:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}
