
:root {
  --star-on: #FFB836;
  --star-off: #cbd2dc;
}

.dark {
  --star-off: #4b5058;
}

.review-form {
  display: flex;
  flex-direction: column;
  color: hsl(var(--foreground));
}

.review-form--framed {
  padding: 20px;
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  background: hsl(var(--card));
}

.review-form__edit-note {
  align-self: stretch;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
}

.review-form__prompt {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: hsl(var(--foreground));
}

.review-form__body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.review-form__rating-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.review-form__stars {
  display: flex;
  align-items: center;
  margin-top: 2px;
}

.review-form__star {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  color: var(--star-off);
  -webkit-tap-highlight-color: transparent;
}

.review-form__star svg {
  width: 30px;
  height: 30px;
  fill: transparent;
  stroke: var(--star-off);
  stroke-width: 1.5;
  stroke-linejoin: round;
  pointer-events: none;
}

.review-form__star:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.review-form--lg .review-form__star {
  width: 46px;
  height: 46px;
}

.review-form--lg .review-form__star svg {
  width: 34px;
  height: 34px;
}

.review-form__star.is-on svg {
  fill: var(--star-on);
  stroke: var(--star-on);
}

.review-form__rating-label {
  font-size: 15px;
  font-weight: 500;
  color: hsl(var(--star-on));
  min-height: 20px;
}

.review-form__expanded {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid hsl(var(--border));
}

.review-form__expanded[hidden] {
  display: none;
}

.review-form__tags-prompt {
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.review-form__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-form__tags[hidden] {
  display: none;
}

.review-form__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.3;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  padding: 7px 12px;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.review-form__tag:hover {
  border-color: hsl(var(--primary) / 0.5);
}

.review-form__tag input {
  appearance: none;
  margin: 0;
  width: 0;
  height: 0;
  position: absolute;
  opacity: 0;
}

.review-form__tag span::after {
  content: "+";
  margin-left: 6px;
  color: hsl(var(--muted-foreground));
}

.review-form__tag:has(input:checked) {
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
  border-color: hsl(var(--primary));
  font-weight: 600;
}

.review-form__tag:has(input:checked) span::after {
  content: "✓";
  color: hsl(var(--primary));
}

.review-form__tag:has(input:focus-visible) {
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12);
}

.review-tags {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.review-tag {
  font-size: 12px;
  line-height: 1.3;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
  border-radius: 999px;
  padding: 4px 10px;
}

.review-form__comment {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.review-form__comment:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12);
}

.review-form__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.review-form__submit {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border-radius: 999px;
  padding: 0 22px;
  height: 44px;
}

.review-form__submit:hover {
  background: hsl(var(--primary-hover));
}

.review-form__submit[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.review-form__support {
  align-self: stretch;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
}

.review-form__support a {
  color: hsl(var(--primary));
}

.review-form__error {
  align-self: stretch;
  margin-bottom: 8px;
  font-size: 13px;
  color: hsl(var(--destructive));
}

.review-form__posted {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.review-form__posted-stars {
  display: flex;
  align-items: center;
}

.review-form__posted-stars svg {
  width: 22px;
  height: 22px;
  margin-right: 2px;
  fill: transparent;
  stroke: var(--star-off);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.review-form__posted-stars svg.is-on {
  fill: var(--star-on);
  stroke: var(--star-on);
}

.review-form__posted-title {
  font-size: 15px;
  font-weight: 600;
}

.review-form__posted-note {
  font-size: 13px;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
  max-width: 34ch;
}

.review-form__posted-tags {
  margin-top: 2px;
}

.review-form__posted-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: hsl(var(--foreground));
  max-width: 46ch;
}

.review-form__edit {
  margin-top: 2px;
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--primary));
}

.review-form__edit:hover {
  text-decoration: underline;
}

.review-prompt-card {
  display: block;
}

.review-summary {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .review-summary {
    flex-direction: row;
    align-items: center;
    gap: 2rem;
  }
}

.review-summary__score {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .review-summary__score {
    width: 10rem;
  }
}

.review-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  color: var(--star-on);
}

.review-summary__bars {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

.review-summary__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.review-summary__bar-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  width: 2.25rem;
  flex-shrink: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.review-summary__bar-track {
  flex: 1 1 auto;
  height: 0.5rem;
  border-radius: 9999px;
  overflow: hidden;
}

.review-summary__bar-fill {
  height: 100%;
  border-radius: 9999px;
}

.review-summary__bar-count {
  width: 2rem;
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.review-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  border-top: 1px solid hsl(var(--border));
}

.review-list__item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 0;
}

.review-list__item + .review-list__item {
  border-top: 1px solid hsl(var(--border));
}

.review-list__item:last-child {
  padding-bottom: 0;
}

.review-list__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.625rem;
  row-gap: 0.25rem;
}

.review-list__star {
  width: 0.875rem;
  height: 0.875rem;
}

.review-list__text {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.review-list__row {
  display: flex;
  gap: 0.875rem;
}

.review-list__avatar {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 9999px;
  background-color: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.review-list__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.review-list__verified {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: hsl(var(--success));
}

.review-list__verified svg,
.review-summary__bar-label svg {
  width: 0.75rem;
  height: 0.75rem;
}

.review-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.75rem;
  row-gap: 0.25rem;
  margin-bottom: 1rem;
}

.review-list__more {
  margin: 1.25rem 0 0;
}

.review-list__more-toggle {
  display: list-item;
  width: max-content;
  padding: 0.5625rem 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  list-style: none;
}

.review-list__more-toggle::-webkit-details-marker {
  display: none;
}

.review-list__more[open] > .review-list__more-toggle {
  display: none;
}

.review-reply {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.875rem;
  margin-left: 1.5rem;
  padding: 0.75rem 0.875rem;
  background: hsl(var(--muted));
  border-left: 3px solid hsl(var(--primary) / 0.45);
  border-radius: 0 0.5rem 0.5rem 0;
}

.review-reply__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.25rem;
}

.review-reply__icon {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  color: hsl(var(--muted-foreground));
}

.review-reply__author {
  font-size: 0.875rem;
  font-weight: 600;
}

.review-reply__text {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.review-reply-form {
  margin-top: 0.5rem;
  padding-left: 0.875rem;
  max-width: 42rem;
}

.review-reply-form__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  padding: 0.25rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  list-style: none;
  transition: color 0.15s ease;
}

.review-reply-form__toggle::-webkit-details-marker {
  display: none;
}

.review-reply-form__toggle:hover {
  color: hsl(var(--foreground));
}

.review-reply-form[open] .review-reply-form__toggle {
  color: hsl(var(--foreground));
}

.review-reply-form[open] .review-reply-form__toggle svg {
  transform: rotate(90deg);
}

.review-reply-form__toggle svg {
  transition: transform 0.15s ease;
}

.review-reply-form__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.review-reply-form__actions {
  display: flex;
  justify-content: flex-end;
}

.review-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.review-note svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.review-stars svg:not(.fill-current) {
  color: var(--star-off);
}

.review-star-half {
  position: relative;
  display: inline-flex;
}

.review-star-half__fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  overflow: hidden;
  display: inline-flex;
}

.review-star-half__fill > svg {
  flex-shrink: 0;
}
