/* WhaleIQ Whale Intelligence Page — extends dashboard.css */

.whales-body {
  grid-template-columns: 1fr 248px;
}

.whales-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

/* ─── Page Header ─── */
.page-header {
  margin-bottom: var(--space-1);
}

.page-title {
  font-size: var(--text-h2);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: var(--space-1);
}

.page-sub {
  font-size: var(--text-body-sm);
  color: var(--color-text-secondary);
  max-width: 520px;
}

/* ─── Table ─── */
.whales-table-card {
  padding: 0;
  overflow: hidden;
}

.whales-table-wrap {
  overflow: auto;
  max-height: 400px;
}

.whales-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.whales-table thead th {
  background: rgba(14, 30, 54, 0.98);
  backdrop-filter: blur(8px);
}

.whales-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.whales-table th.sortable:hover { color: var(--color-text-secondary); }

.sort-icon {
  width: 12px;
  height: 12px;
  display: inline-block;
  vertical-align: middle;
  margin-left: 2px;
  opacity: 0.5;
}

.whales-table th.sortable:hover .sort-icon,
.whales-table th[aria-sort="ascending"] .sort-icon,
.whales-table th[aria-sort="descending"] .sort-icon {
  opacity: 1;
  color: var(--color-primary);
}

.whales-table tbody tr {
  cursor: pointer;
  transition: background 120ms ease;
}

.whales-table tbody tr.selected td {
  background: rgba(0, 194, 255, 0.08);
  border-bottom-color: rgba(0, 194, 255, 0.12);
}

.wallet-cell { font-weight: 500; }

/* 30D Performance bar */
.perf-bar {
  display: block;
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  position: relative;
  overflow: hidden;
}

.perf-bar::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--perf, 50%);
  border-radius: var(--radius-full);
  background: var(--color-text-tertiary);
}

.perf-bar--high::after { background: var(--color-success); }
.perf-bar--mid::after { background: var(--color-primary); }
.perf-bar--low::after { background: var(--color-warning); }

/* Status badges */
.badge-status {
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

.badge-status--approved {
  background: var(--color-success-muted);
  color: var(--color-success);
}

.badge-status--pending {
  background: var(--color-warning-muted);
  color: var(--color-warning);
}

.btn-row {
  height: 28px;
  padding: 0 var(--space-3);
  font-size: var(--text-caption);
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--color-primary);
  background: var(--color-info-muted);
  border: 1px solid rgba(0, 194, 255, 0.15);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.btn-row:hover {
  background: rgba(0, 194, 255, 0.18);
  border-color: var(--color-border-strong);
}

/* ─── Wallet Detail Panel ─── */
.wallet-detail {
  border-color: rgba(0, 194, 255, 0.2);
  box-shadow: var(--shadow-glow);
}

.wallet-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-5);
}

.wallet-detail-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.wallet-detail-close svg { width: 16px; height: 16px; }

.wallet-detail-close:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.wallet-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.detail-block {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.detail-block--wide {
  grid-column: span 2;
}

.detail-block-title {
  font-size: var(--text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
}

.allocation-list,
.holdings-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.allocation-list li {
  display: grid;
  grid-template-columns: 56px 1fr 40px;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-body-sm);
}

.alloc-token { font-weight: 600; }

.alloc-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  position: relative;
  overflow: hidden;
}

.alloc-bar::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--w, 50%);
  background: var(--color-primary);
  border-radius: var(--radius-full);
}

.holdings-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-1) 0;
  font-size: var(--text-body-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.holdings-list li:last-child { border-bottom: none; }

.detail-chart {
  height: 100px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.detail-chart svg { width: 100%; height: 100%; display: block; }

.risk-profile-dl {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.risk-profile-dl div {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.risk-profile-dl dt {
  font-size: var(--text-body-sm);
  color: var(--color-text-secondary);
}

.risk-profile-dl dd { font-weight: 600; }

.detail-activity-table th,
.detail-activity-table td {
  padding: var(--space-2) var(--space-3);
}

/* ─── Bottom Section ─── */
.whales-bottom {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.distribution-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  height: 140px;
  padding-top: var(--space-4);
  margin-bottom: var(--space-6);
}

.dist-bar {
  flex: 1;
  height: var(--h, 50%);
  background: linear-gradient(180deg, rgba(0, 194, 255, 0.35) 0%, rgba(0, 194, 255, 0.08) 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  position: relative;
  min-height: 20px;
  transition: height 200ms ease;
}

.dist-bar--accent {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.4) 0%, rgba(34, 197, 94, 0.1) 100%);
}

.dist-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.ranking-list {
  list-style: none;
  counter-reset: rank;
}

.ranking-list li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  font-size: var(--text-body-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ranking-list li:last-child { border-bottom: none; }

.rank-num {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--color-primary);
  font-weight: 600;
}

.movers-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.movers-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-body-sm);
  padding: var(--space-2) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.movers-list li:last-child { border-bottom: none; }

/* ─── Right Panel ─── */
.whales-panel {
  position: sticky;
  top: calc(56px + var(--space-5));
  max-height: calc(100vh - 56px - var(--space-8));
  overflow-y: auto;
}

.whales-panel-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.panel-wallet {
  font-size: var(--text-body-sm);
  font-weight: 500;
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

.panel-dl {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.panel-dl div {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-dl dt {
  font-size: var(--text-caption);
  color: var(--color-text-tertiary);
}

.panel-dl dd { font-weight: 600; }

.watchlist-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.watchlist-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-body-sm);
  padding: var(--space-1) 0;
}

/* ─── Responsive ─── */
@media (max-width: 1280px) {
  .whales-body { grid-template-columns: 1fr; }
  .whales-panel { position: static; max-height: none; }
  .whales-panel-inner {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .whales-bottom { grid-template-columns: 1fr; }
  .wallet-detail-grid { grid-template-columns: 1fr; }
  .detail-block--wide { grid-column: span 1; }
}

@media (max-width: 768px) {
  .whales-panel-inner { grid-template-columns: 1fr; }
  .distribution-chart { height: 120px; }
}
