/**
 * single-product-reviews.css
 *
 * Dandiran WooCommerce Theme — Product Reviews UI
 * Uses Bootstrap's grid (.row/.col-*) already enqueued by the theme;
 * everything visual here is scoped under .dnd-reviews and driven by
 * CSS custom properties so colors/radii can be re-themed easily.
 *
 * Color/radius/shadow tokens (--dnd-primary, --dnd-radius-lg, etc.)
 * now live in assets/css/dnd-tokens.css and are inherited from :root.
 * This file must be enqueued with 'dnd-tokens' as a dependency so it
 * always loads after it.
 */

.dnd-reviews {
  color: var(--dnd-text);
  direction: rtl;
  margin-top: 30px;
}

.dnd-reviews * {
  box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Header                                                              */
/* ------------------------------------------------------------------ */

.dnd-reviews__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.dnd-reviews__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.dnd-reviews__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.4rem;
  border-radius: var(--dnd-radius-pill);
  background: var(--dnd-bg-soft);
  color: var(--dnd-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* CTA sidebar card                                                    */
/* ------------------------------------------------------------------ */

.dnd-review-cta {
  background: var(--dnd-bg-soft);
  border-radius: var(--dnd-radius-lg);
  padding: 1.75rem 1.5rem;
  text-align: center;
  /* height: 100%; */
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dnd-review-cta__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--dnd-white);
  color: var(--dnd-muted);
  margin-bottom: 1rem;
}

.dnd-review-cta__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.dnd-review-cta__desc {
  font-size: 0.85rem;
  color: var(--dnd-muted);
  line-height: 1.9;
  margin: 0 0 1.5rem;
}

.dnd-review-cta__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  border: 0;
  background: var(--dnd-primary);
  color: var(--dnd-white);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-radius: var(--dnd-radius-pill);
  cursor: pointer;
  transition: background 0.15s ease;
}

.dnd-review-cta__button:hover {
  background: var(--dnd-primary-dark);
}

.dnd-review-cta__plus {
  font-size: 1.1rem;
  line-height: 1;
}

/* ------------------------------------------------------------------ */
/* Review list & cards                                                 */
/* ------------------------------------------------------------------ */

.dnd-review-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dnd-review-list__item {
  list-style: none;
}

.dnd-review {
  background: var(--dnd-white);
  border: 1px solid var(--dnd-border);
  border-radius: var(--dnd-radius-lg);
  /* box-shadow: var(--dnd-shadow); */
  padding: 1.5rem;
}

.dnd-review__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.dnd-review__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.dnd-review__badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* بج امتیاز ستاره‌ای همچنان دایره‌ای باقی می‌ماند */
.dnd-review__badge--rating {
  width: 34px;
  height: 34px;
  justify-content: center;
  border-radius: 50%;
  background: rgba(245, 166, 35, 0.12);
  color: var(--dnd-star);
  font-size: 0.8rem;
  font-weight: 700;
}

/* بج پیشنهاد خرید حالا آیکون + متن کنار هم، به‌صورت پیل */
.dnd-review__badge--up,
.dnd-review__badge--down {
  padding: 0.3rem 0.65rem;
  border-radius: var(--dnd-radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}

.dnd-review__badge--up {
  background: var(--dnd-primary-soft);
  border-color: var(--dnd-primary);
  color: var(--dnd-primary);
}

.dnd-review__badge--down {
  background: var(--dnd-danger-soft);
  border-color: var(--dnd-danger);
  color: var(--dnd-danger);
}

.dnd-review__badge-text {
  line-height: 1;
}

.dnd-review__badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.dnd-review__content {
  font-size: 0.9rem;
  line-height: 2;
  color: var(--dnd-text);
}

.dnd-review__content p {
  margin: 0 0 0.5rem;
}

.dnd-review__content p:last-child {
  margin-bottom: 0;
}

.dnd-review__reply {
  margin-top: 1rem;
  background: var(--dnd-bg-soft);
  border-radius: var(--dnd-radius-md);
  padding: 1rem 1.25rem;
}

.dnd-review__reply-label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.dnd-review__reply-content {
  font-size: 0.85rem;
  line-height: 1.9;
  color: var(--dnd-muted);
}

.dnd-review__reply-content p {
  margin: 0;
}

.dnd-review__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--dnd-border);
  font-size: 0.78rem;
  color: var(--dnd-muted);
}

