/* ==========================================================================
   BitcoinHub — Dashboard Stylesheet
   Terminal-style full-screen trading dashboard
   ========================================================================== */

:root {
  --btc:  #F7931A;
  --btc2: #FF6B00;
  --glow: rgba(247,147,26,0.2);
  --bg:   #080A0C;
  --bg2:  #0D1117;
  --bg3:  #141B22;
  --bg4:  #1A2332;
  --line: rgba(247,147,26,0.1);
  --line2:rgba(255,255,255,0.05);
  --text: #E6EDF3;
  --dim:  #7D8590;
  --green:#3FB950;
  --red:  #F85149;
  --blue: #58A6FF;
  --mono: 'JetBrains Mono', 'Space Mono', monospace;
  --sans: 'Syne', sans-serif;
}

/* ── Dashboard body overrides ────────────────────────────────────────────── */
body.dashboard-page {
  background: var(--bg);
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
body.dashboard-page::before,
body.dashboard-page::after { display: none; }

/* -- Site header on dashboard: strip sticky, become flex item -------------- */
body.dashboard-page .site-header {
  position: static !important;   /* disable sticky -- page never scrolls */
  flex-shrink: 0;
  background: var(--bg2) !important;
  border-bottom-color: var(--line) !important;
  height: 52px;
  padding: 0 16px !important;
  backdrop-filter: none !important;
}
body.dashboard-page .site-header .logo-icon {
  width: 28px; height: 28px; font-size: 12px;
}
body.dashboard-page .site-header .site-logo {
  font-size: 16px;
}
body.dashboard-page .site-header .primary-nav {
  font-size: 12px;
}
body.dashboard-page .mobile-nav { display: none !important; }

/* -- Compact terminal footer bar ------------------------------------------ */
.db-footer-bar {
  background: var(--bg2);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  height: 34px;
  overflow: hidden;
}
.db-footer-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  gap: 14px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
}
.db-footer-logo {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--sans); font-size: 13px; font-weight: 700;
  color: var(--text); text-decoration: none; white-space: nowrap; flex-shrink: 0;
}
.db-footer-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; background: var(--btc); border-radius: 50%;
  font-size: 9px; color: #000; font-weight: 700;
}
.db-footer-copy { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }

.dashboard-wrap {
  flex: 1;           /* fill all space between site header and footer */
  min-height: 0;     /* critical: allows flex child to shrink below content size */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Admin bar -- WP adds 32px/46px to top; body shrinks accordingly */
.admin-bar body.dashboard-page { height: calc(100vh - 32px); }
@media screen and (max-width:782px) {
  .admin-bar body.dashboard-page { height: calc(100vh - 46px); }
}

/* ── TOP BAR ─────────────────────────────────────────────────────────────── */
.db-topbar {
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  padding: 0 14px;
  gap: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.db-topbar::-webkit-scrollbar { height: 2px; }

.db-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 14px; font-weight: 800;
  color: var(--btc); margin-right: 4px; white-space: nowrap; flex-shrink: 0;
  text-decoration: none;
}
.db-logo-icon {
  width: 24px; height: 24px; background: var(--btc); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #000; font-weight: 700;
  box-shadow: 0 0 12px var(--glow);
}
.db-logo-text { color: var(--dim); font-weight: 700; }

.db-price {
  font-size: 20px; font-weight: 700; color: var(--text);
  letter-spacing: -.5px; white-space: nowrap; flex-shrink: 0;
}
.db-change {
  font-size: 11px; padding: 2px 8px; font-family: var(--mono);
  background: rgba(63,185,80,.12); color: var(--green);
  border: 1px solid rgba(63,185,80,.2); flex-shrink: 0;
}
.db-change.dn { background: rgba(248,81,73,.12); color: var(--red); border-color: rgba(248,81,73,.2); }

.db-sep { width: 1px; height: 22px; background: var(--line2); flex-shrink: 0; }

.db-stat { display: flex; flex-direction: column; gap: 1px; white-space: nowrap; flex-shrink: 0; }
.db-stat-l { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; font-family: var(--mono); }
.db-stat-v { font-size: 11px; color: var(--text); font-weight: 500; font-family: var(--mono); }
.db-stat-v.g { color: var(--green); }
.db-stat-v.r { color: var(--red); }
.db-stat-v.o { color: var(--btc); }

.db-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.db-nav   { display: flex; gap: 2px; }
.db-btn {
  padding: 5px 12px; font-family: var(--mono); font-size: 11px;
  background: transparent; border: 1px solid transparent;
  color: var(--dim); cursor: pointer; transition: all .15s;
  text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
}
.db-btn:hover, .db-btn.active {
  color: var(--btc); border-color: rgba(247,147,26,.3);
  background: rgba(247,147,26,.06);
}
.live-dot {
  width: 7px; height: 7px; background: var(--green); border-radius: 50%;
  box-shadow: 0 0 8px var(--green); animation: blink-db 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes blink-db { 0%,100%{opacity:1} 50%{opacity:.25} }

.db-back-link {
  font-size: 10px; font-family: var(--mono); color: var(--dim);
  text-decoration: none; border: 1px solid var(--line2); padding: 4px 10px;
  transition: all .15s; white-space: nowrap;
}
.db-back-link:hover { color: var(--btc); border-color: rgba(247,147,26,.3); }

/* ── MAIN LAYOUT ─────────────────────────────────────────────────────────── */
.db-layout {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  grid-template-rows: 1fr 180px;
  gap: 1px;
  background: var(--line2);
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── PANEL BASE ──────────────────────────────────────────────────────────── */
.db-panel {
  background: var(--bg2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.db-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--line2); flex-shrink: 0;
}
.db-panel-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--dim); display: flex; align-items: center; gap: 6px;
  font-family: var(--mono);
}
.db-panel-title::before { content:''; width:8px; height:2px; background:var(--btc); display:block; }
.db-panel-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.db-pa-btn {
  padding: 2px 8px; font-family: var(--mono); font-size: 9px;
  background: transparent; border: 1px solid var(--line2); color: var(--dim);
  cursor: pointer; transition: .15s; text-transform: uppercase; letter-spacing: .5px;
}
.db-pa-btn:hover, .db-pa-btn.active { border-color: var(--btc); color: var(--btc); background: rgba(247,147,26,.06); }
.db-panel-body { flex: 1; overflow: hidden; padding: 0; min-height: 0; }

/* ── LEFT: METRICS ───────────────────────────────────────────────────────── */
.db-left-panel { grid-row: 1 / 3; }
.db-metrics-list { overflow-y: auto; height: 100%; }
.db-metrics-list::-webkit-scrollbar { width: 3px; }
.db-metrics-list::-webkit-scrollbar-thumb { background: rgba(247,147,26,.25); }

.db-metric-group { border-bottom: 1px solid var(--line2); }
.db-metric-group-title {
  padding: 7px 12px 4px; font-size: 9px; text-transform: uppercase;
  letter-spacing: 1.5px; color: rgba(247,147,26,.5);
  background: rgba(247,147,26,.03); font-family: var(--mono);
}
.db-metric-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 12px; border-bottom: 1px solid rgba(255,255,255,.02);
  transition: background .15s; cursor: default;
}
.db-metric-row:hover { background: rgba(247,147,26,.04); }
.db-mr-label { font-size: 10px; color: var(--dim); font-family: var(--mono); }
.db-mr-value { font-size: 11px; font-weight: 500; color: var(--text); text-align: right; font-family: var(--mono); }
.db-mr-value.g { color: var(--green); }
.db-mr-value.r { color: var(--red); }
.db-mr-value.o { color: var(--btc); }
.db-mr-sub { font-size: 9px; color: var(--dim); text-align: right; font-family: var(--mono); }

