/**
 * "我的"页样式（设计稿 H1-me-home）
 * 复用 relationships-report.css 米色调 token（直接内联色值，不跨文件 var 倒挂）
 */

.me-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  /* 底部 tabbar 56px + safe-area 兜底 */
  padding-bottom: 80px;
  background: #faf3e3;
  min-height: 100vh;
  min-height: 100dvh;
  color: #3a2e1f;
  font-family: var(--onboard-font-sans, -apple-system, "PingFang SC", sans-serif);
}

/* ============ Profile header card ============ */
.me-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #e3d4ae;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  position: relative;
}
.me-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  /* 兜底色：JS 通过 inline style 传 avatarFallbackStyle()；
     /auth/me 不含 gender（users 表无该列），默认走中性紫蓝渐变 */
  background: linear-gradient(135deg, #23244F 0%, #5B4FB3 100%);
  background-position: center;
  background-size: cover;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  flex: 0 0 auto;
}
.me-info {
  flex: 1;
  min-width: 0;
}
.me-name {
  font-size: 18px;
  font-weight: 600;
  color: #3a2e1f;
}
.me-id {
  font-size: 12px;
  color: #8a7860;
  margin-top: 2px;
}
.me-edit {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #a07a32;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}

/* ============ "查看完整人格解读"虚线行 ============ */
.me-report-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px dashed #e3d4ae;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: #3a2e1f;
  cursor: pointer;
}
.me-report-link::after {
  content: '→';
  color: #a07a32;
  font-size: 14px;
}

/* ============ Section 标题 ============ */
.me-section-heading {
  font-size: 12px;
  color: #8a7860;
  margin: 0 4px 8px;
  letter-spacing: 0.5px;
}

/* ============ 卡片行 (飞星工具 / 我的档案) ============ */
.me-card-row {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e3d4ae;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #3a2e1f;
  cursor: pointer;
}
.me-card-row__icon {
  margin-right: 10px;
  font-size: 18px;
  line-height: 1;
}
.me-card-row__label {
  flex: 1;
  font-weight: 500;
}
.me-card-row__meta {
  color: #8a7860;
  font-size: 12px;
  margin-right: 6px;
}
.me-card-row__chevron {
  color: #a07a32;
  font-size: 14px;
}

/* ============ Footer 链接（用户协议 / 隐私政策）============ */
.me-footer-links {
  text-align: center;
  margin: 24px 0 12px;
  font-size: 12px;
  color: #8a7860;
}
.me-footer-links button {
  background: none;
  border: none;
  color: #8a7860;
  font-size: 12px;
  cursor: pointer;
  padding: 0 8px;
}
.me-footer-links span {
  color: #c1995a;
}

/* ============ 套餐额度卡片 ============ */
.me-quota-card {
  background: #ffffff;
  border: 1px solid #e3d4ae;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.me-quota-loading {
  font-size: 13px;
  color: #8a7860;
  text-align: center;
  padding: 8px 0;
}
.me-quota-plans {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.me-quota-tag {
  background: #f5e9c8;
  border: 1px solid #e3c97a;
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 12px;
  color: #7a5c1e;
  font-weight: 500;
}
.me-quota-row {
  margin-bottom: 10px;
}
.me-quota-row:last-child {
  margin-bottom: 0;
}
.me-quota-row__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}
.me-quota-row__label {
  font-size: 13px;
  font-weight: 500;
  color: #3a2e1f;
}
.me-quota-row__hint {
  font-size: 12px;
  color: #8a7860;
}
.me-quota-bar {
  height: 6px;
  background: #f0e6cc;
  border-radius: 99px;
  overflow: hidden;
}
.me-quota-bar__fill {
  height: 100%;
  background: #c1995a;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.me-quota-bar__fill--low {
  background: #c0594a;
}

/* ============ 退出登录 ============ */
.me-logout {
  display: block;
  width: 100%;
  background: #ffffff;
  border: 1px solid #e3d4ae;
  border-radius: 999px;
  padding: 12px 0;
  color: #c0594a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 1px;
}
.me-logout:active { transform: scale(0.99); }

/* main-view / me-view 给 tabbar 留底空间的规则统一在 tabbar.css 里，
   不放在本文件（避免 me.css 跨文件耦合 main-view 布局，review#3 必修）*/

