/**
 * Happy Customers Widget Styles
 * Reference-parity layout: summary header, distribution bars, media wall,
 * type tabs + toolbar, three-column review rows.
 * Extends the CSS variables defined in all-reviews.css.
 *
 * @package YayReviews
 */

/* Neutralize the inherited filter-bar panel: the toolbar row supplies its own look */
.yayrev-hc .yayrev-widget__filters {
  background: transparent;
  padding: 0;
}

/* ---------------------------------- */
/* Summary hero (average + big stars) */
/* ---------------------------------- */

.yayrev-hc__summary {
  margin-bottom: 2rem;
}

.yayrev-hc__hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 1.75rem;
}

/* Hero + bar stars reuse the shared rating renderer; only scale the icons here */
.yayrev-hc__hero-stars {
  display: inline-block;
  line-height: 1;
}

.yayrev-hc__hero-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
}

.yayrev-hc__hero-rating .yayrev-rating-icon {
  width: 24px;
  height: 24px;
  font-size: 24px;
  max-height: unset;
}

.yayrev-hc__hero-meta {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  font-size: 0.9375rem;
}

.yayrev-hc__hero-average {
  font-weight: 600;
}

.yayrev-hc__hero-count {
  color: var(--yayrev-text-muted);
}

/* ---------------------------------------- */
/* Overview row: distribution bars + wall   */
/* ---------------------------------------- */

.yayrev-hc__overview {
  display: flex;
  justify-content: center;
  gap: 2rem;
  align-items: center;
  justify-items: center;
}

/* Bars use the shared .yayrev-rating-bar design (assets/css/frontend/rating-bars.css). */
.yayrev-hc__bars {
  width: 100%;
  max-width: 360px;
}

/* ------------------------- */
/* Customer media wall       */
/* ------------------------- */

/* The media wall renders through the shared media-grid component (context=wall).
   These overrides restore the wall's compact 4-column look on top of the grid. */
.yayrev-media-grid--wall {
  width: 100%;
  max-width: 360px;
}

.yayrev-media-grid--wall .yayrev-media-grid__grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.yayrev-media-grid--wall .yayrev-media-grid__more {
  background: rgba(17, 24, 39, 0.55);
  font-size: 0.875rem;
  font-weight: 600;
}

/* ------------------------- */
/* Tabs + toolbar row        */
/* ------------------------- */

.yayrev-hc__toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid var(--yayrev-border);
  margin-bottom: 0;
  border-radius: 0;
}

.yayrev-hc__tabs {
  display: flex;
  gap: 1.5rem;
}

.yayrev-hc__tab {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.625rem 0;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.9375rem;
  color: var(--yayrev-text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.yayrev-hc__tab:hover {
  color: var(--yayrev-text);
}

.yayrev-hc__tab--active {
  color: var(--yayrev-text);
  font-weight: 600;
  border-bottom-color: var(--yayrev-primary);
}

.yayrev-hc__toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  padding-bottom: 0.375rem;
}

.yayrev-hc__search {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.yayrev-hc__search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: var(--yayrev-bg);
  border: 1px solid var(--yayrev-border);
  border-radius: 6px;
  color: var(--yayrev-text);
  cursor: pointer;
  transition: background-color 0.15s;
}

.yayrev-hc__search-toggle:hover {
  background: var(--yayrev-bg-hover);
}

.yayrev-hc .yayrev-hc__search-input {
  display: none;
  width: 200px;
  padding: 0.5rem 0.75rem !important;
}

.yayrev-hc__search--open .yayrev-hc__search-input {
  display: block;
}

.yayrev-hc__select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--yayrev-border);
  border-radius: 6px;
  background: var(--yayrev-bg);
  font-size: 0.875rem;
  color: var(--yayrev-text);
  cursor: pointer;
}

/* ------------------------- */
/* Review rows (3 columns)   */
/* ------------------------- */

.yayrev-hc__reviews {
  display: flex;
  flex-direction: column;
}

.yayrev-hc__review {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 320px;
  gap: 1.5rem;
  padding: 1.75rem 0;
  border:none;
  border-radius: 0;
  border-bottom: 1px solid var(--yayrev-border);
}

.yayrev-hc__review:hover {
  box-shadow: none;
}

.yayrev-hc__author {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.yayrev-hc__author-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.yayrev-hc__author-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.yayrev-hc__author-name {
  font-weight: 600;
}

.yayrev-hc__date {
  font-size: 0.8125rem;
  color: var(--yayrev-text-muted);
}

.yayrev-hc__review-main {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  min-width: 0;
}

.yayrev-hc__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.yayrev-hc__content {
  color: var(--yayrev-text);
}

.yayrev-hc__content p:last-child {
  margin-bottom: 0;
}

.yayrev-hc__provenance {
  margin: 0;
  font-size: 0.875rem;
  color: var(--yayrev-text-muted);
}

.yayrev-hc__votes {
  margin-top: 0.25rem;
}

.yayrev-hc__product-card {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding: 0.625rem 0.875rem;
  background: var(--yayrev-bg-hover);
  border-radius: var(--yayrev-radius);
  text-decoration: none;
  color: var(--yayrev-text);
  max-width: 420px;
}

.yayrev-hc__product-card:hover .yayrev-hc__product-name {
  text-decoration: underline;
}

.yayrev-hc__product-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.yayrev-hc__product-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.yayrev-hc__product-label {
  font-size: 0.75rem;
  color: var(--yayrev-text-muted);
}

.yayrev-hc__product-name {
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Replies: only rendered when non-empty (see review-item.php), so no empty-state
   rule is needed. .yayrev-hc__review-main is a flex column with its own gap, so
   the reply components' own top spacing/border is zeroed here to avoid double
   spacing; their own padding/colors are left untouched for visual consistency
   with the reply markup elsewhere (single review page, my account, store reviews). */
.yayrev-hc__replies .yayrev-store-replies,
.yayrev-hc__replies .yayrev-store-review__replies {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* Right column: first media large, extras as a thumb strip */
.yayrev-hc__review-media .yayrev-media-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.yayrev-hc__review-media .yayrev-media-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

.yayrev-hc__review-media .yayrev-media-thumb:first-child {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
}

.yayrev-hc__review-media .yayrev-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.yayrev-hc__review-media .yayrev-video-thumb {
  width: 100%;
  height: 100%;
}

/* ------------------------- */
/* Responsive                */
/* ------------------------- */

@media (max-width: 900px) {
  .yayrev-hc__review {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .yayrev-hc__review-media {
    grid-column: 2;
  }

  .yayrev-hc__review-media--empty {
    display: none;
  }

  .yayrev-hc__review-media .yayrev-media-thumb:first-child {
    width: 64px;
    height: 64px;
    aspect-ratio: auto;
  }
}

@media (max-width: 640px) {

  .yayrev-hc__review {
    grid-template-columns: 1fr;
  }

  .yayrev-hc__toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .yayrev-hc__tabs {
    gap: 1rem;
    overflow-x: auto;
  }

  .yayrev-hc__toolbar {
    margin-left: 0;
  }

  .yayrev-hc .yayrev-hc__search-input {
    width: 100%;
  }

  .yayrev-hc__search {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .yayrev-hc__bar,
  .yayrev-hc__tab,
  .yayrev-hc__search-toggle {
    transition: none;
  }
}
