/* ============================================================
   Coindaily - Crypto RSI Heatmap (/indicators/rsi-heatmap/)
   Complements styles.css + indicator-page.css. Zone palette:
     overbought #BE5E6C  strong #CC8A6A  neutral #74808F
     weak #5F9E9A  oversold #4F9E7C
   ============================================================ */

/* ---------- breadth hero ---------- */
.rh-hero .rh-breadth { margin: 4px 0 20px; }
.rh-breadth-lab { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.rh-breadth-lab span:first-child { font-family: var(--mono); font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--tx-mid); font-weight: 600; }
.rh-breadth-lab span:last-child { font-size: 11px; color: var(--tx-dim); }
.rh-breadth-bar { display: flex; height: 12px; border-radius: 4px; overflow: hidden; background: var(--panel-2); gap: 1px; }
.rh-breadth-bar i { display: block; height: 100%; min-width: 2px; transition: width .5s ease, flex-basis .5s ease; }
.rh-breadth-leg { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 11px; }
.rh-breadth-leg span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--tx-mid); }
.rh-breadth-leg span .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.rh-breadth-leg span b { font-family: var(--mono); color: var(--tx-hi); font-weight: 600; }
.rh-tfpill { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--tx-mid); border: 1px solid var(--hairline); border-radius: 20px; padding: 3px 9px; white-space: nowrap; }
.rh-tfpill span { color: var(--amber); }

/* ---------- heatmap panel head controls ---------- */
.rh-panel { margin-bottom: 20px; }
.rh-panel .panel-head { flex-wrap: wrap; gap: 12px; }
.rh-panel .panel-head .right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rh-search { display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border: 1px solid var(--hairline); border-radius: var(--r-sm); background: var(--panel-2); color: var(--tx-dim); transition: border-color .12s; }
.rh-search:focus-within { border-color: var(--amber-dim); color: var(--tx-mid); }
.rh-search svg { flex: none; }
.rh-search input { width: 128px; max-width: 40vw; background: none; border: none; outline: none; color: var(--tx-hi); font-family: var(--mono); font-size: 12px; }
.rh-search input::placeholder { color: var(--tx-dim); font-family: var(--sans); }

/* ---------- heatmap legend ---------- */
.rh-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 16px 4px; }
.rh-lg { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--tx-mid); cursor: default; }
.rh-lg i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.rh-lg b { font-family: var(--mono); font-size: 10px; color: var(--tx-dim); font-weight: 500; }

/* ---------- the plot ---------- */
.rh-plot-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.rh-plot { position: relative; height: 580px; margin: 6px 10px 4px; }
.rh-yaxis { position: absolute; inset: 0 auto 0 0; width: 30px; pointer-events: none; }
.rh-yaxis .yt { position: absolute; right: 6px; transform: translateY(-50%); font-family: var(--mono); font-size: 9.5px; color: var(--tx-faint); }
.rh-yaxis .yt::after { content: ""; position: absolute; right: -4px; top: 50%; width: 3px; height: 1px; background: var(--tx-faint); }

/* band region sits between the y-axis gutter and the zone-label gutter */
.rh-bands { position: absolute; top: 10px; bottom: 10px; left: 34px; right: 78px; border-radius: 4px;
  background: linear-gradient(180deg,
    rgba(190,94,108,0.16) 0%, rgba(190,94,108,0.16) 25%,
    rgba(204,138,106,0.13) 25%, rgba(204,138,106,0.13) 37.5%,
    rgba(116,128,143,0.09) 37.5%, rgba(116,128,143,0.09) 62.5%,
    rgba(95,158,154,0.12) 62.5%, rgba(95,158,154,0.12) 75%,
    rgba(79,158,124,0.16) 75%, rgba(79,158,124,0.16) 100%);
  box-shadow: inset 0 0 0 1px var(--hairline-2); }
/* faint separators at the zone boundaries */
.rh-bands::before, .rh-bands::after { content: ""; position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(255,255,255,.10); }
.rh-bands::before { top: 25%; }
.rh-bands::after { top: 75%; }

.rh-zonelabels { position: absolute; top: 10px; bottom: 10px; right: 0; width: 74px; pointer-events: none; }
.rh-zonelabels span { position: absolute; right: 2px; transform: translateY(-50%); font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; text-align: right; line-height: 1.25; opacity: .82; }

.rh-avgline { position: absolute; left: 34px; right: 78px; height: 0; border-top: 1px dashed var(--amber); opacity: .9; pointer-events: none; z-index: 3; transition: top .45s ease; }
.rh-avgline span { position: absolute; right: 4px; top: -8px; font-family: var(--mono); font-size: 9px; font-weight: 600; color: var(--amber-hi); background: var(--panel); padding: 0 4px; border-radius: 3px; white-space: nowrap; }

.rh-dots { position: absolute; inset: 0; }
.rh-coin { position: absolute; transform: translate(-50%, -50%); font-family: var(--mono); font-size: 9.5px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: default; padding: 1px 2px; border-radius: 3px; transition: opacity .12s, background .12s, color .12s; will-change: transform; }
.rh-coin::before { content: ""; display: inline-block; width: 3.5px; height: 3.5px; border-radius: 50%; background: currentColor; margin-right: 3px; vertical-align: middle; opacity: .8; }
.rh-coin:hover { background: rgba(255,255,255,.08); z-index: 5; }
.rh-coin.rh-hit { background: var(--amber); color: #0A0A0B !important; font-weight: 700; z-index: 6; box-shadow: 0 0 0 2px rgba(201,154,75,.35); }
.rh-coin.rh-dim { opacity: .16; }
.rh-coin.rh-big { font-size: 11.5px; font-weight: 700; }

.rh-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--tx-dim); }
.rh-empty[hidden] { display: none; }

