/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:          #000000;
  --bg2:         #000000;
  --bg3:         #050505;
  --bg4:         #0c0c0e;
  --border:      #16161a;
  --border2:     #282830;

  --call:        #ff7700;
  --call-dim:    rgba(255, 119, 0, 0.18);
  --put:         #8e8e93;
  --put-dim:     rgba(142, 142, 147, 0.18);

  --zero-line:   #ffd000;
  --zero-dim:    rgba(255, 208, 0, 0.15);
  --major-pos:   #ff7700;
  --major-neg:   #8e8e93;
  --spot-line:   #00d4ff;
  --spot-dim:    rgba(0, 212, 255, 0.22);

  --text1:  #f5f5f7;
  --text2:  #8e8e93;
  --text3:  #6e6e73;

  --green:  #34c759;
  --yellow: #ffcc00;
  --orange: #ff7700;
  --red:    #ff3b30;
  --cyan:   #00d4ff;

  --xaxis-h:   32px;

  --font-mono: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Pro", system-ui, sans-serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Pro", system-ui, sans-serif;

  --radius: 6px;
  --transition: 150ms ease;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text1);
  font-family: var(--font-sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
body {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
canvas { display: block; }

/* ─── Top Row Layout (Sidebar left, Charts right) ────────────────────────── */
.app-top-row {
  display: flex;
  flex-direction: row;
  flex-grow: 1;
  min-height: 0;
  width: 100vw;
  overflow: hidden;
}

/* ─── Metrics Sidebar (vertical sidebar on the left) ─────────────────────── */
.metrics-panel {
  width: 180px;
  height: 100%;
  background: #08080a;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 100;
  box-sizing: border-box;
  overflow-y: auto;
  align-items: stretch;
  animation: panel-fade-in 0.3s ease;
}

@keyframes panel-fade-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── SPX Price block ── */
.metrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.metrics-symbol {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffffff;
}

.metrics-status {
  display: flex;
  align-items: center;
  gap: 4px;
}

.market-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.market-dot.live   { background: var(--green); box-shadow: 0 0 5px var(--green); animation: pulse-green 2s infinite; }
.market-dot.closed { background: rgba(255,255,255,0.18); }

.market-label-live   { font-size: 11px; font-weight: 700; color: var(--green); }
.market-label-closed { font-size: 11px; font-weight: 700; color: #ffffff; }

/* Datetime */
.metrics-datetime {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  margin-top: -10px;
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}

/* Main price row inside the sidebar */
.metrics-price-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0;
}

.metrics-price {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.metrics-change {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* Sidebar divider */
.metrics-divider {
  display: none;
}

/* Grid of metrics in vertical stack */
.metrics-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

.metric-cell {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  transition: background var(--transition);
}

.metric-cell:hover {
  background: rgba(255, 255, 255, 0.02);
}

.metric-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text3);
}

.metric-val {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.info-val, .info-change { color: rgba(255,255,255,0.85); }



/* ─── Right Area containing GEX and Volume Panels vertically stacked ─── */
.main-charts-area {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

.gex-chart-area {
  position: relative;
  display: grid;
  grid-template-rows: var(--xaxis-h) 1fr;
  height: 100%;
  flex-grow: 1;
  overflow: hidden;
}

/* X-axis (GEX scale header) */
.x-axis-wrapper {
  position: relative;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg2);
  height: 100%;
  width: 100%;
}
#xAxisCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* GEX Ladder */
.gex-wrapper {
  position: relative;
  overflow: hidden;
  height: 100%;
  width: 100%;
}
#gexCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Expected Move & Decay Panel (full width bottom) ───────────────────────── */
.em-decay-wrapper {
  position: relative;
  border-top: 1px solid var(--border);
  overflow: hidden;
  background: #000000;
  height: var(--em-panel-h, 240px);
  width: 100%;
  flex-shrink: 0;
  transition: height 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.22s ease;
}
.em-decay-charts-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}
.em-decay-chart-box {
  position: relative;
  width: 100%;
  flex: 1 1 0%;
  min-height: 0;
}
#em-decay-box {
  flex: 1 1 0%;
}
.em-decay-chart-box canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Volume & Delta Volume Indicators Wrapper ───────────────────────── */
.volume-indicators-wrapper {
  position: relative;
  border-top: 1px solid var(--border);
  overflow: hidden;
  background: #080810;
  height: var(--volume-panel-h, 160px);
  width: 100%;
  flex-shrink: 0;
}
.volume-charts-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}
.volume-chart-box {
  position: relative;
  width: 100%;
  flex: 1 1 0%;
  min-height: 0;
}
.volume-chart-box canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
.volume-splitter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  cursor: ns-resize;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: center;
}
.volume-splitter .splitter-handle {
  width: 40px;
  height: 3px;
  background: var(--border);
  border-radius: 1.5px;
  transition: background 0.2s, box-shadow 0.2s;
}
.volume-splitter:hover .splitter-handle,
.volume-splitter.active .splitter-handle {
  background: var(--spot);
  box-shadow: 0 0 8px var(--spot);
}

