/* ========================================== */
/* ===== STRICT EXAM LAYOUT (v2.5) ========= */
/* ========================================== */

body {
  overflow: hidden;
  /* Prevent body scroll */
}

.exam-container {
  padding: 1rem;
  max-width: 100%;
  margin: 0;
  height: 100vh;
  box-sizing: border-box;
  overflow: hidden;
}

.strict-layout-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
  align-items: start;
  height: 100%;
  overflow: hidden;
}

/* === LEFT COLUMN === */
.layout-left-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  overflow: hidden;
}

.box-header-title {
  background-color: var(--color-primary);
  /* Custom Blue from Mockup Implication */
  color: white;
  padding: 12px 20px;
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 1.1rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.box-header-title h1 {
  margin: 0;
  font-size: inherit;
}

.box-content {
  background-color: #fff;
  border: 2px solid var(--color-primary);
  border-radius: 20px;
  padding: 2rem;
  /* min-height removed to allow flex shrinking if needed, but flex: 1 handles fill */
  position: relative;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.box-constants {
  background-color: var(--color-primary);
  color: white;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.box-constants h4 {
  margin: 0 0 5px 0;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 5px;
}

.box-navigation {
  background: white;
  border: 2px solid var(--color-primary);
  padding: 10px;
  border-radius: 4px;
  flex-shrink: 0;
  max-height: 30vh;
  overflow-y: auto;
}

/* === RIGHT COLUMN === */
/* === RIGHT COLUMN === */
.layout-right-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  overflow-y: auto;
  padding-right: 5px;
}

.box-timer {
  background-color: var(--color-primary);
  color: white;
  padding: 12px;
  text-align: center;
  font-weight: 700;
  font-size: 1.2rem;
  border-radius: 4px;
}

.sidebar-box {
  background-color: var(--color-primary);
  color: white;
  padding: 15px;
  border-radius: 4px;
}

.sidebar-box h4 {
  margin: 0 0 10px 0;
  text-align: center;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 5px;
}

.sidebar-box p {
  margin: 5px 0;
  font-size: 0.9rem;
}

.status-pending {
  color: #ffc107;
  font-weight: bold;
}

.status-ok {
  color: #4cd964;
  font-weight: bold;
}

.box-submit-btn {
  background-color: var(--color-primary);
  color: white;
  border: none;
  padding: 15px;
  font-weight: 700;
  font-size: 1.1rem;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.box-submit-btn:hover {
  background-color: #0b5170;
}

.box-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-btn {
  padding: 12px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: white;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.control-btn.prev {
  background-color: var(--color-primary);
}

.control-btn.next {
  background-color: var(--color-primary);
}

.control-btn:hover {
  background-color: #0b5170;
}

/* Navigation Grid - Cards Layout */
#question-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.nav-part-box {
  border: 2px solid var(--color-primary);
  border-radius: 4px;
  overflow: hidden;
  /* For header radius */
  background: white;
  display: flex;
  flex-direction: column;
}

.nav-part-header {
  background-color: var(--color-primary);
  color: white;
  padding: 8px 12px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
  text-align: center;
}

.nav-part-body {
  padding: 10px;
  flex: 1;
}

.nav-part-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: start;
}

.nav-button {
  min-width: 32px;
  height: 32px;
  border: 1px solid #007bff;
  /* Blue Border */
  background: white;
  color: #007bff;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.nav-button:hover {
  background: #e7f1ff;
}

.nav-button.active {
  background: #007bff;
  /* Blue Background */
  color: white;
}

.sidebar-logo {
  margin-top: auto;
  /* Push to bottom if flex container allows, or just margin */
  padding: 1rem 0;
  display: flex;
  justify-content: center;
}

.sidebar-logo img {
  max-width: 180px;
  height: auto;
  opacity: 0.9;
}

/* HIDE SCROLLBARS BUT KEEP FUNCTIONALITY */
.box-content::-webkit-scrollbar,
.box-navigation::-webkit-scrollbar,
.layout-right-col::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Opera */
}

.box-content,
.box-navigation,
.layout-right-col {
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .strict-layout-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .layout-right-col {
    order: -1;
    /* Move Timer/Status to top on mobile? Or keep bottom? */
    /* Usually users want timer visible. */
    /* Let's keep separate order logic if needed. */
  }

  .box-content {
    min-height: auto;
  }
}

/* ========================================== */
/* ===== LEGACY STYLES (kept for compat) === */
/* ========================================== */

.test-content {
  align-items: center;
  justify-content: center;
  background-color: var(--color-background);
  max-width: 1000px;
  margin: 2rem;
  padding: 5rem;
  position: relative;
  /* Thêm dòng này */
  z-index: 1;
  /* Thêm dòng này */
}

.test-title-display h1 {
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 2.5rem;
  color: var(--color-text-primary);
}




/* --- PHẦN HEADER (TIÊU ĐỀ VÀ ĐỒNG HỒ) --- */
.test-header {
  background-color: var(--color-surface);
  padding: 1.5rem;
  border-radius: var(--border-radius-soft);
  box-shadow: var(--shadow-subtle);
  margin-bottom: 0;
  /* Bỏ margin-bottom, sẽ dùng gap của flexbox để thay thế */
  display: flex;
  flex-direction: column;
  /* Xếp dọc các phần tử */
  align-items: center;
  border: 1px solid var(--color-border);
}

.test-header h1 {
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 1.5rem;
  color: var(--color-text-primary);
}



#test-title-display {
  margin: 0;
  font-size: 1.5rem;
  color: inherit;
  /* Inherit white from parent .box-header-title */
}

