/* ============================================================
   ProductReview Plugin — review.css
   ============================================================ */

/* ── CSS 变量 ─────────────────────────────────────────────── */
#pr-section {
  --pr-primary   : #2e9e8a;
  --pr-primary-lt: #e8f6f4;
  --pr-star      : #f0a500;
  --pr-star-empty: #d9d9d9;
  --pr-border    : #e5e7eb;
  --pr-text      : #1a1a1a;
  --pr-muted     : #6b7280;
  --pr-card-bg   : #ffffff;
  --pr-form-bg   : #ffffff;
  --pr-radius    : 6px;
}

/* ── 全局容器 ─────────────────────────────────────────────── */
.pr-wrap {
  margin: 32px 0;
  font-family: inherit;
  color: var(--pr-text);
}

/* ── 星级基础 ─────────────────────────────────────────────── */
.pr-sf { color: var(--pr-star); }
.pr-se { color: var(--pr-star-empty); }

/* ── 商品详情页：价格上方迷你评分摘要 ─────────────────────── */
.pr-mini-summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  line-height: 1;
  flex-wrap: wrap;
}

.pr-mini-stars {
  font-size: 15px;
  letter-spacing: 1px;
}

.pr-mini-count {
  color: var(--pr-muted);
  font-size: 14px;
  line-height: 1;
}

@media (max-width: 768px) {
  .pr-mini-summary { margin-bottom: 6px; }
  .pr-mini-stars { font-size: 14px; }
  .pr-mini-count { font-size: 13px; }
}

/* ════════════════════════════════════════════════════════════
   摘要栏
════════════════════════════════════════════════════════════ */
.pr-summary {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 24px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius);
  background: #fff;
  flex-wrap: wrap;
  margin-bottom: 0;
}

.pr-score-block {
  min-width: 160px;
  text-align: left;
}

.pr-big-stars { font-size: 22px; line-height: 1.2; }

.pr-avg-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--pr-text);
  margin: 4px 0 2px;
}

.pr-base-cnt {
  font-size: 13px;
  color: var(--pr-muted);
}

.pr-verified-mark {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: var(--pr-primary);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  margin-left: 4px;
}

/* 分布条 */
.pr-bars-block {
  flex: 1;
  min-width: 180px;
}

.pr-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.pr-bar-lbl {
  font-size: 13px;
  white-space: nowrap;
  min-width: 64px;
}

.pr-bar-track {
  flex: 1;
  height: 8px;
  background: var(--pr-border);
  border-radius: 4px;
  overflow: hidden;
}

.pr-bar-fill {
  height: 100%;
  background: var(--pr-primary);
  border-radius: 4px;
  transition: width .3s;
}

.pr-bar-cnt {
  font-size: 13px;
  color: var(--pr-muted);
  min-width: 28px;
  text-align: right;
}

/* 写评价区 */
.pr-write-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 130px;
}

.pr-write-btn {
  display: inline-block;
  padding: 8px 20px;
  border: 1px solid var(--pr-primary);
  border-radius: 3px;
  background: transparent;
  color: var(--pr-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.pr-write-btn:hover {
  background: var(--pr-primary);
  color: #fff;
}

.pr-write-btn--disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ════════════════════════════════════════════════════════════
   内嵌写评价表单
════════════════════════════════════════════════════════════ */
.pr-form-section {
  border: 1px solid var(--pr-border);
  border-top: none;
  background: var(--pr-form-bg);
}

.pr-form-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 24px 32px;
  text-align: center;
}

.pr-form-heading {
  font-size: 20px;
  font-weight: 600;
  color: var(--pr-text);
  margin: 0 0 28px;
  letter-spacing: .3px;
}

.pr-form-alert {
  padding: 10px 16px;
  border-radius: var(--pr-radius);
  font-size: 14px;
  margin-bottom: 16px;
  text-align: left;
}

.pr-form-alert--error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.pr-form-alert--success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* 字段 */
.pr-field {
  margin-bottom: 20px;
  text-align: left;
}

.pr-field--sm { margin-bottom: 12px; }

.pr-field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--pr-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.pr-field-label-sub {
  text-transform: none;
  font-weight: 400;
  font-size: 11px;
  color: var(--pr-muted);
  margin-left: 6px;
  letter-spacing: 0;
}

.pr-nickname-preview {
  color: var(--pr-primary);
  font-weight: 600;
  text-decoration: underline dotted;
}

.pr-name-caret { font-size: 10px; }

.pr-field-input,
.pr-field-textarea {
  width: 100%;
  border: 1px solid var(--pr-primary);
  border-radius: 3px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--pr-text);
  background: #fff;
  transition: box-shadow .15s;
  outline: none;
  box-sizing: border-box;
}