/* Premium Timeframe Zoom Controls (Floating Center Pill) */
.chart-controls-wrapper {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translate(-50%, 10px);
  z-index: 1010;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px 0;
}

.chart-controls-wrapper:hover {
  opacity: 1;
  transform: translate(-50%, 0);
}

.chart-controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(36, 36, 44, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  padding: 6px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text2);
  white-space: nowrap;
}

.chart-controls-row .premium-slider {
  width: 160px;
}

.chart-controls-row .control-label {
  color: var(--text1);
  text-transform: uppercase;
}

.chart-controls-row .zoom-value-label {
  color: var(--cyan);
  min-width: 32px;
  text-align: right;
}


/* Expected Move & Decay Panel Splitter */
.chart-splitter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  cursor: ns-resize;
  background: transparent;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chart-splitter:hover, .chart-splitter.active {
  background: rgba(0, 212, 255, 0.08);
}
.splitter-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.15s, transform 0.15s;
}
.chart-splitter:hover .splitter-handle, .chart-splitter.active .splitter-handle {
  background: var(--cyan);
  transform: scaleY(1.2);
}

.demo-banner {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 200, 0, 0.15);
  border: 1px solid rgba(255, 200, 0, 0.35);
  color: var(--yellow);
  font-size: 11px;
  padding: 4px 14px;
  border-radius: 4px;
  pointer-events: none;
  letter-spacing: 0.03em;
}

/* ─── Loading overlay ─────────────────────────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 9999;
  transition: opacity 0.4s ease;
}
#loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-spinner {
  width: 36px; height: 36px;
  border: 2px solid var(--border2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text2); font-size: 16px; letter-spacing: 0.05em; }

/* ─── Tooltip ────────────────────────────────────────────────────────────── */
#tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text1);
  pointer-events: none;
  z-index: 300;
  display: none;
  line-height: 1.7;
  min-width: 180px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.8);
}
#tooltip.visible { display: block; }
#tooltip b { color: var(--cyan); }

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
.gex-wrapper::-webkit-scrollbar { display: none; }

.timeline-controls-wrapper {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translate(-50%, 10px);
  z-index: 500;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px 0;
}

.timeline-controls-wrapper:hover {
  opacity: 1;
  transform: translate(-50%, 0);
}

.timeline-capsule {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(36, 36, 44, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  padding: 6px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.control-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
}

.time-btn {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 14px;
  border-radius: 20px;
  color: var(--text2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  background: none;
}

.time-btn:hover {
  color: var(--text1);
  background: rgba(255, 255, 255, 0.06);
}

.time-btn.active {
  color: #000000 !important;
  background: var(--cyan);
  box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

/* Specific style for LIVE active/inactive */
.time-btn[data-hour="live"].active {
  background: var(--green);
  box-shadow: 0 2px 10px rgba(52, 199, 89, 0.4);
  color: #000000 !important;
}

.live-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  box-shadow: 0 0 4px currentColor;
}

/* Animations for pulsing when live but NOT active */
.time-btn[data-hour="live"]:not(.active) .live-pulse {
  color: var(--green);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { opacity: 0.3; }
  50% { opacity: 1; filter: drop-shadow(0 0 2px var(--green)); }
  100% { opacity: 0.3; }
}

/* ─── Timeline Scrubber ──────────────────────────────────────────────────── */
.timeline-scrubber {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 8px;
}

.scrubber-label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  width: 48px;
  text-align: right;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}

.scrubber-label.live-active {
  color: var(--green);
  text-shadow: 0 0 8px rgba(52, 199, 89, 0.3);
}

.premium-slider {
  -webkit-appearance: none;
  width: 250px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  outline: none;
  transition: background 0.2s;
  cursor: pointer;
}

.premium-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 0 4px rgba(0, 212, 255, 0.4);
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
}

