/* Ninja Reviews widget — scoped under .nt-reviews (and .nt-badge) to avoid colliding with the host
   theme. Visual design mirrors the Yotpo "Reviews Main Widget" as seen on ninjatransfers.com PDP. */

/* ─── Width cap + centering (must live on our roots, not the host) ─── */
.nt-product, .nt-site {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── CSS custom properties (scoped) ─── */
.nt-reviews, .nt-badge {
  --nt-star: #FFC400;
  --nt-star-empty: #E3E3E3;
  --nt-blue: #019AFF;
  --nt-ink: #1a1a1a;
  --nt-muted: #6b7280;
  --nt-line: #e5e7eb;
  --nt-green: #2ecc71;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--nt-ink);
  box-sizing: border-box;
}
.nt-reviews *, .nt-reviews *::before, .nt-reviews *::after { box-sizing: inherit; }
.nt-badge *, .nt-badge *::before, .nt-badge *::after { box-sizing: inherit; }

/* ─── Stars (layered fractional-fill technique) ─── */
.nt-stars {
  position: relative;
  display: inline-block !important;
  line-height: 0;
  white-space: nowrap;
  vertical-align: middle;
}
/* Harden every star SVG so host-page rules (svg{display:none}, svg{width:100%},
   svg{fill:currentColor}) cannot override them — !important on all critical props.
   Width/height are set as inline attrs in JS — we force max-width:none and
   min-width/height:0 so flex/grid parents can't crush them, and !important on fill. */
.nt-stars-bg svg,
.nt-stars-fg svg {
  fill: #E3E3E3 !important;
  display: inline-block !important;
  vertical-align: middle !important;
  flex-shrink: 0 !important;
  overflow: visible !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
}
.nt-stars-fg {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  white-space: nowrap;
}
.nt-stars-fg svg { fill: #FFC400 !important; }

/* ─── Badge variant (sits inline next to PDP title) ─── */
.nt-badge {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  cursor: default;
  /* Ensure the badge itself never gets display:none from host */
  visibility: visible !important;
}
/* Badge stars: 15px, forced gold — host svg rules must not win */
.nt-badge .nt-stars {
  display: inline-flex !important;
  align-items: center;
}
.nt-badge .nt-stars-bg svg,
.nt-badge .nt-stars-fg svg {
  width: 15px !important;
  height: 15px !important;
}
.nt-badge-count {
  /* Match the adjacent Ninja product text (e.g. "Ships from"): 16px / 500 / black, no underline. */
  font-size: 16px;
  color: #000;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: normal;
  white-space: nowrap;
}

/* ─── Main widget header ─── */
.nt-widget-heading {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--nt-ink);
  padding-top: 22px;
  border-top: 1px solid var(--nt-line);
  text-align: center;
}

/* ─── Summary block (two-column on desktop) ─── */
.nt-summary {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 0 24px;
  border-bottom: 1px solid var(--nt-line);
}

/* LEFT: big average score — number + stars inline, count beneath */
.nt-summary-score {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 130px;
  gap: 4px;
}
/* Row 1: number + stars side-by-side */
.nt-summary-score-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.nt-avg {
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  color: var(--nt-blue);
}
.nt-summary-score .nt-stars { display: inline-block; }
.nt-count {
  font-size: 12px;
  color: var(--nt-muted);
  font-weight: 400;
  margin-top: 2px;
  text-align: left;
}

/* RIGHT: distribution bars — capped width, blue fill + counts */
.nt-dist {
  flex: 0 0 auto;
  width: 360px;
  max-width: 360px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nt-dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--nt-muted);
}
.nt-dist-label {
  width: 28px;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}
.nt-dist-star { color: var(--nt-star); }
.nt-dist-track {
  flex: 1;
  max-width: 240px;
  height: 8px;
  background: #e3e3e3;
  border-radius: 4px;
  overflow: hidden;
}
.nt-dist-fill {
  display: block;
  height: 100%;
  background: var(--nt-blue);
  border-radius: 4px;
}
.nt-dist-n {
  width: 46px;
  text-align: right;
  color: var(--nt-blue);
  font-size: 11px;
}