.part-info {
  color: rgba(255, 255, 255, 0.8);
  margin-top: 0.25rem;
}

.timer-container {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

/* OPTIMIZED CONTROL BUTTONS */
.box-controls {
  display: flex;
  gap: 10px;
  width: 100%;
}

.control-btn {
  flex: 1;
  /* Make buttons verify width equal */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 12px;
  font-size: 1rem;
}


#timer {
  color: #e74c3c;
  background-color: #ffffff;
  padding: 10px 0;
  border-radius: 8px;
  min-width: 140px;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  display: block;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin: 0 auto;
}

/* --- KHUNG CÂU HỎI --- */
#questions-render-container .question-block {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-soft);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

#questions-render-container h4 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

#questions-render-container .mcq-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#questions-render-container .mcq-option input[type="radio"] {
  width: 1.2em;
  height: 1.2em;
}

#questions-render-container .mcq-options-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#questions-render-container .short-answer-text {
  width: 100%;
  padding: 0.75rem;
}


/* --- CÁC LỰA CHỌN CÂU TRẢ LỜI --- */

/* Trắc nghiệm ABCD */
.mcq-options-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mcq-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mcq-option input[type="radio"] {
  width: 1.2em;
  height: 1.2em;
}

/* Đúng/Sai */
.true-false-options-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.true-false-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--color-surface-soft);
}

.true-false-option:first-child {
  border-top: none;
}

.true-false-radios {
  display: flex;
  gap: 1rem;
}

/* Trả lời ngắn */
.short-answer-text {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-hard);
  font-size: 1rem;
}

/* NÚT NỘP BÀI */
.submit-test-btn {
  margin-top: 1.5rem;
  /* Giảm khoảng cách trên */
  width: 100%;
  padding: 12px;
  font-size: 1.1rem;
  background-color: var(--color-danger);
  /* Đổi màu để nổi bật */
}

.submit-test-btn:hover {
  background-color: var(--color-danger-dark);
}

.test-taking-layout {
  display: grid;
  grid-template-columns: 1fr;
  /* Mặc định 1 cột */
  gap: 2rem;
  align-items: flex-start;
}

/* Áp dụng layout 2 cột cho màn hình lớn */
@media (min-width: 1024px) {
  .test-taking-layout {
    grid-template-columns: 3fr 1fr;
    gap: 3rem;
  }

  .test-content .test-controls-card {
    display: none;
  }
}

.test-navigation-panel {
  position: sticky;
  top: 200px;
  /* Giữ nó đứng yên khi cuộn */
  background: var(--color-surface);
  display: flex;
  /* Thêm flexbox */
  flex-direction: column;
  /* Xếp các phần tử con theo chiều dọc */
  gap: 1rem;
  /* Khoảng cách giữa các phần tử con */
  padding: 1rem;
  border-radius: var(--border-radius-soft);
}

#question-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  /* 5 nút trên một hàng */
  gap: 10px;
  margin: 1rem 0;
}

.nav-question-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  background: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.nav-question-btn.answered {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  font-weight: 600;
  transform: scale(1.1);
  transition: transform 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  position: relative;
  /* Thêm dòng này */
}


/* --- THÔNG BÁO LƯU BÀI --- */
.save-status {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 8px 16px;
  border-radius: 5px;
  font-size: 0.9rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s;
  z-index: 2000;
}

.save-status.visible {
  opacity: 1;
  visibility: visible;
}

/* --- MODAL CẢNH BÁO GIAN LẬN --- */
.warning-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.warning-modal.visible {
  opacity: 1;
  visibility: visible;
}

.warning-modal-content {
  background-color: var(--color-surface);
  padding: 2rem;
  border-radius: var(--border-radius-soft);
  width: 90%;
  max-width: 450px;
  text-align: center;
  box-shadow: var(--shadow-large);
}

.warning-icon {
  font-size: 3rem;
  color: var(--color-danger);
  margin-bottom: 1rem;
}

.warning-modal-content h2 {
  margin-top: 0;
  color: var(--color-danger);
}