.premium-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #ffffff;
}

.premium-slider:active::-webkit-slider-thumb {
  background: var(--cyan);
  transform: scale(1.3);
}

/* ─── Filter Section in Sidebar ────────────────────────────────────────── */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-select-label {
  font-size: 8px;
  font-weight: 700;
  color: #8e8e93;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.premium-select {
  background: #121216;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 8px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.premium-select:hover {
  background: #181820;
  border-color: rgba(255, 255, 255, 0.15);
}

.premium-select:focus {
  border-color: var(--blue);
}

/* ─── Premium Checkbox ─────────────────────────────────────────────────── */
.premium-checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
}

.premium-checkbox-container input {
  display: none;
}

.premium-checkbox-checkmark {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  background: #121216;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.premium-checkbox-container:hover .premium-checkbox-checkmark {
  border-color: rgba(255, 255, 255, 0.4);
}

.premium-checkbox-container input:checked + .premium-checkbox-checkmark {
  background: var(--blue);
  border-color: var(--blue);
}

.premium-checkbox-checkmark::after {
  content: "";
  width: 3px;
  height: 6px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-0.5px, -0.5px);
  display: none;
}

.premium-checkbox-container input:checked + .premium-checkbox-checkmark::after {
  display: block;
}

/* ─── Custom Time Picker ──────────────────────────────────────────────── */
.custom-time-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.custom-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-time-row .filter-select-label {
  min-width: 22px;
  text-align: right;
}

.premium-time-input {
  background: #121216;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 6px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  flex: 1;
  box-sizing: border-box;
  color-scheme: dark;
}

.premium-time-input:hover {
  background: #181820;
  border-color: rgba(255, 255, 255, 0.15);
}

.premium-time-input:focus {
  border-color: var(--cyan);
}

.custom-time-apply-btn {
  margin-top: 2px;
  background: rgba(0, 212, 255, 0.12);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 4px;
  color: var(--cyan);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 5px 0;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.custom-time-apply-btn:hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: rgba(0, 212, 255, 0.4);
}

.custom-time-apply-btn:active {
  background: rgba(0, 212, 255, 0.3);
  transform: scale(0.98);
}

/* ─── Alert Section ───────────────────────────────────────────────────── */
.alert-section {
  gap: 6px;
}

.alert-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Premium iOS-style Toggle Switch */
.premium-toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.premium-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  transition: background 0.3s, box-shadow 0.3s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.premium-toggle-switch input:checked + .toggle-slider {
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

.premium-toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* Alert Container */
.alert-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fade-in 0.2s ease;
}

.alert-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.alert-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.alert-status-dot.scanning {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-green 2s infinite;
}

.alert-status-dot.off {
  background: rgba(255, 255, 255, 0.15);
}

.alert-status-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text3);
}

.alert-status-label.scanning {
  color: var(--green);
}

/* Alert List */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.alert-list::-webkit-scrollbar {
  width: 3px;
}
.alert-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.alert-empty {
  font-size: 9px;
  font-weight: 500;
  color: var(--text3);
  text-align: center;
  padding: 8px 0;
  font-style: italic;
}

/* Individual Alert Card */
.alert-card {
  position: relative;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  border-left: 3px solid var(--text3);
  animation: alert-slide-in 0.3s ease;
  transition: background 0.2s;
}

@keyframes alert-slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.alert-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

.alert-card.bullish {
  border-left-color: var(--green);
}

.alert-card.bearish {
  border-left-color: var(--red);
}

.alert-card.new-alert {
  animation: alert-pulse 1.5s ease 2;
}

@keyframes alert-pulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 12px rgba(0, 212, 255, 0.2); }
}

.alert-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.alert-pattern-name {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--cyan);
}

.alert-direction {
  font-size: 11px;
  font-weight: 800;
}

.alert-direction.bullish { color: var(--green); }
.alert-direction.bearish { color: var(--red); }

.alert-time {
  font-size: 8px;
  font-weight: 600;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
}

