/* Виджет отзывов с Авито. Все стили под префиксом .aw- — не конфликтуют с сайтом. */

#avito-reviews-widget,
[data-avito-widget] {
  --aw-bg: #1f44a8;
  --aw-bg-deep: #143177;
  --aw-card-bg: #ffffff;
  --aw-text: #0e1a2c;
  --aw-text-muted: #5a6779;
  --aw-accent: #e63946;
  --aw-star: #ffc107;
  --aw-radius: 12px;
  --aw-shadow: 0 4px 16px rgba(15, 35, 80, .12);

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--aw-text);
  background: var(--aw-bg);
  border-radius: var(--aw-radius);
  padding: 24px;
  box-sizing: border-box;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.aw-widget *,
.aw-widget *::before,
.aw-widget *::after {
  box-sizing: border-box;
}

/* ===== Заголовок ===== */
.aw-header__title {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.3;
  display: inline-block;
  position: relative;
  padding-bottom: 6px;
}
.aw-header__title::after {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 56px;
  height: 3px;
  background: var(--aw-accent);
  border-radius: 2px;
}

/* ===== Тело: 2 колонки ===== */
.aw-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  margin-top: 20px;
  align-items: stretch;
}

/* ===== Сводная карточка слева ===== */
.aw-summary {
  background: var(--aw-card-bg);
  border-radius: var(--aw-radius);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--aw-shadow);
  gap: 10px;
}
.aw-summary__rating {
  font-size: 28px;
  font-weight: 700;
}
.aw-summary__brand {
  margin-top: 8px;
  color: var(--aw-text);
}
.aw-avito-logo {
  height: 22px;
  width: auto;
  display: block;
}
.aw-summary__count {
  font-size: 13px;
  color: var(--aw-text-muted);
  margin-top: 4px;
}
.aw-summary__cta {
  margin-top: auto;
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--aw-text);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--aw-text);
  text-decoration: none;
  background: transparent;
  transition: background .2s, color .2s;
}
.aw-summary__cta:hover {
  background: var(--aw-text);
  color: #fff;
}

/* ===== Звёзды ===== */
.aw-stars {
  display: inline-flex;
  gap: 2px;
  font-size: 18px;
  line-height: 1;
}
.aw-star {
  color: #d8dde6;
}
.aw-star--filled {
  color: var(--aw-star);
}

/* ===== Карусель ===== */
.aw-carousel {
  position: relative;
  min-width: 0;
}
.aw-carousel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(320px, 1fr);
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 4px;
}
.aw-carousel__track::-webkit-scrollbar { display: none; }

/* ===== Карточка отзыва ===== */
.aw-review {
  background: var(--aw-card-bg);
  border-radius: var(--aw-radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-snap-align: start;
  box-shadow: var(--aw-shadow);
  min-height: 220px;
}
.aw-review__head {
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 10px;
  align-items: start;
}
.aw-review__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c8d3ec, #aab9d9);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  text-transform: uppercase;
}
.aw-review__author {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.aw-review__verify {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #00a046;
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}
.aw-review__date {
  font-size: 12px;
  color: var(--aw-text-muted);
  margin-top: 4px;
}
.aw-review__title {
  font-weight: 600;
  font-size: 14px;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.aw-review__text {
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
  color: var(--aw-text);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  white-space: pre-wrap;
  /* Плавный fade на нижнюю строку, как на скриншоте */
  mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}
.aw-review__text--expanded {
  -webkit-line-clamp: unset;
  display: block;
  overflow: visible;
  mask-image: none;
  -webkit-mask-image: none;
}
.aw-review__more {
  align-self: flex-start;
  background: transparent;
  border: 0;
  color: var(--aw-text);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 0 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-family: inherit;
}
.aw-review__more:hover { color: var(--aw-bg); }
.aw-review__more[hidden] { display: none; }

/* ===== Стрелки и прогресс ===== */
.aw-carousel__nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.aw-nav {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, .35);
  background: transparent;
  color: #fff;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .2s, border-color .2s;
}
.aw-nav:hover {
  background: rgba(255, 255, 255, .15);
  border-color: #fff;
}
.aw-progress {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, .3);
  border-radius: 2px;
  overflow: hidden;
}
.aw-progress__bar {
  height: 100%;
  background: #fff;
  width: 0;
  transition: width .15s ease-out;
}

/* ===== Загрузка / ошибка ===== */
.aw-status {
  color: #fff;
  text-align: center;
  padding: 20px;
  font-size: 14px;
}
.aw-status--error {
  color: #ffd1d1;
}

/* ===== Адаптив ===== */
@media (max-width: 720px) {
  #avito-reviews-widget,
  [data-avito-widget] {
    padding: 16px;
  }
  .aw-body {
    grid-template-columns: 1fr;
  }
  .aw-summary {
    flex-direction: row;
    flex-wrap: wrap;
    text-align: left;
    padding: 16px;
  }
  .aw-summary__rating { font-size: 22px; }
  .aw-summary__cta { margin-left: auto; margin-top: 0; }
  .aw-carousel__track {
    grid-auto-columns: 85%;
  }
}