.warning-subtext {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.warning-modal-actions {
  display: flex;
  justify-content: flex-end;
}

/* --- CSS RESPONSIVE CHO ĐIỆN THOẠI --- */

@media (max-width: 768px) {
  .test-content {
    margin: 0;
    padding: 0.5rem 0.5rem 1.5rem 0.5rem;
    border-radius: 0;
    box-shadow: none;
  }

  .test-taking-layout {
    flex-direction: column !important;
    display: flex !important;
    gap: 1.2rem;
    margin-top: 3.5rem;
    padding: 0;
  }

  .test-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 1rem 0.5rem;
    border-radius: 0;
    box-shadow: none;
  }

  .test-header h1,
  #test-title-display {
    font-size: 1.1rem;
    text-align: left;
    padding: 0;
  }

  .test-title-display {
    margin-bottom: 0.5rem;
    text-align: left;
    align-items: flex-start;
  }

  .test-navigation-panel {
    order: -1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 0.5rem 0.5rem 1rem 0.5rem;
    border-radius: 0;
    box-shadow: none;
    position: static;
    margin-bottom: 1rem;
  }

  #question-nav-grid {
    gap: 6px;
    margin: 0.5rem 0 0.5rem 0;
    justify-content: flex-start;
  }

  .nav-button {
    min-width: 36px;
    min-height: 36px;
    font-size: 1rem;
    padding: 0 8px;
    border-radius: 6px;
  }

  .submit-test-btn {
    padding: 12px 0;
    font-size: 1.05rem;
    border-radius: 6px;
    margin: 18px 0 0 0;
  }

  .navigation-buttons {
    gap: 6px;
    margin: 12px 0 8px 0;
    flex-wrap: wrap;
  }

  #prev-btn,
  #next-btn {
    font-size: 1rem;
    padding: 8px 12px;
    border-radius: 6px;
    min-width: 90px;
  }

  .question-block {
    padding: 0.7rem 0.2rem;
    margin-bottom: 1rem;
  }

  .question-block h4 {
    font-size: 1rem;
    margin-bottom: 0.7rem;
  }

  .short-answer-text {
    font-size: 1rem;
    padding: 0.6rem;
  }

  .mcq-option,
  .true-false-option {
    gap: 0.5rem;
    font-size: 1rem;
    padding: 0.5rem 0;
  }

  .mcq-option input[type="radio"],
  .true-false-radios input[type="radio"] {
    width: 1.1em;
    height: 1.1em;
  }

  .save-status {
    right: 10px;
    bottom: 10px;
    font-size: 0.95rem;
    padding: 6px 10px;
  }

  .warning-modal-content {
    padding: 1rem 0.5rem;
    max-width: 98vw;
  }

  .instruction-box {
    padding: 1rem 0.5rem;
    max-width: 98vw;
  }
}

@media (max-width: 600px) {
  .test-taking-layout {
    display: block !important;
    gap: 0 !important;
    padding: 0 !important;
  }

  .test-content,
  .test-navigation-panel {
    max-width: 100vw !important;
    width: 100vw !important;
    padding: 8px 2px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .test-header,
  .test-header h1,
  #test-title-display {
    font-size: 1rem !important;
    padding: 0.5rem 0.25rem !important;
  }

  .timer-container,
  #timer {
    font-size: 1rem !important;
    padding: 0.25rem 0.5rem !important;
    min-width: 40px !important;
  }

  #questions-render-container .question-block {
    padding: 0.75rem 0.25rem !important;
    margin-bottom: 0.75rem !important;
    font-size: 0.95rem !important;
  }

  .navigation-buttons {
    flex-direction: column !important;
    gap: 6px !important;
    margin: 10px 0 !important;
  }

  .navigation-buttons button,
  .submit-test-btn {
    width: 100% !important;
    font-size: 1rem !important;
    padding: 10px 0 !important;
    margin: 0 !important;
  }

  #question-nav-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    margin: 0.5rem 0 !important;
  }

  .nav-question-btn,
  .nav-button {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.95rem !important;
    padding: 0 !important;
  }

  .test-navigation-panel {
    position: static !important;
    padding: 8px 2px !important;
    margin-top: 1rem !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .warning-modal-content {
    padding: 1rem 0.5rem !important;
    max-width: 98vw !important;
    font-size: 0.95rem !important;
  }

  .instruction-box {
    padding: 0.5rem 0.25rem !important;
    font-size: 0.95rem !important;
    border-radius: 8px !important;
  }

  .agreement-box label {
    font-size: 0.95rem !important;
  }
}

/* --- FIX: Đáp án A B C D không bị xuống dòng trên mobile --- */
.mcq-options-container,
.true-false-options-container {
  flex-direction: column;
}

@media (max-width: 900px) {

  .mcq-options-container,
  .true-false-options-container {
    flex-direction: column !important;
  }

  .mcq-option {
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    flex-wrap: nowrap !important;
    white-space: normal !important;
  }

  .mcq-option label {
    display: inline !important;
    white-space: normal !important;
    word-break: break-word !important;
    flex: 1 1 0 !important;
  }
}

/* Đảm bảo đáp án nằm trên 1 dòng nếu đủ chỗ, chỉ xuống dòng khi quá dài */
.mcq-option {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: nowrap;
  white-space: normal;
}

.mcq-option label,
.true-false-option label {
  display: inline;
  white-space: normal;
  word-break: break-word;
  flex: 1 1 0;
}

/* --- ĐẢM BẢO ĐÁP ÁN A. [nội dung] LUÔN CÙNG DÒNG --- */
.mcq-option label,
.true-false-option label {
  display: flex !important;
  align-items: center !important;
  gap: 0.5em !important;
  white-space: normal !important;
  word-break: break-word !important;
  flex: 1 1 0 !important;
  line-height: 1.5 !important;
}

.mcq-option label .option-label,
.true-false-option label .option-label {
  display: inline-block;
  min-width: 2.2em;
  font-weight: 600;
  margin-right: 0.3em;
  flex-shrink: 0;
  text-align: left;
  line-height: 1.5 !important;
}

.mcq-option label span,
.true-false-option label span {
  display: inline-block;
  white-space: normal;
  word-break: break-word;
  flex: 1 1 0;
  line-height: 1.5 !important;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: #f4f6f9;
  color: #333;
  margin: 0;
  padding-bottom: 60px;
  position: relative;
  min-height: 100vh;
}

/* MỚI: Background Logo mờ 20% */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: none;
  /* Asset 13.png removed */
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* Hoặc cover tùy ý user, contain để thấy rõ logo */
  opacity: 0.2;
  z-index: -10;
  pointer-events: none;
}

