/* Yandex Reviews Widget — палитра задаётся для каждого экземпляра из админки */
.yrw {
  --yrw-accent: #FF4433;
  --yrw-on-accent: #FFFFFF;
  --yrw-widget-bg: #FFCC00;
  --yrw-summary-bg: #FFFFFF;
  --yrw-card-bg: #FFFFFF;
  --yrw-text: #1A1A1A;
  --yrw-muted: #1A1A1A;
  --yrw-border: #FFD3CD;
  --yrw-star: #FFCC00;
  --yrw-lines: #FF4433;
  --yrw-arrows: #1A1A1A;
  --yrw-brand-red: var(--yrw-accent);
  --yrw-brand-red-dark: #D92B20;
  --yrw-red: var(--yrw-accent);
  --yrw-red-dark: var(--yrw-accent);
  --yrw-yellow: var(--yrw-lines);
  --yrw-yellow-dark: #E6B800;
  --yrw-yellow-soft: #fff3cc;
  --yrw-card: var(--yrw-card-bg);
  --yrw-star-off: #e5e7eb;
  --yrw-reply: var(--yrw-summary-bg);
  --yrw-radius: 20px;
  --yrw-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  --yrw-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.1);

  color: var(--yrw-text);
  width: 100%;
  max-width: 1430px;
  min-width: 0;
  margin: 28px auto;
  padding: 22px 20px 18px;
  border-radius: 28px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;

  background: var(--yrw-widget-bg);
  border: 1px solid var(--yrw-border);
  box-shadow: var(--yrw-shadow);
  position: relative;
  overflow: hidden;
}

.yrw::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: #FF4433;
  z-index: 0;
}

.yrw * {
  box-sizing: border-box;
}

.yrw--square,
.yrw--square *,
.yrw--square::before,
.yrw--square *::before,
.yrw--square *::after {
  border-radius: 0 !important;
}

/* Header */
.yrw__header {
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.yrw__header::after {
  content: "";
  display: block;
  width: 76px;
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: #FFCC00;
}

.yrw__title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--yrw-text) !important;
}

/* Summary */
.yrw__summary {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  background: var(--yrw-summary-bg) !important;
  background-image: none !important;
  border: 1px solid var(--yrw-border);
  border-radius: 22px;
  box-shadow: none;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
  color: var(--yrw-text) !important;
}

.yrw__summary-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 88px;
  padding: 10px 14px;
  border-radius: 20px;
  background: var(--yrw-accent) !important;
  background-image: none !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
  color: var(--yrw-on-accent) !important;
  flex-shrink: 0;
}

.yrw__score-value {
  font-size: 32px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--yrw-on-accent) !important;
  text-align: center;
  white-space: nowrap;
}

.yrw__summary-score .yrw__stars {
  margin-top: 4px;
}

.yrw__summary-score .yrw__star {
  color: var(--yrw-on-accent) !important;
  -webkit-text-fill-color: var(--yrw-on-accent) !important;
  opacity: 0.35;
  font-size: 14px;
}

.yrw__summary-score .yrw__star.is-on {
  color: var(--yrw-on-accent) !important;
  -webkit-text-fill-color: var(--yrw-on-accent) !important;
  opacity: 1;
  text-shadow: none;
}

.yrw__summary-score .yrw__star--summary {
  --yrw-star-fill: 0%;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  opacity: 1;
  background: linear-gradient(90deg,
    var(--yrw-on-accent) 0 var(--yrw-star-fill),
    rgba(255, 255, 255, 0.35) var(--yrw-star-fill) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.yrw__summary-meta {
  flex: 1;
  min-width: 0;
  color: var(--yrw-text) !important;
}

.yrw__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  height: 88px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  line-height: 0;
  box-shadow: none;
}

.yrw__brand-logo {
  display: block;
  width: auto;
  height: 70px;
  max-width: 267px;
  object-fit: contain;
}

.yrw__org {
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 4px;
  color: var(--yrw-text) !important;
}

.yrw__based {
  color: #111111 !important;
  font-size: 13px;
  line-height: 1.4;
  opacity: 0.85;
}

.yrw__summary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.yrw__summary-actions .yrw__source-link {
  margin-top: 0;
}

.yrw__review-link {
  display: inline-flex !important;
  align-items: center;
  padding: 8px 16px !important;
  border-radius: 999px !important;
  background: var(--yrw-arrows) !important;
  color: var(--yrw-on-accent) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
  border: 0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14) !important;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.yrw__review-link:hover,
.yrw__review-link:focus,
.yrw__review-link:visited {
  background: var(--yrw-arrows) !important;
  color: var(--yrw-on-accent) !important;
  text-decoration: none !important;
}

.yrw__review-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

.yrw__summary a.yrw__source-link,
.yrw a.yrw__source-link,
.yrw__source-link {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 16px !important;
  border-radius: 999px !important;
  background: var(--yrw-accent) !important;
  background-image: none !important;
  color: var(--yrw-on-accent) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  border: 0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14) !important;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.2 !important;
}