/* "查看完整人格解读"在 self 档案数据未就绪前 disabled 状态 */
.me-report-link.is-disabled,
.me-report-link[disabled] {
  opacity: 0.5;
  cursor: wait;
}

/* ============ 兑换码 bottom sheet ============ */
.me-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.me-sheet[hidden] { display: none; }
.me-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.me-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #faf3e3;
  border-radius: 18px 18px 0 0;
  padding: 18px 20px calc(28px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.18);
  animation: me-sheet-slide-up 220ms ease-out;
}
@keyframes me-sheet-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.me-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.me-sheet__title {
  font-size: 16px;
  font-weight: 600;
  color: #3a2e1f;
}
.me-sheet__close {
  background: none;
  border: none;
  color: #8a7860;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.me-sheet__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.me-sheet__input {
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid #e3d4ae;
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 15px;
  color: #3a2e1f;
  letter-spacing: 1px;
  outline: none;
}
.me-sheet__input:focus {
  border-color: #c1995a;
}
.me-sheet__input::placeholder {
  color: #b3a387;
  letter-spacing: 0;
}
/* 二维码弹窗里可编辑的 URL / path —— 长串、要换行、等宽看得清 */
.me-sheet__input--url {
  letter-spacing: 0;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  word-break: break-all;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.me-sheet__error {
  font-size: 12px;
  color: #c0594a;
  margin-top: -6px;
  padding-left: 4px;
}
/* sheet 顶部说明文案（如绑定邀请人「绑定后不可更改」） */
.me-sheet__hint {
  font-size: 13px;
  line-height: 1.5;
  color: #8a795c;
}
.me-sheet__submit {
  width: 100%;
  background: #c1995a;
  border: none;
  border-radius: 999px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 0;
  letter-spacing: 1px;
  cursor: pointer;
  margin-top: 6px;
}
.me-sheet__submit:active { transform: scale(0.99); }
.me-sheet__submit:disabled {
  opacity: 0.55;
  cursor: wait;
}
/* 次要按钮（如「复制链接」）：描边而非填充，跟主按钮区分主次 */
.me-sheet__submit--ghost {
  background: transparent;
  color: #b07d2e;
  border: 1px solid #d9c08a;
  margin-top: 0;
}

/* ===== 联系客服 ClawBot 绑定 sheet ===== */
.me-clawbot-qrbox {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 240px;
  height: 240px;
  margin: 8px auto 4px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #ececec;
  overflow: hidden;
}
.me-clawbot-qr {
  width: 224px;
  height: 224px;
  display: block;
}
.me-clawbot-qr-empty {
  color: #999;
  font-size: 14px;
  text-align: center;
  padding: 0 16px;
}
.me-clawbot-qr-empty a { color: #c8893a; }
.me-clawbot-status {
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  min-height: 21px;
}

/* ===== 专属海报 sheet（canvas 合成的成品海报，长按保存）===== */
.me-poster-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 280px;
  /* 海报比例 1086×1448 ≈ 0.75；占位时给个最小高避免抖动 */
  min-height: 200px;
  margin: 8px auto 4px;
}
.me-poster-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.me-poster-empty {
  color: #999;
  font-size: 14px;
  text-align: center;
  padding: 0 16px;
}

/* ===== 「我的记忆」sheet 列表（user_memories 查看/删除）===== */
.me-memory-hint {
  font-size: 12px;
  color: #8a8a8a;
  line-height: 1.5;
  margin-bottom: 12px;
}
.me-memory-list {
  max-height: 46vh;
  overflow-y: auto;
  margin-bottom: 12px;
}
.me-memory-empty {
  text-align: center;
  color: #9a9a9a;
  font-size: 13px;
  padding: 28px 8px;
  line-height: 1.6;
}
.me-memory-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.me-memory-item__type {
  flex: 0 0 auto;
  font-size: 11px;
  color: #c1995a;
  background: rgba(193, 153, 90, 0.12);
  border-radius: 6px;
  padding: 2px 7px;
  margin-top: 1px;
}
.me-memory-item__text {
  flex: 1 1 auto;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
  word-break: break-word;
}
.me-memory-item__del {
  flex: 0 0 auto;
  border: none;
  background: none;
  color: #bbb;
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.me-memory-item__del:active { color: #e0556f; }
.me-sheet__submit--danger {
  background: #e0556f;
}
