<template>
  <PageShell>
    <div class="page-three">
      <div class="answer-card">
        <div class="answer-title">答题卡</div>
        <div class="answer-grid">
          <button class="answer-index active">1</button>
          <button class="answer-index">2</button>
        </div>
        <div class="answer-legend">
          <span><i class="legend-dot answered"></i>已答 1</span>
          <span><i class="legend-dot pending"></i>未答 1</span>
        </div>
      </div>

      <div class="question-panel">
        <div class="question-title">考试标题</div>
        <div class="question-desc">感谢您能抽出几分钟时间来参加本次答题，现在我们就马上开始吧！</div>

        <div class="question-block">
          <div class="question-label"><span class="required">*</span>1. 请选择一个选项</div>
          <el-radio-group v-model="selectedAnswer" class="option-group">
            <el-radio value="A">A.选项1</el-radio>
            <el-radio value="B">B.选项2</el-radio>
            <el-radio value="C">C.选项3</el-radio>
            <el-radio value="D">D.选项4</el-radio>
          </el-radio-group>
        </div>

        <div class="question-block">
          <div class="question-label"><span class="required">*</span>2. 请简要阐述你的观点</div>
          <el-input v-model="comment" type="textarea" :rows="4" placeholder="请输入" />
        </div>

        <div class="submit-row">
          <el-button type="primary" class="submit-button">提交</el-button>
        </div>
      </div>
    </div>
  </PageShell>
</template>

<script setup name="TestPageThree" lang="ts">
import { ref } from 'vue';
import PageShell from '@/components/PageShell/index.vue';

const selectedAnswer = ref('A');
const comment = ref('');
</script>

<style scoped lang="scss">
.page-three {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  min-height: calc(100vh - 150px);
}

.answer-card,
.question-panel {
  background: #fff;
  border-radius: 8px;
}

.answer-card {
  align-self: start;
  padding: 12px;
}

.answer-title {
  position: relative;
  padding-left: 8px;
  margin-bottom: 12px;
  color: #303133;
  font-weight: 600;
}

.answer-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  width: 2px;
  height: 14px;
  background: #2f6cf6;
}

.answer-grid {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.answer-index {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  color: #909399;
  background: #f5f7fa;
  cursor: pointer;
}

.answer-index.active {
  color: #2f6cf6;
  background: #eef3ff;
}

.answer-legend {
  display: flex;
  justify-content: space-between;
  color: #606266;
  font-size: 12px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
}

.legend-dot.answered {
  background: #2f6cf6;
}

.legend-dot.pending {
  background: #c0c4cc;
}

.question-panel {
  padding: 38px 26px 44px;
}

.question-title {
  margin-bottom: 14px;
  color: #303133;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.question-desc {
  margin-bottom: 34px;
  color: #606266;
  font-size: 14px;
}

.question-block {
  margin-bottom: 32px;
}

.question-label {
  margin-bottom: 18px;
  color: #303133;
  font-size: 16px;
  font-weight: 600;
}

.required {
  margin-right: 4px;
  color: #f56c6c;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: flex-start;
}

.submit-row {
  display: flex;
  justify-content: center;
  padding-top: 10px;
}

.submit-button {
  min-width: 132px;
}

@media (max-width: 960px) {
  .page-three {
    grid-template-columns: 1fr;
  }

  .answer-card {
    order: 2;
  }
}
</style>
