/* ============================================================
   茶叶审评 - 移动端 H5 样式
   设计原则：大按钮、大字体、底部主操作（单手拇指可达）、响应式
   ============================================================ */

:root {
  --primary: #2e7d32;          /* 茶绿 */
  --primary-dark: #1b5e20;
  --primary-light: #e8f5e9;
  --accent: #ff7043;           /* 茶橙 */
  --text: #1f1f1f;
  --text-light: #666;
  --border: #e0e0e0;
  --bg: #f5f7f6;
  --card: #ffffff;
  --danger: #d32f2f;
  --radius: 12px;
  --shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  /* 适配移动端安全区 */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- 顶部导航栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.topbar .back {
  font-size: 22px;
  width: 32px;
  color: #fff;
  cursor: pointer;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; flex: 1; text-align: center; }
.topbar .right { min-width: 32px; text-align: right; font-size: 14px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px;
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input, .field textarea, .field select {
  width: 100%;
  font-size: 16px;          /* >=16px 避免 iOS 自动放大 */
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  color: var(--text);
  font-family: inherit;
  transition: border-color .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.field textarea { min-height: 80px; resize: vertical; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* 语音输入按钮（贴在输入框右侧） */
.input-with-mic { position: relative; }
.input-with-mic textarea { padding-right: 48px; }
.mic-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mic-btn.recording {
  background: var(--danger);
  color: #fff;
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ---------- 按钮（大、易点） ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;            /* 拇指友好 */
  padding: 0 20px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }
.btn-block { display: flex; width: 100%; }
.btn-accent { background: var(--accent); }
.btn-danger { background: var(--danger); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-primary-bg { background: var(--primary); }

/* 底部固定主操作栏 */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
  display: flex;
  gap: 12px;
  z-index: 90;
}
/* 内容区给底部栏留空间 */
.has-bottom-bar { padding-bottom: 80px; }

/* ---------- 列表 ---------- */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.list-item:active { background: var(--primary-light); }
.list-item .title { font-size: 16px; font-weight: 500; }
.list-item .sub { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* 品类标签 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #fff;
  margin-right: 6px;
}

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty .icon { font-size: 48px; margin-bottom: 12px; }

/* ---------- 详情页 ---------- */
.detail-section { margin-bottom: 16px; }
.detail-section h3 {
  font-size: 15px;
  color: var(--primary);
  margin: 0 0 6px;
  border-left: 3px solid var(--primary);
  padding-left: 8px;
}
.detail-section p { margin: 0; color: var(--text); }

/* 图片九宫格 */
.img-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.img-grid .img-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}
.img-grid .img-cell img { width: 100%; height: 100%; object-fit: cover; }
.img-cell .type-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
}
.img-cell .del-btn {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(211, 47, 47, 0.9);
  color: #fff;
  border: none;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 上传占位 */
.upload-add {
  aspect-ratio: 1;
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 12px;
  gap: 4px;
  cursor: pointer;
}
.upload-add .plus { font-size: 24px; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--primary-dark), var(--primary));
}
.login-logo {
  color: #fff;
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .icon { font-size: 56px; }
.login-logo h1 { margin: 8px 0 4px; font-size: 22px; }
.login-logo p { margin: 0; opacity: 0.85; font-size: 14px; }
.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* ---------- 底部 Tab 栏 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: var(--safe-bottom);
  z-index: 90;
}
.tabbar a {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  color: var(--text-light);
  font-size: 12px;
  text-decoration: none;
}
.tabbar a .ic { font-size: 22px; display: block; }
.tabbar a.active { color: var(--primary); }

/* ---------- toast / loading ---------- */
.__toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: 80%;
  text-align: center;
}
.__toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.__loading {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}
.__loading-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 搜索框 */
.search-bar {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}
.search-bar input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 15px;
}
.search-bar .mode-toggle {
  font-size: 12px;
  color: var(--primary);
  padding: 0 8px;
  align-self: center;
  white-space: nowrap;
}

/* 响应式：窄屏紧凑，宽屏（平板）限宽居中 */
@media (min-width: 640px) {
  body { background: var(--bg); }
  .page { max-width: 720px; margin: 0 auto; }
}

/* FAQ 折叠 */
.faq-item {
  background: #fff;
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-item .q {
  padding: 12px 14px;
  font-weight: 600;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
}
.faq-item .q .arrow { margin-left: auto; transition: transform .2s; color: var(--text-light); }
.faq-item.open .q .arrow { transform: rotate(90deg); }
.faq-item .a {
  display: none;
  padding: 0 14px 12px;
  color: var(--text-light);
  font-size: 14px;
}
.faq-item.open .a { display: block; }
