/* ============================================================
   HSKY TRADESIM TERMINAL UI
   ============================================================ */

/* HUD Scoreboard */
.hud-scoreboard {
  display: flex;
  gap: 16px;
  font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
  background: rgba(0,0,0,0.2);
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.05);
  align-items: center;
}

.hud-stat {
  color: var(--muted);
}

.hud-stat span {
  color: var(--off-white);
  font-weight: 600;
}

.hud-divider {
  width: 1px;
  height: 14px;
  background-color: var(--border-color);
  margin: 0 4px;
}

.lifetime-stat {
  color: rgba(255, 255, 255, 0.4);
}
.lifetime-stat span {
  color: rgba(255, 255, 255, 0.8);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden; /* Lock viewport */
  background-color: var(--navy);
  color: var(--off-white);
  font-family: 'Inter', -apple-system, sans-serif;
}

.terminal-layout {
  display: grid;
  grid-template-rows: 42px 1fr 36px;
  grid-template-columns: 48px 1fr;
  height: 100vh;
  width: 100vw;
}

/* TOP BAR (Spans all columns) */
.terminal-topbar {
  grid-row: 1;
  grid-column: 1 / -1;
  background-color: var(--navy-mid);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  padding: 0 16px;
  justify-content: space-between;
  font-size: 13px;
}

/* FOOTER (Scrub Slider) */
.terminal-footer {
  grid-row: 3;
  grid-column: 1 / -1;
  background-color: var(--navy-mid);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  padding: 0 16px;
}

/* Premium Scrubber Styling */
.terminal-footer input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
  outline: none;
}
.terminal-footer input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}
.terminal-footer input[type="range"]::-webkit-slider-thumb {
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background: var(--blue-bright);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -4px; /* (trackHeight / 2) - (thumbHeight / 2) */
  box-shadow: 0 0 8px rgba(41, 98, 255, 0.6);
  transition: transform 0.1s;
}
.terminal-footer input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.3);
}
.terminal-footer input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.1);
  background: #fff;
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  font-weight: 700;
  color: var(--blue-bright);
  letter-spacing: 1px;
}

.symbol-picker select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 4px 24px 4px 8px; /* Extra padding on right for custom arrow if needed */
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* LEFT TOOLBAR (Icons) */
.terminal-toolbar {
  grid-row: 2;
  grid-column: 1;
  background-color: var(--navy-mid);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 12px;
  gap: 12px;
}

/* LEFT SIDEBAR PALETTE */
.terminal-sidebar {
  grid-row: 2;
  grid-column: 2;
  background-color: rgba(255, 255, 255, 0.02);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-panel {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-panel h3 {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--faint);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.toggle-row input[type="checkbox"] {
  margin-right: 10px;
  accent-color: var(--blue-bright);
  cursor: pointer;
}

.toggle-row:hover {
  color: #fff;
}

/* MAIN CANVAS AREA */
.terminal-main {
  grid-row: 2;
  grid-column: 2;
  display: flex;
  background-color: var(--ink);
  position: relative;
}

#chart-container {
  flex: 1;
  width: 100%;
  position: relative;
}

/* COUNTDOWN TIMER BADGE
   Floats on the right edge of the chart, tracking the current candle close time.
   Designed to match TradingView's native axis countdown label style.
   JS sets its `top` position dynamically each tick using priceToCoordinate(). */
#candle-countdown {
  position: absolute;
  right: 0;
  /* top is set dynamically by JS */
  transform: translateY(-50%);
  background: #1a1b22;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px 2px 8px;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  display: none; /* Hidden until simulation starts */
}

/* Small left-pointing notch, exactly like TradingView's price label arrow */
#candle-countdown::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: rgba(255, 255, 255, 0.15);
}



/* HIDE SCROLLBARS FOR TERMINAL FEEL */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile Block Overlay */
#mobile-block {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: var(--navy);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px;
}
#mobile-block .mobile-block-content {
  background: var(--navy-mid);
  padding: 40px 24px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  max-width: 400px;
}
#mobile-block svg {
  color: var(--muted);
  margin-bottom: 16px;
}
#mobile-block h2 {
  font-size: 20px;
  margin-bottom: 8px;
  font-weight: 600;
}
#mobile-block p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* Onboarding Modal */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(19, 23, 34, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.modal-content {
  background: var(--navy-mid);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  text-align: left;
}
.modal-content h2 {
  margin: 0 0 8px 0;
  font-size: 22px;
}
.modal-content p {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px 0;
}
.steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}
.step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--off-white);
}
.step span {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  background: rgba(41, 98, 255, 0.15);
  color: var(--blue-bright);
  border-radius: 50%;
  font-weight: bold;
  font-size: 12px;
}
.modal-content .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 16px;
}

@media (max-width: 1024px) {
  .terminal-layout {
    display: none !important;
  }
  #mobile-block {
    display: flex;
  }
}

/* Beta Badge */
.beta-badge {
  background: rgba(41, 98, 255, 0.15);
  color: var(--blue-bright);
  border: 1px solid rgba(41, 98, 255, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
}