.test-container {
  display: grid;
  grid-template-columns: 1fr;
  /* Mặc định 1 cột cho mobile */
  gap: 2rem;
  padding: 1rem;
  max-width: 1200px;
  margin: 2rem auto;
}

/* Bố cục 2 cột cho màn hình lớn hơn */
@media (min-width: 1024px) {
  .test-container {
    grid-template-columns: 2fr 1fr;
  }
}

#question-panel,
#nav-panel {
  background-color: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.sticky-panel {
  position: sticky;
  top: 2rem;
}

.test-title {
  font-size: 1.8rem;
  font-weight: 700;
}

.part-info {
  color: #6c757d;
  margin-top: 0.25rem;
}

.question-content {
  min-height: 200px;
  margin-top: 1.5rem;
}

.navigation-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.timer-box {
  text-align: center;
  margin-bottom: 1rem;
}

.nav-title {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
}

.timer-display {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

#question-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
  gap: 10px;
  margin-bottom: 1.5rem;
}

.nav-button {
  width: 40px;
  height: 40px;
  border: 1px solid #dee2e6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-button:hover {
  background-color: #f1f3f5;
}

/* --- IMAGE ZOOM CONTROLS --- */
.image-zoom-wrapper {
  position: relative;
  display: inline-block;
  margin: 10px 0;
  max-width: 100%;
}

.image-zoom-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  padding: 4px;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 10;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s;
}

.image-zoom-wrapper:hover .image-zoom-toolbar,
.image-zoom-toolbar:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.98);
}

.btn-img-zoom {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  color: #4b5563;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.btn-img-zoom:hover {
  background: #f3f4f6;
  color: #111827;
}

.image-scroll-container {
  overflow: auto;
  max-height: 600px;
  text-align: center;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  width: 100%;
  border-radius: 8px;
}

.image-scroll-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.image-scroll-container::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}

.image-scroll-container img {
  border-radius: 8px;
  transition: width 0.2s ease-out;
  display: block;
  margin: 0 auto;
}

/* Ensure images inside questions fit well by default */
.question-block img:not(.image-scroll-container img) {
  max-width: 100%;
}

.nav-button.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.nav-button.answered {
  background-color: #e9ecef;
  border-color: #ced4da;
}

/* Add to your test-taking.css file */

.question-block {
  display: none;
  /* Ẩn tất cả các câu hỏi theo mặc định */
}

.question-block.active {
  display: block;
  /* Chỉ hiển thị câu hỏi có lớp 'active' */
}

.navigation-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  /* Điều chỉnh lại margin */
}

#question-counter-display {
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* Hide button when not needed */
.hidden {
  display: none;
}

.question-review-block.is-manually-graded-correct {
  border-left-color: #28a745;
  /* Màu xanh lá cây */
  background-color: #e6f7eb;
}