.yrw__summary a.yrw__source-link:hover,
.yrw a.yrw__source-link:hover,
.yrw a.yrw__source-link:focus,
.yrw a.yrw__source-link:visited,
.yrw__source-link:hover {
  background: var(--yrw-accent) !important;
  background-image: none !important;
  color: var(--yrw-on-accent) !important;
  text-decoration: none !important;
  transform: translateY(-1px);
  filter: brightness(0.88);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18) !important;
}

/* Stars — жёлтые у имени клиента */
.yrw__stars {
  display: inline-flex !important;
  gap: 1px;
  letter-spacing: 0;
  line-height: 1;
  color: transparent;
}

.yrw__star {
  font-size: 15px !important;
  line-height: 1 !important;
  color: var(--yrw-star-off) !important;
  -webkit-text-fill-color: var(--yrw-star-off) !important;
}

.yrw__star.is-on {
  color: var(--yrw-star) !important;
  -webkit-text-fill-color: var(--yrw-star) !important;
  text-shadow: none;
}

.yrw__stars--sm .yrw__star {
  font-size: 14px !important;
}

/* Cards */
.yrw__card {
  background: var(--yrw-card-bg);
  border: 1px solid var(--yrw-border);
  border-radius: var(--yrw-radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
  padding: 16px 16px 14px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  background-clip: padding-box;
}

.yrw__card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--yrw-lines) !important;
  background-image: none !important;
  border-radius: 4px 0 0 4px;
}

.yrw__card:hover {
  transform: translateY(-3px);
  box-shadow: var(--yrw-shadow-hover);
}

.yrw__card-top {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding-left: 4px;
}

.yrw__avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.yrw__avatar,
.yrw__avatar--placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--yrw-summary-bg);
  color: var(--yrw-accent);
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid var(--yrw-card-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.yrw__badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: var(--yrw-on-accent);
  background: var(--yrw-accent);
  border: 2px solid var(--yrw-card-bg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  line-height: 1;
}

.yrw__author {
  font-weight: 800;
  font-size: 15px;
  color: var(--yrw-text);
}

.yrw__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 3px;
}

.yrw__date {
  color: var(--yrw-muted);
  font-size: 12px;
  font-weight: 500;
}

.yrw__text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--yrw-text);
  word-break: break-word;
  padding-left: 4px;
}

.yrw__text::before {
  content: "“";
  color: var(--yrw-accent);
  font-size: 20px;
  font-weight: 800;
  line-height: 0;
  margin-right: 2px;
  vertical-align: -4px;
}

.yrw__reply {
  margin-top: 10px;
  margin-left: 4px;
  padding: 10px 12px;
  background: var(--yrw-reply);
  border: 1px solid var(--yrw-border);
  border-left: 3px solid var(--yrw-lines);
  border-radius: 12px;
  font-size: 13px;
  color: var(--yrw-text);
  line-height: 1.45;
}

.yrw__reply strong {
  color: var(--yrw-accent);
  font-weight: 800;
}

/* List */
.yrw__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}

/* Table */
.yrw__table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--yrw-border);
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  background: var(--yrw-card-bg);
  position: relative;
  z-index: 1;
}

.yrw__table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.yrw__table th,
.yrw__table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--yrw-border);
  vertical-align: top;
  text-align: left;
  font-size: 13px;
}

.yrw__table th {
  background: var(--yrw-summary-bg);
  font-weight: 800;
  white-space: nowrap;
  color: var(--yrw-text);
}

.yrw__table tr:hover td {
  background: var(--yrw-summary-bg);
}

.yrw__table tr:last-child td {
  border-bottom: 0;
}

.yrw__author-cell {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
}

.yrw__author-cell .yrw__avatar {
  width: 38px;
  height: 38px;
  font-size: 14px;
}

.yrw__td-text .yrw__text::before {
  display: none;
}

/* Carousel — native scroll (стрелки листают через scrollBy) */
.yrw__carousel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
}

