/* ============================================================
   问卷调查工具 - 样式表
   毛玻璃UI + 深浅色切换 + 响应式设计
   ============================================================ */

/* CSS 变量 - 浅色主题 */
:root {
  --bg-gradient-1: #667eea;
  --bg-gradient-2: #764ba2;
  --bg-gradient-3: #f093fb;
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-bg-hover: rgba(255, 255, 255, 0.35);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #6a6a8a;
  --accent: #667eea;
  --accent-hover: #5568d3;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --private-color: #8b5cf6;
  --input-bg: rgba(255, 255, 255, 0.5);
  --input-border: rgba(255, 255, 255, 0.6);
}

/* 深色主题 */
[data-theme="dark"] {
  --bg-gradient-1: #0f0c29;
  --bg-gradient-2: #302b63;
  --bg-gradient-3: #24243e;
  --glass-bg: rgba(30, 30, 50, 0.5);
  --glass-bg-hover: rgba(50, 50, 80, 0.6);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --text-primary: #f0f0f5;
  --text-secondary: #c0c0d5;
  --text-muted: #9090a5;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --input-bg: rgba(255, 255, 255, 0.08);
  --input-border: rgba(255, 255, 255, 0.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3));
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  color: var(--text-primary);
  overflow-x: hidden;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 背景装饰 */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}

body::before {
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.3);
  top: -100px;
  right: -100px;
  animation: float1 20s ease-in-out infinite;
}

body::after {
  width: 350px;
  height: 350px;
  background: rgba(255, 200, 255, 0.3);
  bottom: -80px;
  left: -80px;
  animation: float2 25s ease-in-out infinite;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-50px, 50px); }
}

@keyframes float2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(50px, -30px); }
}

/* 应用容器 */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* 顶部导航 */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: var(--glass-shadow);
}

.theme-toggle:hover {
  background: var(--glass-bg-hover);
  transform: scale(1.1);
}

/* 屏幕通用 */
.screen {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.5s ease;
}

.screen.active {
  display: flex;
}

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

/* ========== 首页 ========== */
.home-header {
  text-align: center;
  color: white;
  margin-bottom: 10px;
}

.home-header h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.home-header p {
  font-size: 15px;
  opacity: 0.9;
}

/* 问卷列表 */
.survey-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}

.survey-list::-webkit-scrollbar {
  width: 6px;
}

.survey-list::-webkit-scrollbar-track {
  background: transparent;
}

.survey-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
}

.survey-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  position: relative;
  box-shadow: var(--glass-shadow);
}

.survey-card:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
}

.survey-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3), var(--glass-shadow);
}

.survey-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.survey-info {
  flex: 1;
  min-width: 0;
}

.survey-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.survey-info p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.survey-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--input-bg);
  padding: 2px 8px;
  border-radius: 10px;
}

.survey-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.survey-card.selected .survey-check {
  display: flex;
}

/* 底部操作区 */
.home-footer {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--glass-shadow);
}

.selected-info {
  text-align: center;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.selected-info strong {
  color: var(--text-primary);
  font-size: 16px;
}

.version-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.version-option {
  flex: 1;
  min-width: 100px;
  padding: 12px;
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease;
}

.version-option:hover {
  border-color: var(--accent);
}

.version-option.selected {
  border-color: var(--accent);
  background: rgba(102, 126, 234, 0.15);
}

.version-option .version-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.version-option .version-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.start-btn {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.start-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== 问卷页 ========== */
.survey-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.survey-title {
  font-size: 18px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 5px rgba(0,0,0,0.2);
}

.progress-container {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 6px;
  margin-bottom: 16px;
  position: relative;
}

.progress-bar {
  height: 8px;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 20px;
  transition: width 0.5s ease;
  width: 0%;
}

.progress-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* 隐私提示 */
.privacy-notice {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--private-color);
}

/* 题目卡片 */
.question-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--glass-shadow);
  animation: slideIn 0.4s ease;
}

.question-card.private-question {
  border-color: rgba(139, 92, 246, 0.4);
}

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

