/* #/reviews/<place> (js/pages/reviews.js): design "V4 Reviews" + "MK Phone Reviews". Page-only layout; every colour,
   radius and size comes from tokens.css and the shared components. */

/* ---------- Head: title | view switch, period, search pill ---------- */
.rv-head-end { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rv-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rv-count { display: none; font-size: 20px; color: var(--muted-2); }
.rv-search { min-width: 300px; }
.rv-view { display: flex; flex-direction: column; gap: var(--gap-section); min-width: 0; }

/* ---------- Tiles (design: all accent, written white, star distribution span 2) ---------- */
.rv-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.rv-tile { min-height: 150px; gap: 16px; }
.rv-tile-l { font-size: var(--fs-ui); font-weight: 500; }
.rv-big { font-size: 48px; }
.rv-span { grid-column: 1 / -1; }
.rv-sk { min-height: 150px; }
.rv-dist { grid-column: span 2; justify-content: flex-start; gap: 8px; }
.rv-dist-l { font-size: var(--fs-ui); }
.rv-dist-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 40px; gap: 10px; align-items: center;
  height: 22px; padding: 0 4px; margin: 0 -4px; border: none; border-radius: 8px; background: transparent;
  color: inherit; font-size: var(--fs-meta); text-align: start; transition: background var(--t-fast);
}
.rv-dist-row:hover { background: rgba(255, 255, 255, .05); }
.rv-dist-row .s { color: var(--muted); text-align: right; /* dir-ok: dir="ltr" spans (start/end would follow them, not the page); English: below */ }
.rv-dist-row .c { font-family: var(--font-num); font-size: var(--fs-ui); color: var(--soft); text-align: left; /* dir-ok: as .s */ }
:root[dir="ltr"] .rv-dist-row .s { text-align: left; }
:root[dir="ltr"] .rv-dist-row .c { text-align: right; }
.rv-phone-only { display: none; }
.rv-notes { display: flex; flex-direction: column; gap: 6px; }
.rv-note { font-size: var(--fs-meta); color: var(--muted); }

/* ---------- Chips row + filter / sort ---------- */
.rv-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; scroll-margin-top: 20px; }
.rv-chips { flex: 1 1 auto; min-width: 0; }
.rv-tools { display: flex; gap: 6px; align-items: center; margin-inline-start: auto; }
.rv-filter { height: 42px; padding: 0 18px; }
.rv-fcount {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--ac); color: var(--ink);
  font-family: var(--font-num); font-size: var(--fs-small); display: inline-grid; place-items: center;
}
.rv-sort { height: 42px; }
.rv-sort .ph { font-size: 16px; }
.rv-active { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rv-pill { height: 36px; padding: 0 14px; font-size: var(--fs-meta); background: var(--card-2); }
.rv-pill .ph { font-size: 14px; opacity: .7; }

/* ---------- The list (design: auto-fill 380 px cards, gap 10) ---------- */
.rv-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: var(--gap);
  transition: opacity var(--t-fast);
}
.rv-list > .sk-grid, .rv-list > .empty, .rv-list > .alert, .rv-list > .old-line { grid-column: 1 / -1; }
.rv-list > .old-line { scroll-margin-top: 20px; }
.rv-list.rv-busy { opacity: .45; pointer-events: none; }
.rv-readmore {
  align-self: flex-start; border: none; background: transparent; color: inherit; padding: 0; margin-top: -4px;
  font-size: var(--fs-meta); text-decoration: underline; text-underline-offset: 4px; opacity: .75; min-height: 28px;
}
.rv-more { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 4px; }
.rv-more-btn { min-width: 220px; }

/* ---------- Filters sheet ---------- */
.rv-sheet-sec { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 10px; border-bottom: 1px solid var(--divider); }
.rv-sheet-sec:last-child { border-bottom: none; }
.rv-sheet-h { font-size: var(--fs-body); }
.rv-stars-seg { align-self: flex-start; }
.rv-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rv-date-l { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-meta); color: var(--muted); }
.rv-date { width: 100%; min-width: 0; font-family: var(--font-num); }
.rv-sheet-msg { font-size: var(--fs-meta); color: var(--bad-text); min-height: 1em; }