.test-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(26, 36, 51, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.test-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.instruction-box {
  background-color: var(--color-surface);
  border-radius: var(--border-radius-soft);
  max-width: 650px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.instruction-header {
  background-color: var(--color-danger);
  color: white;
  padding: 1.5rem;
  text-align: center;
}

.warning-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.instruction-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.instruction-body {
  padding: 1.5rem;
}

.instruction-body p {
  text-align: center;
  color: var(--color-text-secondary);
  margin-top: 0;
}

.instruction-body ul {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
}

.instruction-body li {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.instruction-body li i {
  color: var(--color-primary);
  font-size: 1.2rem;
  margin-top: 5px;
  width: 25px;
  text-align: center;
}

.instruction-body li div strong {
  display: block;
  font-weight: 600;
  color: var(--color-text-primary);
}

.instruction-body li div span {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.agreement-box {
  margin-top: 2rem;
  padding: 1rem;
  background-color: var(--color-surface-soft);
  border-radius: var(--border-radius-hard);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.instruction-footer {
  padding: 1.5rem;
  background-color: var(--color-surface-soft);
  text-align: center;
  border-top: 1px solid var(--color-border);
}

.instruction-footer .button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.instruction-footer .button {
  padding: 10px 20px;
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.instruction-footer .button.button-danger {
  background-color: var(--color-danger);
}

.instruction-footer .button.button-danger:hover {
  background-color: var(--color-danger-dark);
}


.instruction-footer .button:hover {
  background-color: var(--color-primary-dark);
}

/* Add to your test-taking.css file */

/* --- CSS MỚI CHO VIỆC HIỂN THỊ ẢNH/BẢNG TRONG BÀI THI --- */
.question-prompt-render img,
.question-prompt-render table {
  max-width: 100%;
  height: auto;
  margin: 15px 0;
  display: block;
  border-radius: 5px;
}

/* --- Giao diện overlay hướng dẫn/quy định --- */
#instructions-overlay.test-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.instruction-box {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  max-width: 480px;
  width: 95%;
  padding: 32px 28px 24px 28px;
  text-align: left;
  animation: fadeIn 0.3s;
}

.instruction-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.instruction-header i {
  font-size: 2.2rem;
  color: #f39c12;
}

.instruction-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #00468c;
  margin: 0;
}

.instruction-body ul {
  list-style: none;
  padding: 0;
  margin: 0 0 18px 0;
}

.instruction-body li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.instruction-body li i {
  font-size: 1.3rem;
  color: #3498db;
  margin-top: 2px;
}

.instruction-body strong {
  color: #00468c;
  font-weight: 700;
}

.instruction-body span {
  color: #555;
  font-size: 0.98rem;
}

.agreement-box {
  margin: 18px 0 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.agreement-box label {
  font-size: 1rem;
  color: #222;
  cursor: pointer;
}

.instruction-footer {
  margin-top: 18px;
  text-align: right;
}

#start-test-btn {
  background: linear-gradient(90deg, #007bff 0%, #00c6ff 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.08);
  transition: background 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

#start-test-btn:disabled {
  background: #bdbdbd;
  color: #fff;
  cursor: not-allowed;
}

#start-test-btn:not(:disabled):hover {
  background: linear-gradient(90deg, #0056b3 0%, #007bff 100%);
}

/* --- Giao diện layout làm bài --- */
.test-taking-layout {
  display: grid;
  /* Chuyển về grid để nhất quán với các quy tắc responsive */
  gap: 2rem;
  margin: 5rem 0;
  /* Tăng khoảng cách với header để không bị che */
  align-items: flex-start;
}

.test-content {
  flex: 2;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  padding: 32px 24px;
  min-width: 0;
}

.test-navigation-panel {
  flex: 1;
  position: sticky;
  /* Thêm lại thuộc tính sticky */
  top: 100px;
  /* Khoảng cách từ top, đảm bảo không bị header che */
  background: #f7fafd;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  padding: 1.5rem;
  min-width: 300px;
  border: 1px solid var(--color-border);
  /* Bỏ max-width để cột có thể rộng hơn */
}

.test-header h1 {
  font-size: 1.3rem;
  font-weight: 1000;
  color: #00468c;
  margin: 0 0 8px 0;
  text-align: center;
  /* Căn giữa tiêu đề */
}

.timer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  /* --- MỚI: Thêm hiệu ứng đường chạy --- */
  position: relative;
  /* Cần thiết để định vị pseudo-element */
  border-radius: 10px;
  /* Bo góc cho container */
  overflow: hidden;
  /* Ẩn phần thừa của animation */
  /* SỬA LỖI: Chuyển nền sang ::before để che gradient */
  background-color: rgba(255, 255, 255, 0.5);
  /* Hiệu ứng kính mờ */
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 0.5rem 1rem;
  z-index: 1;
}

/* Lớp giả để tạo và điều khiển animation */
.timer-container::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150%;
  /* Lớn hơn container để có thể xoay */
  height: 150%;
  background: conic-gradient(transparent, #e74c3c, transparent 30%);
  animation: rotate-border 4s linear infinite;
  z-index: -2;
  /* Nằm dưới cùng */
}

/* --- MỚI: Thêm lớp nền đục để che gradient --- */
.timer-container::after {
  content: '';
  position: absolute;
  inset: 2px;
  /* Cách viền 2px để tạo hiệu ứng border */
  background-color: var(--color-surface);
  border-radius: 8px;
  /* Bo góc nhỏ hơn một chút */
  z-index: -1;
  /* Nằm giữa gradient và nội dung */
}

/* --- MỚI: Style cho card chứa các nút điều khiển --- */
.test-controls-card {
  background-color: var(--color-surface-soft);
  border-radius: var(--border-radius-soft);
  padding: 0.5rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid var(--color-border);
  margin-top: auto;
}

.test-controls-card .submit-test-btn {
  margin-top: 0.5rem;
}

@keyframes rotate-border {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

#timer {
  font-weight: 700;
  font-size: 1.2rem;
  color: #e74c3c;
  /* Giữ nguyên màu chữ cho đồng hồ */
}

.navigation-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* SỬA LỖI: Dàn đều các phần tử */
  gap: 1rem;
  /* Điều chỉnh khoảng cách */
  margin: 32px 0 18px 0;
}

#prev-btn,
#next-btn {
  background: #f0f4fa;
  color: #00468c;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

#prev-btn:disabled,
#next-btn:disabled {
  background: #ececec;
  color: #aaa;
  cursor: not-allowed;
}

#prev-btn:not(:disabled):hover,
#next-btn:not(:disabled):hover {
  background: #d0e6ff;
}

#question-counter-display {
  font-size: 1.1rem;
  font-weight: 600;
  color: #007bff;
}

