/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
}

/* 容器样式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 头部样式 */
header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px 0;
  border-bottom: 1px solid #e0e0e0;
}

header h1 {
  color: #2c3e50;
  font-size: 2rem;
  margin-bottom: 10px;
}

header p {
  color: #7f8c8d;
  font-size: 1.1rem;
}

/* 主内容区样式 */
.main-content {
  flex: 1;
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

/* 问卷区域样式 */
.questionnaire-section {
  flex: 1;
  min-width: 300px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 30px;
}

/* 历史记录面板样式 */
.history-panel {
  width: 300px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.history-panel-header {
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.history-panel-header h3 {
  color: #2c3e50;
  font-size: 1.2rem;
}

.history-panel-body {
  padding: 20px;
}

.history-item {
  padding: 15px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.history-item:hover {
  background-color: #f9f9f9;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item-time {
  font-size: 0.9rem;
  color: #7f8c8d;
  margin-bottom: 5px;
}

.history-item-level {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.level-L1 {
  background-color: #e8f5e8;
  color: #2e7d32;
}

.level-L2 {
  background-color: #fff3e0;
  color: #ef6c00;
}

.level-L3 {
  background-color: #ffebee;
  color: #c62828;
}

.history-item-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

.history-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

/* 问卷题目样式 */
.question {
  margin-bottom: 25px;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.question-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 15px;
  color: #2c3e50;
}

.question-required {
  color: #e74c3c;
  margin-left: 5px;
}

/* 选项样式 */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: center;
  padding: 10px;
  background-color: white;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  transition: all 0.3s ease;
  cursor: pointer;
}

.option:hover {
  border-color: #3498db;
  box-shadow: 0 2px 5px rgba(52, 152, 219, 0.1);
}

.option input[type="radio"],
.option input[type="checkbox"] {
  margin-right: 10px;
  transform: scale(1.2);
}

.option label {
  cursor: pointer;
  flex: 1;
}

/* 文本输入框样式 */
.text-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
}

.text-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 提交按钮样式 */
.submit-section {
  margin-top: 30px;
  text-align: center;
}

.submit-btn {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.submit-btn:hover {
  background-color: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
}

.submit-btn:disabled {
  background-color: #bdc3c7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.submit-btn.loading {
  position: relative;
  padding-left: 40px;
}

.submit-btn.loading::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* 结果区域样式 */
.result-section {
  margin-top: 30px;
  padding: 30px;
  background-color: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e0e0e0;
}

.result-header h2 {
  color: #2c3e50;
  font-size: 1.5rem;
}

.copy-btn {
  background-color: #27ae60;
  color: white;
  border: none;
  padding: 8px 16px;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-btn:hover {
  background-color: #229954;
}

.result-content {
  white-space: pre-wrap;
  line-height: 1.8;
  color: #333;
}

/* 错误提示样式 */
.error-message {
  color: #e74c3c;
  font-size: 0.9rem;
  margin-top: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }

  .history-panel {
    width: 100%;
    position: static;
    max-height: none;
  }

  .questionnaire-section {
    padding: 20px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .question {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  .questionnaire-section {
    padding: 15px;
  }

  header h1 {
    font-size: 1.3rem;
  }

  header p {
    font-size: 1rem;
  }

  .submit-btn {
    width: 100%;
    padding: 15px;
  }
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* 加载动画 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* 按钮通用样式 */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: #3498db;
  color: white;
}

.btn-primary:hover {
  background-color: #2980b9;
}

.btn-secondary {
  background-color: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
}

.btn-danger {
  background-color: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background-color: #c0392b;
}