/* ==========================================================================
   rating.css — hanya gaya khusus halaman Rating (/rating).
   Token, tombol, .filter, .stars, .pager, .pd-shot, lightbox dipakai ulang dari
   theme.css + style.css + product.css. Daftar isi:
   1. Utilitas & halaman
   2. Ringkasan rating
   3. Filter & daftar ulasan
   4. Form ulasan
   5. Foto, pesan, toast
   6. Responsif
   ========================================================================== */

/* 1. Utilitas & halaman
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.rv {
  padding: calc(var(--header-h) + 28px) 0 clamp(56px, 8vw, 96px);
}

.rv-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: clamp(24px, 3vw, 36px);
}

.rv-head h1 {
  font-weight: 600;
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1.1;
  letter-spacing: -.03em;
  text-wrap: balance;
}

.rv-head p {
  max-width: 46ch;
  margin-top: 10px;
  color: var(--muted);
}

.rv-open {
  display: none;
}

.rv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(340px, 31vw, 410px);
  gap: clamp(24px, 3.4vw, 52px);
  align-items: start;
}

.rv-main {
  min-width: 0;
}


/* 2. Ringkasan rating
   -------------------------------------------------------------------------- */
.rv-summary {
  margin-bottom: 20px;
  padding: clamp(18px, 2.4vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .03);
}

.rv-summary__scope {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.rv-summary__body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 5vw, 56px);
}

.rv-score b {
  display: block;
  font-weight: 500;
  font-size: clamp(48px, 5vw, 64px);
  line-height: 1;
  letter-spacing: -.04em;
}

.rv-score .stars {
  display: block;
  margin-top: 10px;
}

.rv-score small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.rv-dist {
  display: grid;
  gap: 4px;
}

.rv-dist__row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 28px;
  padding: 0 8px;
  margin-inline: -8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: 12.5px Inter, system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background .2s, color .2s;
}

.rv-dist__row:hover,
.rv-dist__row.on {
  background: var(--purple-soft);
  color: var(--ink);
}

.rv-dist__row:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.rv-dist__row i {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(255, 255, 255, .07);
}

.rv-dist__row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--purple);
}

.rv-dist__row > span:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}


/* 3. Filter & daftar ulasan
   -------------------------------------------------------------------------- */
.rv-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 18px;
}

.rv-bar[hidden] {
  display: none;
}

.rv-stars-filter {
  flex-basis: 100%;
}

.rv-select {
  position: relative;
  min-width: 0;
}

.rv-select svg {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.rv-select--bar {
  flex: 0 1 220px;
}

.rv-select select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  text-overflow: ellipsis;
}

.rv-item {
  margin-bottom: 14px;
  padding: clamp(18px, 2.2vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .03);
  animation: rv-in .4s var(--ease) both;
}

@keyframes rv-in {
  from { opacity: 0; }
}

/* Ulasan yang baru dikirim: sorotan singkat sebagai jawaban atas aksi pengguna */
.rv-item.is-new {
  animation: rv-new 2.4s var(--ease) both;
}

@keyframes rv-new {
  from { border-color: rgba(167, 139, 250, .8); background: var(--purple-soft); }
}

.rv-item__head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.rv-av {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(167, 139, 250, .3);
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple-text);
  font-weight: 600;
}

.rv-who {
  min-width: 0;
}

.rv-who b {
  display: block;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-who time {
  color: var(--dim);
  font-size: 12.5px;
}

.rv-text {
  max-width: 68ch;
  margin-top: 14px;
  color: rgba(244, 242, 236, .86);
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.rv-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.rv-shots .pd-shot {
  width: 104px;
}

.rv-broken {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 6px;
  color: var(--dim);
  font-size: 11.5px;
  text-align: center;
}

.rv-product {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  transition: border-color .2s, background .2s, color .2s;
}

.rv-product:hover {
  border-color: rgba(167, 139, 250, .45);
  background: var(--purple-soft);
  color: var(--purple-text);
}

.rv-product:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}

.rv-product img,
.rv-product__ph {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  object-fit: cover;
}

.rv-product__ph {
  display: grid;
  place-items: center;
  background: var(--purple-soft);
  color: var(--purple-text);
  font-weight: 600;
}

.rv-product span:not(.rv-product__ph) {
  flex: 1;
  min-width: 0;
}

.rv-product small {
  display: block;
  color: var(--dim);
  font-size: 12px;
}

.rv-product b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-product svg {
  flex: none;
}

.pager__gap {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  color: var(--dim);
}

/* Kerangka pemuatan & state kosong */
.rv-skel {
  height: 168px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .03);
  animation: rv-pulse 1.4s ease-in-out infinite;
}

@keyframes rv-pulse {
  50% { opacity: .5; }
}

.rv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(40px, 7vw, 72px) 24px;
  border: 1px dashed rgba(255, 255, 255, .14);
  border-radius: var(--radius);
  text-align: center;
}

.rv-empty__icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(167, 139, 250, .3);
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple-text);
}

.rv-empty h2 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.rv-empty p {
  max-width: 38ch;
  margin: 8px 0 22px;
  color: var(--muted);
}


/* 4. Form ulasan
   -------------------------------------------------------------------------- */
.rv-side {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  max-height: calc(100dvh - var(--header-h) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px -34px #000;
}

.rv-form {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 2.2vw, 24px);
}

.rv-form__head h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.02em;
}

.rv-form__head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13.5px;
}

