/* AI 盘货助手 —— 复刻微信小程序视觉与交互规范（对应需求 2.1） */

:root {
  --primary: #07c160;
  --primary-dark: #06ad56;
  --bg: #f7f7f7;
  --card: #ffffff;
  --text: #1f2329;
  --sub: #86909c;
  --border: #e8eaed;
  --danger: #fa5151;
  --radius: 12px;
  --nav-h: 44px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body.mp-body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 17px;
  color: var(--text);
  background: #eceff1;
  line-height: 1.5;
}

/* 手机外框：桌面端居中模拟小程序，移动端全屏 */
.mp-phone {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.08);
}

/* 顶部导航栏 */
.mp-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 8px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.mp-nav__back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding-bottom: 4px;
}

.mp-nav__title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.mp-nav__right {
  min-width: 40px;
  text-align: right;
  font-size: 15px;
  color: var(--sub);
}

.mp-nav__right a {
  color: var(--sub);
  text-decoration: none;
}

/* 内容区 */
.mp-content {
  flex: 1;
  padding-bottom: 32px;
}

.mp-safe-bottom {
  height: env(safe-area-inset-bottom, 0px);
}

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

.mp-card__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp-card__title::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--primary);
}

.mp-card__title--plain::before {
  display: none;
}

/* 列表项（小程序 cell 风格） */
.mp-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.mp-cell:last-child {
  border-bottom: none;
}

.mp-cell__main {
  flex: 1;
  min-width: 0;
}

.mp-cell__title {
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-cell__desc {
  font-size: 13px;
  color: var(--sub);
  margin-top: 2px;
}

.mp-cell__arrow {
  color: #c9cdd4;
  font-size: 18px;
}

.mp-list {
  background: var(--card);
  border-radius: var(--radius);
  margin: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* 表单 */
.mp-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.mp-field:last-child {
  border-bottom: none;
}

.mp-field__label {
  width: 104px;
  flex: none;
  font-size: 15px;
  color: var(--text);
}

.mp-field__label .req {
  color: var(--danger);
  margin-left: 2px;
}

.mp-field__control {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-input,
.mp-textarea,
.mp-select {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
  padding: 4px 0;
}

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

.mp-input::placeholder,
.mp-textarea::placeholder {
  color: #c9cdd4;
}

.mp-input--error {
  color: var(--danger);
}

.mp-field__unit {
  color: var(--sub);
  font-size: 15px;
  flex: none;
}

.mp-hint {
  font-size: 12px;
  color: var(--sub);
  margin: 6px 0 0;
}

.mp-hint--error {
  color: var(--danger);
}

/* 按钮 */
.mp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.16s, background 0.16s;
}

.mp-btn:active {
  opacity: 0.86;
}

.mp-btn[disabled] {
  background: #c8e9d4;
  cursor: not-allowed;
}

.mp-btn--ghost {
  background: #f2f3f5;
  color: var(--text);
}

.mp-btn--danger {
  background: #fff;
  color: var(--danger);
}

.mp-btn--mini {
  width: auto;
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
}

.mp-btn--block-secondary {
  margin-top: 10px;
}

/* 结果展示 */
.mp-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.mp-result {
  background: #f7f8fa;
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}

.mp-result__label {
  font-size: 12px;
  color: var(--sub);
  white-space: nowrap;
}

.mp-result__value {
  font-size: 19px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.mp-result__value--accent {
  color: var(--primary);
}

.mp-result__value--danger {
  color: var(--danger);
}

.mp-result__value--empty {
  color: #c9cdd4;
}

/* 卖点列表 */
.mp-point {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.mp-point:last-child {
  border-bottom: none;
}

.mp-checkbox {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border: 1.5px solid #c9cdd4;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
}

.mp-checkbox:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.mp-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.mp-point__body {
  flex: 1;
  min-width: 0;
}

.mp-point__title {
  font-size: 15px;
  font-weight: 600;
}

.mp-point__desc {
  font-size: 14px;
  color: var(--sub);
  margin-top: 3px;
}

/* 空状态 */
.mp-empty {
  text-align: center;
  color: var(--sub);
  font-size: 14px;
  padding: 48px 24px;
}

.mp-empty__icon {
  font-size: 44px;
  display: block;
  margin-bottom: 10px;
  opacity: 0.5;
}

/* 手卡预览 */
.mp-preview {
  margin-top: 14px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f7f8fa;
}

.mp-preview img {
  display: block;
  width: 100%;
}

.mp-preview__empty {
  padding: 40px 0;
  text-align: center;
  color: var(--sub);
  font-size: 14px;
}

.mp-upload {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mp-upload__thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f7f8fa;
}

.mp-upload__picker {
  flex: 1;
  border: 1px dashed #c9cdd4;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--sub);
  font-size: 14px;
  cursor: pointer;
}

.mp-upload__picker:active {
  background: #f7f8fa;
}

/* 徽标 */
.mp-badge {
  display: inline-block;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 10px;
  background: #e8f8ef;
  color: var(--primary);
  font-weight: 500;
}

.mp-badge--gray {
  background: #f2f3f5;
  color: var(--sub);
}

.mp-badge--warn {
  background: #fff5e6;
  color: #ff9a2e;
}

/* Toast */
.mp-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 10px;
  max-width: 76%;
  text-align: center;
  z-index: 1000;
  animation: mp-fade-in 0.18s ease;
}

.mp-toast--error {
  background: rgba(250, 81, 81, 0.92);
}

.mp-toasts .mp-toast {
  position: static;
  transform: none;
  margin: 10px 12px 0;
  max-width: none;
}

@keyframes mp-fade-in {
  from {
    opacity: 0;
    transform: translate(-50%, -46%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Modal */
.mp-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 32px;
}

.mp-modal[hidden] {
  display: none;
}

.mp-modal__box {
  width: 100%;
  max-width: 320px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
}

.mp-modal__title {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  padding: 22px 22px 8px;
}

.mp-modal__body {
  padding: 4px 22px 18px;
}

.mp-modal__desc {
  font-size: 14px;
  color: var(--sub);
  text-align: center;
  line-height: 1.6;
}

.mp-modal__actions {
  display: flex;
  border-top: 1px solid var(--border);
}

.mp-modal__actions button {
  flex: 1;
  height: 50px;
  border: none;
  background: #fff;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
}

.mp-modal__actions button.mp-modal__ok {
  color: var(--primary);
  font-weight: 600;
}

.mp-modal__actions button + button {
  border-left: 1px solid var(--border);
}

/* 段落标题与间距工具 */
.mp-section-gap {
  height: 8px;
}

.mp-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.mp-title-row .mp-card__title {
  margin: 0;
}

.mp-name {
  font-size: 20px;
  font-weight: 600;
  word-break: break-word;
}

.mp-meta {
  font-size: 13px;
  color: var(--sub);
  margin-top: 4px;
}

.mp-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mp-mt {
  margin-top: 12px;
}
