/* ============================================
   Linear Design System - Indicators
   Clean, Modern, Unified Style
   ============================================ */

:root {
  /* Indicator Colors */
  --ind-bg: #FFFFFF;
  --ind-border: #E2E8F0;
  --ind-text: #64748B;

  --ind-active-bg: #F0F9FF;
  --ind-active-border: var(--penguin-navy);
  --ind-active-text: var(--penguin-navy);

  --ind-answered-bg: #F8FAFC;
  --ind-answered-border: #CBD5E1;
  --ind-answered-text: #475569;

  --ind-correct-bg: #DCFCE7;
  --ind-correct-border: #86EFAC;
  --ind-correct-text: #166534;

  --ind-incorrect-bg: #FEE2E2;
  --ind-incorrect-border: #FCA5A5;
  --ind-incorrect-text: #991B1B;
}

/* ============================================
   Container Layout
   ============================================ */
.question-indicators-container {
  width: 100%;
  max-width: 900px;
  margin: 6px auto 10px;
  padding: 6px 20px;
  background: transparent;
  box-sizing: border-box;
}

/* Ensure centering for both modes */
body:not([data-current-subject]) .question-indicators-container {
  margin-left: auto;
  margin-right: auto;
}

.question-indicators {
  width: 100%;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
  overflow: visible;
}

/* ============================================
   Grid Layouts
   ============================================ */

/* Regular Exam (20 questions): 10 columns x 2 rows */
body[data-current-subject] .question-indicators {
  display: grid;
  grid-template-columns: repeat(10, 35px);
  gap: 12px;
  justify-content: center;
}

/* Mock Exam (80 questions): 20 columns layout */
body:not([data-current-subject]) .question-indicators {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ============================================
   Indicator Item Style (Unified)
   ============================================ */
.indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  border-radius: 3px;
  background-color: var(--ind-bg);
  border: 1.5px solid var(--ind-border);
  color: var(--ind-text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
}

/* Mock exam indicators slightly smaller to fit 20 cols */
body:not([data-current-subject]) .indicator {
  width: 35px;
  height: 35px;
  font-size: 0.75rem;
  border-radius: 3px;
}

/* 과목별 카드 레이아웃 */
.indicator-subject-card {
  background: #f8fafc;
  border: 1px solid #e8ecf1;
  border-radius: 8px;
  padding: 8px 12px 10px;
  margin-bottom: 6px;
}

.indicator-subject-label {
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 4px;
  padding-left: 6px;
  border-left: 2px solid #ccc;
  line-height: 1;
}

.indicator-subject-grid {
  display: grid;
  grid-template-columns: repeat(10, 35px);
  gap: 12px;
  justify-content: center;
}

/* 레거시 spacer — 더 이상 사용하지 않지만 안전하게 유지 */
.indicator-subject-spacer {
  grid-column: 1 / -1;
  height: 4px;
}

/* Hover State */
.indicator:hover:not(.current) {
  border-color: var(--penguin-skyblue);
  color: var(--penguin-navy);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ============================================
   States
   ============================================ */

/* 1. Current (Active Question) */
.indicator.current {
  background-color: var(--ind-active-bg);
  border-color: var(--ind-active-border);
  color: var(--ind-active-text);
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(29, 47, 78, 0.1);
  /* Subtle Ring */
  z-index: 2;
  transform: scale(1.05);
}

/* 2. Answered (Selected but not checked) */
.indicator.answered:not(.correct):not(.incorrect) {
  background-color: var(--ind-answered-bg);
  border-color: var(--ind-answered-border);
  color: var(--ind-answered-text);
}

/* 3. Correct */
.indicator.correct {
  background-color: var(--ind-correct-bg);
  border-color: var(--ind-correct-border);
  color: var(--ind-correct-text);
}

/* 4. Incorrect */
.indicator.incorrect {
  background-color: var(--ind-incorrect-bg);
  border-color: var(--ind-incorrect-border);
  color: var(--ind-incorrect-text);
}

/* 5. Checked Correct (정답 보기로 확인된 정답) */
.indicator.checked-correct {
  background-color: var(--ind-correct-bg);
  border-color: var(--ind-correct-border);
  color: var(--ind-correct-text);
}

/* 6. Checked Incorrect (정답 보기로 확인된 오답) */
.indicator.checked-incorrect {
  background-color: var(--ind-incorrect-bg);
  border-color: var(--ind-incorrect-border);
  color: var(--ind-incorrect-text);
}


/* ============================================
   Responsive Design
   ============================================ */

/* Tablet & Mobile - 그리드 유지, 스크롤 없이 한 화면에 */
@media (max-width: 768px) {
  .question-indicators-container {
    padding: 3px 4%;
    margin: 2px auto 3px;
    overflow: visible;
    box-sizing: border-box;
  }

  /* 일반 시험: 10열 그리드 */
  body[data-current-subject] .question-indicators {
    display: grid;
    grid-template-columns: repeat(10, 22px);
    column-gap: 5px;
    row-gap: 5px;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
  }

  /* 모의고사: 과목별 카드 세로 배치 유지 */
  body:not([data-current-subject]) .question-indicators {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
  }

  /* 과목별 카드 모바일 */
  .indicator-subject-card {
    padding: 4px 6px 6px;
    margin-bottom: 3px;
    border-radius: 6px;
  }

  .indicator-subject-label {
    font-size: 0.6rem;
    margin-bottom: 3px;
  }

  .indicator-subject-grid {
    grid-template-columns: repeat(10, 22px);
    gap: 5px;
    justify-content: center;
  }

  /* 인디케이터: 축소 */
  body .question-indicators .indicator,
  .indicator-subject-grid .indicator {
    width: 22px;
    height: 22px;
    font-size: 0.5rem;
    border-radius: 3px;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .question-indicators-container {
    padding: 2px 4%;
    margin: 1px auto 2px;
  }

  body[data-current-subject] .question-indicators {
    grid-template-columns: repeat(10, 15px);
    column-gap: 5px;
    row-gap: 5px;
  }

  body:not([data-current-subject]) .question-indicators {
    column-gap: 5px;
    row-gap: 5px;
  }

  .indicator-subject-card {
    padding: 3px 5px 5px;
    margin-bottom: 2px;
  }

  .indicator-subject-label {
    font-size: 0.55rem;
    margin-bottom: 2px;
  }

  .indicator-subject-grid {
    grid-template-columns: repeat(10, 15px);
    gap: 5px;
    justify-content: center;
  }

  body .question-indicators .indicator,
  .indicator-subject-grid .indicator {
    width: 15px;
    height: 15px;
    font-size: 0.4rem;
    border-radius: 3px;
  }
}