/* C3DP Reviews — Phase 2 (customer flow + history)
 * Spec: C3DP_Spec_Reviews_v1_1.docx Section 17 (brand alignment)
 * Phase 3 will extend this for product page + listing card display.
 *
 * Brand: lime #a3e635 (filled stars, primary CTA), grey #d1d5db (empty stars),
 * blue #2487ce (links), no border-radius anywhere.
 */

/* ── Stars (display) ────────────────────────────────────── */
.r-stars {
  color: #a3e635;
  letter-spacing: 1px;
  font-size: 1rem;
  white-space: nowrap;
}
.r-stars__off { color: #d1d5db; }

/* ── Stars (input — radio overlay) ──────────────────────── */
.r-stars-input {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 6px;
  font-size: 2.2rem;
  line-height: 1;
  margin-top: 4px;
  padding: 4px 0;
}
.r-stars-input__label { cursor: pointer; }
.r-stars-input__label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.r-stars-input__star {
  color: #d1d5db;
  transition: color 80ms ease;
  display: inline-block;
}
/* Highlight this star and all later siblings (which are visually to the LEFT
 * because of row-reverse). Result: hovering the 4th star highlights stars 1–4. */
.r-stars-input__label:hover .r-stars-input__star,
.r-stars-input__label:hover ~ .r-stars-input__label .r-stars-input__star,
.r-stars-input__label input:checked ~ .r-stars-input__star,
.r-stars-input__label input:checked + .r-stars-input__star {
  color: #a3e635;
}
.r-stars-input__label:has(input:checked) ~ .r-stars-input__label .r-stars-input__star {
  color: #a3e635;
}

/* ── Form layout (customer review submission) ───────────
   Designed to drop inside .acct-main as a self-contained card.
   Brand: white card on neutral page; lime CTA; blue focus ring. */
.r-form {
  max-width: 720px;
  margin: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 24px 28px;
}
.r-form__group {
  display: block;
  margin: 0 0 18px 0;
  border: 0;
  padding: 0;
  min-width: 0; /* required so fieldset doesn't blow out flex/grid containers */
}
.r-form__group legend {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
  padding: 0;
  color: #1f2937;
}
.r-form__label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: #1f2937;
}
.r-form__hint {
  font-weight: 400;
  color: #64748b;
  font-size: 0.82rem;
}
.r-form input[type="text"],
.r-form input[type="file"],
.r-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  font-size: 0.95rem;
  font-family: inherit;
  background: #ffffff;
  color: #1f2937;
  box-sizing: border-box;
  line-height: 1.4;
}
.r-form textarea { resize: vertical; min-height: 140px; }
.r-form input:focus,
.r-form textarea:focus {
  outline: 2px solid #2487ce;
  outline-offset: 1px;
  border-color: #2487ce;
}
.r-form input[type="file"] {
  padding: 8px 10px;
  background: #f8fafc;
  cursor: pointer;
}
.r-form__radio {
  display: inline-block;
  margin-right: 22px;
  margin-top: 4px;
  font-weight: 500;
  color: #1f2937;
  cursor: pointer;
}
.r-form__radio input { margin-right: 6px; vertical-align: middle; }
.r-form__error {
  color: #b91c1c;
  font-size: 0.82rem;
  margin-top: 6px;
  font-weight: 500;
}
.r-form__notice {
  font-size: 0.82rem;
  color: #64748b;
  margin: 16px 0 0 0;
}
.r-form__actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
}

