/* ============================================================
   REVIEW CARD WIDGET  —  frontend\widgets\reviews\ReviewsCarousel
   Review card + horizontal carousel + single-review detail modal.
   Shared by the hotel page and the category page; self-contained,
   design tokens come from variables.css (TripMeBaseAsset).
   ============================================================ */

/* ----------------------------------------------------------
   CAROUSEL  —  horizontal scroller with hover-reveal arrows
   ---------------------------------------------------------- */
.tm-rv-carousel {
  position: relative;
  min-width: 0;
  /* Card width — overridden wider on the photo-banner (category)
     variant; the hotel-page text cards keep the compact default. */
  --tm-rv-cols: minmax(280px, 320px);
}

.tm-rv-carousel--wide {
  --tm-rv-cols: minmax(360px, 420px);
}

.tm-rv-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--tm-gray-200);
  background: var(--tm-white);
  color: var(--tm-dark);
  border-radius: var(--tm-radius-full);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(13, 22, 38, 0.12);
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: background var(--tm-transition-fast),
              color var(--tm-transition-fast),
              opacity var(--tm-transition-fast);
}

.tm-rv-arrow:hover {
  background: var(--tm-dark);
  color: var(--tm-white);
}

.tm-rv-arrow--prev { left: -18px; }
.tm-rv-arrow--next { right: -18px; }

@media (min-width: 768px) {
  .tm-rv-arrow {
    display: inline-flex;
  }
  .tm-rv-carousel:hover .tm-rv-arrow,
  .tm-rv-arrow:focus-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

.tm-rv-arrow svg {
  width: 18px;
  height: 18px;
}

.tm-rv-scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--tm-rv-cols, minmax(280px, 320px));
  gap: var(--tm-space-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: var(--tm-space-2);
  /* Bleed to the container edge so the next-card peek hint feels
     intentional, not clipped. */
  margin-inline: calc(-1 * var(--tm-space-3));
  padding-inline: var(--tm-space-3);
}

.tm-rv-scroller::-webkit-scrollbar {
  display: none;
}

@media (max-width: 575.98px) {
  .tm-rv-scroller {
    grid-auto-columns: 85%;
  }
}

/* ----------------------------------------------------------
   CARD
   ---------------------------------------------------------- */
.tm-rv-card {
  display: flex;
  flex-direction: column;
  background: var(--tm-gray-50);
  border-radius: var(--tm-radius-lg);
  overflow: hidden;
  scroll-snap-align: start;
  min-width: 0;
}

/* Category (photo-banner) cards carry a light border; the hotel-page
   text cards stay borderless. */
.tm-rv-carousel--wide .tm-rv-card {
  border: 1px solid var(--tm-gray-200);
}

/* Hotel photo banner — category variant only (showHotel). Full card
   width on top; absent on the hotel page (single hotel, no photo). */
.tm-rv-card__photo {
  display: block;
  aspect-ratio: 21 / 9;
  background: var(--tm-gray-200);
  overflow: hidden;
}

.tm-rv-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--tm-transition-slow);
}

.tm-rv-card:hover .tm-rv-card__photo img {
  transform: scale(1.04);
}

/* Padded content area — wraps everything below the photo. On the
   hotel page (no photo) it is simply the card's padded body. */
.tm-rv-card__main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: var(--tm-space-2);
  padding: var(--tm-space-4) var(--tm-space-4) var(--tm-space-3);
  min-width: 0;
}

