/**
 * Section: Opinions / Reviews — v3 premium redesign
 *
 * Layout:
 *   Top row  : heading left  |  score card right  (2-col grid)
 *   Filter   : label + pill chips
 *   Slider   : prev arrow | overflow | next arrow  (arrows flush to cards)
 *   Pagination: pill dots
 *   CTA bar  : full-width encouragement strip
 *
 * Design tokens: base.css :root
 * Accent : --color-accent (#ff3a2d)
 * Stars  : #f59e0b (amber — universal review convention)
 *
 * @package Ortorodzina
 */

/* ── Shell ────────────────────────────────────────────────────────────────── */

.opinions {
  padding: var(--space-8) 0 var(--space-9);
  background: var(--color-surface);
}

/* ── Top 2-column row ─────────────────────────────────────────────────────── */

.opinions__top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-6) var(--space-8);
  align-items: start;
  margin-bottom: var(--space-6);
}

/* Left: heading + intro */

.opinions__top-left {
  max-width: 620px;
  transition:
    opacity 500ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 500ms cubic-bezier(0.23, 1, 0.32, 1);

  @starting-style {
    opacity: 0;
    transform: translateY(14px);
  }
}

.opinions__title {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  color: var(--color-dark);
  line-height: 1.2;
  margin: 0 0 var(--space-4);
}

.opinions__intro {
  font-size: 16px;
  color: var(--color-text-soft);
  line-height: 1.7;
  margin: 0;
}

/* Right: compact score card */

.opinions__score-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 260px;
  flex-shrink: 0;
}

.opinions__score-main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.opinions__score-num {
  font-size: 42px;
  font-weight: 800;
  color: var(--color-accent);
  line-height: 1;
  letter-spacing: -1px;
}

.opinions__score-detail {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.opinions__score-stars {
  display: inline-flex;
  gap: 2px;
  color: #f59e0b;
}

.opinions__score-count {
  font-size: 13px;
  color: var(--color-text-soft);
  font-weight: 400;
}

/* Platform pills inside score card */

.opinions__score-platforms {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.opinions__platform {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition:
    background 160ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.opinions__platform:hover,
.opinions__platform:focus-visible {
  background: #f0f0f0;
  border-color: #c5c5c5;
}

.opinions__platform:active {
  transform: scale(0.97);
}

.opinions__platform img {
  display: block;
  flex-shrink: 0;
  border-radius: 2px;
}

.opinions__platform-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-soft);
  flex: 1;
}

.opinions__platform-score {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-dark-2);
}

/* ── Filter row ───────────────────────────────────────────────────────────── */

.opinions__filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.opinions__filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-soft);
  white-space: nowrap;
  flex-shrink: 0;
}

.opinions__tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.opin-tag {
  cursor: pointer;
  border: 1.5px solid var(--color-border);
  background: #fff;
  color: var(--color-text-soft);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 15px;
  border-radius: 100px;
  line-height: 1.2;
  transition:
    background 160ms cubic-bezier(0.23, 1, 0.32, 1),
    color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 160ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.opin-tag:hover {
  border-color: var(--color-dark-2);
  color: var(--color-dark-2);
  background: #f7f7f7;
}

.opin-tag:active {
  transform: scale(0.97);
}

.opin-tag--active,
.opin-tag--active:hover {
  background: var(--color-dark);
  border-color: var(--color-dark);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* ── Slider shell ─────────────────────────────────────────────────────────── */

/* Arrows sit flush against the overflow so they feel attached to the cards */
.opinions__slider-shell {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

/* Overflow wrapper: extra padding so card shadows aren't clipped.
   Negative margin compensates for the added space. */
.opinions__overflow {
  overflow: hidden;
  padding: 12px 20px 20px;
  margin: 0 -20px -14px;
}

.opinions__track {
  display: flex;
  gap: var(--space-5); /* 24 px — must match JS getGap() fallback */
  list-style: none;
  margin: 0;
  padding: 0;
  will-change: transform;
}

/* ── Arrow buttons ────────────────────────────────────────────────────────── */

.opinions__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  background: #fff;
  color: var(--color-dark-2);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition:
    background 160ms cubic-bezier(0.23, 1, 0.32, 1),
    border-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 160ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.opinions__arrow:hover:not(:disabled) {
  background: var(--color-dark);
  border-color: var(--color-dark);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.opinions__arrow:active:not(:disabled) {
  transform: scale(0.93);
}

.opinions__arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

/* 3-up by default; responsive overrides below match JS getPerPage() */
.opinion-card {
  flex: 0 0 calc((100% - var(--space-5) * 2) / 3);
  background: #fff;
  border: 1px solid #ebebeb;
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-5) var(--space-4);
  box-shadow:
    0 1px 6px rgba(0, 0, 0, 0.05),
    0 4px 18px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  position: relative;
  overflow: hidden;
  transition:
    box-shadow 200ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}

.opinion-card::before {
  content: "\201C";
  position: absolute;
  top: 4px;
  right: 52px;
  font-size: 180px;
  line-height: 1;
  color: #faf9f9;
  font-family: Georgia, serif;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.opinion-card:hover {
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.1),
    0 1px 4px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

/* ── Card: author row ─────────────────────────────────────────────────────── */

.opinion-card__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  position: relative;
  z-index: 1;
}

.opinion-card__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
  user-select: none;
}

.opinion-card__meta {
  flex: 1;
  min-width: 0;
}

.opinion-card__name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-dark-2);
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opinion-card__date {
  display: block;
  font-size: 12px;
  color: var(--color-text-soft);
  margin-top: 1px;
}

/* Source label: icon + platform name, top-right of head */
.opinion-card__source {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
  flex-shrink: 0;
}

.opinion-card__source img {
  display: block;
  flex-shrink: 0;
  border-radius: 2px;
}

/* ── Stars ────────────────────────────────────────────────────────────────── */

.opinion-card__stars {
  display: flex;
  gap: 2px;
  color: #f59e0b;
}

.opinion-card__star--empty {
  color: #d1d5db;
}

/* ── Category tag ─────────────────────────────────────────────────────────── */

.opinion-card__tag-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.opinion-card__tag {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-soft);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 3px 10px;
  line-height: 1.4;
}

