/* ════════════════════════════════════════════════
   环境公益 AI 需求调研问卷 — 设计系统
   风格: Nature Distilled · 大地纸本
   核心原则: 无渐变 · 固体色彩 · 温暖纸感
   ════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700;800&display=swap');

:root {
  /* ── Earthy Palette (Solid, No Gradients) ── */
  --terracotta:     #C67B5C;
  --terracotta-dark:#A86545;
  --terracotta-deep:#8B5035;
  --olive:          #6B7B3C;
  --olive-light:    #8A9B5A;
  --olive-pale:     #E8EDD8;
  --warm-clay:      #B5651D;
  --cream-bg:       #F5F0E1;
  --surface:        #FAF7F0;
  --white:          #FFFFFF;
  --text:           #2D2A24;
  --text-secondary: #6B6560;
  --text-muted:     #9C958D;
  --border:         #E5DDD3;
  --border-light:   #EFE9E0;
  --border-hover:   #D5CBC0;
  --red:            #C0392B;
  --yellow-bg:      #FBF3E0;
  --yellow-border:  #F0E4C8;
  --yellow-text:    #8A6D2B;

  /* ── Shadows (Warm-tinted) ── */
  --shadow-sm:  0 1px 4px rgba(45, 42, 36, 0.05);
  --shadow-md:  0 2px 12px rgba(45, 42, 36, 0.06);
  --shadow-lg:  0 4px 24px rgba(45, 42, 36, 0.08);
  --shadow-xl:  0 8px 40px rgba(45, 42, 36, 0.10);
  --shadow-btn: 0 2px 8px rgba(198, 123, 92, 0.25);

  /* ── Radii ── */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* ── Transitions ── */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition: 200ms var(--ease-out);
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ── */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--cream-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ── Container ── */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ── */
.header {
  background: var(--terracotta);
  color: var(--white);
  padding: 48px 20px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle geometric pattern overlay using repeating dots (solid, no gradients) */
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='1' fill='rgba(255,255,255,0.07)'/%3E%3C/svg%3E");
  background-size: 40px 40px;
  pointer-events: none;
}

/* Diagonal line accent (replaces gradient swoosh) */
.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--olive);
}

.header .container {
  position: relative;
  z-index: 1;
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
  line-height: 1.3;
}

.header .subtitle {
  font-size: 14px;
  opacity: 0.85;
  font-weight: 400;
}

.header .estimate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  opacity: 0.75;
  margin-top: 14px;
  background: rgba(0, 0, 0, 0.12);
  padding: 5px 16px;
  border-radius: var(--radius-full);
  letter-spacing: 0.01em;
}

/* ── Stats Header Variant ── */
.header-stats {
  background: var(--olive);
}

.header-stats::after {
  background: var(--terracotta);
}

.header-admin {
  background: var(--text-secondary);
}

.header-admin::after {
  background: var(--terracotta);
}

/* ── Module Cards ── */
.module {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  margin: 20px 0;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.module:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.module-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.005em;
  color: var(--text);
}

.mod-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--terracotta);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.mod-num-alt {
  background: var(--olive);
}

.module-desc {
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--cream-bg);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 28px;
  line-height: 1.7;
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--terracotta);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.contact-grid .field {
  margin-bottom: 0;
}

/* ── Form Fields ── */
.field {
  margin-bottom: 28px;
}

.q-label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text);
  letter-spacing: 0.005em;
  line-height: 1.5;
}

.q-label .required {
  color: var(--red);
  margin-left: 2px;
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.6;
  background: var(--cream-bg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--olive);
}

.input, .textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  transition: all var(--transition);
  background: var(--white);
  color: var(--text);
}

.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(198, 123, 92, 0.12);
}

.input-inline {
  width: auto;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-left: 6px;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
}

.input-inline:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(198, 123, 92, 0.10);
}

.textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.6;
}

/* ── Radio / Checkbox Options ── */
.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15px;
  cursor: pointer;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  line-height: 1.5;
  border: 1px solid transparent;
  background: var(--white);
}

.opt:hover {
  background: var(--cream-bg);
  border-color: var(--border-light);
}

/* Selected state: when radio/checkbox inside is checked, highlight the label */
.opt:has(input:checked) {
  background: var(--olive-pale);
  border-color: var(--olive-light);
}

.opt input[type="radio"],
.opt input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--olive);
  width: 18px;
  height: 18px;
}

/* ── Rating Matrix ── */
.matrix-group {
  margin-bottom: 36px;
}

.matrix-group h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--terracotta-dark);
  margin-bottom: 12px;
  padding-left: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.matrix-group h3::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--terracotta);
  border-radius: 2px;
}

.matrix-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--white);
}