.alert-confluences {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.alert-confluence-item {
  font-size: 8px;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
}

.alert-confluence-item::before {
  color: var(--cyan);
  font-weight: 800;
  font-size: 10px;
}

/* ─── Premium Date Select and Playback Controls ────────────────────────── */
.premium-date-select {
  background: #121216;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: var(--text2);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
  height: 28px;
  box-sizing: border-box;
}
.premium-date-select:hover {
  background: #181820;
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text1);
}
.playback-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 8px;
}
.playback-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 11px;
}
.playback-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text1);
  border-color: rgba(255, 255, 255, 0.2);
}
.playback-btn:active {
  transform: scale(0.92);
}
.premium-speed-select {
  background: #121216;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: var(--text2);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 0 8px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
  height: 28px;
  box-sizing: border-box;
}
.premium-speed-select:hover {
  background: #181820;
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text1);
}

/* Sidebar characters styling override (pure Apple style) */
.metrics-panel,
.metrics-panel * {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Pro", system-ui, -webkit-system-font, sans-serif !important;
}

/* BBtest2 Logiche Button Styling (Simple White Text Link) */
#bb-logiche-btn {
  cursor: pointer;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  transition: opacity 0.2s, color 0.2s;
  text-transform: uppercase;
  display: inline-block;
  opacity: 0.7;
}

#bb-logiche-btn:hover {
  opacity: 1;
  text-decoration: underline;
}

#bb-logiche-btn:active {
  opacity: 0.8;
}

/* Sidebar Bottom Toggle Button (Expected Move) */
.sidebar-bottom-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 8px 14px;
  color: var(--text1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "SF Compact", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 4px;
  margin-bottom: 4px;
}

.sidebar-bottom-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 4px 16px rgba(0, 0, 0, 0.25);
  transform: translateY(-0.5px);
}

.sidebar-bottom-toggle-btn:active {
  transform: scale(0.97) translateY(0);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-bottom-toggle-btn .indicator-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00d4ff;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.7);
  transition: background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  margin-right: 8px;
}

.sidebar-bottom-toggle-btn .btn-text {
  flex-grow: 1;
  text-align: left;
  font-weight: 700;
}

.sidebar-bottom-toggle-btn .btn-arrow {
  font-size: 9px;
  color: var(--text3);
  margin-left: 6px;
  transition: transform 0.2s;
}


/* ─── Sidebar Collapse / Expand ──────────────────────────────────────────── */

/* Collapse button (‹) inside the metrics-header */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  margin-left: 6px;
  padding: 0 0 1px 0;
}
.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text1);
  border-color: rgba(255, 255, 255, 0.22);
}
.sidebar-collapse-btn:active {
  transform: scale(0.90);
}

/* Collapsed state: slide the panel out with a smooth transition */
.metrics-panel {
  transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.22s ease,
              padding 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.metrics-panel.collapsed {
  width: 0 !important;
  padding: 0 !important;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  border-right: none;
}

/* Floating reopen button (›) — hidden by default, visible when collapsed */
.sidebar-reopen-btn {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%) translateX(-100%);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 48px;
  border-radius: 0 6px 6px 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: none;
  background: #131318;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.15s, color 0.15s;
}
.sidebar-reopen-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}
.sidebar-reopen-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text1);
}
.sidebar-reopen-btn:active {
  transform: translateY(-50%) translateX(0) scale(0.94);
}

/* ─── Asset Tab Bar ────────────────────────────────────────────────────────── */
.asset-tab-bar {
  position: absolute;
  top: 4px;
  left: 12px;
  z-index: 1000;
  display: flex;
  background: rgba(16, 16, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 2px;
}

.asset-tab {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 18px;
  color: var(--text2);
  transition: all var(--transition);
}

.asset-tab:hover {
  color: var(--text1);
  background: rgba(255, 255, 255, 0.06);
}

.asset-tab.active {
  color: #000000;
  background: var(--cyan);
  box-shadow: 0 2px 6px rgba(0, 212, 255, 0.3);
}

/* Bottom Panel Collapse / Expand styles */
.em-decay-wrapper {
  transition: height 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.22s ease,
              border-top-color 0.28s;
}
.em-decay-wrapper.collapsed {
  height: 0 !important;
  opacity: 0;
  pointer-events: none;
  border-top-color: transparent;
}

.bottom-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  margin-left: 6px;
  padding: 0 0 2px 0;
}
.bottom-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text1);
  border-color: rgba(255, 255, 255, 0.22);
}
.bottom-collapse-btn:active {
  transform: scale(0.90);
}

