/* static/css/panel.css */
/* ================================
   DETAIL PANEL, CHARTS & SIGNALS
   Edge Odds Design System
   ================================ */

/* ==========================================================
   PANEL OVERLAY
   ========================================================== */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}
.panel-overlay--visible {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================
   DETAIL PANEL (.panel)
   Fixed right panel, 300px, slides in
   ========================================================== */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  max-width: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border-default);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
}
.panel--open {
  transform: translateX(0);
}

/* Panel head — title + close button */
.panel-head,
.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-elevated);
}
.panel-title,
.panel__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}
.panel-sub,
.panel__subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.panel-close,
.panel__close {
  font-size: 19px;
  color: var(--text-dim);
  cursor: pointer;
  padding: var(--space-1);
  line-height: 1;
  transition: color var(--transition-fast);
}
.panel-close:hover,
.panel__close:hover {
  color: var(--text-primary);
}

/* Panel nav — prev/next arrows */
.panel-nav,
.panel__nav {
  display: flex;
  gap: 4px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-default);
  align-items: center;
}
.panel-nav-btn,
.panel__nav-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid #16161e;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}
.panel-nav-btn:hover,
.panel__nav-btn:hover {
  color: var(--text-secondary);
  border-color: var(--text-ghost);
}

/* Panel content (legacy) */
.panel__content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.panel__content::-webkit-scrollbar {
  display: none;
}

/* ==========================================================
   PANEL SECTIONS
   Content sections with bottom border
   ========================================================== */
.panel-section,
.panel__section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-default);
}
.panel-section:last-child,
.panel__section:last-child {
  border-bottom: none;
}
.panel-section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-invisible);
  margin-bottom: 8px;
}

/* ==========================================================
   PANEL ODDS LIST (.p-odds-row)
   Bookmaker odds list row: dot + name + line + price
   ========================================================== */
.p-odds-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--bg-elevated);
}
.p-odds-row:last-child {
  border-bottom: none;
}
.p-odds-bookie {
  display: flex;
  align-items: center;
  gap: 8px;
}
.p-odds-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.p-odds-name {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.p-odds-val {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.p-odds-val.best {
  color: var(--success);
  font-weight: 700;
}

/* Legacy odds list */
.odds-list {
  display: flex;
  flex-direction: column;
}
.odds-list__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-default);
}
.odds-list__item:last-child {
  border-bottom: none;
}
.odds-list__bookie {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.odds-list__bookie-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: white;
}
.odds-list__bookie-name {
  font-size: var(--text-base);
  color: var(--text-primary);
}
.odds-list__value {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}
.odds-list__value--best {
  color: var(--success);
}

/* ==========================================================
   STATS GRID (.stats-grid / .stat-box)
   4-column grid: best / worst / avg / spread
   ========================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.stat-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  padding: 6px;
  text-align: center;
}
.stat-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.stat-val.g { color: var(--success); }
.stat-val.r { color: var(--danger); }
.stat-lbl {
  font-size: 9px;
  color: var(--text-invisible);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Legacy stats grid */
.stats-grid__item {
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
}
.stats-grid__label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}
.stats-grid__value {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

/* Metrics row (legacy) */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* ==========================================================
   CHARTS
   ========================================================== */

/* Chart container with dark background */
.chart-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
}

/* Chart header — title + legend + expand */
.chart-head,
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.chart-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Chart legend with colored dots */
.chart-legend {
  display: flex;
  gap: 8px;
  font-size: 10px;
}
.chart-legend-item,
.chart-legend__item {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--text-dim);
  cursor: pointer;
}
.chart-legend-dot,
.chart-legend__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* Chart area — SVG container */
.chart-area {
  height: 140px;
  position: relative;
  overflow: hidden;
}
.chart-area svg {
  width: 100%;
  height: 100%;
}
.chart-no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* SVG chart styles */
.chart-grid-line {
  stroke: var(--bg-surface);
  stroke-width: 1;
}
.chart-line {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-y-label {
  font-size: 10px;
  fill: var(--text-invisible);
  font-family: var(--font-mono);
}
.chart-x-label {
  font-size: 9px;
  fill: var(--text-invisible);
  font-family: var(--font-mono);
}

/* Expand to modal button */
.chart-expand,
.chart-expand-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid #16161e;
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
}
.chart-expand:hover,
.chart-expand-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Legacy chart section */
.chart-section {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

/* ==========================================================
   EXPANDED CHART MODAL
   ========================================================== */
.chart-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}
.chart-modal--active {
  opacity: 1;
  visibility: visible;
}
.chart-modal__content {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 90vw;
  max-width: 900px;
  padding: var(--space-5);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}
