/* ============================================================
   WDA 官方介面整合 - AI Test Stage 1 + Stage 2
   直接作用於 ai/vscode-workspace 的系統主頁面。
   Stage 1：正式作答第一層外殼。
   Stage 2：正式作答題目骨架；不改題庫/答案/配分/Renderer。
   ============================================================ */

body.wda-stage1-exam {
  background: #ffeca9 !important;
}

/* 官方練習頁不顯示自訂頂部標題列 */
body.wda-stage1-exam #id_header .nav-top {
  display: none !important;
}

body.wda-stage1-exam #id_header {
  background: #fff !important;
  box-shadow: none !important;
}

/* 考生資訊區 */
body.wda-stage1-exam #toppanel,
body.wda-stage1-exam #toppanel2 {
  width: 100% !important;
  background: #fff !important;
  padding: 4px 30px !important;
  min-height: 34px !important;
  border: 0 !important;
  color: #000 !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  align-items: center !important;
}

body.wda-stage1-exam #toppanel .label,
body.wda-stage1-exam #toppanel2 .label {
  width: auto !important;
  min-width: 86px !important;
  margin-right: 4px !important;
  text-align: left !important;
  color: #222 !important;
  font-size: 15px !important;
  font-weight: 700 !important;
}

body.wda-stage1-exam #toppanel .value,
body.wda-stage1-exam #toppanel2 .value,
body.wda-stage1-exam #id_seat,
body.wda-stage1-exam #examNumber {
  color: #111 !important;
  font-size: 15px !important;
  font-weight: 400 !important;
}

body.wda-stage1-exam .toppanel-left { width: 22% !important; }
body.wda-stage1-exam .toppanel-center { width: 39% !important; }
body.wda-stage1-exam .toppanel-right {
  width: 39% !important;
  flex: 0 0 auto !important;
}

/* 官方灰色操作區 */
body.wda-stage1-exam .toolbar-row-1,
body.wda-stage1-exam .toolbar-row-2 {
  background: #eaeaea !important;
  border: 0 !important;
  padding: 8px 30px !important;
  min-height: 48px !important;
  gap: 10px !important;
}

body.wda-stage1-exam .toolbar-row-1 {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

body.wda-stage1-exam .toolbar-row-2 {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
}

body.wda-stage1-exam .toolbar-left-group,
body.wda-stage1-exam .toolbar-left-group-2 {
  gap: 8px !important;
}

body.wda-stage1-exam .btn-align-right-1,
body.wda-stage1-exam .btn-align-right-2 {
  margin-left: 0 !important;
}

/* 字型大小控制：對應官方 #szie-select */
.wda-font-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: #000;
  font-size: 20px;
  line-height: 1.4;
  white-space: nowrap;
}

.wda-font-control label {
  margin: 0;
  font-size: 20px;
  font-weight: 400;
}

#wdaFontSizeSelect {
  width: 70px;
  height: 40px;
  padding: 4px 12px;
  border: 1px solid #ccc;
  border-radius: 0;
  background: #fff;
  color: #333;
  font-family: "微軟正黑體", "Microsoft JhengHei", Arial, sans-serif;
  font-size: 20px;
  line-height: 1.42857143;
}

/* WDA Bootstrap 3 按鈕比例 */
body.wda-stage1-exam .btn-official,
body.wda-stage1-exam .btn-official.btn-review-link {
  min-height: 34px !important;
  height: 34px !important;
  padding: 6px 12px !important;
  margin: 0 !important;
  border-radius: 0 !important;
  font-size: 14px !important;
  line-height: 20px !important;
  font-weight: 400 !important;
  box-shadow: none !important;
}

body.wda-stage1-exam .btn-official.nav-btn,
body.wda-stage1-exam .btn-official.primary,
body.wda-stage1-exam .btn-official.btn-next,
body.wda-stage1-exam .btn-official.btn-review-link {
  background: #337ab7 !important;
  border-color: #2e6da4 !important;
  color: #fff !important;
}

body.wda-stage1-exam .btn-official.danger {
  background: #d9534f !important;
  border-color: #d43f3a !important;
}

body.wda-stage1-exam .jump-select {
  width: 58px !important;
  height: 34px !important;
  padding: 4px 8px !important;
  border-radius: 0 !important;
  font-size: 14px !important;
}

body.wda-stage1-exam .answered-display {
  height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 0 10px !important;
  border-radius: 0 !important;
  font-size: 14px !important;
  color: #333 !important;
  font-weight: 400 !important;
}

body.wda-stage1-exam .timer {
  color: #d9534f !important;
  font-size: 15px !important;
  font-weight: 700 !important;
}

/* 隱藏／展開列 */
body.wda-stage1-exam .toolbar-row-3 {
  min-height: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  background: #a5a5a5 !important;
  border: 0 !important;
}

body.wda-stage1-exam .btn-official.toggle-btn {
  width: 100% !important;
  height: 28px !important;
  min-height: 28px !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 4px 0 !important;
  background: #a5a5a5 !important;
  color: #fff !important;
  font-size: 16px !important;
  line-height: 20px !important;
}

body.wda-stage1-exam .btn-official.toggle-btn:hover {
  background: #714f38 !important;
}

/* 官方黃色題目區 */
body.wda-stage1-exam #id_middle {
  right: 0 !important;
  background: #ffeca9 !important;
  padding: 20px 30px 80px !important;
}

body.wda-stage1-exam .question-container,
body.wda-stage1-exam .question-card {
  background: #ffeca9 !important;
}

