/*!
Vouch app code (c) Rofsky Solutions. Unauthorized copying or reuse prohibited. Merchant content and third-party licenses unaffected.
*/
/* --- Global Variables (Required for all components) --- */
:root {
  --review-star-color: #ffb400;
  --review-primary-color: #1F1E1F;
  --review-border-color: #ebebeb;
  --review-bg-color: #ffffff;
  --review-text-color: #2d2d2d;
  --review-text-secondary: #6a6a6a;
  --review-verified-color: #008060;
  --review-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --review-radius: 8px;
}

/* Container query scope - lets responsive rules react to the widget's own
   width instead of viewport width, so the admin preview's 375px wrapper
   triggers the same collapse behavior as a real mobile viewport. */
.review-widget {
  container-type: inline-size;
  container-name: review-widget;
}

/* Theme-compat: Horizon-style themes use `align-items: flex-start` on the
   flex column that wraps app blocks, so the `.shopify-block` flex item
   sizes to its content instead of stretching. Combined with our widget's
   `container-type: inline-size` (which short-circuits the intrinsic-size
   chain), the widget collapses to width: 0 and reviews render squashed
   into a narrow strip. Restore the default flex stretch on the parent
   block - but only when it actually wraps our widget, so we don't touch
   any other app's blocks on the page. */
.shopify-block:has(> .review-widget) {
  align-self: stretch;
  width: 100%;
  min-width: 0;
}

/* --- Header Layout Specific Styles --- */
.review-header-horizontal .review-summary {
  flex-direction: row;
  justify-content: space-evenly;
  gap: 20px;
}

.review-header-vertical .review-summary {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.review-summary {
  display: flex;
  align-items: center;
  padding: 20px;
  background: #f9f9f9;
  border-radius: var(--review-radius);
  margin-block-end: 40px;
}

.review-header-horizontal .average-rating {
  flex: 0 0 auto;
  min-width: 120px;
  border-inline-end: 1px solid var(--review-border-color);
  padding-inline-end: 32px;
}

.review-header-vertical .average-rating {
  border-inline-end: none;
  width: 100%;
}

.average-rating {
  text-align: center;
  border-inline-end: 1px solid var(--review-border-color);
}

.rating-number-wrapper {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-block-end: 4px;
}

.rating-number {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  color: var(--review-text-color);
}

.vouch-rating-star {
  font-size: var(--review-header-star-size, 48px);
  color: var(--review-header-star-color, var(--review-star-color));
  line-height: 1;
}

.review-header-horizontal .rating-distribution {
  flex: 1;
}

.review-header-vertical .rating-distribution {
  align-items: center;
  width: 100%;
}

.rating-distribution {
  min-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  width: 100%;
}

.review-header-vertical .dist-row {
  justify-content: center;
  width: 100%;
  max-width: 500px;
}

.review-header-vertical .dist-bar-bg {
  flex: none;
  width: 40%;
  flex-shrink: 0;
}

.review-header-vertical .write-review-btn {
  margin: 0 auto;
  display: block;
}

.review-header-horizontal .write-review-btn {
  flex: 0 0 auto;
}

.write-review-btn {
  color: var(--review-button-text-color);
}

.review-widget {
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  color: var(--review-text-color);
  padding-block: 8px;
  box-sizing: border-box;
}

.review-summary {
  display: flex;
  align-items: center;
  padding: 20px;
  background: #f9f9f9;
  border-radius: var(--review-radius);
  margin-block-end: 40px;
}

@container review-widget (max-width: 600px) {
  .review-header-horizontal .review-summary {
    flex-direction: column;
    gap: 20px;
  }

  .review-header-horizontal .average-rating {
    border-inline-end: none;
    border-block-end: 1px solid var(--review-border-color);
    padding-inline-end: 0;
    width: 100%;
  }

  .review-header-horizontal .write-review-btn {
    width: 100%;
  }
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--review-text-secondary);
}

.dist-stars {
  min-width: 80px;
  color: var(--review-header-star-color, var(--review-star-color));
  font-size: 16px;
  white-space: nowrap;
}

.dist-bar-bg {
  flex: 1;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  background: var(--review-star-color);
  transition: width 0.3s ease;
  display: block;
}

.dist-bar-fill:empty {
  display: block;
}

.dist-count {
  min-width: 40px;
  text-align: center;
  font-weight: 500;
  color: var(--review-text-color);
}

/* --- Clean Header Styles --- */
.review-header-clean {
  width: 100%;
  position: relative;
  margin-block-end: 32px;
  display: inline-block; /* Or block, depending on desired width */
}

/* Remove default marker */
.review-header-clean summary {
  list-style: none;
}
.review-header-clean summary::-webkit-details-marker {
  display: none;
}

.clean-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  user-select: none;
  font-weight: 500;
  font-size: 16px;
}

.clean-summary:hover {
  background-color: #f5f5f5;
}

.summary-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-stars {
  display: flex;
  color: var(--review-header-star-color, var(--review-star-color));
  align-items: center;
}

.summary-text {
  color: var(--review-text-color);
}

.summary-chevron {
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
  color: var(--review-text-color); /* Black chevron as in image */
}

.review-header-clean[open] .summary-chevron {
  transform: rotate(180deg);
}

.clean-dropdown {
  position: absolute;
  box-sizing: border-box;
  width: 100%;
  top: 100%;
  /* left: 0; */
  margin-top: 4px;
  background: white;
  border: 1px solid var(--review-border-color);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 10px;
  gap: 10px;
  width: 380px;
  /* max-width: 90vw; */
  z-index: 10;
}

.dropdown-header {
  display: flex;
  justify-content: center;
}

.dropdown-rating-large {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 32px;
  font-weight: 600;
  color: var(--review-header-star-color, var(--review-star-color));
}

.dropdown-rating-large svg {
  color: var(--review-header-star-color, var(--review-star-color));
}

.review-header-clean .rating-distribution {
  min-width: auto;
}

.review-header-clean .dist-row {
  margin-bottom: 8px;
}

.review-header-clean .dist-stars {
  color: var(--review-header-star-color, var(--review-star-color));
  width: auto;
  min-width: 60px;
}

.review-header-clean .dist-bar-bg {
  background: #f0f0f0;
}

.review-header-clean .dist-bar-fill {
  background: var(--review-star-color);
}

/* Fade out effect overlay if needed? Not requested for popup */
