/*
 * TBSJ Bitcoin Dashboard — Bloomberg Terminal Stylesheet
 * Forced dark context — intentionally overrides theme inside the dashboard wrapper.
 * IBM Plex Mono throughout. Bitcoin orange on price. Green/red on changes.
 */

/* ── Custom Properties ─────────────────────────────────────── */
.tbsj-dash-wrap {
  --dash-bg:          #080808;
  --dash-bg-card:     #0f0f0f;
  --dash-bg-card2:    #131313;
  --dash-border:      #1e1e1e;
  --dash-border-dim:  #161616;
  --dash-orange:      #F7931A;
  --dash-orange-dim:  rgba(247, 147, 26, 0.08);
  --dash-orange-glow: rgba(247, 147, 26, 0.18);
  --dash-green:       #22c55e;
  --dash-green-dim:   rgba(34, 197, 94, 0.08);
  --dash-red:         #ef4444;
  --dash-red-dim:     rgba(239, 68, 68, 0.08);
  --dash-text:        #e8e8e8;
  --dash-text-dim:    #444;
  --dash-text-mid:    #666;
  --dash-mono:        'IBM Plex Mono', 'Courier New', monospace;
  --dash-radius:      6px;
  --dash-radius-lg:   10px;
}

/* ── Wrapper — forced dark ─────────────────────────────────── */
.tbsj-dash-wrap {
  background: var(--dash-bg);
  color: var(--dash-text);
  font-family: var(--dash-mono);
  font-size: 13px;
  line-height: 1.4;
  border-radius: var(--dash-radius-lg);
  border: 1px solid var(--dash-border);
  overflow: hidden;
  position: relative;
}

/* Subtle scanline texture */
.tbsj-dash-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 0;
}

.tbsj-dash-wrap > * { position: relative; z-index: 1; }

/* ── Error ─────────────────────────────────────────────────── */
.tbsj-dash-error {
  padding: 1rem 1.25rem;
  color: var(--dash-red);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--dash-border);
}
.tbsj-dash-error a { color: inherit; font-weight: 600; }

/* ── Top bar ───────────────────────────────────────────────── */
.tbsj-dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--dash-bg-card);
  border-bottom: 1px solid var(--dash-border);
  gap: 1rem;
  flex-wrap: wrap;
}

.tbsj-dash-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tbsj-dash-btc-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--dash-orange);
  color: #000;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--dash-orange-glow);
}

.tbsj-dash-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--dash-text);
}

.tbsj-dash-pair {
  font-size: 11px;
  color: var(--dash-text-mid);
  letter-spacing: 0.06em;
}

/* Live dot */
.tbsj-dash-live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--dash-green);
  box-shadow: 0 0 6px var(--dash-green);
  animation: dash-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes dash-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.tbsj-dash-live-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--dash-green);
  font-weight: 700;
}

.tbsj-dash-last-updated {
  font-size: 10px;
  color: var(--dash-text-dim);
  letter-spacing: 0.05em;
}

/* ── Hero — price + sparkline ──────────────────────────────── */
.tbsj-dash-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--dash-border);
  align-items: center;
}
@media (max-width: 560px) {
  .tbsj-dash-hero {
    grid-template-columns: 1fr;
  }
}

/* Price */
.tbsj-dash-price-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tbsj-dash-price {
  font-size: clamp(2rem, 6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--dash-orange);
  line-height: 1;
  text-shadow: 0 0 40px var(--dash-orange-glow);
  transition: text-shadow 0.3s;
}

.tbsj-dash-price-loading {
  font-size: 1.2rem;
  color: var(--dash-text-dim);
  animation: dash-blink 1s step-end infinite;
}
@keyframes dash-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Price flash on update */
.tbsj-dash-price.flash-up {
  animation: dash-flash-up 0.5s ease both;
}
.tbsj-dash-price.flash-down {
  animation: dash-flash-down 0.5s ease both;
}
@keyframes dash-flash-up {
  0%   { background: var(--dash-green-dim); border-radius: 4px; }
  100% { background: transparent; }
}
@keyframes dash-flash-down {
  0%   { background: var(--dash-red-dim); border-radius: 4px; }
  100% { background: transparent; }
}

/* Change row */
.tbsj-dash-changes {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tbsj-dash-change-sep {
  color: var(--dash-border);
  user-select: none;
}

.tbsj-dash-change-item {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.tbsj-dash-change-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--dash-text-dim);
  font-weight: 600;
}

.tbsj-dash-change-val {
  font-size: 13px;
  font-weight: 600;
}
.tbsj-dash-change-val.pos { color: var(--dash-green); }
.tbsj-dash-change-val.neg { color: var(--dash-red); }
.tbsj-dash-change-val.neu { color: var(--dash-text-mid); }

/* Sparkline */
.tbsj-dash-sparkline-wrap {
  position: relative;
  width: 200px;
  flex-shrink: 0;
}
@media (max-width: 560px) {
  .tbsj-dash-sparkline-wrap { width: 100%; }
}

.tbsj-dash-sparkline-wrap canvas {
  display: block;
  width: 100% !important;
}

.tbsj-dash-sparkline-label {
  text-align: right;
  font-size: 9px;
  color: var(--dash-text-dim);
  letter-spacing: 0.1em;
  margin-top: 3px;
}

/* ── Stats grid ────────────────────────────────────────────── */
.tbsj-dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--dash-border-dim);
}
@media (max-width: 620px) {
  .tbsj-dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
  .tbsj-dash-grid { grid-template-columns: 1fr; }
}

.tbsj-dash-stat {
  padding: 14px 16px;
  border-right: 1px solid var(--dash-border-dim);
  border-bottom: 1px solid var(--dash-border-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.15s;
}
.tbsj-dash-stat:hover {
  background: var(--dash-bg-card2);
}
/* Remove right border on last column */
.tbsj-dash-stat:nth-child(3n) { border-right: none; }
@media (max-width: 620px) {
  .tbsj-dash-stat:nth-child(3n)  { border-right: 1px solid var(--dash-border-dim); }
  .tbsj-dash-stat:nth-child(2n)  { border-right: none; }
}

.tbsj-dash-stat-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dash-text-dim);
  display: block;
}

.tbsj-dash-stat-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dash-text);
  display: block;
  line-height: 1.2;
}

.tbsj-dash-stat-sub {
  font-size: 10px;
  color: var(--dash-text-mid);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ATH stat — slight orange tint */
.tbsj-dash-stat--ath {
  background: var(--dash-orange-dim);
}
.tbsj-dash-stat--ath:hover {
  background: rgba(247, 147, 26, 0.12);
}

/* Supply bar */
.tbsj-dash-supply-track {
  display: inline-block;
  width: 56px;
  height: 3px;
  background: var(--dash-border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.tbsj-dash-supply-fill {
  display: block;
  height: 100%;
  background: var(--dash-orange);
  border-radius: 2px;
  transition: width 1s cubic-bezier(0.16,1,0.3,1);
  width: 0;
}