/* ─── Gallery strip ─── */
.nt-gallery { margin: 24px 0 0; }
.nt-gallery-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--nt-ink);
  margin: 0 0 10px;
}
.nt-gallery-inner {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--nt-line) transparent;
  padding-bottom: 6px;
}
.nt-gallery-inner::-webkit-scrollbar { height: 4px; }
.nt-gallery-inner::-webkit-scrollbar-thumb { background: var(--nt-line); border-radius: 2px; }
.nt-gallery-thumb {
  flex: 0 0 auto;
  width: 150px;
  height: 150px;
  border: 1px solid var(--nt-line);
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  background: #f3f4f6;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.nt-gallery-thumb:hover {
  border-color: var(--nt-blue);
  transform: scale(1.03);
}
.nt-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Gallery horizontal scroll chevrons */
.nt-gallery-scroller { position: relative; }
.nt-gallery-chev {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--nt-line);
  box-shadow: 0 1px 6px rgba(0,0,0,0.18);
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: var(--nt-ink);
  padding: 0;
  transition: opacity 0.15s, border-color 0.12s, color 0.12s;
}
.nt-gallery-chev:hover { border-color: var(--nt-blue); color: var(--nt-blue); }
.nt-gallery-chev-prev { left: 4px; }
.nt-gallery-chev-next { right: 4px; }
.nt-chev-hidden { opacity: 0; pointer-events: none; }
.nt-gallery-noscroll .nt-gallery-chev { display: none; }

/* ─── Filter row (search + controls) ─── */
.nt-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin: 22px 0 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--nt-line);
}

/* Sort dropdown */
.nt-sort-wrap { flex-shrink: 0; }
.nt-select {
  padding: 7px 30px 7px 12px;
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
  font-size: 13px;
  /* Hard reset: host theme styles bare <select> with a hatched background-image; override it. */
  background-color: #fff !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 10px 6px !important;
  font-family: inherit;
  color: var(--nt-ink);
  cursor: pointer;
  line-height: 1.4;
  height: auto;
  box-shadow: none !important;
  text-indent: 0;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
}
.nt-select:focus { outline: 2px solid var(--nt-blue); outline-offset: 1px; }

/* Search input (mirrors Yotpo "Search reviews") */
.nt-search-wrap { flex: 1; min-width: 180px; }
.nt-search {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
  font-size: 13px;
  font-family: inherit;
  color: var(--nt-ink);
  background-color: #fff !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: left 11px center !important;
  background-size: 14px 14px !important;
  box-shadow: none !important;
  line-height: 1.4;
  height: auto;
  appearance: none !important;
  -webkit-appearance: none !important;
}
.nt-search:focus { outline: 2px solid var(--nt-blue); outline-offset: 1px; }
.nt-search::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Right-side controls group */
.nt-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* With-media toggle */
.nt-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--nt-ink);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.nt-toggle-cb {
  width: 16px;
  height: 16px;
  accent-color: var(--nt-blue);
  cursor: pointer;
  margin: 0;
}

/* US compliance flag next to reviewer name */
.nt-flag-us {
  font-size: 13px;
  line-height: 1;
  vertical-align: middle;
  margin-left: 2px;
}

/* ─── Review list ─── */
.nt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  transition: opacity 0.15s;
}

.nt-card {
  padding: 20px 0;
  border-bottom: 1px solid var(--nt-line);
}