/* ── Buttons ────────────────────────────────────────────── */
.r-btn {
  display: inline-block;
  padding: 10px 20px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
}
.r-btn--primary {
  background: #a3e635;
  color: #222;
  border-color: #a3e635;
}
.r-btn--primary:hover { background: #84cc16; border-color: #84cc16; }
.r-btn--ghost {
  background: transparent;
  color: #2487ce;
  border-color: #cbd5e1;
}
.r-btn--ghost:hover { background: #f1f5f9; }

/* ── Photo preview (after file picker) ──────────────────── */
.r-photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.r-photo-preview img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border: 1px solid #ddd;
  display: block;
}
.r-photo-preview__error {
  color: #a02020;
  font-size: 0.85rem;
  width: 100%;
}

/* ── Flash messages ─────────────────────────────────────── */
.r-flash {
  padding: 12px 16px;
  margin: 0 0 18px 0;
  border-left: 4px solid;
  font-size: 0.95rem;
}
.r-flash--error  { background: #fef2f2; border-color: #a02020; color: #7f1d1d; }
.r-flash--ok     { background: #f0fdf4; border-color: #16a34a; color: #14532d; }

/* ── Review status badges (history page) ────────────────── */
.r-badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.r-badge--green  { background: #dcfce7; color: #166534; }
.r-badge--orange { background: #ffedd5; color: #9a3412; }
.r-badge--grey   { background: #e2e8f0; color: #475569; }

/* ========================================================================
   Phase 3 — Public display
   Stars on listing/detail/featured + reviews block on product page
   ======================================================================== */

/* ── Inline star widget (helper-rendered) ───────────────── */
.c3dp-stars {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.95rem;
  letter-spacing: 1px;
  line-height: 1;
}
.c3dp-stars__on  { color: #a3e635; white-space: nowrap; }
.c3dp-stars__off { color: #d1d5db; white-space: nowrap; }
.c3dp-stars__half {
  position: relative;
  display: inline-block;
  color: #d1d5db;
}
.c3dp-stars__half::before {
  content: '★';
  position: absolute;
  left: 0;
  top: 0;
  width: 50%;
  overflow: hidden;
  color: #a3e635;
}
.c3dp-stars__count,
.c3dp-stars__count-link {
  font-size: 0.82rem;
  color: #666;
  letter-spacing: 0;
  text-decoration: none;
  font-weight: 500;
}
.c3dp-stars__count-link:hover { color: #2487ce; text-decoration: underline; }
.c3dp-stars--lg { font-size: 1.6rem; }

/* ── Card-level stars (listing + featured) ──────────────── */
.pc-rating {
  margin: 4px 0 0 0;
  font-size: 0.85rem;
  line-height: 1;
}
.pc-rating .c3dp-stars { font-size: 0.9rem; }

/* ── Product detail title rating row ────────────────────── */
.di-rating {
  margin: 4px 0 14px 0;
  font-size: 1rem;
  line-height: 1;
}
.di-rating .c3dp-stars {
  font-size: 1.5rem;
  letter-spacing: 2px;
}
.di-rating .c3dp-stars__count-link {
  font-size: 0.85rem;
  margin-left: 4px;
}

/* ── Reviews block (on product detail page) ─────────────── */
.c3dp-reviews {
  margin: 48px 0 32px 0;
  padding: 28px 0 0 0;
  border-top: 1px solid #e2e8f0;
  scroll-margin-top: 80px;
}
.c3dp-reviews__heading {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 24px 0;
  color: #222;
}

/* Empty state */
.c3dp-reviews__empty {
  background: #f8fafc;
  border-left: 4px solid #2487ce;
  padding: 18px 20px;
  color: #444;
}
.c3dp-reviews__empty p { margin: 0 0 6px 0; }
.c3dp-reviews__empty-sub { color: #666; font-size: 0.9rem; }

/* Summary (avg + distribution) */
.c3dp-reviews__summary {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 24px;
  padding: 20px;
  background: #f8fafc;
}
.c3dp-reviews__summary-left { text-align: center; }
.c3dp-reviews__avg-num {
  font-size: 3rem;
  font-weight: 700;
  color: #222;
  line-height: 1;
}
.c3dp-reviews__avg-stars { margin: 6px 0; }
.c3dp-reviews__avg-count { font-size: 0.85rem; color: #666; }

.c3dp-reviews__bar-row {
  display: grid;
  grid-template-columns: 32px 1fr 36px;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.c3dp-reviews__bar-label { font-weight: 600; color: #444; }
.c3dp-reviews__bar-track {
  background: #e2e8f0;
  height: 8px;
  display: block;
  position: relative;
}
.c3dp-reviews__bar-fill {
  background: #a3e635;
  height: 100%;
  display: block;
  transition: width 200ms ease;
}
.c3dp-reviews__bar-count { color: #666; text-align: right; }

@media (max-width: 600px) {
  .c3dp-reviews__summary { grid-template-columns: 1fr; gap: 18px; }
}

/* Sort row */
.c3dp-reviews__sort {
  margin: 0 0 18px 0;
  font-size: 0.9rem;
  color: #666;
}
.c3dp-reviews__sort-label { margin-right: 8px; font-weight: 600; }
.c3dp-reviews__sort-link {
  display: inline-block;
  padding: 4px 10px;
  margin-right: 4px;
  color: #2487ce;
  text-decoration: none;
  background: transparent;
}
.c3dp-reviews__sort-link:hover { background: #eef3f6; }
.c3dp-reviews__sort-link.is-active {
  background: #2487ce;
  color: #fff;
}

/* Review card */
.c3dp-reviews__list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.c3dp-review {
  border: 1px solid #e2e8f0;
  padding: 18px 20px;
  background: #fff;
}
.c3dp-review__header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.c3dp-review__rating { line-height: 1; }
.c3dp-review__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #222;
  flex: 1 1 auto;
}
.c3dp-review__badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.c3dp-review__badge--verified {
  background: #2487ce;
  color: #fff;
}
.c3dp-review__badge--imported {
  background: #e2e8f0;
  color: #475569;
}
.c3dp-review__body {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #333;
  margin-bottom: 12px;
  white-space: pre-wrap;
}
.c3dp-review__photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.c3dp-review__photos img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border: 1px solid #ddd;
  display: block;
  cursor: zoom-in;
  transition: transform 120ms ease;
}
.c3dp-review__photos img:hover { transform: scale(1.04); }
.c3dp-review__footer {
  font-size: 0.85rem;
  color: #666;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.c3dp-review__name { font-weight: 600; color: #444; }
.c3dp-review__sep  { color: #ccc; }
.c3dp-review__recommend { color: #16a34a; font-weight: 600; }

/* Pagination */
.c3dp-reviews__pagination {
  margin-top: 20px;
  text-align: center;
}
.c3dp-reviews__page-link {
  display: inline-block;
  padding: 6px 12px;
  margin: 0 2px;
  background: #eef3f6;
  color: #333;
  text-decoration: none;
  font-size: 0.85rem;
}
.c3dp-reviews__page-link.is-active {
  background: #2487ce;
  color: #fff;
}
.c3dp-reviews__page-link:hover { background: #d6e2ea; }
.c3dp-reviews__page-link.is-active:hover { background: #1a6aad; }
