/* --- 1. GIAO DIỆN CHUNG (PC & LAPTOP) --- */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(to right, #f0f2f5, #c8e6c9);
  padding: 40px 20px;
  margin: 0;
  display: flex;
  justify-content: center;
}

.container {
  max-width: 800px;
  width: 100%;
  margin: 20px auto;
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

/* Logo thương hiệu */
.site-logo {
  position: fixed;
  top: 12px;
  left: 16px;
  font-size: 18px;
  font-weight: bold;
  color: #00c6ff;
  text-decoration: none;
  z-index: 999;
  font-family: monospace;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 6px 12px;
  border-radius: 8px;
  box-shadow: 0 0 5px #00c6ff;
  transition: 0.3s ease;
  max-width: 40vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-logo:hover {
  color: #e52e71;
  box-shadow: 0 0 10px #e52e71;
}

h2 {
  text-align: center;
  margin-bottom: 24px;
  color: #0585a2;
  font-size: 22px;
}

/* --- 2. VÙNG HIỂN THỊ CÂU HỎI & ĐÁP ÁN --- */
.question {
  animation: none! important;
  margin-bottom: 20px;
}

.question p.question-text {
  margin-bottom: 16px;
  line-height: 1.6;
  font-weight: 600;
  font-size: 16px;
  color: #2c3e50;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.option-btn {
  display: flex;
  align-items: center;
  text-align: left;
  width: 100%;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #333333;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
  position: relative;
  padding: 12px 15px 12px 48px;
  min-height: 50px;
  margin-bottom: 4px;
}

.option-btn::before {
  content: attr(data-label);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #0288d1;
  color: #0288d1;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #0288d1;
}

/* Trạng thái đúng / sai */
.correct {
  background-color: #4caf50 !important;
  border-color: #4caf50 !important;
  color: white !important;
}

.correct::before {
  border-color: #fff !important;
  color: #4caf50 !important;
}

.incorrect {
  background-color: #e53935 !important;
  border-color: #e53935 !important;
  color: white !important;
}

.incorrect::before {
  border-color: #fff !important;
  color: #e53935 !important;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

/* --- 3. ĐIỀU HƯỚNG VÀ PHÍM CHỨC NĂNG --- */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.nav-buttons button {
  width: 48%;
  font-weight: bold;
  background-color: #025079;
  color: white;
  transition: background 0.3s;
  border-radius: 8px;
  font-size: 16px;
  padding: 12px 16px;
  border: none;
  cursor: pointer;
}

.nav-buttons button:hover:not(:disabled) {
  background-color: #0288d1;
}

.control-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 15px 0;
  flex-wrap: wrap;
}

.control-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 15px;
  min-width: 110px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.12);
  transition: all 0.2s ease;
}

#toc-toggle { background: #0288d1; color: white; }
#toc-toggle:hover { background: #0277bd; }

.shuffle-btn { background: #546e7a; color: white; }
.shuffle-btn:hover { background: #455a64; }

/* --- 4. MỤC LỤC (TOC) & TRẠNG THÁI --- */
#toc {
  max-height: 200px;
  overflow-y: auto;
  padding: 5px;
}

#toc button {
  font-weight: bold;
  transition: all 0.2s ease;
}

/* Viền vàng nổi bật cho câu đã Bookmark */
.toc-bookmarked {
  border: 3px solid #ffeb3b !important;
  box-shadow: 0 0 8px rgba(255, 235, 59, 0.8) !important;
}

/* Khung xanh dương bao quanh câu hiện tại */
.toc-current {
  outline: 3px solid #0288d1 !important;
  outline-offset: 2px;
  transform: scale(1.05);
}

/* Box thống kê thông tin bài làm */
#status-box {
  background: linear-gradient(180deg, #ffffff, #f7fff7);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  margin: 20px auto 0 auto;
  max-width: 500px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.status-label { font-weight: 600; color: #555; }
.status-value { font-weight: 700; color: #0288d1; }

/* --- 5. BẢNG ĐIỂM KẾT QUẢ CUỐI BÀI --- */
.result-card {
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  margin: 20px 0;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

.result-card h3 {
  color: #0585a2;
  margin-bottom: 15px;
  font-size: 22px;
}

.result-info {
  font-size: 16px;
  margin: 8px 0;
  color: #333;
}

.result-score {
  font-size: 32px;
  font-weight: bold;
  color: #e53935;
  margin: 15px 0;
}

/* --- 6. HỖ TRỢ ĐỒ HỌA/HÌNH ẢNH --- */
.question-image-container {
  text-align: center;
  margin: 15px 0;
}

.question-image-container img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: zoom-in;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* --- 7. TỐI ƯU CỰC ĐẠI CHO THIẾT BỊ DI ĐỘNG (MOBILE) --- */
@media (max-width: 600px) {
  body {
    padding: 10px;
  }

  .site-logo {
    font-size: 14px;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    max-width: 70vw;
  }

  /* Ép box câu hỏi rộng tối đa, loại bỏ khoảng hụt lề */
  .container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 10px 0 !important;
    padding: 16px 12px !important;
    border-radius: 8px;
  }

  h2 {
    font-size: 18px;
    margin-bottom: 16px;
    padding-top: 35px; /* Tránh đè chữ vào site-logo cố định */
  }

  .question p.question-text {
    font-size: 15px;
    line-height: 1.5;
  }

  /* Nút chọn đáp án to, rộng rãi, dễ click chính xác trên cảm ứng */
  .option-btn {
    padding: 12px 12px 12px 42px !important;
    font-size: 15px !important;
    border-radius: 6px;
  }

  .option-btn::before {
    left: 10px;
    width: 24px;
    height: 24px;
    font-size: 13px;
  }

  .nav-buttons button {
    padding: 10px 12px;
    font-size: 15px;
  }

  .control-btn {
    padding: 8px 14px;
    font-size: 14px;
    min-width: 95px;
  }

  #status-box {
    padding: 10px;
  }
  
  .status-row {
    font-size: 14px;
  }
}

/* Hiệu ứng chuyển động mượt */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