.bottom-reopen-btn {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 20px;
  border-radius: 6px 6px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
  background: #131318;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.15s, color 0.15s;
}
.bottom-reopen-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.bottom-reopen-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text1);
}
.bottom-reopen-btn:active {
  transform: translateX(-50%) translateY(0) scale(0.94);
}

.page-title-header {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  align-items: center;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", "Helvetica Neue", sans-serif;
  font-size: 26px;
  letter-spacing: -0.035em;
  color: #ffffff;
  user-select: none;
}

.page-title-header .title-bold {
  font-weight: 800; /* Bold part: "Deep" */
}

.page-title-header .title-light {
  font-weight: 300; /* Light part: "Option" */
  opacity: 0.95;
}

/* Toast Notification System (Top-Left next to Sidebar and vertical scale) */
.toast-container {
  position: fixed;
  top: 20px;
  left: 260px; /* Shifted left: 260px to sit immediately after the vertical price scale strikes when sidebar is open */
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none; /* Let clicks pass through background */
  transition: left 0.28s cubic-bezier(0.16, 1, 0.3, 1); /* Syncs perfectly with metrics-panel transition */
}

/* Sidebar is collapsed (closed) -> slide toasts to the left */
.metrics-panel.collapsed ~ .toast-container {
  left: 80px; /* 68px scale strikes + 12px margin (since sidebar width is now 0) */
}

.toast-notification {
  pointer-events: auto; /* Allow closing or hovering */
  position: relative; /* Enabled for absolute close button positioning */
  min-width: 300px;
  max-width: 380px;
  padding: 16px 20px;
  border-radius: 14px;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  background: linear-gradient(135deg, rgba(28, 28, 32, 0.94) 0%, rgba(14, 14, 16, 0.97) 100%);
  transform: translateX(-40px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, sans-serif !important;
}

.toast-notification.toast-show {
  transform: translateX(0);
  opacity: 1;
}

.toast-notification.toast-hide {
  transform: translateX(-20px);
  opacity: 0;
}

/* Premium Black Close Circle Button with White X (Larger & Apple Thin Style) */
.toast-close-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #000000;
  border: 1.2px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, sans-serif !important;
  font-size: 16px;
  font-weight: 300; /* Apple-style thin cross font styling */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 1px 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.85);
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
  pointer-events: auto;
  z-index: 10;
}

.toast-close-btn:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  transform: scale(1.12);
}

.toast-close-btn:active {
  transform: scale(0.92);
}

/* Toast direction glass color schemes (Thicker on top, thinner on bottom) */
.toast-up {
  border-top: 2.2px solid rgba(0, 230, 118, 0.80);
  border-left: 1.5px solid rgba(0, 230, 118, 0.50);
  border-right: 1.5px solid rgba(0, 230, 118, 0.50);
  border-bottom: 0.6px solid rgba(0, 230, 118, 0.25);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 0 15px rgba(0, 230, 118, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.toast-down {
  border-top: 2.2px solid rgba(255, 23, 68, 0.80);
  border-left: 1.5px solid rgba(255, 23, 68, 0.50);
  border-right: 1.5px solid rgba(255, 23, 68, 0.50);
  border-bottom: 0.6px solid rgba(255, 23, 68, 0.25);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 0 15px rgba(255, 23, 68, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.toast-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-grow: 1;
}

.toast-grid-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1.35;
}

.toast-grid-label {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff; /* White labels */
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: 65px;
  flex-shrink: 0;
}

.toast-grid-value {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Dynamic data coloration */
.toast-up .toast-val-price {
  color: #00e676; /* Green for UP alerts */
  text-shadow: 0 0 8px rgba(0, 230, 118, 0.4);
}

.toast-down .toast-val-price {
  color: #ff1744; /* Red for DOWN alerts */
  text-shadow: 0 0 8px rgba(255, 23, 68, 0.4);
}

.toast-val-volume {
  color: #00d4ff; /* Cyan for volume values */
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.toast-grid-subvalue {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.50);
  margin-left: 6px;
}
