/* ==========================================================================
   언어재활사 CBT 스타일 시트 (모의평가 CBT)
   ========================================================================== */

:root {
  --cbt-navy-dark: #0d2341;
  --cbt-navy-main: #163967;
  --cbt-navy-light: #24508a;
  --cbt-blue-accent: #2275d7;
  --cbt-teal-badge: #1aa0b8;
  --cbt-bg-gray: #f4f6f9;
  --cbt-border-gray: #d2dbe5;
  --cbt-text-dark: #222222;
  --cbt-text-muted: #667587;
  --cbt-omr-active: #e3effd;
  --cbt-yellow-clock: #f9d132;
  --cbt-highlight: #fff566;
  --cbt-strike-red: #d32f2f;

  /* 글자 크기 변수 (기본 100%) */
  --cbt-base-font-size: 16px;
  --cbt-q-title-size: 18px;
  --cbt-option-size: 16px;
}

/* 폰트 크기 변경 클래스 */
body.font-size-80 {
  --cbt-base-font-size: 13.5px;
  --cbt-q-title-size: 15px;
  --cbt-option-size: 14px;
}

body.font-size-100 {
  --cbt-base-font-size: 16px;
  --cbt-q-title-size: 18px;
  --cbt-option-size: 16px;
}

body.font-size-125 {
  --cbt-base-font-size: 19px;
  --cbt-q-title-size: 22px;
  --cbt-option-size: 19px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Nanum Gothic", "Noto Sans KR", sans-serif;
  font-size: var(--cbt-base-font-size);
  color: var(--cbt-text-dark);
  background-color: #ffffff;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  user-select: none;
}

/* ==========================================================================
   1. 상단 KCBT 마스터 헤더 (국시원 공식 배색 #163967)
   ========================================================================== */
.kcbt-header {
  height: 64px;
  background-color: var(--cbt-navy-main);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 2px solid #0b2241;
  flex-shrink: 0;
  z-index: 50;
}

.kcbt-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
}

.examinee-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--cbt-teal-badge);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.examinee-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.examinee-meta .row {
  display: flex;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
}

.examinee-meta .label {
  color: #a9c7eb;
}

.examinee-meta .val {
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}
.examinee-meta .val:hover {
  text-decoration: underline;
}

/* 중앙 시험 명칭 */
.kcbt-header-center {
  flex: 1;
  text-align: center;
}

.kcbt-exam-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
}

/* 우측 컨트롤 도구 (글자크기, 화면배치, 시간, 문제관리) */
.kcbt-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-label {
  font-size: 12px;
  color: #a0bede;
  font-weight: 600;
  white-space: nowrap;
}

.cbt-btn-pill-group {
  display: flex;
  gap: 2px;
  background-color: var(--cbt-navy-dark);
  padding: 2px;
  border-radius: 4px;
  border: 1px solid #234b7f;
}

.cbt-btn-pill {
  border: none;
  background: transparent;
  color: #b9d3f2;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.cbt-btn-pill:hover {
  color: #ffffff;
  background-color: rgba(255,255,255,0.1);
}

.cbt-btn-pill.active {
  background-color: var(--cbt-blue-accent);
  color: #ffffff;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.3);
}

/* 레이아웃 아이콘 */
.layout-icon-1col {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 1px;
}

.layout-icon-2col {
  display: inline-flex;
  gap: 1.5px;
  width: 14px;
  height: 14px;
}
.layout-icon-2col span {
  width: 6px;
  height: 100%;
  border: 1.5px solid currentColor;
  border-radius: 1px;
}

/* 시험 타이머 */
.cbt-timer-box {
  background-color: #0c1f38;
  border: 1px solid #244b7e;
  border-radius: 20px;
  padding: 5px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: #ffffff;
}

.cbt-clock-icon {
  width: 16px;
  height: 16px;
  fill: var(--cbt-yellow-clock);
}

.timer-warning {
  color: #ff5252 !important;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from { opacity: 1; }
  to { opacity: 0.5; }
}

/* 문제 등록/불러오기 버튼 */
.btn-manage-questions {
  background-color: #285b99;
  border: 1px solid #4a82c7;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}
.btn-manage-questions:hover {
  background-color: #316cb5;
}

/* ==========================================================================
   2. 본문 영역 (문제 풀이 + 우측 OMR 답안 표기란)
   ========================================================================== */
.kcbt-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* 문제 풀이 메인 영역 */
.kcbt-questions-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 60px 32px;
  background-color: #ffffff;
}

/* 1단 보기 모드 */
.kcbt-questions-container.layout-1col {
  max-width: 100%;
}