.matrix {
  width: 100%;
  min-width: 460px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.matrix thead th {
  background: var(--cream-bg);
  color: var(--text);
  font-weight: 600;
  padding: 13px 8px;
  text-align: center;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
}

.matrix thead th:first-child {
  text-align: left;
  padding-left: 16px;
}

.matrix thead th:last-child {
  padding-right: 16px;
}

.matrix tbody td {
  padding: 4px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.matrix tbody td:first-child {
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.matrix tbody tr:last-child td {
  border-bottom: none;
}

/* Rating hover highlight */
.matrix tbody tr:hover td {
  background: var(--cream-bg);
}

/* Attention/validation row */
.matrix tbody tr.attention-row {
  background: var(--yellow-bg);
}

.matrix tbody tr.attention-row td:first-child {
  color: var(--yellow-text);
  font-weight: 500;
}

.matrix tbody tr.attention-row:hover td {
  background: var(--yellow-border);
}

/* Rating radio buttons — bigger touch target */
.matrix input[type="radio"] {
  accent-color: var(--terracotta);
  width: 18px;
  height: 18px;
  cursor: pointer;
  transition: transform var(--transition);
}

.matrix input[type="radio"]:checked {
  transform: scale(1.15);
}

/* ── Submit Section ── */
.submit-section {
  text-align: center;
  padding: 40px 16px 60px;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  background: var(--cream-bg);
  padding: 8px 20px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--terracotta);
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  padding: 15px 44px;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-btn);
  font-family: inherit;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.btn-submit:hover {
  background: var(--terracotta-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(198, 123, 92, 0.30);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: var(--cream-bg);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.footer-info {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 28px;
  line-height: 1.8;
}

.qrcode-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
}

.qrcode-image {
  width: min(180px, 56vw);
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.qrcode-caption {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Stats Page ── */
.thanks-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--olive-pale);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 20px 0;
  font-size: 15px;
  line-height: 1.6;
  border: 1px solid var(--olive-light);
  box-shadow: var(--shadow-sm);
}

.thanks-icon {
  font-size: 32px;
  flex-shrink: 0;
  line-height: 1;
}

.thanks-banner strong {
  color: var(--olive);
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-state p {
  font-size: 17px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.stats-summary {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.stat-card {
  text-align: center;
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 28px 44px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

/* Small accent top bar on stat card (replaces gradient text) */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--terracotta);
}

.stat-number {
  font-size: 44px;
  font-weight: 800;
  color: var(--terracotta);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-number-alt {
  color: var(--olive);
}

.stat-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

.stats-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin: 20px 0;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.stats-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
  letter-spacing: 0.005em;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.ranking-group {
  margin-bottom: 28px;
}

.ranking-group h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--terracotta-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ranking-group h3::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 16px;
  background: var(--terracotta);
  border-radius: 2px;
}

.ranking-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.rank-label {
  width: 170px;
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-secondary);
}

.rank-bar-bg {
  flex: 1;
  height: 20px;
  background: var(--cream-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(45, 42, 36, 0.06);
}

.rank-bar {
  height: 100%;
  background: var(--olive);
  border-radius: var(--radius-full);
  min-width: 2px;
  transition: width 0.8s var(--ease-out);
}

.rank-score {
  width: 56px;
  text-align: right;
  font-weight: 600;
  font-size: 14px;
  color: var(--olive);
  flex-shrink: 0;
}

.chart-container {
  max-width: 480px;
  margin: 0 auto;
}

.chart-sm {
  max-width: 400px;
}

/* ── Word Cloud ── */
.wordcloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 28px 0;
  line-height: 1.3;
}

.wc-word {
  display: inline-block;
  padding: 2px 6px;
  font-weight: 600;
  color: var(--olive);
  transition: all var(--transition);
  cursor: default;
  border-radius: 4px;
}

.wc-word:hover {
  color: var(--terracotta);
  background: var(--cream-bg);
  transform: scale(1.15);
}

/* ── Admin ── */
.admin-login-card {
  max-width: 380px;
  margin: 48px auto;
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.admin-login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--terracotta);
}

.error-msg {
  background: #FDF2F2;
  color: var(--red);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid #F5C6C6;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  min-width: 700px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  background: var(--white);
}

.data-table th {
  background: var(--cream-bg);
  color: var(--text);
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
  font-size: 12px;
  text-transform: none;
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.data-table tbody tr:hover {
  background: var(--cream-bg);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Admin Nav Bar ── */
.admin-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
  padding: 6px 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-link:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--white);
}

.btn-link-danger {
  border-color: rgba(192, 57, 43, 0.5);
}

.btn-link-danger:hover {
  background: rgba(192, 57, 43, 0.2);
  border-color: rgba(192, 57, 43, 0.7);
}

/* ── Admin stat grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.stat-grid .stat-card {
  padding: 20px 24px;
}

.stat-label-sm {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.backup-actions {
  display: grid;
  gap: 16px;
}

.import-form {
  display: grid;
  gap: 12px;
}

.success-banner {
  color: var(--olive);
  background: var(--olive-pale);
  border: 1px solid var(--olive-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .header {
    padding: 32px 16px 28px;
  }
  .header h1 {
    font-size: 20px;
  }
  .header .subtitle {
    font-size: 13px;
  }
  .module {
    padding: 24px 16px;
    border-radius: var(--radius-md);
    margin: 12px 0;
  }
  .module-title {
    font-size: 16px;
  }
  .mod-num {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .matrix tbody td:first-child {
    font-size: 13px;
    padding: 10px 12px;
  }
  .rank-label {
    width: 120px;
    font-size: 12px;
  }
  .rank-bar-bg {
    height: 16px;
  }
  .btn-submit {
    width: 100%;
    padding: 15px 32px;
    font-size: 15px;
    justify-content: center;
  }
  .stats-section {
    padding: 24px 16px;
  }
  .stat-number {
    font-size: 36px;
  }
  .admin-nav {
    flex-direction: column;
    align-items: center;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 0 28px;
  }
  .module {
    padding: 40px 36px;
    margin: 24px 0;
  }
  .header h1 {
    font-size: 28px;
  }
}
