/* ============================================================
   Alpha Finance v2: RWA Perps (/rwa-perps/)
   Loaded after funding.css and lsr.css, whose hero, stats, cards, bar,
   table and detail panel it reuses. Only the market map, the two side
   lists and the market icon live here.
   ============================================================ */

/* the map takes two thirds; movers and funding stack beside it at the same height */
.rp-ov { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.rp-side { display: grid; grid-template-rows: 1fr 1fr; gap: 12px; min-width: 0; }
body.rwap .fnstat-v .up { color: var(--pos-text); }
body.rwap .fnstat-v .down { color: var(--neg-text); }
body.rwap .up { color: var(--pos-text); }
body.rwap .down { color: var(--neg-text); }

/* market icons: square brand tiles, softened to match the UI's radii */
.rp-logo { display: inline-block; vertical-align: middle; width: 20px; height: 20px; margin-right: 9px; border-radius: 5px; object-fit: cover; background: var(--panel-2); }

/* ---------- the market map ---------- */
.rp-mapcard .lsr-card-head .pick { margin-left: auto; }
.rp-map { position: relative; flex: 1; min-height: 430px; margin: 12px 13px 10px 16px; overflow: hidden; }
.rp-grp {
  position: absolute; height: 18px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
  font-family: var(--mono); font-size: 9.5px; line-height: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rp-grp b { font-weight: 500; color: var(--text-2); }
.rp-grp:hover b { color: var(--text); }
.rp-tile {
  position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 0; border: 0; border-radius: 3px; overflow: hidden; cursor: pointer;
  color: #fff; font: inherit; line-height: 1; text-align: center;
  transition: filter 0.12s;
}
.rp-tile:hover { filter: brightness(1.18); }
.rp-tile.is-sel { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.85); }
.rp-tile b { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.rp-tile span { font-family: var(--mono); font-size: 10.5px; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.82); }
.rp-tile .rp-logo { width: 26px; height: 26px; margin: 0 0 3px; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18); }
.rp-tile.is-more { background: var(--panel-2); color: var(--muted); font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.04em; }
.rp-tile.is-more:hover { color: var(--text-2); filter: none; }
.rp-legend { display: flex; align-items: center; gap: 8px; }
.rp-ramp { display: block; width: 120px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, rgb(204, 78, 60), rgb(30, 35, 42) 50%, rgb(27, 140, 116)); }
.rp-legend-n { margin-left: auto; text-align: right; }

/* ---------- movers and funding: two short lists side by side ---------- */
body.rwap .rp-side .lsr-card-body { padding: 12px 16px 10px; }
.rp-movers { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.rp-movers .fl-k { margin-bottom: 4px; }
.rp-mv { list-style: none; margin: 0; padding: 0; }
.rp-mv li + li { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
/* the whole row is the target */
.rp-mv li button {
  display: flex; align-items: center; width: calc(100% + 12px); margin: 0 -6px; padding: 7px 6px;
  border: 0; border-radius: 5px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background 0.12s;
}
.rp-mv li button:hover { background: var(--panel-2); }
.rp-mv li b { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-mv li .c { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.rp-mv .rp-logo, .rp-mv .rp-chip { flex: none; width: 18px; height: 18px; margin-right: 8px; }

/* the table: the class chip stands in when a market has no icon */
.rp-chip {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 20px; height: 20px; margin-right: 9px; border-radius: 5px;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
}
.rp-chip svg { width: 12px; height: 12px; }
.rp-cls { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.rp-cls::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c); }
body.rwap .frates td small { display: block; margin-top: 2px; font-size: 10px; font-weight: 400; color: var(--muted); }
body.rwap .frates td.co small { display: inline; margin: 0 0 0 8px; font-size: 12px; }
body.rwap .frates tbody tr[data-id] { cursor: pointer; }
body.rwap .frates td.rp-dex small { font-family: var(--sans); }

/* the chart is taller here: a price pane and a funding pane */
.rp-chart { height: 340px; }
body.rwap .lsr-detail { overflow: visible; }   /* the market menu drops over the chart */
body.rwap .lsr-detail-head { align-items: center; }
body.rwap .lsr-detail-head .pick { margin-left: auto; }
body.rwap .lsr-detail-head .note { margin-left: 0; flex-basis: 100%; font-size: 11px; color: var(--text-2); }
body.rwap .lsr-detail-head .note b { color: var(--text); font-weight: 500; }

/* the market picker: a button that says what is charted, the largest markets as chips beside it */
.rp-pickrow { flex-basis: 100%; display: flex; align-items: center; gap: 10px; min-width: 0; }
.rp-pickwrap { position: relative; flex: none; }
.rp-pick {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px 0 8px;
  border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer;
  transition: border-color 0.12s;
}
.rp-pick:hover, .rp-pick[aria-expanded="true"] { border-color: var(--lime); }
.rp-pick > span { display: flex; align-items: center; white-space: nowrap; }
.rp-pick b { font-size: 13.5px; font-weight: 600; }
.rp-pick small { margin-left: 8px; font-size: 12.5px; color: var(--text-2); }
.rp-pick svg { width: 14px; height: 14px; color: var(--text-2); }
.rp-pick .rp-logo, .rp-pick .rp-chip { margin-right: 8px; }
.rp-menu {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 360px; max-width: calc(100vw - 48px);
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55); overflow: hidden;
}
.rp-menu-q { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.rp-menu-q svg { width: 14px; height: 14px; flex: none; }
.rp-menu-q input { flex: 1; min-width: 0; height: 38px; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 13px; }
.rp-menu ul { list-style: none; margin: 0; padding: 4px; max-height: 300px; overflow-y: auto; }
.rp-menu li { display: grid; grid-template-columns: 20px auto minmax(0, 1fr) 62px 64px; align-items: center; column-gap: 9px; padding: 7px 8px; border-radius: 5px; cursor: pointer; }
.rp-menu li:hover, .rp-menu li.is-at { background: var(--panel-2); }
.rp-menu li[aria-selected="true"] b { color: var(--lime); }
.rp-menu li b { font-size: 13px; font-weight: 600; color: var(--text); }
.rp-menu li small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-menu li span { font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; text-align: right; color: var(--text-2); }
.rp-menu li .rp-logo, .rp-menu li .rp-chip { margin: 0; }
.rp-menu li.none { display: block; padding: 14px 8px; font-size: 12.5px; color: var(--muted); cursor: default; background: none; }
.rp-quick { display: flex; gap: 6px; min-width: 0; overflow: hidden; }
.rp-quick button {
  display: flex; align-items: center; flex: none; height: 34px; padding: 0 11px 0 8px;
  border: 1px solid var(--line); border-radius: 6px; background: none; color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.rp-quick button:hover { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }
.rp-quick button[aria-pressed="true"] { color: var(--text); border-color: var(--lime); background: color-mix(in srgb, var(--lime) 8%, transparent); }
.rp-quick .rp-logo, .rp-quick .rp-chip { width: 18px; height: 18px; margin-right: 7px; }

@media (max-width: 1080px) {
  .rp-ov { grid-template-columns: minmax(0, 1fr); }
  .rp-side { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rp-map { min-height: 400px; }
}
@media (max-width: 760px) {
  .rp-chart { height: 280px; }
  .rp-side { grid-template-columns: minmax(0, 1fr); }
  .rp-map { min-height: 340px; margin: 10px 10px 8px 12px; }
  .rp-legend-n { display: none; }
  .rp-pickrow { flex-wrap: wrap; }
  .rp-pickrow .pick-l { display: none; }
  .rp-quick { flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
}
