/* ============================================================
   新料咨询 - 移动端 H5 样式
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #333;
  background: #f5f6f8;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100%; display: flex; flex-direction: column; }

.page { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.page-content { flex: 1; }
.page-gray { background: #f5f6f8; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; outline: none; background: none; cursor: pointer; }
input, textarea { font-family: inherit; outline: none; border: none; }
img { display: block; }

/* ---------------- 顶部导航栏 ---------------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  height: 46px; padding: 0 14px;
  background: #fff; border-bottom: 1px solid #f0f0f0;
}
.navbar-title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 16px; font-weight: 600; color: #222; }
.navbar-back {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #333; position: relative; z-index: 1;
}
.navbar-right { width: 60px; text-align: right; font-size: 13px; color: #666; position: relative; z-index: 1; }

/* ---------------- 分类 tab ---------------- */
.tabs-wrap { position: sticky; top: 0; z-index: 99; background: #fff; }
.cat-tabs {
  display: flex; align-items: center;
  padding: 0 6px; height: 44px;
  overflow-x: auto; white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0; padding: 0 14px; height: 44px; line-height: 44px;
  font-size: 14px; color: #666; position: relative;
}
.cat-tab.active { color: #00B578; font-weight: 600; }
.cat-tab.active::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 20px; height: 3px; border-radius: 3px; background: #00B578;
}

/* ---------------- 作品卡片 ---------------- */
.work-card {
  background: #fff; border-radius: 10px;
  margin: 10px 12px 0; padding: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.work-author { display: flex; align-items: center; }
.work-avatar, .expert-avatar, .my-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.work-author-info { flex: 1; min-width: 0; margin-left: 10px; }
.work-author-name { font-size: 14px; font-weight: 600; color: #222; }
.work-author-job {
  font-size: 11px; color: #999; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-follow {
  flex-shrink: 0; margin-left: 10px;
  padding: 5px 14px; border-radius: 15px;
  font-size: 12px; color: #00B578;
  border: 1px solid #00B578; background: #fff;
  transition: all .2s;
}
.btn-follow.followed { color: #bbb; border-color: #ddd; }

.work-title {
  margin-top: 10px; font-size: 16px; font-weight: 600; color: #222;
  line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.work-digest {
  margin-top: 6px; font-size: 13px; color: #888; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.work-meta { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; }
.work-time { font-size: 11px; color: #bbb; }
.work-price { font-size: 15px; font-weight: 700; color: #e64340; }
.work-price.free { color: #07c160; font-size: 13px; font-weight: 600; }

/* 搜索框（列表页顶部） */
.search-bar {
  margin: 10px 12px 0; padding: 0 12px;
  height: 34px; border-radius: 17px; background: #f2f3f5;
  display: flex; align-items: center;
}
.search-bar svg { width: 15px; height: 15px; margin-right: 6px; flex-shrink: 0; }
.search-bar input { flex: 1; height: 100%; background: transparent; font-size: 13px; color: #333; }
.search-bar input::placeholder { color: #bbb; }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: sticky; bottom: 0; z-index: 100;
  display: flex; background: #fff;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid #f0f0f0;
}
.tabbar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: #999; }
.tabbar-item svg { width: 22px; height: 22px; }
.tabbar-item.active { color: #00B578; }

/* ---------------- 登录/注册页 ---------------- */
.auth-page { background: #fff; }
.auth-logo-wrap { display: flex; flex-direction: column; align-items: center; padding: 64px 0 40px; }
.auth-logo {
  width: 76px; height: 76px;
}
.auth-logo svg { width: 76px; height: 76px; display: block; filter: drop-shadow(0 8px 18px rgba(0,145,224,.25)); }
.auth-logo-text { margin-top: 14px; font-size: 21px; font-weight: 700; color: #0a8c6e; letter-spacing: 1px; }

.auth-form { padding: 0 36px; }
.auth-field {
  display: flex; align-items: center;
  border-bottom: 1px solid #f0f0f0; padding: 14px 0;
}
.auth-field .field-icon { width: 20px; height: 20px; margin-right: 12px; flex-shrink: 0; }
.auth-field .field-icon svg, .field-clear svg, .field-eye svg { width: 100%; height: 100%; display: block; }
.auth-field input { flex: 1; font-size: 15px; color: #333; background: transparent; }
.auth-field input::placeholder { color: #c3c3c3; }
.field-tip { font-size: 11px; color: #c3c3c3; margin: 6px 0 0 32px; }
.field-clear { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.field-eye { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }

.btn-primary {
  display: block; width: 100%; height: 44px; margin-top: 34px;
  border-radius: 22px; font-size: 16px; color: #fff; font-weight: 600;
  background: linear-gradient(90deg, #00C48C 0%, #0091E0 100%);
  box-shadow: 0 6px 16px rgba(0,180,120,.28);
}
.btn-primary:active { opacity: .85; }

.auth-links { margin-top: 18px; text-align: center; font-size: 13px; color: #999; }
.auth-links em { font-style: normal; color: #00B578; }

.auth-wx { display: flex; flex-direction: column; align-items: center; margin-top: 46px; }
.auth-wx-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: #07c160;
  box-shadow: 0 4px 12px rgba(7,193,96,.3);
}
.auth-wx-icon svg { width: 30px; height: 30px; }
.auth-wx-text { margin-top: 8px; font-size: 12px; color: #999; }

.auth-agree {
  display: flex; align-items: center; justify-content: center;
  margin-top: 26px; padding: 0 20px;
  font-size: 11px; color: #b2b2b2; line-height: 1.5;
}
.auth-agree .agree-check {
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid #d9d9d9; margin-right: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; transition: all .15s;
}
.auth-agree .agree-check.checked { background: #00B578; border-color: #00B578; }
.auth-agree a { color: #6a8ade; }

/* ---------------- 详情页 ---------------- */
.detail-author {
  display: flex; align-items: center;
  background: #fff; padding: 14px 12px;
}
.detail-title {
  background: #fff; padding: 4px 12px 10px;
  font-size: 19px; font-weight: 700; color: #111; line-height: 1.45;
}
.detail-meta { background: #fff; padding: 0 12px 12px; font-size: 11px; color: #bbb; }
.detail-body { background: #fff; padding: 6px 12px 20px; }
.detail-body p { font-size: 15px; line-height: 1.75; color: #3a3a3a; margin-bottom: 14px; text-align: justify; }
.detail-body.locked { position: relative; max-height: 300px; overflow: hidden; }
.detail-body.locked::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 120px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #fff 82%);
}
.pay-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 12px 12px; color: #b2b2b2; font-size: 12px;
}
.pay-divider::before, .pay-divider::after { content: ''; flex: 1; border-top: 1px dashed #ddd; }

.pay-bar {
  position: sticky; bottom: 0; z-index: 100;
  display: flex; align-items: center;
  background: #fff; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #f0f0f0;
}
.pay-price { flex: 1; font-size: 20px; font-weight: 700; color: #e64340; }
.pay-price small { font-size: 12px; }
.btn-pay {
  display: flex; align-items: center; gap: 5px;
  height: 38px; padding: 0 16px; border-radius: 19px;
  font-size: 14px; font-weight: 600;
}
.btn-pay svg { width: 16px; height: 16px; }
.btn-pay.wx { color: #07c160; border: 1px solid #07c160; margin-right: 10px; }
.btn-pay.alipay { color: #1677ff; border: 1px solid #1677ff; }
.btn-pay.paid { color: #07c160; border: 1px solid #07c160; }

/* ---------------- 专家卡片 ---------------- */
.expert-card {
  background: #fff; border-radius: 10px;
  margin: 10px 12px 0; padding: 14px;
  display: flex; align-items: flex-start;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.expert-info { flex: 1; min-width: 0; margin-left: 10px; }
.expert-name { font-size: 15px; font-weight: 600; color: #222; display: flex; align-items: center; }
.expert-job { font-size: 12px; color: #999; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expert-intro {
  margin-top: 8px; font-size: 12px; color: #888; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.expert-consult {
  flex-shrink: 0; margin-left: 10px; text-align: center;
}
.expert-consult-price {
  padding: 6px 16px; border-radius: 18px;
  background: linear-gradient(90deg, #ffe7b8 0%, #ffd76e 100%);
  color: #c0392b; font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(255,201,82,.35);
}
.expert-consult-btn {
  margin-top: 6px; font-size: 11px; color: #c0392b; text-align: center;
}

/* ---------------- 专家咨询页 ---------------- */
.consult-hero { background: #fff; padding: 14px 12px; display: flex; align-items: center; }
.consult-hero-info { flex: 1; min-width: 0; margin-left: 10px; }
.consult-price-tag { font-size: 17px; font-weight: 700; color: #e64340; margin-top: 2px; }
.consult-section { background: #fff; margin-top: 10px; padding: 14px 12px; }
.consult-section-title { font-size: 14px; font-weight: 600; color: #333; }
.consult-textarea {
  width: 100%; min-height: 130px; margin-top: 10px;
  background: #f7f8fa; border-radius: 8px; padding: 12px;
  font-size: 14px; color: #333; line-height: 1.6; resize: none;
}
.consult-textarea::placeholder { color: #c3c3c3; }
.consult-count { text-align: right; font-size: 11px; color: #bbb; margin-top: 6px; }
.consult-count.warn { color: #e64340; }
.consult-history { margin-top: 6px; }
.consult-history-item {
  background: #f7f8fa; border-radius: 8px; padding: 12px; margin-top: 10px;
  font-size: 13px; color: #555; line-height: 1.6;
}
.consult-history-item .status { display: inline-block; margin-top: 6px; font-size: 11px; color: #07c160; }
.consult-empty { text-align: center; color: #c3c3c3; font-size: 12px; padding: 24px 0; }
.consult-submit-bar {
  position: sticky; bottom: 0;
  background: #fff; border-top: 1px solid #f0f0f0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center;
}
.consult-submit-bar .note { flex: 1; font-size: 11px; color: #bbb; line-height: 1.5; }
.consult-submit-bar .note b { color: #e64340; font-size: 15px; }
.btn-submit {
  height: 40px; padding: 0 26px; border-radius: 20px;
  background: linear-gradient(90deg, #00C48C 0%, #0091E0 100%);
  color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,180,120,.28);
}

/* ---------------- 我的页面 ---------------- */
.my-header {
  background: #fff; padding: 22px 12px 16px;
  display: flex; align-items: center;
}
.my-avatar { width: 60px; height: 60px; }
.my-user-info { flex: 1; min-width: 0; margin-left: 12px; }
.my-nickname { font-size: 17px; font-weight: 700; color: #222; }
.my-regtime { font-size: 11px; color: #b2b2b2; margin-top: 5px; }
.btn-setting {
  flex-shrink: 0; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
}
.btn-setting svg { width: 20px; height: 20px; }

.my-stats {
  background: #fff; display: flex;
  padding: 14px 0 16px; border-top: 1px solid #f7f7f7;
}
.my-stat { flex: 1; text-align: center; }
.my-stat b { display: block; font-size: 18px; color: #222; }
.my-stat span { display: block; font-size: 11px; color: #b2b2b2; margin-top: 3px; }

.sub-tabs {
  display: flex; background: #fff; margin-top: 10px;
  border-bottom: 1px solid #f0f0f0;
}
.sub-tab {
  flex: 1; height: 44px; line-height: 44px; text-align: center;
  font-size: 14px; color: #666; position: relative;
}
.sub-tab.active { color: #00B578; font-weight: 600; }
.sub-tab.active::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 28px; height: 3px; border-radius: 3px; background: #00B578;
}

.empty-state { text-align: center; padding: 70px 0; color: #c3c3c3; font-size: 13px; }
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 14px; opacity: .5; }

/* 已购条目 */
.record-card {
  background: #fff; border-radius: 10px; margin: 10px 12px 0; padding: 13px 14px;
  display: flex; align-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.record-info { flex: 1; min-width: 0; }
.record-title { font-size: 14px; font-weight: 600; color: #222; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-sub { font-size: 11px; color: #b2b2b2; margin-top: 4px; }
.record-price { flex-shrink: 0; margin-left: 10px; font-size: 14px; font-weight: 700; color: #e64340; }

/* ---------------- 设置页 ---------------- */
.cell-group { background: #fff; border-radius: 10px; margin: 10px 12px 0; overflow: hidden; }
.cell {
  display: flex; align-items: center;
  padding: 15px 14px; border-bottom: 1px solid #f7f7f7;
  font-size: 14px; color: #333;
}
.cell:last-child { border-bottom: none; }
.cell-label { flex: 1; }
.cell-arrow { width: 7px; height: 7px; border-top: 1.5px solid #c8c8c8; border-right: 1.5px solid #c8c8c8; transform: rotate(45deg); }
.cell-value { font-size: 12px; color: #bbb; margin-right: 8px; }
.btn-logout {
  display: block; width: calc(100% - 24px); margin: 30px 12px;
  height: 44px; border-radius: 22px;
  background: #fff; color: #e64340; font-size: 15px; font-weight: 600;
  border: 1px solid #ffd4d2;
}

/* ---------------- 协议页 ---------------- */
.protocol-page { background: #fff; padding: 18px 16px 40px; }
.protocol-page h3 { font-size: 13px; color: #999; font-weight: 400; margin-bottom: 4px; }
.protocol-page p { font-size: 14px; line-height: 1.8; color: #444; margin-bottom: 12px; text-align: justify; }
.protocol-page p strong { color: #222; }

/* ---------------- 弹窗 / Toast ---------------- */
.toast {
  position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%);
  max-width: 70%; padding: 11px 18px; border-radius: 8px;
  background: rgba(0,0,0,.75); color: #fff; font-size: 13px; line-height: 1.5;
  z-index: 9999; text-align: center;
  animation: toast-in .18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%,-50%) scale(.92); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }

.modal-mask {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in .2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.pay-sheet {
  width: 100%; background: #fff;
  border-radius: 14px 14px 0 0;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  animation: sheet-up .22s ease;
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.pay-sheet-title { text-align: center; font-size: 15px; font-weight: 600; color: #222; }
.pay-amount { text-align: center; margin: 14px 0 18px; }
.pay-amount b { font-size: 32px; color: #e64340; font-weight: 700; }
.pay-amount small { font-size: 15px; color: #e64340; }
.pay-method {
  display: flex; align-items: center; padding: 14px 4px;
  border-top: 1px solid #f5f5f5; font-size: 15px; color: #333;
}
.pay-method svg { width: 22px; height: 22px; margin-right: 10px; }
.pay-method .chk { margin-left: auto; width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid #ddd; }
.pay-method.selected .chk { border-color: #00B578; background: #00B578; box-shadow: inset 0 0 0 3px #fff; }
.pay-sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.pay-sheet-actions .btn { flex: 1; height: 42px; border-radius: 21px; font-size: 15px; }
.pay-sheet-actions .btn-cancel { background: #f2f3f5; color: #666; }
.pay-sheet-actions .btn-confirm { background: linear-gradient(90deg,#00C48C,#0091E0); color: #fff; font-weight: 600; }
.pay-demo-tip { text-align: center; margin-top: 12px; font-size: 11px; color: #c3c3c3; }
.pay-demo-tip em { font-style: normal; color: #6a8ade; }

/* 微信模拟授权弹窗 */
.wx-auth-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
}
.wx-auth-card {
  width: 78%; background: #fff; border-radius: 12px;
  padding: 24px 20px 16px; text-align: center;
}
.wx-auth-card .app-name { font-size: 15px; font-weight: 600; color: #222; margin-top: 12px; }
.wx-auth-card .desc { font-size: 12px; color: #999; margin-top: 10px; line-height: 1.6; }
.wx-auth-card .app-logo {
  width: 46px; height: 46px; margin: 0 auto;
}
.wx-auth-card .app-logo svg { width: 46px; height: 46px; display: block; }
.wx-auth-btns { display: flex; margin-top: 20px; border-top: 1px solid #f0f0f0; }
.wx-auth-btns button { flex: 1; height: 42px; font-size: 15px; }
.wx-auth-btns .allow { color: #07c160; font-weight: 600; }
.wx-auth-btns .deny { color: #999; border-right: 1px solid #f0f0f0; }

/* 加载更多 */
.load-more { text-align: center; color: #c3c3c3; font-size: 12px; padding: 16px 0 20px; }