/* ---------- tooltip ---------- */
.rh-tip { position: fixed; z-index: 60; pointer-events: none; min-width: 132px; background: var(--elevated); border: 1px solid var(--hairline); border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.5); padding: 9px 11px; opacity: 0; transform: translateY(3px); transition: opacity .1s; }
.rh-tip.on { opacity: 1; transform: none; }
.rh-tip .t { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; color: var(--tx-hi); margin-bottom: 7px; }
.rh-tip .t .zdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.rh-tip .r { display: flex; justify-content: space-between; gap: 18px; font-size: 11.5px; margin-top: 3px; }
.rh-tip .r span { color: var(--tx-mid); }
.rh-tip .r b { font-family: var(--mono); color: var(--tx-hi); font-weight: 600; }

/* ---------- the table ---------- */
.rh-table-wrap { overflow-x: auto; }
.rh-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.rh-table thead th { position: sticky; top: 0; text-align: right; font-size: 10px; color: var(--tx-dim); font-weight: 500; letter-spacing: .05em; text-transform: uppercase; padding: 11px 12px; border-bottom: 1px solid var(--hairline); background: var(--panel); white-space: nowrap; }
.rh-table thead th.rh-rank, .rh-table thead th.rh-symcol { text-align: left; }
.rh-table thead th[data-sort] { cursor: pointer; user-select: none; }
.rh-table thead th[data-sort]:hover { color: var(--tx-mid); }
.rh-table thead th.sorted { color: var(--amber); }
.rh-table thead th[data-sort] .ar { font-size: 8px; margin-left: 3px; opacity: 0; }
.rh-table thead th.sorted .ar { opacity: 1; }
.rh-table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--hairline-2); text-align: right; font-family: var(--mono); font-size: 12.5px; color: var(--tx); white-space: nowrap; }
.rh-table tbody tr:hover { background: rgba(255,255,255,.018); }
.rh-table tbody tr.rh-hit-row { background: rgba(201,154,75,.07); }
.rh-table .rh-rank { text-align: left; color: var(--tx-dim); font-size: 11px; width: 34px; }
.rh-table .rh-symcol { text-align: left; }
.rh-sym { display: inline-flex; align-items: center; gap: 9px; font-family: var(--sans); }
.rh-sym .chip { width: 20px; height: 20px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; font-weight: 700; color: #0A0A0B; }
.rh-sym .chip--img { background: rgba(255,255,255,.05); }
.rh-sym .chip img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; display: block; }
.rh-sym .s { font-weight: 600; color: var(--tx-hi); }
.rh-sym a.s:hover { color: var(--amber); }
.rh-cell-rsi { font-weight: 600; }
.rh-cell-rsi .v { display: inline-block; min-width: 40px; text-align: center; border-radius: 4px; padding: 3px 6px; }

/* ---------- show more ---------- */
.rh-more-wrap { display: flex; justify-content: center; padding: 14px 0 4px; }
.rh-more { font-family: var(--mono); font-size: 11.5px; color: var(--tx-mid); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 7px 16px; transition: .12s; }
.rh-more:hover { color: var(--amber); border-color: var(--amber-dim); }

/* ---------- explainer zone cards (5-up) ---------- */
.rh-zones { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 14px; }
.rh-zone-card { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 14px 15px; border-top: 2px solid var(--zc, var(--tx-dim)); }
.rh-zone-card .zc-head { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--tx-hi); margin-bottom: 9px; }
.rh-zone-card .zc-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--zc, var(--tx-dim)); }
.rh-zone-card .zc-th { margin-left: auto; font-family: var(--mono); font-size: 9px; font-weight: 600; color: var(--tx-dim); border: 1px solid var(--hairline); border-radius: 4px; padding: 2px 5px; white-space: nowrap; }
.rh-zone-card p { font-size: 11.5px; line-height: 1.55; color: var(--tx-mid); margin: 0; }

/* ---------- loading skeleton ---------- */
body.rh-loading #rh-avg, body.rh-loading #rh-zone, body.rh-loading #rh-ob,
body.rh-loading #rh-os, body.rh-loading #rh-median, body.rh-loading #rh-count {
  color: transparent !important; border-radius: 5px;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--elevated) 37%, var(--panel-2) 63%);
  background-size: 400% 100%; animation: as-shimmer 1.3s ease-in-out infinite; }
body.rh-loading .rh-breadth-bar i { flex-grow: 0 !important; min-width: 0 !important; }
body.rh-loading #rh-dist-leg, body.rh-loading #rh-avgline { visibility: hidden; }
body.rh-loading .rh-plot { position: relative; }
body.rh-loading .rh-dots { visibility: hidden; }
body.rh-loading .rh-bands::after, body.rh-loading .rh-bands::before { opacity: .4; }
body.rh-loading .rh-plot::after { content: ""; position: absolute; top: 10px; bottom: 10px; left: 34px; right: 78px; border-radius: 4px;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--elevated) 37%, var(--panel-2) 63%);
  background-size: 400% 100%; animation: as-shimmer 1.3s ease-in-out infinite; pointer-events: none; opacity: .55; }
body.rh-loading #rh-tbody tr { opacity: 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .rh-zones { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .rh-plot { height: 470px; min-width: 560px; margin: 6px 0 4px; }
  .rh-bands, .rh-avgline { right: 66px; left: 30px; }
  .rh-zonelabels { width: 62px; }
  .rh-coin { font-size: 9px; }
  .ig-num#rh-avg { font-size: 44px; }
}
@media (max-width: 520px) {
  .rh-zones { grid-template-columns: 1fr; }
  .rh-panel .panel-head .right { width: 100%; }
  .rh-search input { width: 100%; max-width: none; }
  .rh-search { flex: 1; }
}