/* Card top row: avatar + author/verified col + date */
.nt-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.nt-card-who {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nt-author {
  font-weight: 700;
  font-size: 14px;
  color: var(--nt-ink);
  line-height: 1.3;
}
.nt-verified {
  color: #2ecc71;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.nt-date {
  color: var(--nt-muted);
  font-size: 12px;
  white-space: nowrap;
  margin-left: auto;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Stars sit below the avatar row */
.nt-card-stars { margin: 0 0 6px; }

.nt-card-title {
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 4px;
  color: var(--nt-ink);
  line-height: 1.4;
}
.nt-card-body {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  margin: 0;
}

/* Review photo thumbnails */
.nt-photos {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.nt-photo-btn {
  padding: 0;
  border: 1px solid var(--nt-line);
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  display: block;
}
.nt-photo-btn:hover {
  border-color: var(--nt-blue);
  transform: scale(1.04);
}
.nt-photo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  display: block;
}
.nt-video-wrap {
  position: relative;
  padding: 0;
  border: 1px solid var(--nt-line);
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  line-height: 0;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.nt-video-wrap:hover {
  border-color: var(--nt-blue);
  transform: scale(1.04);
}
.nt-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.15s;
}
.nt-video-play svg {
  width: 20px;
  height: 20px;
  fill: #fff;
  margin-left: 2px; /* optical centering of the triangle */
}
.nt-video {
  height: 132px;
  min-width: 92px;
  max-width: 220px;
  display: block;
  background: #000;
  object-fit: contain;
}

/* Merchant reply */
.nt-reply {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f6f8fa;
  border-left: 3px solid var(--nt-line);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  line-height: 1.55;
  color: #374151;
}
.nt-reply-label {
  font-weight: 700;
  font-size: 12px;
  color: var(--nt-muted);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Pagination ─── */
.nt-pager {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin: 28px 0 8px;
  flex-wrap: wrap;
}
.nt-page {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--nt-line);
  background: #fff;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  color: var(--nt-ink);
  font-family: inherit;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nt-page:hover:not(:disabled) { border-color: var(--nt-blue); color: var(--nt-blue); }
.nt-page.nt-active {
  background: var(--nt-blue);
  border-color: var(--nt-blue);
  color: #fff;
  font-weight: 700;
}
.nt-page:disabled { opacity: 0.35; cursor: default; }

/* ─── Site hero (site variant only) ─── */
.nt-site-hero {
  text-align: center;
  padding: 6px 0 18px;
}
.nt-site-line {
  margin-top: 8px;
  font-size: 15px;
  color: var(--nt-muted);
}
.nt-site-line strong {
  color: var(--nt-ink);
  font-size: 20px;
}

/* ─── Self-hosted footer line ─── */
/* ─── States ─── */
.nt-loading, .nt-empty, .nt-error {
  color: var(--nt-muted);
  font-size: 14px;
  padding: 18px 0;
}
.nt-error { color: #b42318; }

/* ─── Lightbox ─── */
.nt-lb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.82);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
body.nt-lb-open { overflow: hidden; }

.nt-lb-box {
  position: relative;
  background: #fff;
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.nt-lb-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--nt-muted);
  cursor: pointer;
  z-index: 2;
  padding: 2px 6px;
  border-radius: 4px;
}
.nt-lb-close:hover { color: var(--nt-ink); background: var(--nt-line); }

.nt-lb-img-wrap {
  width: 100%;
  background: #111;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 56vh;
}
.nt-lb-img {
  max-width: 100%;
  max-height: 56vh;
  object-fit: contain;
  display: block;
}
.nt-lb-video {
  max-width: 100%;
  max-height: 56vh;
  object-fit: contain;
  display: block;
  background: #000;
}

.nt-lb-nav {
  position: absolute;
  top: 30%;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--nt-line);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  color: var(--nt-ink);
  transition: border-color 0.12s, color 0.12s;
}
.nt-lb-nav:hover { background: #fff; border-color: var(--nt-blue); color: var(--nt-blue); }
.nt-lb-prev { left: 10px; }
.nt-lb-next { right: 10px; }

.nt-lb-info { padding: 16px 20px 20px; }
.nt-lb-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.nt-lb-author { font-weight: 700; font-size: 14px; color: var(--nt-ink); }
.nt-lb-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--nt-ink); }
.nt-lb-body { font-size: 14px; line-height: 1.6; color: #333; }
.nt-lb-counter { font-size: 12px; color: var(--nt-muted); margin-top: 10px; text-align: right; }

/* ─── Responsive: 390px primary ─── */
@media (max-width: 600px) {
  .nt-summary { gap: 18px; flex-direction: column; }
  .nt-summary-score { min-width: unset; width: 100%; align-items: flex-start; }
  .nt-summary-score-top { gap: 10px; }
  .nt-avg { font-size: 36px; }
  .nt-count { text-align: left; }
  .nt-dist { width: 100%; max-width: 100%; }
  .nt-gallery-thumb { width: 120px; height: 120px; }
  .nt-filter-row { flex-direction: column; gap: 10px; }
  .nt-controls { width: 100%; justify-content: space-between; }
  .nt-search-wrap { width: 100%; }
  .nt-sort-wrap { align-self: flex-end; }
  .nt-lb-box { border-radius: 8px; max-height: 96vh; }
  .nt-lb-img-wrap { max-height: 50vh; border-radius: 8px 8px 0 0; }
  .nt-lb-img { max-height: 50vh; }
  .nt-lb-video { max-height: 50vh; }
  .nt-lb-nav { top: 25%; width: 32px; height: 32px; font-size: 18px; }
  .nt-lb-prev { left: 4px; }
  .nt-lb-next { right: 4px; }
}