.pr-field-input:focus,
.pr-field-textarea:focus {
  box-shadow: 0 0 0 3px rgba(46, 158, 138, .15);
}

.pr-field-textarea {
  resize: vertical;
  min-height: 100px;
}

/* 星级选择器 */
.pr-star-selector {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 4px;
}

.pr-star-sel {
  font-size: 28px;
  cursor: pointer;
  color: var(--pr-star-empty);
  transition: color .1s, transform .1s;
  line-height: 1;
}

.pr-star-sel:hover,
.pr-star-sel.pr-star-on { color: var(--pr-star); }

.pr-star-sel:hover { transform: scale(1.15); }

/* 上传区域 */
.pr-upload-area {
  border: 2px dashed var(--pr-border);
  border-radius: var(--pr-radius);
  padding: 28px 20px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: border-color .15s, background .15s;
}

.pr-upload-area:hover {
  border-color: var(--pr-primary);
  background: var(--pr-primary-lt);
}

.pr-upload-icon { color: #9ca3af; }
.pr-upload-area:hover .pr-upload-icon { color: var(--pr-primary); }

/* 上传预览 */
.pr-upload-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pr-preview-item {
  position: relative;
  width: 64px;
  height: 64px;
  border: 1px solid var(--pr-border);
  border-radius: 4px;
  overflow: visible;
}

.pr-preview-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.pr-preview-video {
  width: 64px;
  height: 64px;
  background: #1a1a1a;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
  font-size: 10px;
  gap: 2px;
  padding: 4px;
  text-align: center;
}

.pr-preview-filename {
  word-break: break-all;
  font-size: 9px;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pr-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  z-index: 1;
}

/* 匿名 */
.pr-anon-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--pr-muted);
}

