/**
 * Review Enhanced — Flipkart/Myntra Style Reviews
 *
 * Scoped under .review-enhanced to avoid conflicts with Journal 3.
 * All colors inherit from J3's CSS custom property system.
 * No hardcoded colors — uses the theme's design tokens.
 */

/* ===== Rating Summary Section ===== */
.review-enhanced__summary {
  display: flex;
  align-items: stretch;
  gap: 24px;
  padding: 20px;
  border-radius: 8px;
  background: var(--expand-overlay, var(--background-color, #f8f8f8));
  border: 1px solid color-mix(in srgb, currentColor 10%, transparent);
  margin-bottom: 24px;
}

.review-enhanced__summary-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  padding: 12px 16px;
  border-right: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

.review-enhanced__summary-number {
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.review-enhanced__summary-number .fa-star {
  font-size: 1em; /* was 2.75em which = ~7.7rem inside the 2.8rem parent — way too large */
}

.review-enhanced__summary-total {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-top: 4px;
}

.review-enhanced__summary-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.review-enhanced__bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.review-enhanced__bar-label {
  min-width: 20px;
  text-align: right;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.review-enhanced__bar-label .fa-star {
  font-size: 0.7em;
  opacity: 0.5;
}

.review-enhanced__bar-track {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: color-mix(in srgb, currentColor 8%, transparent);
  overflow: hidden;
  position: relative;
}

.review-enhanced__bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  min-width: 0;
}

/* Star color grades — inherits from J3's primary accent when possible */
.review-enhanced__bar-fill[data-star="5"] {
  background: color-mix(in srgb, var(--primary-color, #388e3c) 90%, #000);
}

.review-enhanced__bar-fill[data-star="4"] {
  background: color-mix(in srgb, var(--primary-color, #388e3c) 75%, #8bc34a);
}

.review-enhanced__bar-fill[data-star="3"] {
  background: color-mix(in srgb, var(--primary-color, #ff9800) 70%, #ffb300);
}

.review-enhanced__bar-fill[data-star="2"] {
  background: color-mix(in srgb, var(--primary-color, #ff5722) 70%, #ff7043);
}

.review-enhanced__bar-fill[data-star="1"] {
  background: color-mix(in srgb, var(--primary-color, #f44336) 80%, #e53935);
}

.review-enhanced__bar-count {
  min-width: 32px;
  text-align: right;
  opacity: 0.5;
  font-size: 0.8rem;
}

/* ===== Review Cards ===== */
.review-enhanced__card {
  padding: 16px 0;
  border-bottom: 1px solid color-mix(in srgb, currentColor 8%, transparent);
  transition: background-color 0.15s ease;
}

.review-enhanced__card:last-child {
  border-bottom: none;
}

.review-enhanced__card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.review-enhanced__rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}

.review-enhanced__rating-badge .fa-star {
  font-size: 0.7em;
}

/* Rating badge colors — uses CSS variable interpolation */
.review-enhanced__rating-badge[data-rating="5"],
.review-enhanced__rating-badge[data-rating="4"] {
  background: color-mix(in srgb, var(--primary-color, #388e3c) 90%, #1b5e20);
}

.review-enhanced__rating-badge[data-rating="3"] {
  background: color-mix(in srgb, var(--primary-color, #ff9800) 85%, #e65100);
}

.review-enhanced__rating-badge[data-rating="2"],
.review-enhanced__rating-badge[data-rating="1"] {
  background: color-mix(in srgb, var(--primary-color, #f44336) 85%, #b71c1c);
}

.review-enhanced__card-date {
  font-size: 0.8rem;
  opacity: 0.5;
}

.review-enhanced__card-text {
  line-height: 1.6;
  margin-bottom: 12px;
  word-break: break-word;
}

.review-enhanced__card-text.is-truncated {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-enhanced__read-more {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

.review-enhanced__read-more:hover {
  opacity: 1;
}

/* ===== Review Images ===== */
.review-enhanced__images {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.review-enhanced__image-thumb {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, currentColor 10%, transparent);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.review-enhanced__image-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.review-enhanced__image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== Review Author Footer ===== */
.review-enhanced__card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-enhanced__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: color-mix(in srgb, var(--primary-color, #607d8b) 65%, #455a64);
  flex-shrink: 0;
}

.review-enhanced__author-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.review-enhanced__separator {
  opacity: 0.3;
}

/* ===== Review Form — Enhanced ===== */
.review-enhanced__form-section {
  margin-top: 24px;
}

.review-enhanced__form-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Interactive Star Rating */
.review-enhanced__star-rating {
  display: flex;
  align-items: center;
  gap: 2px;
  direction: rtl;
  unicode-bidi: bidi-override;
  /* direction:rtl makes flex-start = right edge; use flex-end to pack visually left */
  justify-content: flex-end;
  margin-bottom: 16px;
}

.review-enhanced__star-input {
  display: none;
}

.review-enhanced__star-label {
  cursor: pointer;
  line-height: 1;
  color: #ccc;
  transition: color 0.15s ease, transform 0.1s ease;
  font-style: normal;
  -webkit-text-stroke: 0;
  flex-shrink: 0;
}

/* Use the #input-rating ID to reach specificity 1,1,0 — beats J3's
   "label, .form-group .control-label, .form-label" rule (0,2,0 max)
   regardless of cascade order. !important kept as a second line of defence. */
#input-rating.review-enhanced__star-rating > .review-enhanced__star-label {
  font-size: 2.8rem !important;
  font-family: inherit !important;
  font-weight: normal !important;
  line-height: 1 !important;
}

.review-enhanced__star-label:hover,
.review-enhanced__star-label:hover~.review-enhanced__star-label {
  color: #ffc107;
  transform: scale(1.15);
}

.review-enhanced__star-input:checked~.review-enhanced__star-label {
  color: #ffc107;
}

/* Uppy Dashboard Container */
.review-enhanced__upload-section {
  margin-bottom: 16px;
}

.review-enhanced__upload-label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  display: block;
}

.review-enhanced__upload-hint {
  font-size: 0.8rem;
  opacity: 0.5;
  margin-top: 4px;
}

/* Uppy overrides for J3 theme compat */
.review-enhanced__upload-section .uppy-Dashboard {
  border-radius: 8px !important;
  border-color: color-mix(in srgb, currentColor 12%, transparent) !important;
}

.review-enhanced__upload-section .uppy-Dashboard-inner {
  background: var(--expand-overlay, var(--background-color, #fafafa)) !important;
}

.review-enhanced__upload-section .uppy-Dashboard-AddFiles {
  border-color: color-mix(in srgb, currentColor 10%, transparent) !important;
}

/* Submit Button */
.review-enhanced__submit {
  position: relative;
  overflow: hidden;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.review-enhanced__submit:active {
  transform: scale(0.97);
}

.review-enhanced__submit.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

/* ===== Empty State ===== */
.review-enhanced__empty {
  text-align: center;
  padding: 32px 16px;
  opacity: 0.5;
  font-size: 0.95rem;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .review-enhanced__summary {
    flex-direction: column;
    gap: 16px;
  }

  .review-enhanced__summary-score {
    border-right: none;
    border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
    padding-bottom: 16px;
    flex-direction: row;
    gap: 16px;
  }

  .review-enhanced__summary-number {
    font-size: 2rem;
  }

  .review-enhanced__image-thumb {
    width: 60px;
    height: 60px;
  }
}