/* ============================================================
   coupons.css — 优惠圈（列表 / 详情 / 编辑 / 小程序 embed 精简版）
   与 section.css 的列表页基类（.sec-*）搭配使用。
   注意：base.css 有 form input[type="text"]{max-width:300px}，
   本文件的输入类一律用更高优先级把宽度撑满。
   ============================================================ */

/* ---- 通用 ---- */
.cp-page, .cp-embed-main, .cp-detail, .cp-edit-page {
  --cp-ink: #202124;
  --cp-muted: #5f6368;
  --cp-line: #dadce0;
  --cp-blue: #1967d2;
  --cp-orange: #b45309;
  color: var(--cp-ink);
}

.cp-lead {
  margin: 0 0 16px;
  color: var(--cp-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ---- 列表卡片 ---- */
.cp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin: 16px 0 8px;
}
.cp-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--cp-line);
  border-radius: 14px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.08);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.cp-card:hover {
  transform: translateY(-2px);
  border-color: #c6dafc;
  box-shadow: 0 6px 18px rgba(60, 64, 67, 0.16);
}
.cp-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f4f6fa;
  overflow: hidden;
}
.cp-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cp-cover-ph {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; font-size: 2.6rem;
}
.cp-expiry {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #166534; font-size: 0.75rem; font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.cp-expiry-soon { background: #fff1e6; color: var(--cp-orange); }
.cp-body { display: flex; flex-direction: column; flex: 1; gap: 6px; padding: 12px 14px 14px; }
.cp-title { font-size: 1rem; font-weight: 700; line-height: 1.4; }
.cp-merchant { font-size: 0.82rem; color: var(--cp-muted); }
.cp-desc { font-size: 0.85rem; color: #4a4f55; line-height: 1.55; }
.cp-foot {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-top: auto; padding-top: 8px; font-size: 0.78rem; color: var(--cp-muted);
}
.cp-addr { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-more { flex: none; color: var(--cp-blue); font-weight: 600; }
.cp-until { font-size: 0.74rem; color: #80868b; border-top: 1px dashed #e8eaed; padding-top: 8px; }

.cp-empty {
  margin: 22px 0; padding: 28px 18px; text-align: center;
  border: 1px dashed #cfd6de; border-radius: 12px;
  background: #fff; color: var(--cp-muted); line-height: 1.9;
}
.cp-empty-sub { font-size: 0.82rem; color: #9aa0a6; }

.cp-pagination { margin-top: 20px; }
.sec-admin { margin-top: 22px; text-align: center; }
.sec-admin-btn {
  display: inline-block; padding: 7px 18px; border: 1px solid #f4b400;
  border-radius: 16px; background: #fff; color: #b06000;
  font-size: 0.85rem; text-decoration: none;
}

/* 搜索框：覆盖 base.css 的 300px 限制（完整版会加载 base.css） */
.cp-page form input.sec-search-input,
.cp-embed-main form input.sec-search-input {
  max-width: none; width: 100%; box-sizing: border-box;
}

/* ---- 小程序 web-view 精简外壳 ---- */
.cp-embed {
  margin: 0; background: #f7f9fc; color: var(--cp-ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}
.cp-embed-main { max-width: 960px; margin: 0 auto; padding: 14px 14px 40px; }
.cp-mini-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--cp-line);
  font-size: 0.9rem;
}
.cp-mini-title { font-weight: 700; }
.cp-mini-home, .cp-mini-brand { color: var(--cp-blue); text-decoration: none; font-size: 0.82rem; }
.cp-mini-brand { color: #80868b; }

/* ---- 详情 ---- */
.cp-detail { max-width: 720px; margin: 0 auto; padding: 12px 0 44px; }
.cp-back { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 0.88rem; }
.cp-back a { color: var(--cp-blue); text-decoration: none; }
.cp-detail-card {
  overflow: hidden; border: 1px solid var(--cp-line); border-radius: 16px;
  background: #fff; box-shadow: 0 1px 4px rgba(60, 64, 67, 0.08);
}
.cp-detail-img { display: block; width: 100%; max-height: 460px; object-fit: contain; background: #f4f6fa; }
.cp-detail-body { padding: 18px 20px 22px; }
.cp-badge {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  background: #e8f5ec; color: #166534; font-size: 0.8rem; font-weight: 700;
}
.cp-badge-soon { background: #fff1e6; color: var(--cp-orange); }
.cp-detail-body h1 { margin: 12px 0 4px; font-size: 1.5rem; line-height: 1.35; }
.cp-detail-merchant { color: var(--cp-muted); font-size: 0.9rem; }
.cp-block { margin-top: 20px; padding-top: 16px; border-top: 1px solid #eef0f3; }
.cp-block h2 { margin: 0 0 10px; font-size: 1rem; font-weight: 700; }
.cp-prose { color: #3c4043; font-size: 0.92rem; line-height: 1.85; white-space: pre-wrap; }
.cp-address {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 15px; border: 1px solid #c6dafc; border-radius: 10px;
  background: #f2f7ff; color: #174ea6; text-decoration: none; font-size: 0.92rem;
}
.cp-address:hover { background: #e8f0fe; }
.cp-address-text { min-width: 0; word-break: break-word; }
.cp-address-go { flex: none; font-weight: 700; }
.cp-until-line { margin: 0; font-size: 0.92rem; color: #3c4043; }
.cp-meta { margin-top: 22px; color: #9aa0a6; font-size: 0.78rem; }
.cp-expired-note {
  margin-top: 12px; padding: 10px 14px; border-radius: 8px;
  background: #fff1f2; color: #a32d2d; font-size: 0.86rem;
}
.cp-admin-actions { margin-top: 18px; text-align: center; }
.cp-edit-btn {
  display: inline-block; padding: 8px 20px; border: 1px solid #f4b400;
  border-radius: 18px; background: #fff; color: #b06000;
  font-size: 0.86rem; text-decoration: none;
}

/* ---- 自定义新增 / 编辑页 ---- */
.cp-edit-page { max-width: 760px; margin: 0 auto; padding: 12px 0 48px; }
.cp-edit-back { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 0.88rem; }
.cp-edit-back a { color: var(--cp-blue); text-decoration: none; }
.cp-edit-title { margin: 0 0 6px; font-size: 1.4rem; }
.cp-edit-lead { margin: 0 0 20px; color: var(--cp-muted); font-size: 0.88rem; }
.cp-errors, .cp-err { color: #c5221f; font-size: 0.85rem; margin-top: 6px; }
.cp-errors { padding: 10px 14px; background: #fce8e6; border-radius: 8px; margin-bottom: 14px; }
.cp-form-card {
  margin-bottom: 18px; padding: 18px 20px; border: 1px solid var(--cp-line);
  border-radius: 14px; background: #fff;
}
.cp-form-card h2 { margin: 0 0 16px; font-size: 1.05rem; }
.cp-row { display: flex; flex-wrap: wrap; gap: 14px; }
.cp-row .cp-field { flex: 1 1 220px; }
.cp-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.cp-field:last-child { margin-bottom: 0; }
.cp-field-sm { flex: 0 1 150px !important; }
.cp-field label { font-size: 0.88rem; font-weight: 600; }
.cp-field label em { color: #c5221f; font-style: normal; }
.cp-field small { color: #80868b; font-size: 0.78rem; line-height: 1.5; }

/* (0,3,1) 稳稳盖过 base.css 的 form input[type="text"]{max-width:300px} */
.cp-form .cp-field input[type="text"],
.cp-form .cp-field input[type="date"],
.cp-form .cp-field input[type="number"],
.cp-form .cp-field input[type="file"],
.cp-form .cp-field select,
.cp-form .cp-field textarea {
  width: 100%; max-width: none; box-sizing: border-box;
  padding: 10px 12px; border: 1px solid var(--cp-line); border-radius: 8px;
  background: #fff; font: inherit; font-size: 16px; color: var(--cp-ink);
}
.cp-form .cp-field textarea { resize: vertical; line-height: 1.6; }
.cp-form .cp-field input:focus,
.cp-form .cp-field select:focus,
.cp-form .cp-field textarea:focus { outline: none; border-color: #4285f4; box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15); }
.cp-current-image { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; font-size: 0.78rem; color: var(--cp-muted); }
.cp-current-image img { width: 96px; height: 72px; object-fit: cover; border: 1px solid var(--cp-line); border-radius: 8px; }
.cp-map-preview { margin: 0; font-size: 0.85rem; }
.cp-map-preview a { color: var(--cp-blue); }
.cp-edit-warning { margin: 0; padding: 10px 14px; border-radius: 8px; background: #fff7ed; color: #9a3412; font-size: 0.85rem; }
.cp-form-actions { display: flex; align-items: center; gap: 16px; }
.cp-save {
  padding: 11px 26px; border: none; border-radius: 10px;
  background: #1967d2; color: #fff; font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
.cp-save:hover { background: #1557b0; }
.cp-cancel { color: var(--cp-muted); font-size: 0.88rem; text-decoration: none; }

@media (max-width: 480px) {
  .cp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cp-body { padding: 10px; }
  .cp-title { font-size: 0.92rem; }
  .cp-detail-body { padding: 16px; }
  .cp-form-card { padding: 14px; }
}
