/* ===== 问卷页面样式 css/questionnaire.css ===== */

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #1f2937;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* 头部样式 */
.questionnaire-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.questionnaire-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #3b82f6;
}

.progress-indicator {
  background: #3b82f6;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-weight: 500;
  font-size: 0.875rem;
}

/* 主内容区域 */
.questionnaire-main {
  padding: 2rem 0 4rem;
}

/* 进度条 */
.progress-container {
  margin-bottom: 3rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 16.67%; /* 1/6 steps */
}

/* 表单容器 */
.questionnaire-form {
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  position: relative;
}

/* 步骤样式 */
.step {
  padding: 3rem;
  display: none;
  min-height: 500px;
}

.step.active {
  display: block;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.step-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.step-header h2 {
  font-size: 2rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.step-header p {
  font-size: 1.125rem;
  color: #6b7280;
  line-height: 1.6;
}

/* 表单网格布局 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-group input,
.form-group select {
  padding: 0.875rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: white;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f8fafc;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.5rem;
}

.input-group input {
  border: none;
  background: transparent;
  padding: 0.375rem 0.5rem;
  width: 80px;
  text-align: center;
}

.input-group span {
  color: #6b7280;
  font-weight: 500;
  font-size: 0.875rem;
}

/* 单选框样式 */
.radio-group {
  display: grid;
  gap: 1rem;
}

.radio-wrapper {
  position: relative;
}

.radio-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-label {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  border: 2px solid #e5e7eb;
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.radio-label:hover {
  border-color: #d1d5db;
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.radio-input:checked + .radio-label {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 8px 25px -8px rgba(59, 130, 246, 0.3);
}

.radio-indicator {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.radio-input:checked + .radio-label .radio-indicator {
  border-color: #3b82f6;
  background: #3b82f6;
}

.radio-input:checked + .radio-label .radio-indicator::after {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  background: white;
  border-radius: 50%;
}

.radio-content {
  flex: 1;
}

.radio-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.radio-title {
  font-weight: 600;
  color: #1f2937;
  font-size: 1.125rem;
  display: block;
  margin-bottom: 0.25rem;
}

.radio-description {
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* 菜系选择网格 */
.cuisine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.cuisine-card {
  position: relative;
}

.cuisine-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cuisine-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  height: 100%;
}

.cuisine-label:hover {
  border-color: #d1d5db;
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.cuisine-input:checked + .cuisine-label {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 8px 25px -8px rgba(59, 130, 246, 0.3);
}

.cuisine-flag {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.cuisine-name {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.cuisine-description {
  color: #6b7280;
  font-size: 0.75rem;
  line-height: 1.4;
}

/* 复选框网格 */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.checkbox-wrapper {
  position: relative;
}

.checkbox-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  font-weight: 500;
}

.checkbox-label:hover {
  border-color: #d1d5db;
  background: #f8fafc;
}

.checkbox-input:checked + .checkbox-label {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e40af;
}

.checkbox-indicator {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #d1d5db;
  border-radius: 0.375rem;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.checkbox-input:checked + .checkbox-label .checkbox-indicator {
  border-color: #3b82f6;
  background: #3b82f6;
}

.checkbox-input:checked + .checkbox-label .checkbox-indicator::after {
  content: '✓';
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
}

/* 分类区域 */
.restriction-section {
  margin-bottom: 2.5rem;
}

.restriction-section:last-child {
  margin-bottom: 0;
}

.restriction-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
}

.workout-preferences,
.time-preferences,
.cooking-section {
  margin-bottom: 2.5rem;
}

.workout-preferences h3,
.time-preferences h3,
.cooking-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 1rem;
}

/* 导航按钮 */
.form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 3rem;
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  border: none;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background: white;
  color: #6b7280;
  border: 2px solid #e5e7eb;
}

.btn-secondary:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #d1d5db;
  color: #374151;
}

/* 加载模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: white;
  border-radius: 1.5rem;
  padding: 3rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.loading-container h3 {
  color: #1f2937;
  margin: 1.5rem 0 1rem;
  font-size: 1.5rem;
}

.loading-container p {
  color: #6b7280;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.loading-spinner {
  width: 3rem;
  height: 3rem;
  border: 3px solid #f3f4f6;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #f8fafc;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.loading-step.active {
  opacity: 1;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e40af;
}

.step-icon {
  font-size: 1.25rem;
}

.step-text {
  font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    padding: 0 0.75rem;
  }
  
  .step {
    padding: 2rem 1.5rem;
    min-height: auto;
  }
  
  .step-header h2 {
    font-size: 1.5rem;
  }
  
  .step-header p {
    font-size: 1rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .cuisine-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
  }
  
  .checkbox-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .radio-label {
    padding: 1rem;
  }
  
  .cuisine-label {
    padding: 1rem 0.75rem;
  }
  
  .form-navigation {
    padding: 1.5rem;
    flex-direction: column;
    gap: 1rem;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .questionnaire-header .container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .modal-content {
    padding: 2rem 1.5rem;
    margin: 1rem;
  }
  
  .loading-steps {
    gap: 0.75rem;
  }
  
  .loading-step {
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 480px) {
  .step {
    padding: 1.5rem 1rem;
  }
  
  .step-header h2 {
    font-size: 1.25rem;
  }
  
  .radio-icon {
    font-size: 1.5rem;
  }
  
  .cuisine-flag {
    font-size: 2rem;
  }
  
  .cuisine-grid {
    grid-template-columns: 1fr 1fr;
  }
}