/* ---------- «عبر الزمن» ---------- */
.rv-time { display: flex; flex-direction: column; gap: var(--gap-section); min-width: 0; }
.rv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.rv-ptile { min-height: 150px; }
.rv-ptile-sub { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-meta); }
.rv-ptile-sub .badge { align-self: flex-start; }
.rv-ptile-n { font-size: var(--fs-small); opacity: .7; }
.rv-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.rv-chart-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.rv-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.rv-stat { display: flex; flex-direction: column; gap: 4px; }
.rv-stat .num .unit { font-size: 14px; }
.rv-stat.ac .num { color: var(--ac); }
.rv-stat-l { font-size: var(--fs-small); color: var(--muted); }
.rv-chart-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--divider); padding-top: 12px;
}
.rv-total { display: flex; align-items: center; gap: 8px; }
.rv-total-l { font-size: var(--fs-small); padding: 3px 10px; border-radius: var(--r-pill); background: var(--card-2); }
.rv-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--raised) transparent; }
.rv-scroll-in { min-width: var(--min-w, 0); }
.rv-ramp .ramp { height: 160px; }
.rv-ramp.dense .ramp, .rv-ramp.dense .ramp-axis { gap: 3px; }
.rv-ramp.dense .ramp-bar { border-radius: 6px; }
.rv-pick { cursor: pointer; transition: height var(--m-dur, var(--t-bar)) var(--ease), filter var(--t-fast); }
.rv-pick:hover, .rv-pick:focus-visible { filter: brightness(1.15); }
.rv-moves { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.rv-move-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rv-move-h { display: flex; align-items: center; gap: 6px; font-size: var(--fs-ui); }
.rv-move-h.good .ph { color: var(--good-text); }
.rv-move-h.bad .ph { color: var(--bad-text); }
.rv-move {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: none; border-radius: var(--r-inner);
  background: var(--card-2); color: var(--text); text-align: start; transition: transform var(--t-fast) var(--ease);
}
.rv-move:hover { transform: translateY(-2px); }
.rv-move-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.rv-move-name { font-size: var(--fs-ui); }
.rv-move .delta { font-family: var(--font-num); font-size: var(--fs-body); }
.rv-move-from { font-size: var(--fs-meta); color: var(--muted); }
.rv-topic-chips .fchip { background: var(--card-2); height: 38px; padding: 0 14px; font-size: var(--fs-meta); }
.rv-topic-chips .fchip[aria-pressed="true"] { background: var(--white); }
.rv-topic-line { font-size: var(--fs-meta); color: var(--muted); }
.rv-topic-line b { font-weight: 500; color: var(--text); }

/* ---------- Tablet ---------- */
@media (max-width: 1099px) {
  .rv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv-grid2 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Phone (design "MK Phone Reviews": title + count, search, chip row, cards) ---------- */
@media (max-width: 700px) {
  .rv-head .eyebrow { display: none; }
  .rv-count { display: inline; }
  .rv-title-row { width: 100%; }
  .rv-head .page-head-text { flex: 1 1 100%; }
  .rv-head-end { flex-direction: column; flex-wrap: nowrap; align-items: stretch; width: 100%; gap: 10px; }
  .rv-head-end .period-switch { order: 1; }
  .rv-seg { order: 2; width: 100%; }
  .rv-seg button { flex: 1; height: 44px; font-size: var(--fs-ui); }
  .rv-search { order: 3; min-width: 0; height: 48px; padding-block: 0; padding-inline: 6px 16px; gap: 8px; }
  .rv-search .hdr-search-ic { width: 44px; height: 44px; }
  .rv-search input { align-self: stretch; } /* the whole pill height is the text field */
  .rv-search .hdr-search-ic .ph { font-size: 16px; }
  .rv-tiles { display: none; }
  .rv-phone-only { display: flex; }
  .rv-bar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; }
  .rv-chips {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--page-pad));
    padding: 0 var(--page-pad);
  }
  .rv-chips::-webkit-scrollbar { display: none; }
  .rv-chips .fchip { height: 44px; padding: 0 16px; font-size: var(--fs-meta); }
  .rv-tools { margin: 0; }
  .rv-tools > * { flex: 1; }
  .rv-filter, .rv-sort { height: 44px; width: 100%; justify-content: center; font-size: var(--fs-meta); }
  .rv-sort-box .period-menu { inset-inline-end: auto; inset-inline-start: 0; }
  .rv-pill { height: 44px; }
  .rv-readmore { min-height: 44px; margin-top: -10px; }
  .rv-more-btn { width: 100%; }
  .rv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv-ptile { min-height: 140px; padding: 14px 16px; }
  .rv-ptile .num-kpi { font-size: var(--fs-kpi); }
  .rv-dist.rv-phone-only { grid-column: auto; border-radius: var(--r-card); }
  .rv-dist-row { height: 32px; }
  .rv-stats { gap: 18px; }
  .rv-moves { grid-template-columns: minmax(0, 1fr); }
  .rv-dates { grid-template-columns: minmax(0, 1fr); }
  .rv-ramp .ramp { height: 120px; }
  .rv-topic-chips .fchip { height: 44px; }
  .rv-topic-chips {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 0 18px;
  }
}

/* Design: only a review that needs a reply has the accent button; the others get the quiet inner one */
.rv-list .rcard .btn-open { background: var(--card-2); color: var(--text); }
.rv-list .rcard.rv-needs .btn-open { background: var(--ac); color: var(--ink); }
.rv-list .rcard.hot .btn-open { background: #000; color: var(--text); }

/* A long month chart names only every k-th bar: let that name run over its empty neighbours */
.rv-ramp.dense .ramp-axis span { overflow: visible; text-overflow: clip; }