/* Hotel name heading — category variant only. */
.tm-rv-card__hotel-name {
  margin: 0;
  font-size: var(--tm-font-size-md);
  font-weight: var(--tm-font-weight-bold);
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tm-rv-card__hotel-name a {
  color: var(--tm-dark);
  text-decoration: none;
}

.tm-rv-card:hover .tm-rv-card__hotel-name a {
  color: var(--tm-primary);
}

.tm-rv-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

.tm-rv-card__score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 28px;
  padding: 0 8px;
  background: var(--tm-success);
  color: var(--tm-white);
  border-radius: var(--tm-radius-md);
  font-size: var(--tm-font-size-sm);
  font-weight: var(--tm-font-weight-semibold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tm-rv-card__score-label {
  color: var(--tm-dark);
}

.tm-rv-card__body {
  margin: 0;
  font-size: var(--tm-font-size-sm);
  line-height: 1.55;
  color: var(--tm-dark);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tm-rv-card__more {
  align-self: flex-start;
  padding: 0;
  margin: -2px 0 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--tm-font-size-sm);
  font-weight: var(--tm-font-weight-semibold);
  color: var(--tm-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.tm-rv-card__more:hover {
  color: var(--tm-cta);
}

.tm-rv-card__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  padding-top: var(--tm-space-2);
  line-height: 1.4;
}

.tm-rv-card__author {
  font-size: var(--tm-font-size-sm);
  font-weight: var(--tm-font-weight-semibold);
  color: var(--tm-dark);
}

.tm-rv-card__date {
  font-size: var(--tm-font-size-xs);
  color: var(--tm-gray-500);
}

/* ----------------------------------------------------------
   DETAIL MODAL  —  centered desktop, bottom-sheet on mobile
   ---------------------------------------------------------- */
.tm-rv-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: calc(100% - 2 * var(--tm-space-4));
  max-width: 640px;
  max-height: calc(100vh - 2 * var(--tm-space-5));
  border-radius: var(--tm-radius-lg);
  overflow: hidden;
}

.tm-rv-dialog::backdrop {
  background: rgba(13, 22, 38, 0.45);
}

.tm-rv-dialog-shell {
  display: flex;
  flex-direction: column;
  background: var(--tm-white);
  max-height: calc(100vh - 2 * var(--tm-space-5));
}

.tm-rv-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--tm-space-3);
  padding: var(--tm-space-4) var(--tm-space-5);
  border-bottom: 1px solid var(--tm-gray-100);
  flex-shrink: 0;
}

.tm-rv-dialog-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

.tm-rv-dialog-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: -4px -8px -4px 0;
  border: 0;
  background: transparent;
  color: var(--tm-gray-700);
  border-radius: var(--tm-radius-full);
  cursor: pointer;
  transition: background var(--tm-transition-fast), color var(--tm-transition-fast);
}

.tm-rv-dialog-close:hover {
  background: var(--tm-gray-50);
  color: var(--tm-dark);
}

.tm-rv-dialog-body {
  padding: var(--tm-space-4) var(--tm-space-5) var(--tm-space-5);
  overflow-y: auto;
}

.tm-rv-dialog-hotel {
  margin: 0 0 var(--tm-space-2);
  font-size: var(--tm-font-size-base);
  font-weight: var(--tm-font-weight-bold);
  color: var(--tm-dark);
  letter-spacing: -0.005em;
}

.tm-rv-dialog-body p {
  margin: 0 0 var(--tm-space-3);
  font-size: var(--tm-font-size-base);
  line-height: 1.6;
  color: var(--tm-dark);
}

.tm-rv-dialog-body p:last-child {
  margin-bottom: 0;
}

.tm-rv-dialog-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--tm-space-3);
  line-height: 1.4;
}

.tm-rv-dialog-meta .tm-rv-card__author {
  font-size: var(--tm-font-size-sm);
}

.tm-rv-dialog-meta time {
  font-size: var(--tm-font-size-xs);
  color: var(--tm-gray-500);
}

@media (max-width: 767.98px) {
  .tm-rv-dialog {
    margin: 0;
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    position: fixed;
    inset: auto 0 0 0;
    border-radius: var(--tm-radius-lg) var(--tm-radius-lg) 0 0;
  }
  .tm-rv-dialog-shell {
    max-height: 85vh;
  }
  .tm-rv-dialog-head {
    padding: var(--tm-space-3) var(--tm-space-4);
  }
  .tm-rv-dialog-body {
    padding: var(--tm-space-3) var(--tm-space-4) var(--tm-space-4);
  }
}

body.tm-rv-dialog-open {
  overflow: hidden;
}