.rv-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.rv-field label,
.rv-field legend,
.rv-label {
  display: block;
  padding: 0;
  margin-bottom: 8px;
  color: rgba(244, 242, 236, .9);
  font-size: 13px;
  font-weight: 500;
}

.rv-field__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.rv-count {
  color: var(--dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.rv-label em,
.rv-field label em {
  color: var(--dim);
  font-style: normal;
  font-weight: 400;
}

.rv-form input[type="text"],
.rv-form select,
.rv-form textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  color: var(--ink);
  font: 14px/1.5 Inter, system-ui, sans-serif;
  outline: 0;
  transition: border-color .2s, box-shadow .2s;
}

.rv-form input[type="text"],
.rv-form select {
  height: 46px;
  padding: 0 14px;
}

.rv-form select {
  cursor: pointer;
}

.rv-form select option {
  background: #111;
}

.rv-form textarea {
  min-height: 120px;
  padding: 12px 14px;
  resize: vertical;
}

.rv-form ::placeholder {
  color: var(--dim);
}

.rv-form input[type="text"]:focus,
.rv-form select:focus,
.rv-form textarea:focus {
  border-color: rgba(167, 139, 250, .6);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, .1);
}

.rv-field.is-invalid input[type="text"],
.rv-field.is-invalid select,
.rv-field.is-invalid textarea,
.rv-field.is-invalid .rv-drop__btn {
  border-color: rgba(229, 72, 77, .75);
}

.rv-field.is-invalid input[type="text"]:focus,
.rv-field.is-invalid select:focus,
.rv-field.is-invalid textarea:focus {
  box-shadow: 0 0 0 4px rgba(229, 72, 77, .12);
}

.rv-err {
  margin-top: 6px;
  color: #ff9a9e;
  font-size: 12.5px;
}

.rv-err:empty {
  display: none;
}

/* Bintang */
.rv-rate-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.rv-rate {
  position: relative;
  display: inline-flex;
  gap: 2px;
}

.rv-rate label {
  display: block;
  margin: 0;
  padding: 2px;
  border-radius: 8px;
  color: rgba(255, 255, 255, .2);
  line-height: 0;
  cursor: pointer;
  transition: color .15s, transform .2s var(--ease);
}

.rv-rate label.on {
  color: var(--warn);
}

.rv-rate label:hover {
  transform: scale(1.1);
}

.rv-rate input:focus-visible + label {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.rv-rate__label {
  color: var(--muted);
  font-size: 13px;
}

.rv-field.is-invalid .rv-rate label:not(.on) {
  color: rgba(229, 72, 77, .45);
}

/* Kolom jebakan bot */
.rv-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}


/* 5. Foto, pesan, toast
   -------------------------------------------------------------------------- */
.rv-drop__btn {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  border: 1px dashed rgba(255, 255, 255, .2);
  border-radius: 14px;
  color: var(--purple-text);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.rv-drop__btn svg {
  flex: none;
}

.rv-drop__btn b {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.rv-drop__btn small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
}

.rv-drop__btn:hover,
.rv-drop.is-over .rv-drop__btn {
  border-color: rgba(167, 139, 250, .65);
  background: var(--purple-soft);
}

.rv-drop:has(input:focus-visible) .rv-drop__btn {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}

.rv-drop.is-full .rv-drop__btn {
  opacity: .45;
  pointer-events: none;
}

.rv-previews {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rv-previews:not(:empty) {
  margin-top: 12px;
}

.rv-preview {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0818;
}

.rv-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rv-preview__x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(7, 6, 12, .78);
  color: #fff;
  cursor: pointer;
  transition: background .2s;
}

.rv-preview__x:hover {
  background: var(--danger);
}

.rv-preview__x:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.rv-note {
  padding: 11px 14px;
  border: 1px solid rgba(229, 72, 77, .4);
  border-radius: 12px;
  background: rgba(229, 72, 77, .1);
  color: #ffb3b6;
  font-size: 13.5px;
}

.rv-note[hidden] {
  display: none;
}

.rv-submit {
  position: relative;
  width: 100%;
  height: 48px;
  overflow: hidden;
}

.rv-submit__bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p, 0%);
  background: rgba(255, 255, 255, .22);
  transition: width .25s linear;
}

.rv-submit__label {
  position: relative;
}

.rv-submit:disabled {
  cursor: progress;
  transform: none;
}

.rv-submit.is-busy {
  opacity: .9;
}

.rv-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border: 1px solid rgba(70, 211, 122, .4);
  border-radius: 99px;
  background: #0d1a14;
  color: #9ceab9;
  font-size: 14px;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}

.rv-toast.is-in {
  opacity: 1;
  transform: translate(-50%, 0);
}


/* 6. Responsif
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .rv-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Form menjadi panel di atas daftar, dibuka lewat tombol "Tulis ulasan" */
  .rv-open {
    display: inline-flex;
  }

  .rv-side {
    display: none;
    position: static;
    max-height: none;
    overflow: visible;
    order: -1;
  }

  .rv-side.is-open {
    display: block;
  }
}

@media (max-width: 560px) {
  .rv-head {
    align-items: stretch;
  }

  .rv-open {
    width: 100%;
  }

  .rv-summary__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .rv-select--bar {
    flex: 1 1 100%;
  }

  .rv-item__head {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .rv-item__head .stars {
    grid-column: 2;
  }

  .rv-shots .pd-shot {
    width: calc((100% - 16px) / 3);
  }
}