/* ── Body: text + expand button ───────────────────────────────────────────── */

.opinion-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.opinion-card__text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text);
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.opinion-card__body--expanded .opinion-card__text {
  -webkit-line-clamp: none;
  overflow: visible;
}

.opinion-card__more {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  line-height: 1.4;
}

.opinion-card__more:hover {
  text-decoration: underline;
}

/* ── Card footer ──────────────────────────────────────────────────────────── */

.opinion-card__footer {
  padding-top: var(--space-3);
  border-top: 1px solid #f0f0f0;
  margin-top: auto;
}

.opinion-card__patient {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ── Pagination dots ──────────────────────────────────────────────────────── */

.opinions__pagination {
  display: flex;
  justify-content: center;
  padding: var(--space-3) 0 var(--space-5);
}

.opinions__dots {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.opinions__counter {
  display: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-soft);
  letter-spacing: 0.03em;
}

.opinions__dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d1d5db;
  border: none;
  padding: 0;
  cursor: pointer;
  transition:
    background 160ms cubic-bezier(0.23, 1, 0.32, 1),
    width 200ms cubic-bezier(0.23, 1, 0.32, 1),
    border-radius 200ms cubic-bezier(0.23, 1, 0.32, 1);
}

.opinions__dot--active {
  background: var(--color-accent);
  width: 22px;
  border-radius: 4px;
}

/* ── CTA bar ──────────────────────────────────────────────────────────────── */

.opinions__cta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5) var(--space-7);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
}

.opinions__cta-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text);
  margin: 0;
  flex: 1;
  min-width: 0;
}

.opinions__cta-text strong {
  color: var(--color-dark);
}

.opinions__cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 100px;
  background: var(--color-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background 160ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.opinions__cta-btn:hover {
  background: #e02316;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 58, 45, 0.35);
}

.opinions__cta-btn:active {
  transform: scale(0.97);
  box-shadow: none;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

/* Tablet: 2 cards */
@media (max-width: 1024px) {
  .opinion-card {
    flex-basis: calc((100% - var(--space-5)) / 2);
  }
}

/* ≤ 900px: score card drops below heading */
@media (max-width: 900px) {
  .opinions__top {
    grid-template-columns: 1fr;
  }

  .opinions__score-card {
    min-width: unset;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-6);
  }

  .opinions__score-main {
    flex: 1;
  }

  .opinions__score-platforms {
    flex-direction: row;
    flex-wrap: wrap;
    border-top: none;
    padding-top: 0;
    width: 100%;
    gap: var(--space-2);
  }
}

/* 768px: layout tightening */
@media (max-width: 768px) {
  .opinions {
    padding: var(--space-7) 0;
  }

  .opinions__filter-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .opinion-card {
    padding: var(--space-4);
  }

  .opinions__cta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-5);
  }
}

/* 640px: 1-card mobile */
@media (max-width: 640px) {
  .opinion-card {
    flex-basis: 100%;
  }

  .opinions__slider-shell {
    grid-template-columns: 36px 1fr 36px;
    gap: var(--space-2);
  }

  .opinions__arrow {
    width: 36px;
    height: 36px;
  }

  .opinions__score-card {
    flex-direction: column;
  }

  .opinions__score-platforms {
    flex-direction: column;
  }

  /* Swap dots → text counter on mobile to avoid overflow */
  .opinions__dots {
    display: none;
  }

  .opinions__counter {
    display: block;
  }
}

/* 380px: extra-small adjustments */
@media (max-width: 380px) {
  .opinion-card {
    padding: var(--space-4) var(--space-3);
    gap: 10px;
  }

  .opinion-card__avatar {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .opinions__score-num {
    font-size: 36px;
  }
}
