/* =====================================================================
   HELLO Online Shop: Reviews (redesign)
   Brand colors are CSS variables below. Change them here only.
   ===================================================================== */
.rv {
  --rv-brand: #7b1d35;        /* main maroon (buttons, accents) */
  --rv-brand-dark: #5f1428;   /* hover */
  --rv-soft: #f8ecea;         /* soft pink background (like delivery box) */
  --rv-border: #eadfdc;
  --rv-text: #2a1a1f;
  --rv-muted: #7c6e72;
  --rv-star: #f2a900;         /* filled star */
  --rv-star-off: #ddd3d0;     /* empty star */
  --rv-danger: #c0392b;
  --rv-radius: 10px;

  max-width: 960px;
  color: var(--rv-text);
  font-family: inherit;
}
.rv *, .rv *::before, .rv *::after { box-sizing: border-box; }
.rv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rv-req { color: var(--rv-danger); }
.rv-muted { color: var(--rv-muted); }
.rv-heading { margin: 0 0 16px; font-size: 1.4rem; font-weight: 600; }

/* ---------- Stars (gradient fill, supports partial stars like 4.3) ---------- */
.rv-stars {
  --pct: 0%;
  display: inline-block; font-size: 16px; line-height: 1; letter-spacing: 2px; white-space: nowrap;
  background: linear-gradient(90deg, var(--rv-star) var(--pct), var(--rv-star-off) var(--pct));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.rv-stars--lg { font-size: 22px; }

/* ---------- Buttons (match site: small radius, uppercase, spaced) ---------- */
.rv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border-radius: 6px; font: inherit; font-size: 13px;
  font-weight: 600; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  border: 1px solid var(--rv-brand); transition: background .15s, color .15s, opacity .15s;
}
.rv-btn--primary { background: var(--rv-brand); color: #fff; }
.rv-btn--primary:hover:not(:disabled) { background: var(--rv-brand-dark); border-color: var(--rv-brand-dark); }
.rv-btn--ghost { background: #fff; color: var(--rv-brand); }
.rv-btn--ghost:hover { background: var(--rv-soft); }
.rv-btn:disabled { opacity: .7; cursor: progress; }
.rv-btn:focus-visible { outline: 2px solid var(--rv-brand); outline-offset: 2px; }

/* ---------- Summary card ---------- */
.rv-top {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 32px;
  padding: 24px; background: var(--rv-soft); border: 1px solid var(--rv-border); border-radius: var(--rv-radius);
}
.rv-score { text-align: center; min-width: 120px; }
.rv-score-num { font-size: 3rem; font-weight: 700; line-height: 1; color: var(--rv-brand); }
.rv-score .rv-stars { margin: 8px 0 4px; }
.rv-score-count { font-size: .85rem; color: var(--rv-muted); }

.rv-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rv-bars li { display: grid; grid-template-columns: 34px 1fr 28px; align-items: center; gap: 10px; font-size: .82rem; }
.rv-bar-label { color: var(--rv-muted); white-space: nowrap; }
.rv-bar-track { height: 8px; border-radius: 99px; background: #fff; overflow: hidden; }
.rv-bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--rv-star); transition: width .4s ease; }
.rv-bar-num { text-align: right; color: var(--rv-muted); }

.rv-cta { max-width: 230px; text-align: center; }
.rv-cta-text { margin: 0 0 12px; font-size: .85rem; color: var(--rv-muted); line-height: 1.5; }
.rv-cta .rv-btn { width: 100%; }

/* ---------- Review list ---------- */
.rv-list { margin-top: 8px; }
.rv-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px;
  padding: 22px 0; border-bottom: 1px solid var(--rv-border);
}
.rv-item[hidden] { display: none; }               /* needed because .rv-item uses display:grid */
.rv-item--new { animation: rv-flash 3s ease-out; }
@keyframes rv-flash { from { background: var(--rv-soft); } to { background: transparent; } }

.rv-avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--rv-soft); color: var(--rv-brand); font-weight: 700; font-size: 1.05rem;
  border: 1px solid var(--rv-border);
}
.rv-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rv-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rv-name { font-size: .98rem; overflow-wrap: anywhere; }
.rv-date { font-size: .8rem; color: var(--rv-muted); }
.rv-item-title { margin: 10px 0 4px; font-size: 1rem; font-weight: 600; }
.rv-body { margin: 8px 0 0; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; font-size: .95rem; }
.rv-item-title + .rv-body { margin-top: 0; }
.rv-body.is-clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.rv-more {
  margin-top: 4px; padding: 4px 0; background: none; border: 0; cursor: pointer;
  color: var(--rv-brand); font: inherit; font-size: .85rem; font-weight: 600;
}
.rv-more:hover { text-decoration: underline; }

