/* 公开店铺优惠券标签 + 领取弹窗（FEAT-PUBLIC-PRODUCT-COUPON-BADGE-01）
 *
 * 全局共享样式，供 dealer-web / factory-web 公开店铺的首页/商品列表/详情页复用。
 * 原则：
 *   1. 标签紧贴价格右侧、尺寸包裹内容，不得占满价格行/遮挡价格标题图片。
 *   2. 弹窗在移动端为底部抽屉、桌面端居中卡片，320/375/390/桌面端均不产生横向溢出。
 *   3. 全部为后端返回字段驱动；前端仅在 couponAvailable 为真时出现标签。
 */

/* ---------- 价格后标签 ---------- */
/* 仅当价格元素内被挂载券标签时加入修饰类，使价格+标签同行且可自动换行，避免溢出。
   文本节点在 flex 容器内视为匿名 flex item，标签自然排到价格右侧。 */
.cf-badge-host {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cf-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  height: 20px;
  max-width: 100%;
  padding: 0 6px;
  margin-top: 2px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6a3d, #e8590c);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 2px rgba(232, 89, 12, 0.35);
}

.cf-badge-icon {
  width: 12px;
  height: 12px;
  flex: none;
}

.cf-badge-label {
  flex: none;
}

/* ---------- 领取弹窗 ---------- */
.cf-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 12px 12px 0;
  box-sizing: border-box;
}

.cf-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: 82vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.18);
}

.cf-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.cf-title {
  font-size: 16px;
  font-weight: 700;
  color: #1f2933;
  flex: none;
}

.cf-title-product {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: #8a94a0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cf-close {
  flex: none;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: #8a94a0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}

.cf-close:hover { background: #f5f6f7; }

.cf-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

.cf-loading,
.cf-empty {
  padding: 28px 8px;
  text-align: center;
  font-size: 13px;
  color: #8a94a0;
}

.cf-list { display: block; }

.cf-coupon {
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px dashed #f0d6bf;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffbf6, #fff6ec);
}

.cf-coupon-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cf-coupon-title {
  font-size: 14px;
  font-weight: 700;
  color: #2d2d2d;
  word-break: break-word;
}

.cf-coupon-tag {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: #b35a12;
  background: rgba(232, 89, 12, 0.12);
}

.cf-coupon-rule {
  margin-top: 8px;
  font-size: 13px;
  color: #e8590c;
  font-weight: 600;
  word-break: break-word;
}

.cf-coupon-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #8a94a0;
}

.cf-coupon-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.cf-coupon-remain,
.cf-coupon-state {
  flex: 1 1 auto;
  font-size: 11px;
  color: #8a94a0;
}

.cf-claim {
  flex: none;
  min-height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: #e8590c;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.cf-claim:disabled,
.cf-claim.is-disabled {
  background: #ecb99a;
  cursor: not-allowed;
}

.cf-coupon-msg {
  margin-top: 6px;
  font-size: 12px;
  color: #c0392b;
}

.cf-policy-notice {
  position: fixed;
  left: 50%;
  bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 2000;
  max-width: calc(100vw - 24px);
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  transform: translateX(-50%);
}

/* ---------- 桌面端 ---------- */
@media (min-width: 521px) {
  .cf-overlay {
    align-items: center;
    padding: 24px;
  }
  .cf-dialog {
    max-height: 70vh;
    border-radius: 16px;
    width: 520px;
  }
}