.submit-test-btn {
  background: linear-gradient(90deg, #00c6ff 0%, #007bff 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-weight: 700;
  font-size: 1.1rem;
  margin: 24px auto 0 auto;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.08);
  transition: background 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.submit-test-btn:hover {
  background: linear-gradient(90deg, #0056b3 0%, #007bff 100%);
}

#question-nav-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.nav-button {
  background: #fff;
  border: 1.5px solid #007bff;
  color: #007bff;
  border-radius: 6px;
  padding: 7px 14px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.nav-button.active,
.nav-button.answered {
  background: #007bff;
  color: #fff;
}

.nav-button:hover:not(.active):not(.answered) {
  background: #eaf6ff;
}

@media (max-width: 900px) {
  .test-taking-layout {
    flex-direction: column;
    gap: 18px;
  }

  .test-content,
  .test-navigation-panel {
    max-width: 100%;
    width: 100%;
    padding: 16px 6px;
  }

  .test-header h1 {
    font-size: 1.1rem;
  }

  .navigation-buttons {
    gap: 8px;
    margin: 18px 0 10px 0;
  }

  .submit-test-btn {
    padding: 10px 10px;
    font-size: 1rem;
  }
}

/* --- MOBILE OPTIMIZATION FOR TEST-TAKING PAGE (ENHANCED) --- */
@media (max-width: 600px) {
  .test-taking-layout {
    display: block !important;
    gap: 0 !important;
    padding: 0 !important;
  }

  .test-content,
  .test-navigation-panel {
    max-width: 100vw !important;
    width: 100vw !important;
    padding: 8px 2px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .test-header,
  .test-header h1,
  #test-title-display {
    font-size: 1rem !important;
    padding: 0.5rem 0.25rem !important;
  }

  .timer-container,
  #timer {
    font-size: 1rem !important;
    padding: 0.25rem 0.5rem !important;
    min-width: 40px !important;
  }

  #questions-render-container .question-block {
    padding: 0.75rem 0.25rem !important;
    margin-bottom: 0.75rem !important;
    font-size: 0.95rem !important;
  }

  .navigation-buttons {
    flex-direction: column !important;
    gap: 6px !important;
    margin: 10px 0 !important;
  }

  .navigation-buttons button,
  .submit-test-btn {
    width: 100% !important;
    font-size: 1rem !important;
    padding: 10px 0 !important;
    margin: 0 !important;
  }

  #question-nav-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    margin: 0.5rem 0 !important;
  }

  .nav-question-btn,
  .nav-button {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.95rem !important;
    padding: 0 !important;
  }

  .test-navigation-panel {
    position: static !important;
    padding: 8px 2px !important;
    margin-top: 1rem !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .warning-modal-content {
    padding: 1rem 0.5rem !important;
    max-width: 98vw !important;
    font-size: 0.95rem !important;
  }

  .instruction-box {
    padding: 0.5rem 0.25rem !important;
    font-size: 0.95rem !important;
    border-radius: 8px !important;
  }

  .agreement-box label {
    font-size: 0.95rem !important;
  }
}

/* --- OMR GRID STYLES (NEW PART 3) --- */
.omr-grid-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 300px;
  margin-top: 10px;
  user-select: none;
  /* Prevent text selection */
}

.omr-box-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

/* File item styles */
.file-item {
  margin-top: 5px;
  padding: 5px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  /* Cho dropdown hoặc absolute positioning nếu cần */
}

.btn-delete-file {
  margin-left: auto;
  /* Đẩy sang phải cùng */
  color: #dc3545;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 50%;
  transition: background 0.2s;
}

.btn-delete-file:hover {
  background: #ffe6e6;
}


.file-item a {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
}

.file-item a:hover {
  text-decoration: underline;
}

.file-item i {
  font-size: 0.9em;
}

/* OMR Grid colors */
.omr-char-input {
  width: 45px;
  height: 45px;
  border: 1px solid #333;
  /* Standard border color */
  text-align: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: #000;
  outline: none;
  background-color: white;
  border-radius: 4px;
}

.omr-char-input:focus {
  background-color: #f8f9fa;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  border-color: #000;
}

.omr-bubble-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.omr-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 45px;
  /* Match input width */
}

.omr-bubble {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #ccc;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  background-color: white;
}

.omr-bubble:hover {
  background-color: #f0f0f0;
  border-color: #999;
}

.omr-bubble.invisible {
  visibility: hidden;
  pointer-events: none;
}

.omr-bubble.active {
  background-color: #333;
  color: white;
  font-weight: bold;
  border-color: #333;
}

/* --- TRUE/FALSE QUESTION STYLES (PART 2) --- */
.true-false-options-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 15px;
}

.true-false-option {
  display: flex;
  align-items: flex-start;
  /* Align top in case of long text */
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  gap: 20px;
}

.true-false-option:last-child {
  border-bottom: none;
}

.true-false-option span {
  flex: 1;
  /* Take remaining space */
  font-size: 1rem;
  line-height: 1.5;
  color: #333;
}

.true-false-radios {
  display: flex;
  align-items: center;
  gap: 15px;
  white-space: nowrap;
  /* Prevent radio buttons from wrapping */
  min-width: fit-content;
  /* Ensure container fits content */
  justify-content: flex-end;
  flex-shrink: 0;
  /* Prevent container from shrinking */
}

.true-false-radios input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-right: 5px;
  cursor: pointer;
  border: 1px solid #333;
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
}

.true-false-radios input[type="radio"]:checked {
  background-color: #00468c;
  border-color: #00468c;
}

.true-false-radios input[type="radio"]:checked::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.true-false-radios label {
  font-weight: 600;
  color: #555;
  cursor: pointer;
  margin-right: 10px;
  white-space: nowrap !important;
  /* Force no wrap */
  display: inline-block;
  /* Ensure block formatting context */
  min-width: 40px;
  /* Ensure enough space for 'Đúng' */
}

.true-false-radios label:last-child {
  margin-right: 0;
}

/* Hover effect for better UX */
.true-false-option:hover {
  background-color: #f9f9f9;
}

/* Mobile responsive for T/F */
@media (max-width: 600px) {
  .true-false-option {
    flex-direction: column;
    /* Stack on mobile if text is too long? Or keep side-by-side but compact? */
    /* Keeping side-by-side is preferred for "sheet" feel, but if text is long, maybe stack. 
       Let's stick to side-by-side but allow wrapping if absolutely needed, but user wanted NO text wrapping issues. */
    align-items: flex-start;
    gap: 10px;
  }

  .true-false-radios {
    width: 100%;
    justify-content: flex-end;
    /* Align to right on mobile too, or space-between? */
    margin-top: 5px;
  }
}

/* Specific styling to match reference image structure */
.omr-bubble[data-val="-"] {
  margin-bottom: 2px;
}

.omr-bubble[data-val=","] {
  margin-bottom: 10px;
}