.yrw__viewport {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* hide scrollbar, keep scroll */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.yrw__viewport::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.yrw__track {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 16px;
  width: max-content;
  transform: none !important;
}

.yrw__card--slide {
  flex: 0 0 auto;
  min-height: 220px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.yrw__card--slide .yrw__text {
  flex: 1;
}

/* Nav — всегда кликабельны */
.yrw__nav {
  flex: 0 0 44px !important;
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  border: 0 !important;
  background: var(--yrw-arrows) !important;
  border-radius: 50% !important;
  font-size: 26px !important;
  line-height: 1 !important;
  color: var(--yrw-on-accent) !important;
  cursor: pointer !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18) !important;
  align-self: center;
  padding: 0 !important;
  margin: 0 !important;
  transition: transform 0.15s ease, opacity 0.15s ease;
  z-index: 5 !important;
  position: relative;
  pointer-events: auto !important;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
}

.yrw__nav:hover {
  transform: scale(1.06);
}

.yrw__nav-icon {
  display: block;
  width: 24px;
  height: 24px;
  background-color: var(--yrw-on-accent);
  -webkit-mask: url("../image/yandex_reviews_arrow.webp") center / contain no-repeat;
  mask: url("../image/yandex_reviews_arrow.webp") center / contain no-repeat;
}

.yrw__nav--prev .yrw__nav-icon {
  transform: rotate(180deg);
}

.yrw__nav.is-disabled {
  opacity: 0.4 !important;
  cursor: default !important;
  box-shadow: none !important;
  background: var(--yrw-border) !important;
}

.yrw--carousel .yrw__nav {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  visibility: visible !important;
}

.yrw__dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

.yrw__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  background: var(--yrw-border);
  padding: 0;
  cursor: pointer;
  transition: width 0.2s ease, background 0.2s ease, border-radius 0.2s ease;
}

.yrw__dot.is-active {
  width: 20px;
  border-radius: 999px;
  background: var(--yrw-accent);
}

/* Phones incl. iPhone Max: 1 card (JS sets width; CSS fallback) */
@media (max-width: 767px) {
  .yrw {
    margin: 16px auto;
    padding: 16px 12px 14px;
    border-radius: 22px;
  }

  .yrw__title {
    font-size: 20px;
  }

  .yrw__summary {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    align-items: center;
    border-radius: 18px;
    padding: 12px;
    column-gap: 10px;
    row-gap: 14px;
  }

  .yrw__summary-score {
    grid-column: 1;
    grid-row: 1;
    width: 100px;
    min-width: 0;
    min-height: 80px;
    padding: 8px;
  }

  .yrw__score-value {
    font-size: 30px;
  }

  .yrw__summary-meta {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .yrw__brand {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 100%;
    max-width: 230px;
    min-width: 0;
    height: 80px;
    margin: 0;
    padding: 6px;
    border-radius: 18px;
    overflow: hidden;
  }

  .yrw__brand-logo {
    width: 100%;
    height: 60px;
    max-width: 228px;
    object-fit: contain;
  }

  .yrw__nav {
    flex: 0 0 38px !important;
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    font-size: 22px !important;
  }

  .yrw--table .yrw__table {
    min-width: 520px;
  }
}

/* Corner shape selected in module settings. Rounded mode follows the reference layout. */
.yrw--rounded {
  border-radius: 28px !important;
}

.yrw--rounded .yrw__summary {
  border-radius: 22px !important;
}

.yrw--rounded .yrw__summary-score,
.yrw--rounded .yrw__card {
  border-radius: 20px !important;
}

.yrw--rounded .yrw__brand {
  border-radius: 18px !important;
}

.yrw--rounded .yrw__source-link,
.yrw--rounded .yrw__review-link {
  border-radius: 10px !important;
}

.yrw--rounded .yrw__avatar,
.yrw--rounded .yrw__avatar--placeholder {
  border-radius: 10px !important;
}

.yrw--rounded .yrw__badge {
  border-radius: 4px !important;
}

.yrw--rounded .yrw__nav {
  border-radius: 12px !important;
}

.yrw--rounded .yrw__dot {
  border-radius: 2px !important;
}

.yrw--rounded .yrw__dot.is-active {
  border-radius: 4px !important;
}

.yrw--rounded .yrw__reply {
  border-radius: 12px !important;
}

.yrw--rounded .yrw__table-wrap {
  border-radius: 18px !important;
}

@media (max-width: 767px) {
  .yrw--rounded {
    border-radius: 22px !important;
  }

  .yrw--rounded .yrw__summary,
  .yrw--rounded .yrw__brand {
    border-radius: 18px !important;
  }
}
