/* =========================================================
   MyLavida – star ratings (cards, product title, reviews section, rating form)
   Logical properties: same file for LTR (English) and RTL (Arabic).
   Star colour: --mlv-star (Customizer → MyLavida Store → Brand colours).
========================================================= */

/* ---------- Static stars (fractional fill) ---------- */
.mlv-stars {
  --mlv-star-size: 14px;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: calc(var(--mlv-star-size) * 5 + 4px);
  height: var(--mlv-star-size);
  line-height: 0;
  vertical-align: middle;
  direction: ltr; /* fill always grows from the first star */
}

html[dir="rtl"] .mlv-stars {
  transform: scaleX(-1); /* fill grows from the right in Arabic */
}

.mlv-stars--md { --mlv-star-size: 17px; }
.mlv-stars--lg { --mlv-star-size: 22px; }

.mlv-stars__bg,
.mlv-stars__fg {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  display: flex;
  gap: 1px;
  overflow: hidden;
  white-space: nowrap;
}

.mlv-stars__bg {
  width: 100%;
  color: #dfe6e2;
}

.mlv-stars__fg {
  width: var(--mlv-fill, 0%);
  color: var(--mlv-star, #f5a524);
}

.mlv-stars svg {
  flex: 0 0 var(--mlv-star-size);
  width: var(--mlv-star-size);
  height: var(--mlv-star-size);
  fill: currentColor;
}

/* ---------- Summary rows ---------- */
.mlv-rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  line-height: 1.2;
}