.chart-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}
.chart-modal__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}
.chart-modal__subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}
.chart-modal__close {
  font-size: 34px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--transition-fast);
}
.chart-modal__close:hover {
  color: var(--text-primary);
}
.chart-modal__chart {
  height: 400px;
  position: relative;
}
.chart-modal__chart .chart-no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ==========================================================
   SIGNALS SIDEBAR (.sigs)
   ========================================================== */

/* Signals header with pulsing dot */
.sigs-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-default);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-invisible);
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono), monospace;
}
.sigs-head .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: sigs-blink 2s infinite;
}
.sigs-head .ct {
  color: var(--accent-hover);
}
@keyframes sigs-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Signals filter chips */
.sigs-filters {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--bg-surface);
}
.sf {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--font-mono), monospace;
  color: var(--text-invisible);
  background: transparent;
  border: 1px solid transparent;
}
.sf.on {
  border-color: #16161e;
  color: var(--text-muted);
}
.sf.arb.on {
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.15);
}
.sf.ev.on {
  color: var(--accent-hover);
  border-color: rgba(168, 85, 247, 0.15);
}
.sf.move.on {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.15);
}
.sf.neg.on {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.15);
}

/* Scrollable signal cards area */
.sigs-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px;
}

/* Signal card (.sc) */
.sc {
  padding: 8px 10px;
  background: #0b0b0e;
  border: 1px solid #10101a;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 12px;
  font-family: var(--font-mono), monospace;
}
.sc:hover {
  border-color: var(--border-hover);
}

/* Signal type badge */
.sc-type {
  display: inline-block;
  padding: 0 4px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}
.sc-type.arb {
  background: rgba(74, 222, 128, 0.06);
  color: var(--success);
}
.sc-type.ev {
  background: rgba(168, 85, 247, 0.06);
  color: var(--accent-hover);
}
.sc-type.drift {
  background: rgba(251, 191, 36, 0.06);
  color: var(--warning);
}
.sc-type.short {
  background: rgba(248, 113, 113, 0.06);
  color: var(--danger);
}

/* Signal card content */
.sc-name {
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 1px;
}
.sc-data {
  color: var(--text-ghost);
  font-size: var(--text-xs);
}
.sc-data .g { color: var(--success); font-weight: 600; }
.sc-data .p { color: var(--accent-hover); font-weight: 600; }
.sc-data .y { color: var(--warning); font-weight: 600; }
.sc-data .r { color: var(--danger); font-weight: 600; }
.sc-time {
  color: var(--text-invisible);
  font-size: 10px;
  margin-top: 2px;
}

/* Bottom stats summary */
.sigs-stats {
  padding: 8px 10px;
  border-top: 1px solid var(--border-default);
  font-family: var(--font-mono), monospace;
}
.ss-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: var(--text-xs);
}
.ss-l {
  color: var(--text-invisible);
}
.ss-v {
  font-weight: 600;
}

/* ==========================================================
   HISTORY LIST (legacy)
   ========================================================== */
.history-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-default);
}
.history-list__item:last-child {
  border-bottom: none;
}
.history-list__bookie {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: white;
  flex-shrink: 0;
}
.history-list__details {
  flex: 1;
  min-width: 0;
}
.history-list__name {
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.history-list__change {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.history-list__right {
  text-align: right;
}
.history-list__odds {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
}
.history-list__diff {
  font-size: var(--text-sm);
}
.history-list__diff--up {
  color: var(--success);
}
.history-list__diff--down {
  color: var(--danger);
}
.history-list__time {
  font-size: var(--text-xs);
  color: var(--text-dim);
  margin-left: var(--space-3);
}

/* ==========================================================
   MOBILE PANEL
   Full-width panel on mobile
   ========================================================== */
@media (max-width: 639px) {
  .panel {
    width: 100%;
  }

  .panel-overlay--visible {
    display: none;
  }

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================
   MENU PANEL (Mobile Nav — legacy)
   ========================================================== */
.menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85%;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-default);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-base);
}
.menu-panel--open {
  transform: translateX(0);
}
.menu-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
}
.menu-panel__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}
.menu-panel__close {
  font-size: 29px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.menu-panel__content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) 0;
}
.menu-panel__section {
  margin-bottom: var(--space-4);
}
.menu-panel__section-title {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 var(--space-5) var(--space-3);
}
.menu-panel__item {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-base);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.menu-panel__item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.menu-panel__item--active {
  background: var(--accent-muted);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}
.menu-panel__toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
  color: var(--text-secondary);
}
.menu-panel__divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-2) var(--space-5);
}

/* ==========================================================
   PANEL MOCK (for design mockup frames)
   ========================================================== */
.panel-mock {
  display: grid;
  grid-template-columns: 1fr 300px;
  min-height: 500px;
  background: var(--bg-primary);
}
.panel-main {
  padding: 16px;
  overflow-y: auto;
}
.panel-side {
  border-left: 1px solid var(--border-default);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
