/* signal-chart.css — chart drawer + copy buttons + toast */

/* ── Copy button — subtle, blends into the column ───────────────────── */
.fb-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-inline-start: 4px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, background 0.15s ease;
  vertical-align: baseline;
  font-family: inherit;
  flex-shrink: 0;
}
.fb-copy-btn:hover {
  color: rgba(255, 255, 255, 0.80);
  background: rgba(255, 255, 255, 0.06);
}
.fb-copy-btn.fb-copy-done {
  color: #00FF87;
  background: transparent;
}
.fb-copy-btn svg { width: 11px; height: 11px; }

/* Inline value + copy wrapper so the button never wraps to its own line */
.fb-val-inline {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  gap: 0;
}

/* TP cell — label + value pairs, easier to scan */
.fb-tp-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  max-width: 100%;
}
.fb-tp-item {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  max-width: 100%;
}
.fb-tp-label {
  font-size: 10px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.45);
  margin-inline-end: 4px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.fb-tp-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* On phones turn the TP list into a clean vertical stack so TP3 never
   gets clipped off the right edge of the card. */
@media (max-width: 720px) {
  .fb-tp-list {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
  .fb-tp-item { width: auto; }
}

/* ── Mobile card layout: stronger visual separation between rows ───── */
@media (max-width: 720px) {
  .table-wrap table.table td {
    border-bottom-color: rgba(255, 255, 255, 0.10) !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
  .table-wrap table.table tr {
    padding: 14px 14px !important;
  }
}

/* Status cell — keep badges + chart toggle on a tidy single row when room
   permits, but wrap cleanly when the row gets a "PROFIT WARNING" too. */
td[data-label][data-fb-status-wrap] {
  /* (we apply this via JS — see below) */
}
.fb-status-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

/* ── Toast ──────────────────────────────────────────────────────────── */
.fb-copy-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #1a1f2e 0%, #131724 100%);
  border: 1px solid rgba(0, 255, 135, 0.40);
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-family: 'Tajawal', 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  z-index: 99999;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,255,135,0.10) inset;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.18, 1.2, 0.56, 1.05);
}
.fb-copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.fb-copy-toast svg { width: 18px; height: 18px; color: #00FF87; }

/* ── "Show chart" toggle — flat, blends into the cell ──────────────── */
.fb-chart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary, #B8BFD0);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  margin: 0;
}
.fb-chart-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}
.fb-chart-toggle.is-open {
  color: #00FF87;
  background: rgba(0, 255, 135, 0.06);
}
.fb-chart-toggle svg { width: 12px; height: 12px; opacity: 0.75; }
.fb-chart-toggle:hover svg, .fb-chart-toggle.is-open svg { opacity: 1; }
.fb-chart-toggle .fb-ct-caret { transition: transform 0.2s ease; }
.fb-chart-toggle.is-open .fb-ct-caret { transform: rotate(180deg); }

/* ── Fullscreen chart modal ─────────────────────────────────────────── */
.fb-chart-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(5, 8, 16, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  animation: fbChartFade 0.22s ease;
  overflow: hidden;
}
@keyframes fbChartFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fb-chart-modal-leaving { animation: fbChartFade 0.18s ease reverse forwards; }
.fb-chart-modal-content {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #0F1424 0%, #0A0E1A 100%);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 14px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.fb-chart-modal-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  inset-inline-end: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
  transition: all 0.18s ease;
}
.fb-chart-modal-close:hover {
  background: rgba(239, 68, 68, 0.20);
  border-color: rgba(239, 68, 68, 0.55);
  color: #fca5a5;
  transform: rotate(90deg);
}

/* Legacy drawer (kept as a no-op alias so nothing else breaks) */
.fb-chart-drawer {
  display: contents;
}
.fb-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
  /* Reserve room for the absolutely-positioned close (×) button so the
     timeframe group never sits underneath it (was overlapping the 1h btn). */
  padding-inline-end: 54px;
}

/* ── Beta / under-development notice inside the chart modal ── */
.fb-chart-beta-note {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 184, 0, 0.10);
  border: 1px solid rgba(255, 184, 0, 0.30);
  color: #FFD057;
  font-size: 12px;
  line-height: 1.5;
  padding: 9px 12px;
  border-radius: 9px;
  margin-bottom: 10px;
}
.fb-chart-beta-note > svg { width: 17px; height: 17px; flex-shrink: 0; color: #FFB800; }
.fb-chart-beta-note span { flex: 1 1 auto; }
.fb-chart-beta-x {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: #FFD057;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.7;
}
.fb-chart-beta-x:hover { opacity: 1; }
.fb-chart-title {
  font-weight: 700;
  font-size: 13.5px;
  color: #E2E8F0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.fb-chart-title-pair {
  font-family: 'JetBrains Mono', 'Inter', monospace;
  color: #FFD057;
  font-weight: 800;
}
.fb-chart-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #00FF87;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.fb-chart-live-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00FF87;
  box-shadow: 0 0 0 0 rgba(0,255,135,0.6);
  animation: fbChartPulse 1.6s ease-out infinite;
}
@keyframes fbChartPulse {
  0%   { box-shadow: 0 0 0 0 rgba(0,255,135,0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(0,255,135,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,255,135,0); }
}

.fb-chart-tf-group {
  display: inline-flex;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.fb-chart-tf-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.fb-chart-tf-btn:hover { color: #E2E8F0; }
.fb-chart-tf-btn.active {
  background: rgba(255,184,0,0.18);
  color: #FFD057;
}

.fb-chart-canvas-wrap {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 240px;
  background: #0A0E1A;
  border-radius: 12px;
  overflow: hidden;
  box-sizing: border-box;
}
.fb-chart-canvas-wrap > * { max-width: 100%; }
.fb-chart-loading,
.fb-chart-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 13px;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  text-align: center;
}
.fb-chart-loading svg {
  width: 32px; height: 32px;
  animation: fbChartSpin 1.1s linear infinite;
  color: #FFB800;
}
@keyframes fbChartSpin { to { transform: rotate(360deg); } }
.fb-chart-error { color: #fca5a5; }

.fb-chart-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  font-size: 11.5px;
}
@media (max-width: 720px) {
  .fb-chart-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.fb-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  color: #cbd5e1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-chart-legend-dot {
  width: 10px;
  height: 2px;
  border-radius: 2px;
  flex-shrink: 0;
}

.fb-chart-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  gap: 8px;
  flex-wrap: wrap;
}
.fb-chart-meta strong { color: #fff; font-weight: 700; }

@media (max-width: 560px) {
  .fb-chart-canvas-wrap { height: 240px; }
  .fb-chart-drawer { padding: 12px; }
}