.dnd-review__reply-count {
  font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Empty state                                                         */
/* ------------------------------------------------------------------ */

.dnd-review-empty {
  /* background: var(--dnd-bg-soft); */
  border-radius: var(--dnd-radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px solid #f2f2f2;
}

.dnd-review-empty__text {
  color: var(--dnd-muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.dnd-review-empty__button {
  border: 0;
  background: var(--dnd-primary);
  color: var(--dnd-white);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  border-radius: var(--dnd-radius-pill);
  cursor: pointer;
}

.dnd-review-empty__button:hover {
  background: var(--dnd-primary-dark);
}

/* ------------------------------------------------------------------ */
/* Pagination                                                           */
/* ------------------------------------------------------------------ */

.dnd-reviews__pagination {
  padding-top: 10px;
}

.dnd-review-pagination {
  display: flex;
  justify-content: center;
}

.dnd-review-pagination__button {
  min-width: 34px;
  height: 34px;
  padding: 0 0.4rem;
  border: 1px solid var(--dnd-border);
  background: var(--dnd-white);
  color: var(--dnd-text);
  border-radius: var(--dnd-radius-pill);
  font-size: 0.85rem;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.dnd-review-pagination__button:hover:not(.is-disabled):not(.is-active) {
  background: var(--dnd-bg-soft);
}

.dnd-review-pagination__button.is-active {
  background: var(--dnd-primary);
  border-color: var(--dnd-primary);
  color: var(--dnd-white);
}

.dnd-review-pagination__button.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dnd-review-pagination__dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  color: var(--dnd-muted);
}

/* ------------------------------------------------------------------ */
/* Modal                                                                */
/* ------------------------------------------------------------------ */

.dnd-review-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.dnd-review-modal[hidden] {
  display: none;
}

.dnd-review-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 30, 0.5);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.dnd-review-modal.is-active .dnd-review-modal__overlay {
  opacity: 1;
}

.dnd-review-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--dnd-white);
  border-radius: var(--dnd-radius-lg);
  padding: 1.75rem;
  transform: translateY(16px);
  opacity: 0;
  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
  direction: rtl;
}

.dnd-review-modal.is-active .dnd-review-modal__dialog {
  transform: translateY(0);
  opacity: 1;
}

.dnd-review-modal__close {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  width: 32px;
  height: 32px;
  border: 0;
  background: var(--dnd-bg-soft);
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--dnd-muted);
  cursor: pointer;
}

.dnd-review-modal__header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.dnd-review-modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

body.dnd-review-modal-open {
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Form                                                                 */
/* ------------------------------------------------------------------ */

.dnd-review-form__group {
  margin-bottom: 1.1rem;
}

.dnd-review-form__input,
.dnd-review-form__textarea {
  width: 100%;
  border: 1px solid var(--dnd-border);
  border-radius: var(--dnd-radius-md);
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--dnd-text);
  background: var(--dnd-white);
  transition: border-color 0.15s ease;
}

.dnd-review-form__input:focus,
.dnd-review-form__textarea:focus {
  outline: none;
  border-color: var(--dnd-primary);
}

.dnd-review-form__input.is-invalid,
.dnd-review-form__textarea.is-invalid {
  border-color: var(--dnd-danger);
}

.dnd-review-form__group--textarea {
  position: relative;
}

.dnd-review-form__textarea {
  resize: vertical;
  min-height: 120px;
  padding-bottom: 1.75rem;
}

.dnd-review-form__counter {
  position: absolute;
  bottom: 0.65rem;
  left: 1rem;
  font-size: 0.72rem;
  color: var(--dnd-muted);
  pointer-events: none;
}