.mlv-rating__avg {
  color: var(--mlv-ink, #0f172a);
  font-weight: 800;
}

.mlv-rating__count {
  color: var(--mlv-muted, #64748b);
  font-weight: 600;
}

/* Product cards */
ul.products li.product .mlv-rating--loop {
  margin: 0 0 6px;
  font-size: 12.5px;
}

ul.products li.product .mlv-rating--loop .mlv-rating__avg {
  font-size: 12.5px;
}

@media (max-width: 767px) {
  ul.products li.product .mlv-rating--loop {
    gap: 3px 4px;
    font-size: 11.5px;
  }
  ul.products li.product .mlv-rating--loop .mlv-stars {
    --mlv-star-size: 12px;
  }
}

/* Under the product title */
.mlv-rating--single {
  margin: -6px 0 12px;
  font-size: 15px;
}

.mlv-rating__visual {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

a.mlv-rating__count {
  color: var(--mlv-primary-strong, #0f9460);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a.mlv-rating__count:hover {
  color: var(--mlv-primary-deep, #0b7a4d);
}

/* =========================================================
   Reviews section (product landing / [mylavida_reviews])
========================================================= */
.mlv-reviews {
  max-width: 980px;
  margin: 16px auto 0;
  padding: 22px;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--mlv-line, #dbeee7);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(var(--mlv-primary-rgb, 31, 191, 117), .10);
  color: var(--mlv-text, #334155);
}

.direct-store-product-page .mlv-reviews {
  scroll-margin-top: 110px;
}

.mlv-reviews *,
.mlv-reviews *::before,
.mlv-reviews *::after {
  box-sizing: border-box;
}

.mlv-reviews__title {
  margin: 0 0 16px;
  color: var(--mlv-ink, #0f172a);
  font-size: clamp(19px, 2.4vw, 24px);
  font-weight: 900;
  line-height: 1.3;
}

.mlv-reviews__top {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.mlv-reviews__score {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px 14px;
  text-align: center;
  background: var(--mlv-tint, #f3fbf7);
  border: 1px solid var(--mlv-line, #dbeee7);
  border-radius: 16px;
}

.mlv-reviews__big {
  color: var(--mlv-ink, #0f172a);
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.mlv-reviews__big small {
  margin-inline-start: 2px;
  color: var(--mlv-muted, #64748b);
  font-size: 16px;
  font-weight: 700;
}

.mlv-reviews__count {
  color: var(--mlv-muted, #64748b);
  font-size: 14px;
  font-weight: 700;
}

.mlv-reviews__note {
  margin: 6px 0 0;
  color: var(--mlv-muted, #64748b);
  font-size: 12.5px;
  line-height: 1.5;
}

.mlv-reviews__empty {
  color: var(--mlv-muted, #64748b);
  font-weight: 700;
}

.mlv-reviews__closed {
  margin: 0;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px dashed var(--mlv-line, #dbeee7);
  border-radius: 14px;
  font-weight: 600;
}

.mlv-reviews__closed a {
  color: var(--mlv-primary-strong, #0f9460);
  font-weight: 800;
}

.mlv-reviews__subtitle {
  margin: 22px 0 10px;
  color: var(--mlv-ink, #0f172a);
  font-size: 17px;
  font-weight: 800;
}

/* WooCommerce review items (template single-product/review.php) */
.mlv-reviews ol.commentlist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mlv-reviews ol.commentlist li.review {
  margin: 0 0 10px;
  padding: 14px 16px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--mlv-line, #dbeee7);
  border-radius: 14px;
}

.mlv-reviews ol.commentlist li .comment_container {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.mlv-reviews ol.commentlist li img.avatar {
  position: static;
  float: none;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--mlv-tint, #f3fbf7);
}

.mlv-reviews ol.commentlist li .comment-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.mlv-reviews ol.commentlist li .comment-text p.meta {
  margin: 4px 0 6px;
  color: var(--mlv-muted, #64748b);
  font-size: 13px;
}

.mlv-reviews ol.commentlist li .comment-text p.meta strong {
  color: var(--mlv-ink, #0f172a);
  font-weight: 800;
}

.mlv-reviews .woocommerce-review__verified {
  color: var(--mlv-primary-strong, #0f9460);
  font-style: normal;
  font-weight: 700;
}

.mlv-reviews .comment-text .description p {
  margin: 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

/* WooCommerce's own .star-rating inside review items: use brand star colour */
.mlv-reviews .star-rating {
  float: none;
  margin: 0;
  color: var(--mlv-star, #f5a524);
}

.mlv-reviews .star-rating::before {
  color: #dfe6e2;
}

/* =========================================================
   Rating form
========================================================= */
.mlv-rate-form {
  margin: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--mlv-line, #dbeee7);
  border-radius: 16px;
}

.mlv-rate-form__title {
  margin: 0 0 8px;
  color: var(--mlv-ink, #0f172a);
  font-size: 16px;
  font-weight: 800;
}

.mlv-rate-form p {
  margin: 0 0 12px;
}

.mlv-rate-form label {
  display: block;
  margin: 0 0 6px;
  color: var(--mlv-ink, #0f172a);
  font-size: 14px;
  font-weight: 700;
}

.mlv-rate-form .required {
  color: #b42318;
}

.mlv-rate-form input[type="text"],
.mlv-rate-form input[type="email"],
.mlv-rate-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--mlv-ink, #0f172a);
  background: #fff;
  border: 1.5px solid var(--mlv-line, #dbeee7);
  border-radius: 12px;
  box-shadow: none;
}

.mlv-rate-form textarea {
  min-height: 90px;
  resize: vertical;
}

.mlv-rate-form input:focus,
.mlv-rate-form textarea:focus {
  outline: none;
  border-color: var(--mlv-primary, #1fbf75);
  box-shadow: 0 0 0 4px rgba(var(--mlv-primary-rgb, 31, 191, 117), .18);
}

html[dir="rtl"] .mlv-rate-form input[type="email"] {
  text-align: right;
}

.mlv-rate-form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

/* Interactive stars: DOM order 5→1 + row-reverse, so "~" highlights lower stars.
   In RTL row-reverse naturally starts star 1 on the right. */
.mlv-stars-input {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
}

.mlv-stars-input input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.mlv-stars-input label {
  display: inline-flex;
  margin: 0;
  padding: 4px;
  color: #d5ddd8;
  cursor: pointer;
  border-radius: 10px;
  transition: color .12s ease, transform .12s ease;
}

.mlv-stars-input label svg {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

.mlv-stars-input input:checked ~ label {
  color: var(--mlv-star, #f5a524);
}

/* While hovering, preview the hovered value instead of the checked one */
.mlv-stars-input:hover input ~ label {
  color: #d5ddd8;
}

.mlv-stars-input:hover label:hover,
.mlv-stars-input:hover label:hover ~ label {
  color: var(--mlv-star, #f5a524);
}

.mlv-stars-input label:hover {
  transform: scale(1.08);
}

.mlv-stars-input input:focus-visible + label {
  outline: 3px solid rgba(var(--mlv-primary-rgb, 31, 191, 117), .45);
  outline-offset: 2px;
}

.mlv-rate-form__choice {
  min-height: 1.4em;
  margin: 0 0 10px !important;
  color: var(--mlv-muted, #64748b);
  font-size: 14px;
  font-weight: 700;
}

.mlv-rate-form__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border: 0;
  border-radius: 12px;
  background: var(--mlv-primary-strong, #0f9460);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color .15s ease, opacity .15s ease;
}

.mlv-rate-form__submit:hover {
  background: var(--mlv-primary-deep, #0b7a4d);
}

.mlv-rate-form__submit:focus-visible {
  outline: 3px solid rgba(var(--mlv-primary-rgb, 31, 191, 117), .45);
  outline-offset: 2px;
}

.mlv-rate-form__submit[disabled] {
  opacity: .7;
  cursor: progress;
}

.mlv-rate-form__msg {
  margin: 10px 0 0 !important;
  font-size: 14px;
  font-weight: 700;
}

.mlv-rate-form__msg:empty {
  display: none;
}

.mlv-rate-form__msg.is-error {
  color: #b42318;
}

.mlv-rate-form__msg.is-success {
  margin: 0 !important;
  padding: 12px 14px;
  color: #0b6a40;
  background: #e9f9f0;
  border-radius: 12px;
}

/* Honeypot – hidden from people, still in the DOM for bots */
.mlv-hp {
  position: absolute !important;
  inset-inline-start: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .mlv-reviews {
    padding: 16px;
  }

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

  .mlv-rate-form__row {
    grid-template-columns: minmax(0, 1fr);
  }

  .mlv-stars-input label svg {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mlv-stars-input label,
  .mlv-rate-form__submit {
    transition: none;
  }
  .mlv-stars-input label:hover {
    transform: none;
  }
}