/* ── CENTER TOP: CHART ───────────────────────────────────────────────────── */
.db-chart-panel { grid-column: 2; grid-row: 1; }
#db-main-chart { width: 100%; height: 100%; display: block; }

/* Crosshair info */
.db-crosshair-info {
  position: absolute; top: 8px; left: 8px;
  font-size: 10px; color: var(--dim); pointer-events: none;
  display: flex; gap: 12px; flex-wrap: wrap; z-index: 10;
  font-family: var(--mono);
}

/* ── CENTER BOTTOM: TRADES ───────────────────────────────────────────────── */
.db-trades-panel { grid-column: 2; grid-row: 2; }
.db-trades-scroll { overflow-y: auto; height: calc(100% - 33px); }
.db-trades-scroll::-webkit-scrollbar { width: 3px; }
.db-trades-table { width: 100%; border-collapse: collapse; }
.db-trades-table th {
  font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim);
  padding: 4px 8px; border-bottom: 1px solid var(--line2); text-align: left;
  font-weight: 400; position: sticky; top: 0; background: var(--bg2); font-family: var(--mono);
}
.db-trades-table td { padding: 3px 8px; font-size: 10px; border-bottom: 1px solid rgba(255,255,255,.02); font-family: var(--mono); }
.t-buy  { color: var(--green); }
.t-sell { color: var(--red); }