.question-category {
  display: inline-block;
  font-size: 12px;
  color: var(--accent);
  background: rgba(102, 126, 234, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
  font-weight: 500;
}

.question-title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 20px;
  color: var(--text-primary);
}

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

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.option-item:hover {
  border-color: var(--accent);
  background: var(--glass-bg-hover);
}

.option-item.checked {
  border-color: var(--accent);
  background: rgba(102, 126, 234, 0.15);
}

.option-item input {
  display: none;
}

.option-radio,
.option-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  flex-shrink: 0;
  position: relative;
  transition: all 0.25s ease;
}

.option-checkbox {
  border-radius: 6px;
}

.option-item.checked .option-radio,
.option-item.checked .option-checkbox {
  border-color: var(--accent);
  background: var(--accent);
}

.option-item.checked .option-radio::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}

.option-item.checked .option-checkbox::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.option-text {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* 文本输入 */
.text-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text-primary);
  resize: vertical;
  font-family: inherit;
  transition: all 0.25s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--glass-bg-hover);
}

.text-input::placeholder {
  color: var(--text-muted);
}

/* 导航按钮 */
.survey-nav {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.btn {
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--glass-bg-hover);
}

.btn-skip {
  background: rgba(139, 92, 246, 0.15);
  color: var(--private-color);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.btn-skip:hover {
  background: rgba(139, 92, 246, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--glass-border);
}

.btn-outline:hover {
  background: var(--glass-bg);
}

/* ========== 结果页 ========== */
.result-container {
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.result-header {
  text-align: center;
  margin-bottom: 24px;
  color: white;
}

.result-icon {
  font-size: 56px;
  margin-bottom: 10px;
  animation: bounce 1s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.result-header h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.result-subtitle {
  font-size: 15px;
  opacity: 0.9;
}

/* 统计卡片 */
.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 16px 10px;
  text-align: center;
  box-shadow: var(--glass-shadow);
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 分支信息 */
.result-branch-info {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--private-color);
  margin-bottom: 20px;
}

/* 回答详情 */
.result-answers {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 20px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: var(--glass-shadow);
}

.result-answers::-webkit-scrollbar {
  width: 6px;
}

.result-answers::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
}

.result-answers h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  position: sticky;
  top: 0;
  background: var(--glass-bg);
  padding-bottom: 10px;
  backdrop-filter: blur(20px);
}

.answers-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.answer-item {
  padding: 12px 14px;
  background: var(--input-bg);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}

.answer-item.skipped {
  opacity: 0.6;
  border-left-color: var(--text-muted);
}

.answer-item.private {
  border-left-color: var(--private-color);
  background: rgba(139, 92, 246, 0.08);
}

.answer-question {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.answer-num {
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.private-badge {
  font-size: 10px;
  background: rgba(139, 92, 246, 0.2);
  color: var(--private-color);
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}

.answer-title {
  flex: 1;
}

.answer-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  padding-left: 22px;
}

.skipped-text {
  color: var(--text-muted);
  font-style: italic;
}

/* 结果操作按钮 */
.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.result-actions .btn {
  flex: 1;
  min-width: 140px;
}

.privacy-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px;
}

/* ========== 响应式 ========== */
@media (max-width: 600px) {
  #app {
    padding: 12px;
  }

  .home-header h1 {
    font-size: 24px;
  }

  .survey-list {
    grid-template-columns: 1fr;
    max-height: 45vh;
  }

  .question-card {
    padding: 18px;
  }

  .question-title {
    font-size: 17px;
  }

  .result-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-number {
    font-size: 20px;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions .btn {
    width: 100%;
  }

  .survey-nav {
    flex-wrap: wrap;
  }

  .survey-nav .btn {
    flex: 1;
    min-width: 100px;
  }

  .version-selector {
    flex-direction: column;
  }
}

@media (max-width: 400px) {
  .logo {
    font-size: 18px;
  }

  .home-header h1 {
    font-size: 20px;
  }

  .option-text {
    font-size: 14px;
  }
}