/* Photo thumbnails (70x70, click opens lightbox) */
.rv-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rv-photo {
  width: 70px; height: 70px; padding: 0; border: 1px solid var(--rv-border); border-radius: 8px;
  overflow: hidden; background: #f3eeed; cursor: zoom-in; transition: transform .15s, box-shadow .15s;
}
.rv-photo:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.rv-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.rv-more-wrap { text-align: center; margin-top: 22px; }

/* Empty state */
.rv-empty { text-align: center; padding: 40px 16px; }
.rv-empty p { margin: 0 0 4px; }
.rv-empty-icon {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
  background: var(--rv-soft); color: var(--rv-brand); font-size: 26px;
}

/* ---------- Modal (<dialog>): popup on desktop, bottom sheet on mobile ---------- */
body.rv-modal-open, body.rv-lb-open { overflow: hidden; }
.rv-modal {
  padding: 0; border: 0; border-radius: 14px; color: var(--rv-text);
  width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden;
}
.rv-modal[open] { display: flex; animation: rv-pop .2s ease-out; }
.rv-modal::backdrop { background: rgba(30, 10, 18, .55); backdrop-filter: blur(2px); }
@keyframes rv-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rv-sheet { from { transform: translateY(100%); } to { transform: none; } }

.rv-modal form { display: flex; flex-direction: column; width: 100%; max-height: calc(100dvh - 32px); min-height: 0; }
.rv-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--rv-border); flex: none;
}
.rv-modal-head h3 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.rv-modal-x {
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--rv-soft);
  color: var(--rv-brand); font-size: 24px; line-height: 1; cursor: pointer;
}
.rv-modal-x:hover { background: var(--rv-border); }
.rv-modal-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.rv-modal-foot { padding: 14px 20px; border-top: 1px solid var(--rv-border); background: #fff; flex: none; }
.rv-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Form fields ---------- */
.rv-field { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.rv-field > label, .rv-field > legend { display: block; margin-bottom: 6px; padding: 0; font-weight: 600; font-size: .9rem; }
.rv-field small { font-weight: 400; color: var(--rv-muted); }
.rv-field input[type="text"], .rv-field textarea {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 15px; color: inherit;
  border: 1px solid var(--rv-border); border-radius: 8px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.rv-field input[type="text"]:focus, .rv-field textarea:focus {
  outline: 0; border-color: var(--rv-brand); box-shadow: 0 0 0 3px rgba(123, 29, 53, .12);
}
.rv-field textarea { resize: vertical; min-height: 100px; }
.rv-counter { display: block; text-align: right; margin-top: 4px; }

/* Star picker: DOM order is 5→1 but displayed reversed so hover/checked lights lower stars */
.rv-star-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rv-star-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.rv-star-input input { position: absolute; opacity: 0; pointer-events: none; }
.rv-star-input label {
  font-size: 38px; line-height: 1; padding: 2px; color: var(--rv-star-off);
  cursor: pointer; transition: color .12s, transform .12s;
}
.rv-star-input label:hover { transform: scale(1.12); }
.rv-star-input input:checked ~ label,
.rv-star-input label:hover,
.rv-star-input label:hover ~ label { color: var(--rv-star); }
.rv-star-input input:focus-visible + label { outline: 2px solid var(--rv-brand); border-radius: 4px; }
.rv-rating-hint { font-size: .9rem; font-weight: 600; color: var(--rv-brand); }

/* Photo upload zone + previews */
.rv-drop {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer;
  border: 1.5px dashed #d8c7c3; border-radius: 10px; background: #fff; color: var(--rv-brand);
  transition: background .15s, border-color .15s;
}
.rv-drop:hover { background: var(--rv-soft); border-color: var(--rv-brand); }
.rv-drop svg { flex: none; }
.rv-drop span { display: flex; flex-direction: column; gap: 2px; color: var(--rv-text); font-size: .9rem; }
.rv-drop em { font-style: normal; font-size: .78rem; color: var(--rv-muted); }
.rv-previews { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 12px 0 0; }
.rv-previews:empty { display: none; }
.rv-preview { position: relative; width: 68px; height: 68px; }
.rv-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid var(--rv-border); display: block; }
.rv-preview-remove {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; padding: 0; border: 2px solid #fff;
  border-radius: 50%; background: var(--rv-danger); color: #fff; font-size: 15px; line-height: 1; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.rv-error { margin: 0 0 10px; padding: 9px 12px; border-radius: 8px; background: #fdecea; color: var(--rv-danger); font-size: .85rem; }
.rv-error[hidden] { display: none; }

/* Submit loading spinner */
.rv-spinner { display: none; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: rv-spin .7s linear infinite; }
.rv-btn.is-loading .rv-spinner { display: inline-block; }
@keyframes rv-spin { to { transform: rotate(360deg); } }

/* ---------- Lightbox (photo viewer) ---------- */
.rv-lb { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.9); animation: rv-fade .15s ease-out; }
.rv-lb[hidden] { display: none; }
@keyframes rv-fade { from { opacity: 0; } to { opacity: 1; } }
.rv-lb-figure { margin: 0; max-width: 92vw; max-height: 90vh; text-align: center; }
.rv-lb-img { max-width: 92vw; max-height: 82vh; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); background: #111; }
.rv-lb-counter { color: #e5e7eb; margin-top: 10px; font-size: .9rem; }
.rv-lb-close, .rv-lb-nav {
  position: absolute; border: 0; background: rgba(255,255,255,.15); color: #fff; cursor: pointer;
  border-radius: 50%; width: 44px; height: 44px; font-size: 28px; line-height: 44px; padding: 0; transition: background .15s;
}
.rv-lb-close:hover, .rv-lb-nav:hover { background: rgba(255,255,255,.3); }
.rv-lb-close { top: 16px; right: 16px; }
.rv-lb-nav { top: 50%; transform: translateY(-50%); }
.rv-lb-prev { left: 16px; }
.rv-lb-next { right: 16px; }
.rv-lb-nav[hidden] { display: none; }

/* Fallback toast (only used if site has no showToast) */
.rv-fallback-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; padding: 12px 20px; border-radius: 8px; color: #fff; background: #2a1a1f; z-index: 10001; transition: all .25s; max-width: 90vw; }
.rv-fallback-toast--success { background: #1e8e5a; }
.rv-fallback-toast--error { background: var(--rv-danger, #c0392b); }
.rv-fallback-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

/* Tablet: score + bars on top row, button full width below */
@media (max-width: 820px) {
  .rv-top { grid-template-columns: auto minmax(0, 1fr); gap: 20px 24px; padding: 20px; }
  .rv-cta { grid-column: 1 / -1; max-width: none; display: flex; align-items: center; gap: 16px; text-align: left; }
  .rv-cta-text { margin: 0; flex: 1; }
  .rv-cta .rv-btn { width: auto; flex: none; }
}

/* Mobile */
@media (max-width: 640px) {
  .rv-heading { font-size: 1.2rem; }

  /* Summary: stack, center the score */
  .rv-top { grid-template-columns: 1fr; gap: 18px; padding: 18px 16px; }
  .rv-score { display: flex; align-items: center; justify-content: center; gap: 14px; text-align: left; }
  .rv-score .rv-stars { margin: 0; }
  .rv-score-num { font-size: 2.6rem; }
  .rv-cta { flex-direction: column; text-align: center; gap: 10px; }
  .rv-cta .rv-btn { width: 100%; }

  /* Review card: smaller avatar */
  .rv-item { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 18px 0; }
  .rv-avatar { width: 36px; height: 36px; font-size: .9rem; }
  .rv-item-head { flex-direction: column; gap: 4px; }
  .rv-photo { width: 64px; height: 64px; }

  /* Modal becomes a bottom sheet */
  .rv-modal {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: 92dvh;
    border-radius: 18px 18px 0 0;
  }
  .rv-modal[open] { animation: rv-sheet .28s ease-out; }
  .rv-modal form { max-height: 92dvh; }
  .rv-modal-head, .rv-modal-body, .rv-modal-foot { padding-left: 16px; padding-right: 16px; }
  .rv-modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .rv-modal-actions .rv-btn { flex: 1; padding: 0 12px; }
  .rv-star-input label { font-size: 42px; }          /* bigger touch target */
  .rv-field input[type="text"], .rv-field textarea { font-size: 16px; } /* stops iOS auto-zoom */

  .rv-lb-nav { width: 38px; height: 38px; line-height: 38px; }
  .rv-lb-prev { left: 8px; }
  .rv-lb-next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .rv *, .rv-lb { animation: none !important; transition: none !important; }
}