/* ── RIGHT: ORDER BOOK + ANALYTICS ──────────────────────────────────────── */
.db-right-panel { grid-row: 1 / 3; display: flex; flex-direction: column; gap: 1px; }
.db-ob-panel    { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.db-ob-body     { overflow: hidden; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.db-ob-asks, .db-ob-bids { flex: 1; overflow-y: auto; }
.db-ob-asks::-webkit-scrollbar,
.db-ob-bids::-webkit-scrollbar { width: 3px; }
.db-ob-asks::-webkit-scrollbar-thumb,
.db-ob-bids::-webkit-scrollbar-thumb { background: rgba(247,147,26,.2); }

.db-ob-table { width: 100%; border-collapse: collapse; }
.db-ob-table th {
  font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim);
  padding: 4px 12px; border-bottom: 1px solid var(--line2); text-align: right;
  font-weight: 400; font-family: var(--mono);
}
.db-ob-table th:first-child { text-align: left; }
.db-ob-table td {
  padding: 2px 12px; font-size: 10px; text-align: right;
  position: relative; white-space: nowrap; font-family: var(--mono);
}
.db-ob-table td:first-child { text-align: left; }
.db-ob-row { position: relative; cursor: default; transition: background .1s; }
.db-ob-row:hover { background: rgba(255,255,255,.03); }
.db-ob-depth {
  position: absolute; right: 0; top: 0; bottom: 0;
  pointer-events: none; opacity: .12;
}
.db-ask-depth { background: var(--red); }
.db-bid-depth { background: var(--green); }

.db-ob-spread {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 12px; background: var(--bg3);
  border-top: 1px solid var(--line2); border-bottom: 1px solid var(--line2);
}
.db-spread-price { font-size: 15px; font-weight: 700; color: var(--btc); letter-spacing: -.5px; font-family: var(--mono); }
.db-spread-pct   { font-size: 10px; color: var(--dim); font-family: var(--mono); }
.db-spread-side  { font-size: 9px; color: var(--dim); font-family: var(--mono); margin-top: 2px; }

/* ── ANALYTICS PANEL (bottom right) ─────────────────────────────────────── */
.db-analytics-panel {
  height: 200px; display: flex; flex-direction: column; background: var(--bg2);
}
.db-analytics-tabs { display: flex; border-bottom: 1px solid var(--line2); }
.db-at-tab {
  padding: 7px 14px; font-size: 10px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--dim); cursor: pointer; border-bottom: 2px solid transparent; transition: .15s;
  font-family: var(--mono);
}
.db-at-tab.active, .db-at-tab:hover { color: var(--btc); border-bottom-color: var(--btc); }
.db-at-body { flex: 1; overflow: auto; padding: 10px 12px; }
.db-at-body::-webkit-scrollbar { width: 3px; }

.db-at-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.db-at-metric { background: var(--bg3); border: 1px solid var(--line2); padding: 8px 10px; }
.db-at-l { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; font-family: var(--mono); }
.db-at-v { font-size: 14px; font-weight: 700; font-family: var(--mono); }
.db-at-v.g { color: var(--green); }
.db-at-v.r { color: var(--red); }
.db-at-v.o { color: var(--btc); }

/* Fear & Greed inside analytics */
.db-fg-track {
  width: 100%; height: 6px;
  background: linear-gradient(90deg, var(--red), #F59E0B, var(--green));
  border-radius: 2px; position: relative; margin: 8px 0 4px;
}
.db-fg-needle {
  position: absolute; top: -3px; width: 12px; height: 12px;
  background: var(--text); border-radius: 50%; border: 2px solid var(--bg);
  transform: translateX(-50%); box-shadow: 0 0 6px rgba(0,0,0,.5);
  transition: left .5s ease;
}

/* Halving inside analytics */
.db-halving-row { display: flex; gap: 8px; margin-top: 10px; }
.db-hv-block {
  flex: 1; background: var(--bg3); border: 1px solid var(--line2);
  padding: 8px 4px; text-align: center;
}
.db-hv-n  { font-size: 20px; font-weight: 700; color: var(--btc); letter-spacing: -1px; display: block; font-family: var(--mono); }
.db-hv-u  { font-size: 8px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; font-family: var(--mono); }

/* Dominance heat bars */
.db-heat-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.db-heat-lbl { width: 60px; font-size: 9px; color: var(--dim); flex-shrink: 0; font-family: var(--mono); }
.db-heat-bar { flex: 1; height: 5px; background: var(--bg4); border-radius: 1px; overflow: hidden; }
.db-heat-fill{ height: 100%; border-radius: 1px; }
.db-heat-pct { font-size: 9px; color: var(--text); width: 36px; text-align: right; font-family: var(--mono); }

/* ── RESPONSIVE: Dashboard on tablet/mobile uses scrollable layout ───────── */
@media (max-width: 1200px) {
  .db-layout { grid-template-columns: 200px 1fr 240px; }
}

@media (max-width: 900px) {
  body.dashboard-page { overflow: auto; }
  .dashboard-wrap { height: auto; overflow: visible; }
  .db-layout {
    display: flex; flex-direction: column;
    height: auto; overflow: visible; gap: 4px; background: transparent;
  }
  .db-left-panel  { grid-row: auto; height: 300px; order: 3; }
  .db-chart-panel { height: 360px; order: 1; }
  .db-trades-panel{ height: 220px; order: 4; }
  .db-right-panel { grid-row: auto; height: 480px; order: 2; flex-direction: row; }
  .db-ob-panel    { flex: 2; }
  .db-analytics-panel { flex: 1; height: auto; }
  .db-metrics-list { height: 100%; }
  .db-topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 10px; }
  .db-sep { display: none; }
  .db-stat { min-width: 80px; }
}

@media (max-width: 600px) {
  .db-right-panel { flex-direction: column; height: 600px; }
  .db-nav { display: none; }
  .db-chart-panel { height: 300px; }
  .db-topbar { font-size: 10px; }
  .db-price { font-size: 16px; }
}