/* 按钮行 */
.pr-form-btns {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.pr-btn-cancel {
  padding: 10px 24px;
  border: 1px solid var(--pr-border);
  border-radius: 3px;
  background: #fff;
  color: var(--pr-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.pr-btn-cancel:hover {
  border-color: var(--pr-text);
  color: var(--pr-text);
}

.pr-btn-submit {
  padding: 10px 28px;
  border: 1px solid var(--pr-primary);
  border-radius: 3px;
  background: var(--pr-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}

.pr-btn-submit:hover   { background: #268a78; }
.pr-btn-submit:disabled { opacity: .6; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════
   排序栏
════════════════════════════════════════════════════════════ */
.pr-sort-bar {
  display: flex;
  align-items: center;
  padding: 14px 0;
  margin-top: 4px;
}

.pr-sort-wrap { position: relative; }

.pr-sort-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--pr-text);
  cursor: pointer;
  padding: 4px 6px 4px 0;
  font-weight: 500;
}

.pr-sort-caret { font-size: 11px; }

.pr-sort-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  padding: 4px 0;
  min-width: 150px;
  z-index: 100;
  list-style: none;
  margin: 0;
}

.pr-sort-menu.pr-menu-open { display: block; }

.pr-sort-menu li {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--pr-text);
  white-space: nowrap;
}

.pr-sort-menu li:hover        { background: var(--pr-primary-lt); }
.pr-sort-menu li.pr-sort-active { color: var(--pr-primary); font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   评价卡片瀑布流（CSS columns — 自动填满列，实现 masonry 效果）
════════════════════════════════════════════════════════════ */
.pr-grid {
  columns: 5;
  column-gap: 16px;
  margin-top: 8px;
}

.pr-card {
  break-inside: avoid;       /* 禁止卡片在列内断开 */
  margin-bottom: 16px;
  background: var(--pr-card-bg);
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pr-card-stars { font-size: 17px; line-height: 1; }

.pr-card-author {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pr-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--pr-primary);
  max-width: 20ch;      /* 约 20 字符宽度 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;       /* 有 verified 徽章时可收缩 */
}

.pr-badge-verified {
  display: inline-block;
  background: var(--pr-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* 图片/视频区 */
.pr-card-media { position: relative; border-radius: 4px; overflow: hidden; }

.pr-card-img {
  width: 100%;
  height: auto;        /* 保持原始比例，瀑布流靠此自然撑开 */
  display: block;
  border-radius: 4px;
  cursor: zoom-in;
  transition: opacity .15s;
}

.pr-card-img:hover { opacity: .9; }

.pr-card-thumbs {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.pr-card-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 3px;
  cursor: zoom-in;
  flex-shrink: 0;
}

/* 视频卡片容器 */
.pr-card-video-wrap {
  position: relative;
  cursor: pointer;
}

/* 视频封面（首帧抓取后填入 src）*/
.pr-card-video-thumb {
  width: 100%;
  height: auto;
  min-height: 120px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  background: #1a1a1a;
}

/* 播放图标悬浮层 */
.pr-card-video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.pr-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: rgba(255,255,255,.85);
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  pointer-events: none;
}

.pr-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--pr-text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.pr-card-content {
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.pr-card-reply {
  font-size: 13px;
  color: var(--pr-muted);
  background: #f9fafb;
  border-left: 3px solid var(--pr-primary);
  padding: 8px 12px;
  border-radius: 0 4px 4px 0;
}

/* 空状态（columns 布局中需 column-span: all 跨全列） */
.pr-empty {
  column-span: all;
  text-align: center;
  padding: 40px 16px;
  color: var(--pr-muted);
  font-size: 15px;
}

/* ── 加载更多 ─────────────────────────────────────────────── */
.pr-load-more-wrap {
  text-align: center;
  margin-top: 24px;
}

.pr-load-more-btn {
  display: inline-block;
  padding: 10px 32px;
  border: 1px solid var(--pr-border);
  border-radius: 3px;
  background: #fff;
  color: var(--pr-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.pr-load-more-btn:hover {
  border-color: var(--pr-primary);
  color: var(--pr-primary);
}

.pr-load-more-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── 加载动画 ─────────────────────────────────────────────── */
.pr-loading {
  column-span: all;
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.pr-loading::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--pr-border);
  border-top-color: var(--pr-primary);
  border-radius: 50%;
  animation: pr-spin .7s linear infinite;
}

@keyframes pr-spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════
   Lightbox
════════════════════════════════════════════════════════════ */
.pr-lb {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.pr-lb.pr-lb-open { display: flex; }

/* 卡片容器 — 固定宽度、垂直布局 */
.pr-lb-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 64px rgba(0,0,0,.45);
}

/* 关闭按钮 — 卡片右上角 */
.pr-lb-x {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(0,0,0,.45);
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: .9;
}
.pr-lb-x:hover { opacity: 1; background: rgba(0,0,0,.65); }

/* 图片区域 — 固定高度，黑底 */
.pr-lb-media {
  position: relative;
  background: #111;
  flex-shrink: 0;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pr-lb-img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
}

/* 左右翻页箭头 — 浮在图片上 */
.pr-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  font-size: 28px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
  transition: background .15s;
}
.pr-lb-nav:hover { background: rgba(255,255,255,.38); }
.pr-lb-prev { left: 8px; }
.pr-lb-next { right: 8px; }

/* 缩略图条 — 图片与信息面板之间 */
.pr-lb-strips {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: #1a1a1a;
  overflow-x: auto;
  flex-shrink: 0;
}
.pr-lb-strips:empty { display: none; }

.pr-lb-strip {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  opacity: .5;
  flex-shrink: 0;
  transition: opacity .15s;
  border: 2px solid transparent;
}
.pr-lb-strip:hover,
.pr-lb-strip.pr-lb-strip-a { opacity: 1; border-color: var(--pr-primary); }

/* 视频缩略图 strip（带封面 + 播放图标） */
.pr-lb-strip-video {
  position: relative;
  width: 60px;
  height: 60px;
  background-color: #1a1a1a;
  background-size: cover;
  background-position: center;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  opacity: .55;
  border: 2px solid transparent;
  transition: opacity .15s;
  overflow: hidden;
  vertical-align: top;
}
.pr-lb-strip-video:hover,
.pr-lb-strip-video.pr-lb-strip-a { opacity: 1; border-color: var(--pr-primary); }

/* 视频 strip 内的播放图标覆盖层 */
.pr-lb-strip-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  background: rgba(0,0,0,.35);
  border-radius: 2px;
  pointer-events: none;
}

/* 视频播放器（lightbox 内） */
.pr-lb-video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 4px;
  display: block;
  background: #000;
}

/* 信息面板 — 白底，可滚动 */
.pr-lb-info {
  background: #fff;
  padding: 16px 18px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

/* 第一行：星级 + 日期 */
.pr-lb-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pr-lb-info-stars { font-size: 18px; color: var(--pr-gold); line-height: 1; }

.pr-lb-info-date { color: #aaa; font-size: 12px; white-space: nowrap; }

/* 第二行：头像 + 昵称 + verified */
.pr-lb-info-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.pr-lb-info-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #bbb;
}

.pr-lb-info-name {
  font-weight: 600;
  font-size: 14px;
  color: #222;
  max-width: 20ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

/* Verified 标签 — 绿色勾 */
.pr-lb-verified {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #27ae60;
  font-size: 12px;
  font-weight: 500;
}
.pr-lb-verified-icon {
  width: 16px;
  height: 16px;
  background: #27ae60;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  flex-shrink: 0;
}

.pr-lb-info-title {
  font-weight: 700;
  font-size: 14px;
  color: #222;
  margin-bottom: 6px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.pr-lb-info-body {
  color: #444;
  line-height: 1.7;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
}

.pr-lb-info-reply {
  margin-top: 12px;
  color: #666;
  font-size: 13px;
  border-top: 1px solid #eee;
  padding-top: 10px;
}

/* 滚动锁 */
.pr-no-scroll { overflow: hidden !important; }

/* ── 响应式 ───────────────────────────────────────────────── */

/* 平板：3 列 */
@media (max-width: 1200px) {
  .pr-grid { columns: 4; }
}

@media (max-width: 900px) {
  .pr-grid { columns: 3; }
}

@media (max-width: 768px) {
  .pr-summary { gap: 16px; }
  .pr-score-block { min-width: 120px; }
  .pr-avg-num { font-size: 22px; }
  .pr-big-stars { font-size: 18px; }
  .pr-write-block { align-items: flex-start; }

  /* 移动端：2 列 */
  .pr-grid { columns: 2; column-gap: 10px; }
  .pr-card { margin-bottom: 10px; padding: 12px; }

  .pr-form-inner { padding: 28px 16px 24px; }

  .pr-lb-inner { max-width: 94vw; border-radius: 10px; }
  .pr-lb-media { height: 240px; }
  .pr-lb-img   { max-height: 240px; }
}

@media (max-width: 480px) {
  .pr-summary { flex-direction: column; align-items: flex-start; }
  .pr-write-block { width: 100%; align-items: stretch; }
  .pr-write-btn { text-align: center; }
}

/* 超小屏仍保持 2 列 */
@media (max-width: 360px) {
  .pr-grid { columns: 2; column-gap: 8px; }
}