/* Gap after comma */

/* Mobile responsiveness for OMR */
@media (max-width: 600px) {
  .omr-grid-container {
    max-width: 100%;
    align-items: center;
    /* Center on mobile */
  }

  .omr-box-row,
  .omr-bubble-row {
    justify-content: center;
    gap: 15px;
    /* More space on mobile to tap */
  }

  .omr-char-input {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .omr-col {
    width: 40px;
  }
}

/* --- MỚI: Style cho Modal Xác nhận Nộp bài (Specific Override) --- */
#submit-confirm-modal .instruction-box {
  padding: 0 0 24px 0;
  /* Xóa padding top/left/right để header full width */
  overflow: hidden;
  /* Bo góc header theo box */
  max-width: 400px;
}

#submit-confirm-modal .instruction-header {
  background-color: #12137F;
  /* Xanh đậm */
  color: white;
  padding: 20px;
  margin-bottom: 24px;
  justify-content: center;
  /* Căn giữa nội dung header */
}

#submit-confirm-modal .instruction-header i {
  color: #f39c12;
  /* Vàng cam */
  font-size: 1.8rem;
}

#submit-confirm-modal .instruction-header h2 {
  color: white;
  font-weight: 700;
}

#submit-confirm-modal .instruction-body {
  padding: 0 24px;
  /* Thêm lại padding cho nội dung */
}

#submit-confirm-modal .instruction-body p {
  color: #555;
  font-size: 1rem;
  line-height: 1.5;
}

#submit-confirm-modal .instruction-footer {
  padding: 0 24px;
  justify-content: center;
  /* Căn giữa nút */
  gap: 15px;
}

#cancel-submit-btn {
  background-color: #12137F;
  color: white;
  border: none;
  min-width: 110px;
  padding: 10px 20px;
  font-weight: 600;
  border-radius: 6px;
}

#confirm-submit-btn {
  background-color: #ef5350;
  /* Đỏ tươi giống hình */
  color: white;
  border: none;
  min-width: 110px;
  padding: 10px 20px;
  font-weight: 600;
  border-radius: 6px;
}

#cancel-submit-btn:hover {
  background-color: #273079;
}

#confirm-submit-btn:hover {
  background-color: #d32f2f;
}

/* ========================================== */
/* ===== EXAM GUIDED TOUR ================== */
/* ========================================== */

#exam-tour-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

#exam-tour-overlay.active {
  display: block;
}

/* 4-panel spotlight overlay */
.tour-spotlight-top,
.tour-spotlight-bottom,
.tour-spotlight-left,
.tour-spotlight-right {
  position: fixed;
  background: rgba(10, 20, 40, 0.72);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  z-index: 9999;
}

/* Highlighted element ring */
#exam-tour-overlay.active::after {
  content: '';
  position: fixed;
  top: var(--ring-top, -999px);
  left: var(--ring-left, -999px);
  width: var(--ring-width, 0);
  height: var(--ring-height, 0);
  display: var(--ring-display, block);
  border: 3px solid rgba(26, 115, 232, 0.7);
  border-radius: 10px;
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.15), 0 0 20px rgba(26, 115, 232, 0.2);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  pointer-events: none;
}

/* Tooltip */
.tour-tooltip {
  position: fixed;
  z-index: 10001;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.08);
  width: 380px;
  max-width: calc(100vw - 32px);
  padding: 0;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  overflow: hidden;
}

.tour-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Tooltip header */
.tour-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0 16px;
}

.tour-step-badge {
  background: linear-gradient(135deg, #1a73e8, #00468c);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.tour-skip-btn {
  background: none;
  border: none;
  color: #999;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.tour-skip-btn:hover {
  background: #f0f0f0;
  color: #333;
}

/* Tooltip icon */
.tour-tooltip-icon {
  text-align: center;
  padding: 16px 16px 8px 16px;
}

.tour-tooltip-icon i {
  font-size: 2.2rem;
  color: #1a73e8;
}

/* Tooltip content */
.tour-tooltip-title {
  margin: 0;
  padding: 0 20px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a2433;
  text-align: center;
}

.tour-tooltip-desc {
  margin: 8px 0 0 0;
  padding: 0 20px;
  font-size: 0.9rem;
  color: #5f6368;
  line-height: 1.6;
  text-align: center;
}

/* Tooltip footer */
.tour-tooltip-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px;
  margin-top: 16px;
  background: #f8f9fa;
  border-top: 1px solid #e8eaed;
}