.dnd-review-form__counter.is-limit {
  color: var(--dnd-danger);
}

.dnd-review-form__question {
  text-align: center;
  font-size: 0.85rem;
  color: var(--dnd-muted);
  margin: 0 0 0.9rem;
}

.dnd-review-form__question--inline {
  text-align: right;
  margin: 0;
}

/* Rating stars */

.dnd-review-form__rating {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.dnd-review-form__star {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.dnd-review-form__star input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dnd-review-form__star-icon {
  font-size: 1.6rem;
  line-height: 1;
  color: #d8dade;
  transition: color 0.15s ease;
}

.dnd-review-form__star-num {
  font-size: 0.72rem;
  color: var(--dnd-muted);
}

.dnd-review-form__star:has(input:checked) .dnd-review-form__star-icon,
.dnd-review-form__star:has(input:checked)
  ~ .dnd-review-form__star
  .dnd-review-form__star-icon,
.dnd-review-form__rating:hover
  .dnd-review-form__star:hover
  .dnd-review-form__star-icon,
.dnd-review-form__rating:hover
  .dnd-review-form__star:hover
  ~ .dnd-review-form__star
  .dnd-review-form__star-icon {
  color: var(--dnd-star);
}

/* Recommend thumbs */

.dnd-review-form__group--recommend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dnd-review-form__recommend {
  display: flex;
  gap: 0.6rem;
}

.dnd-review-form__thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--dnd-border);
  color: var(--dnd-muted);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.dnd-review-form__thumb input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dnd-review-form__thumb-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dnd-review-form__thumb--up:has(input:checked) {
  background: var(--dnd-primary-soft);
  border-color: var(--dnd-primary);
  color: var(--dnd-primary);
}

.dnd-review-form__thumb--down:has(input:checked) {
  background: var(--dnd-danger-soft);
  border-color: var(--dnd-danger);
  color: var(--dnd-danger);
}

/* Message box */

.dnd-review-form__message {
  font-size: 0.85rem;
  text-align: center;
  min-height: 1.2rem;
  margin-bottom: 0.75rem;
}

.dnd-review-form__message.is-success {
  color: var(--dnd-primary);
}

.dnd-review-form__message.is-error {
  color: var(--dnd-danger);
}

/* Submit button */

.dnd-review-form__footer {
  margin-top: 0.5rem;
}

.dnd-review-form__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  border: 0;
  background: var(--dnd-primary);
  color: var(--dnd-white);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.9rem 1rem;
  border-radius: var(--dnd-radius-pill);
  cursor: pointer;
  transition:
    background 0.15s ease,
    opacity 0.15s ease;
}

.dnd-review-form__submit:hover {
  background: var(--dnd-primary-dark);
}

.dnd-review-form__submit:disabled,
.dnd-review-form__submit.is-loading {
  opacity: 0.7;
  cursor: default;
}

.dnd-review-form__plus {
  font-size: 1.1rem;
  line-height: 1;
}

/* ------------------------------------------------------------------ */
/* Login state                                                          */
/* ------------------------------------------------------------------ */

.dnd-review-login {
  text-align: center;
  padding: 2rem 1.5rem;
}

.dnd-review-login__icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.dnd-review-login__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.dnd-review-login__description {
  color: var(--dnd-muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

.dnd-review-login__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.dnd-review-login__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.75rem;
  border-radius: var(--dnd-radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.dnd-review-login__button--primary {
  background: var(--dnd-primary);
  color: var(--dnd-white);
}

.dnd-review-login__button--primary:hover {
  background: var(--dnd-primary-dark);
  color: var(--dnd-white);
}

/* ------------------------------------------------------------------ */
/* Responsive                                                           */
/* ------------------------------------------------------------------ */

@media (max-width: 991.98px) {
  .dnd-review-cta {
    padding: 1.5rem;
  }
}

@media (max-width: 575.98px) {
  .dnd-review-modal__dialog {
    padding: 1.25rem;
    border-radius: var(--dnd-radius-md);
  }

  .dnd-review-form__group--recommend {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
}
