/* =========================================================================
   Avaliações de produto — CSS global (carregada em toda página quando
   reviews_enabled(), via includes/header.php). O modal de enviar avaliação
   é injetado no rodapé (includes/review_modal.php), igual ao Cartão
   Fidelidade — por isso não pode depender de checkout.css (só carregada em
   páginas de conta/checkout) nem de product.css (só na página de produto).
   ========================================================================= */

/* ------------------------------------------------------- modal "bottom sheet" */
.review-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1300;
}

.review-modal {
  position: fixed;
  z-index: 1301;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: min(480px, 100vw);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 12px 24px 32px;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.review-modal.is-open {
  transform: translate(-50%, 0);
}

.review-modal-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
  margin: 0 auto 16px;
}

.review-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  background: none;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.review-modal-close:hover {
  color: var(--primary);
}

.review-modal-title {
  text-align: center;
  margin: 0 0 4px;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.review-modal-product {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 18px;
}

.review-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-modal-error {
  padding: 12px 16px;
  font-size: 14px;
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

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

/* ---------------------------------------------------------- seletor de estrelas */
.review-star-picker {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.review-star-picker button {
  border: 0;
  background: none;
  padding: 2px;
  cursor: pointer;
  color: var(--line-strong);
  transition: color 0.15s ease, transform 0.1s ease;
}

.review-star-picker button svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.review-star-picker button:hover,
.review-star-picker button.is-filled {
  color: var(--orange-400);
}

.review-star-picker button:hover {
  transform: scale(1.08);
}

.review-modal-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.review-modal-form-group label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-2);
}

.review-modal-form-group textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 100px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
}

.review-modal-form-group textarea:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: var(--shadow-focus);
}

.review-modal-image-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-modal-image-preview {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  object-fit: cover;
  display: none;
}

.review-modal-image-preview:not([src=""]) {
  display: block;
}

/* O <input type="file"> nativo some da tela — o clique continua funcionando
   porque o <label for="..."> abaixo aponta pra ele (funciona mesmo com
   display:none, em todos os navegadores). */
.review-modal-image-input {
  display: none;
}

.review-modal-image-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-modal-image-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.review-modal-image-btn:hover {
  border-color: var(--brand-1);
  color: var(--primary);
  background: var(--surface-2);
}

.review-modal-image-btn svg {
  flex-shrink: 0;
}

.review-modal-image-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.review-modal-image-clear:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.review-modal-image-clear[hidden] {
  display: none;
}

/* ------------------------------------------------------------- badge no card */
.product-rating-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  color: var(--orange-500);
}

.product-rating-badge svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.product-rating-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
  font-size: 10px;
  font-weight: 500;
  color: white;
}

@media (prefers-reduced-motion: reduce) {
  .review-modal {
    transition: none;
  }
}