.tour-btn {
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.tour-btn-prev {
  background: #fff;
  color: #5f6368;
  border: 1px solid #dadce0;
}

.tour-btn-prev:hover {
  background: #f0f0f0;
  color: #333;
}

.tour-btn-next {
  background: linear-gradient(135deg, #1a73e8, #1557b0);
  color: white;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.tour-btn-next:hover {
  background: linear-gradient(135deg, #1557b0, #0d47a1);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
}

.tour-btn-next.tour-btn-finish {
  background: linear-gradient(135deg, #0f9d58, #0b8043);
  box-shadow: 0 2px 8px rgba(15, 157, 88, 0.3);
}

.tour-btn-next.tour-btn-finish:hover {
  background: linear-gradient(135deg, #0b8043, #056b36);
}

/* Zoom tip special content inside tooltip */
.tour-zoom-content {
  padding: 0 20px 4px 20px;
}

.tour-zoom-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.tour-zoom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: #f0f4ff;
  border-radius: 8px;
  font-size: 0.82rem;
}

.tour-zoom-row .tour-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  background: linear-gradient(180deg, #fafafa, #e8e8e8);
  border: 1px solid #c4c4c4;
  border-bottom: 2px solid #a0a0a0;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #333;
}

.tour-zoom-row .tour-key-plus {
  color: #888;
  font-weight: 600;
  font-size: 0.8rem;
}

.tour-zoom-row span:last-child {
  margin-left: auto;
  color: #555;
  font-weight: 500;
}

/* Progress bar at bottom of tooltip */
.tour-progress {
  height: 3px;
  background: #e8eaed;
  overflow: hidden;
}

.tour-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1a73e8, #4285f4);
  transition: width 0.4s ease;
}

/* Responsive */
@media (max-width: 600px) {
  .tour-tooltip {
    width: calc(100vw - 24px);
    border-radius: 12px;
  }

  .tour-tooltip-icon i {
    font-size: 1.8rem;
  }

  .tour-tooltip-title {
    font-size: 1rem;
    padding: 0 14px;
  }

  .tour-tooltip-desc {
    font-size: 0.85rem;
    padding: 0 14px;
  }

  .tour-btn {
    padding: 8px 14px;
    font-size: 0.82rem;
  }
}

/* ========================================== */
/* ===== PDF EXAM ROOM (FIXED_FORMAT)  ====== */
/* ========================================== */

/* --- PDF Viewer --- */
.pdf-exam-viewer {
  border: 2px solid var(--color-primary);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: #f8fafc;
}

.pdf-viewer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}

.pdf-viewer-toolbar i {
  margin-right: 6px;
}

.pdf-viewer-controls {
  display: flex;
  gap: 4px;
}

.pdf-viewer-controls button {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.pdf-viewer-controls button:hover {
  background: rgba(255,255,255,0.3);
}

.pdf-viewer-controls a {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  text-decoration: none;
}

.pdf-viewer-controls a:hover {
  background: rgba(255,255,255,0.3);
}

.pdf-canvas-container {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: auto;
  padding: 10px;
  background: #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pdf-page-canvas {
  max-width: 100%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border-radius: 2px;
  background: #fff;
}


.pdf-fullscreen-mode {
  position: fixed !important;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 5000;
  margin: 0 !important;
  border-radius: 0 !important;
}

.pdf-fullscreen-mode .pdf-canvas-container {
  max-height: calc(100vh - 50px);
}

/* --- Answer Sections --- */
.pdf-exam-layout {
  display: flex;
  gap: 20px;
  height: 100%;
  align-items: flex-start;
}

.pdf-exam-left-col {
  flex: 6; /* 60% */
  position: sticky;
  top: 0;
}

.pdf-exam-right-col {
  flex: 4; /* 40% */
}
.pdf-answer-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pdf-section-block {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.pdf-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.pdf-section-header h4 {
  margin: 0;
  font-size: 0.95rem;
  color: #1e293b;
  font-weight: 700;
}

.pdf-section-header h4 i {
  margin-right: 6px;
  opacity: 0.7;
}

.pdf-section-range {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

.pdf-section-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 12px;
}

/* --- Answer Cards (shared) --- */
.pdf-answer-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  transition: all 0.2s ease;
}

.pdf-answer-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pdf-answer-card.answered {
  border-color: #22c55e;
  background: #f0fdf4;
}

.pdf-answer-card.active-card {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.pdf-card-label {
  font-weight: 700;
  font-size: 0.8rem;
  color: #475569;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* --- MCQ Cards --- */
.pdf-mcq-options {
  display: flex;
  gap: 6px;
}

.pdf-mcq-btn {
  flex: 1;
  padding: 8px 0;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pdf-mcq-btn:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: #eff6ff;
}

.pdf-mcq-btn.selected {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border-color: #2563eb;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

/* --- TF Cards --- */
.pdf-tf-card {
  grid-column: span 2;
}

.pdf-tf-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.pdf-tf-sub {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pdf-tf-sub-label {
  font-weight: 700;
  color: #1e40af;
  font-size: 0.85rem;
  min-width: 16px;
}

.pdf-tf-btn {
  width: 34px;
  height: 30px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pdf-tf-btn:hover {
  border-color: #f59e0b;
  color: #f59e0b;
}

.pdf-tf-btn.selected[data-val="Đ"] {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border-color: #16a34a;
}

.pdf-tf-btn.selected[data-val="S"] {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border-color: #dc2626;
}

/* --- Short Answer Cards --- */
.pdf-short-grid {
  display: flex;
  gap: 6px;
  justify-content: flex-start;
}

.pdf-short-char-input {
  width: 38px;
  height: 40px;
  text-align: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1.1rem;
  font-family: 'Roboto Mono', monospace;
  font-weight: 700;
  transition: all 0.2s;
  color: #334155;
  background: #f8fafc;
}

.pdf-short-char-input:focus {
  outline: none;
  border-color: #10b981;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

/* --- Responsive PDF Exam --- */
@media (max-width: 768px) {
  .pdf-section-body {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 6px;
    padding: 8px;
  }

  .pdf-tf-card {
    grid-column: span 1;
  }

  .pdf-tf-grid {
    gap: 8px;
  }

  .pdf-exam-layout {
    flex-direction: column;
  }
  .pdf-exam-left-col {
    position: static;
  }
  .pdf-canvas-container {
    max-height: 40vh;
  }

  .pdf-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}