/* 官方字級 1~7：22~28px */
body.wda-stage1-exam.wda-font-1 #id_middle { font-size: 22px !important; }
body.wda-stage1-exam.wda-font-2 #id_middle { font-size: 23px !important; }
body.wda-stage1-exam.wda-font-3 #id_middle { font-size: 24px !important; }
body.wda-stage1-exam.wda-font-4 #id_middle { font-size: 25px !important; }
body.wda-stage1-exam.wda-font-5 #id_middle { font-size: 26px !important; }
body.wda-stage1-exam.wda-font-6 #id_middle { font-size: 27px !important; }
body.wda-stage1-exam.wda-font-7 #id_middle { font-size: 28px !important; }

/* 浮動工具保持既有功能，先調整到官方第一層位置 */
body.wda-stage1-exam .float-btn-group {
  right: 10px !important;
  top: 25% !important;
  bottom: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  z-index: 999 !important;
}

body.wda-stage1-exam .btn-calc-float,
body.wda-stage1-exam .btn-wb-float {
  width: 70px !important;
  min-width: 70px !important;
  height: 70px !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* ============================================================
   Stage 2：正式作答題目骨架
   官方畫面只保留考試需要資訊；解析/提示/正確答案留在產品內，
   但正式作答時不顯示。
   ============================================================ */
body.wda-stage1-exam #questionCard {
  width: 95% !important;
  margin: 0 0 100px 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

body.wda-stage1-exam #questionCard > .row-wrapper {
  width: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 0 8px 0 !important;
  display: block !important;
}

/* 題組與題型：保留資料，改為官方樸素排版 */
body.wda-stage1-exam #questionCard .row-1,
body.wda-stage1-exam #questionCard .row-2 {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

body.wda-stage1-exam #questionCard .group-badge,
body.wda-stage1-exam #questionCard .question-type-badge {
  all: unset !important;
  display: inline !important;
  color: #000 !important;
  background: transparent !important;
  font-family: inherit !important;
  font-size: 1em !important;
  font-weight: 700 !important;
  line-height: 1.5 !important;
}

body.wda-stage1-exam #questionCard .question-text-label {
  color: #000 !important;
  font-size: 1em !important;
  font-weight: 400 !important;
}

/* 舊版「題幹」與重複提示不是 WDA 正式畫面元素 */
body.wda-stage1-exam #questionCard .row-wrapper:has(.row-3),
body.wda-stage1-exam #questionCard .row-wrapper:has(.row-4) {
  display: none !important;
}

/* 正式作答不顯示解析、法源、秘訣、邏輯、正確答案與查看解析按鈕 */
body.wda-stage1-exam #questionCard .row-1E,
body.wda-stage1-exam #questionCard .row-2E,
body.wda-stage1-exam #questionCard .row-3E,
body.wda-stage1-exam #questionCard .row-4E,
body.wda-stage1-exam #questionCard .row-5E,
body.wda-stage1-exam #questionCard .row-toggle-btn {
  display: none !important;
}

/* 配分與標記保留；標記改為官方暗橘色狀態 */
body.wda-stage1-exam #questionCard .row-5 {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 0 14px 0 !important;
  background: transparent !important;
}

body.wda-stage1-exam #questionCard .points {
  color: #000 !important;
  font-size: .9em !important;
  font-weight: 400 !important;
}

body.wda-stage1-exam #questionCard .mark-btn {
  border: 1px solid #b36b00 !important;
  border-radius: 0 !important;
  background: darkorange !important;
  color: #fff !important;
  padding: 4px 10px !important;
  min-height: 32px !important;
  font-family: inherit !important;
  font-size: .75em !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

/* 題幹本體 */
body.wda-stage1-exam #questionCard .row-6 {
  display: flex !important;
  align-items: flex-start !important;
  gap: 10px !important;
  padding: 0 !important;
  margin: 0 0 18px 0 !important;
  line-height: 1.65 !important;
}

body.wda-stage1-exam #questionCard .number-badge {
  all: unset !important;
  display: inline-block !important;
  flex: 0 0 auto !important;
  color: #000 !important;
  font-family: inherit !important;
  font-size: 1em !important;
  font-weight: 700 !important;
  line-height: 1.65 !important;
}

body.wda-stage1-exam #questionCard .q-text {
  color: #000 !important;
  font-size: 1em !important;
  line-height: 1.65 !important;
}

/* 官方題目內不使用目前自訂的大量分隔線 */
body.wda-stage1-exam #questionCard .row-divider {
  display: none !important;
}

/* 各題型仍由原 Renderer 輸出，Stage 2 只建立共通作答區空間 */
body.wda-stage1-exam #answerContainer1,
body.wda-stage1-exam #answerContainer2,
body.wda-stage1-exam #optionsCardArea,
body.wda-stage1-exam #dropTargetArea,
body.wda-stage1-exam #answerContainer3 {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* 官方以頂部上一/下一題與提前結束控制，不保留舊版題底提交列 */
body.wda-stage1-exam #questionCard .row-29 {
  display: none !important;
}

@media (max-width: 900px) {
  body.wda-stage1-exam #toppanel,
  body.wda-stage1-exam #toppanel2 {
    padding: 4px 10px !important;
    flex-wrap: wrap !important;
  }
  body.wda-stage1-exam .toppanel-left,
  body.wda-stage1-exam .toppanel-center,
  body.wda-stage1-exam .toppanel-right {
    width: 50% !important;
    flex: 0 0 50% !important;
  }
  body.wda-stage1-exam .toolbar-row-1,
  body.wda-stage1-exam .toolbar-row-2 {
    padding: 6px 10px !important;
    flex-wrap: wrap !important;
  }
  body.wda-stage1-exam #id_middle {
    padding: 12px 10px 80px !important;
  }
  body.wda-stage1-exam #questionCard {
    width: calc(100% - 80px) !important;
  }
}