.kcbt-questions-container.layout-1col .cbt-question-card {
  max-width: 900px;
  margin: 0 auto;
}

/* 2단 보기 모드 (국시원 2단 분할) */
.kcbt-questions-container.layout-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  padding: 20px 24px 60px 24px;
}

.kcbt-questions-container.layout-2col .cbt-question-card {
  border-right: 1px dashed var(--cbt-border-gray);
  padding-right: 28px;
}
.kcbt-questions-container.layout-2col .cbt-question-card:last-child {
  border-right: none;
  padding-right: 0;
}

/* 개별 문제 카드 */
.cbt-question-card {
  display: flex;
  flex-direction: column;
  user-select: text; /* 수험생 형광펜 드래그 지원 */
}

/* 문항 상단 서브헤더 */
.q-sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #dce4ee;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.q-subject-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--cbt-navy-main);
  letter-spacing: -0.3px;
}

.q-tools-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-cbt-tool {
  background-color: #f1f4f8;
  border: 1px solid #cbd6e2;
  color: #3b4d63;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}
.btn-cbt-tool:hover {
  background-color: #e5ebf3;
}

.btn-cbt-tool.active-check {
  background-color: #fff2d6;
  border-color: #f0a31a;
  color: #b36e00;
}

.btn-cbt-tool.has-memo {
  background-color: #e3f2fd;
  border-color: #2196f3;
  color: #0b7ad1;
}

/* 문항 안내 */
.q-instruction {
  font-size: 13.5px;
  color: #728498;
  margin-bottom: 14px;
  font-weight: 500;
}

/* 문항 본문 및 형광펜 도구 */
.q-statement-wrap {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.q-statement {
  font-size: var(--cbt-q-title-size);
  font-weight: 700;
  line-height: 1.5;
  color: #111111;
  flex: 1;
}

.cbt-underline {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

/* 형광펜 도구 버튼 세트 */
.highlighter-tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  user-select: none;
}

.btn-highlighter {
  background-color: #f8fafc;
  border: 1px solid #b8c7dc;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  color: #41556b;
  cursor: pointer;
  white-space: nowrap;
}
.btn-highlighter.active {
  background-color: #fff9a6;
  border-color: #e6cb00;
  color: #594e00;
  font-weight: 700;
}

/* 지문/사례/보기 박스 */
.q-passage-box {
  background-color: #f8fafc;
  border: 1px solid #d8e2ec;
  border-radius: 4px;
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: var(--cbt-base-font-size);
  line-height: 1.65;
  white-space: pre-line;
  color: #2b3b4c;
}

/* 형광펜 마크 스타일 */
mark.cbt-mark {
  background-color: var(--cbt-highlight);
  color: inherit;
  padding: 1px 2px;
  border-radius: 2px;
}

/* 5지선다 선택지 목록 */
.q-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.q-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.1s, border-color 0.1s;
  user-select: none;
}

.q-option-item:hover {
  background-color: #f1f6fd;
}

.q-option-item.selected {
  background-color: #ebf3fd;
  border-color: #a4c7f0;
}

.q-option-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.q-option-num {
  font-size: calc(var(--cbt-option-size) * 1.15);
  font-weight: 600;
  color: #334e68;
}

.q-option-text {
  font-size: var(--cbt-option-size);
  color: #1a2634;
  line-height: 1.45;
}

/* 오답 소거법 버튼 */
.btn-eliminate {
  border: 1px solid #cfd8e3;
  background-color: #ffffff;
  color: #5a6e85;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-eliminate:hover {
  background-color: #fce8e6;
  border-color: #f5a49c;
  color: #d32f2f;
}

/* 오답 소거 적용 상태 */
.q-option-item.is-eliminated .q-option-text {
  text-decoration: line-through var(--cbt-strike-red);
  text-decoration-thickness: 1.5px;
  opacity: 0.38;
}
.q-option-item.is-eliminated .q-option-num {
  opacity: 0.38;
}
.q-option-item.is-eliminated .btn-eliminate {
  background-color: #fee2e2;
  color: #b91c1c;
  border-color: #f87171;
}

/* ==========================================================================
   3. 우측 고정 답안 표기란 (OMR 시트)
   ========================================================================== */
.kcbt-omr-sidebar {
  width: 250px;
  background-color: #ffffff;
  border-left: 2px solid #b9cadc;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  user-select: none;
}

.omr-header {
  height: 44px;
  background-color: var(--cbt-navy-main);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.omr-grid-container {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.omr-row {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid #ebf0f5;
  cursor: pointer;
  transition: background-color 0.15s;
}

.omr-row:hover {
  background-color: #f4f8fe;
}

.omr-row.active {
  background-color: var(--cbt-omr-active);
  box-shadow: inset 3px 0 0 var(--cbt-blue-accent);
}

.omr-q-num-cell {
  width: 44px;
  font-size: 14px;
  font-weight: 800;
  color: #1e5ba3;
  display: flex;
  align-items: center;
  gap: 3px;
}

.omr-check-badge {
  color: #e67e22;
  font-size: 12px;
}

.omr-circles-cell {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.omr-circle-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #6b829e;
  background-color: #ffffff;
  color: #3b516b;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* 풀이 도중 오답 클릭 방지: OMR 원문자는 오직 표시 전용 */
  user-select: none;
  transition: all 0.1s;
}

/* OMR 마킹 시 짙은 네이비 원문자 채움 (표시 전용) */
.omr-circle-btn.marked {
  background-color: #112845;
  border-color: #112845;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* OMR 하단 통계 요약 바 */
.omr-footer-stats {
  background-color: #edf3fa;
  border-top: 1px solid #d3e0ed;
  padding: 10px 12px;
  font-size: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  line-height: 1.3;
}

.omr-footer-stats .stat-item {
  display: flex;
  justify-content: space-between;
}
.omr-footer-stats .stat-label {
  color: #556980;
}
.omr-footer-stats .stat-val {
  font-weight: 700;
  color: #163967;
}

/* ==========================================================================
   4. 하단 네비게이션 제어 바 (이전/다음/미표기/체크/제출)
   ========================================================================== */
.kcbt-footer-bar {
  height: 56px;
  background-color: #eef2f7;
  border-top: 2px solid #ccd8e6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 40;
}

.nav-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-kcbt-nav {
  padding: 7px 16px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid #b7c8dc;
  background-color: #ffffff;
  color: #203956;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: all 0.15s;
}

.btn-kcbt-nav:hover:not(:disabled) {
  background-color: #f5f8fc;
  border-color: #9ab4d1;
}

.btn-kcbt-nav:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-kcbt-nav.btn-jump {
  background-color: #f7f9fc;
  color: #3b5370;
  font-size: 12.5px;
}

.btn-kcbt-nav.btn-submit {
  background-color: var(--cbt-navy-main);
  border-color: #0d2749;
  color: #ffffff;
  padding: 8px 22px;
  font-size: 14.5px;
  box-shadow: 0 2px 4px rgba(22, 57, 103, 0.3);
}

.btn-kcbt-nav.btn-submit:hover {
  background-color: #1f4980;
}

/* ==========================================================================
   5. 모달 및 팝업 (메모, 미응시 경고, 성적 결과표, 문제 관리자)
   ========================================================================== */
.cbt-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(10, 25, 47, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.cbt-modal-backdrop.show {
  display: flex;
}

.cbt-modal-box {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  height: 48px;
  background-color: var(--cbt-navy-main);
  color: #ffffff;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 16px;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 20px;
  background-color: #f7f9fb;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 메모 모달 전용 */
.memo-textarea {
  width: 100%;
  height: 180px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.5;
}

/* 성적표 모달 전용 */
.score-report-card {
  text-align: center;
  padding: 16px;
  background-color: #f0f7ff;
  border: 1px solid #bdd7f5;
  border-radius: 8px;
  margin-bottom: 20px;
}

.score-main-value {
  font-size: 42px;
  font-weight: 900;
  color: var(--cbt-navy-main);
  margin: 6px 0;
}

.pass-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 14px;
}
.pass-badge.pass {
  background-color: #d1fae5;
  color: #065f46;
}
.pass-badge.fail {
  background-color: #fee2e2;
  color: #991b1b;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin-top: 12px;
}
.report-table th, .report-table td {
  border: 1px solid #dbe3ed;
  padding: 8px 10px;
  text-align: center;
}
.report-table th {
  background-color: #eaf1fb;
  color: #1a3962;
  font-weight: 700;
}

/* 문제 관리자 탭 */
.tabs-nav {
  display: flex;
  border-bottom: 2px solid #dce4ee;
  margin-bottom: 16px;
}
.tab-btn {
  padding: 8px 16px;
  border: none;
  background: none;
  font-weight: 700;
  font-size: 14px;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab-btn.active {
  color: var(--cbt-navy-main);
  border-bottom-color: var(--cbt-navy-main);
}

.paste-area {
  width: 100%;
  height: 240px;
  font-family: monospace;
  font-size: 13px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  line-height: 1.5;
}

/* 스크롤바 커스텀 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f4f8;
}
::-webkit-scrollbar-thumb {
  background: #c3d1e0;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #9db2c9;
}
