/* ARTEL Fintech — Arbitrage Styles */
/* Light theme matching main dashboard */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg-page: #f5f7fb;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-input: #f1f5f9;

  --border: #e5e7eb;
  --border-light: #f0f0f5;
  --border-hover: #d1d5db;

  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --primary: #6366f1;
  --primary-light: rgba(99, 102, 241, 0.1);
  --primary-hover: #4f46e5;

  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-light: rgba(249, 115, 22, 0.1);
  --accent-glow: rgba(249, 115, 22, 0.3);

  --success: #22c55e;
  --success-dim: rgba(34, 197, 94, 0.1);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.1);
  --info: #3b82f6;
  --info-dim: rgba(59, 130, 246, 0.1);
  --purple: #8b5cf6;
  --purple-dim: rgba(139, 92, 246, 0.1);

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  --sidebar-width: 260px;
  --header-height: 52px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-main); background: var(--bg-page); color: var(--text); font-size: 14px; line-height: 1.5; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }

/* ===== LAYOUT ===== */
.app { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
}

.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-img { width: 42px; height: 42px; border-radius: 10px; }
.logo-text { display: flex; flex-direction: column; }
.logo-title { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.logo-badge { font-size: 10px; font-weight: 700; color: var(--accent); letter-spacing: 1px; }

/* ===== NAV ===== */
.nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-group { margin-bottom: 24px; }
.nav-group-title {
  display: block;
  padding: 0 12px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  font-weight: 500;
  cursor: pointer;
}
.nav-link:hover { background: var(--bg-elevated); color: var(--text); }
.nav-link.active {
  background: linear-gradient(135deg, var(--primary), #818cf8);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.nav-link svg { flex-shrink: 0; opacity: 0.7; }
.nav-link.active svg { opacity: 1; }
.nav-link span:not(.nav-badge) { flex: 1; font-size: 14px; }

.nav-badge {
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.nav-link.active .nav-badge { background: rgba(255,255,255,0.2); color: white; }
.nav-badge.pulse { animation: badgePulse 2s ease-in-out infinite; }
@keyframes badgePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.nav-ext { opacity: 0.7; font-size: 13px; }
.nav-ext:hover { opacity: 1; }
.external-arrow { margin-left: auto; opacity: 0.4; flex-shrink: 0; }

/* ===== SIDEBAR FOOTER ===== */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
}
.conn-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}
.conn-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); transition: all 0.3s; }
.conn-dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(34,197,94,0.2); }
.conn-info { display: flex; flex-direction: column; }
.conn-text { font-size: 12px; font-weight: 600; color: var(--text); }
.conn-desc { font-size: 11px; color: var(--text-muted); }

/* ===== MAIN ===== */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== TOPBAR ===== */
.topbar {
  padding: 14px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title { font-size: 18px; font-weight: 700; color: var(--text); }
.topbar-stats { display: flex; gap: 24px; }
.ts-item { display: flex; flex-direction: column; align-items: center; }
.ts-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.ts-value { font-size: 20px; font-weight: 800; font-family: var(--font-mono); color: var(--text); }
.ts-value.signal { color: var(--primary); }
.ts-value.alert { color: var(--danger); }

/* ===== TABS ===== */
.tab-content { display: none; flex: 1; overflow-y: auto; padding: 20px 24px; }
.tab-content.active { display: block; }

/* ===== LOADING / EMPTY ===== */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
  gap: 12px;
  font-size: 14px;
}
.empty-icon { font-size: 40px; opacity: 0.4; }

/* ===== PAIRS GRID ===== */
.pairs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.pair-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-card);
  position: relative;
}
.pair-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.pair-card.has-signal { border-left: 3px solid var(--primary); }
.pair-card.signal-short { border-left-color: var(--danger); }
.pair-card.signal-long { border-left-color: var(--success); }

.pc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.pc-label { font-size: 15px; font-weight: 700; color: var(--text); }
.pc-type { font-size: 10px; padding: 3px 10px; border-radius: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.pc-type.ord_pref { background: var(--info-dim); color: var(--info); }
.pc-type.sector { background: var(--accent-light); color: var(--accent); }
.pc-type.spot_fut { background: var(--success-dim); color: var(--success); }

.pc-tickers { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-family: var(--font-mono); font-size: 13px; }
.pc-ticker {
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-weight: 600;
  color: var(--text);
}
.pc-price { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.pc-vs { color: var(--text-muted); font-size: 12px; }

.pc-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.pc-metric { text-align: center; }
.pc-metric-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; display: block; margin-bottom: 2px; font-weight: 600; }
.pc-metric-value { font-size: 17px; font-weight: 800; font-family: var(--font-mono); color: var(--text); }
.pc-metric-value.positive { color: var(--success); }
.pc-metric-value.negative { color: var(--danger); }
.pc-metric-value.neutral { color: var(--text-secondary); }
.pc-metric-value.extreme { color: var(--warning); animation: badgePulse 1.5s infinite; }

.pc-bollinger { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); margin-bottom: 6px; padding: 0 2px; }

.pc-zscore-bar {
  height: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}
.pc-zscore-center { position: absolute; left: 50%; width: 2px; height: 100%; background: var(--border); transform: translateX(-1px); }
.pc-zscore-fill { height: 100%; border-radius: 3px; position: absolute; transition: all 0.3s; }
.pc-zscore-fill.pos { background: linear-gradient(90deg, rgba(239,68,68,0.2), var(--danger)); left: 50%; }
.pc-zscore-fill.neg { background: linear-gradient(270deg, rgba(34,197,94,0.2), var(--success)); right: 50%; }

.pc-signal {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pc-signal.short { background: var(--danger-dim); color: var(--danger); }
.pc-signal.long { background: var(--success-dim); color: var(--success); }
.pc-signal.close { background: var(--warning-dim); color: var(--warning); }

/* ===== SIGNALS ===== */
.signals-list { display: flex; flex-direction: column; gap: 12px; }
.signal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
}
.signal-card.short { border-left: 3px solid var(--danger); }
.signal-card.long { border-left: 3px solid var(--success); }
.signal-card.close { border-left: 3px solid var(--warning); }
.sc-icon { font-size: 24px; flex-shrink: 0; }
.sc-body { flex: 1; }
.sc-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.sc-detail { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.sc-meta { display: flex; gap: 8px; margin-top: 8px; }
.sc-chip {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.sc-chip.strength-strong { background: var(--danger-dim); color: var(--danger); }
.sc-chip.strength-moderate { background: var(--warning-dim); color: var(--warning); }
.sc-zscore { font-size: 24px; font-weight: 800; font-family: var(--font-mono); color: var(--text); flex-shrink: 0; }

/* ===== PAIR DETAIL ===== */
.pair-detail-content { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.pd-chart-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 400px;
  box-shadow: var(--shadow-card);
}
.pd-chart-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; color: var(--text); }
.pd-chart-canvas { width: 100%; height: 350px; position: relative; }
.pd-chart-canvas canvas { width: 100% !important; height: 100% !important; }

.pd-sidebar { display: flex; flex-direction: column; gap: 14px; }
.pd-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.pd-info-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.pd-info-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.pd-info-row:last-child { border-bottom: none; }
.pd-info-row .label { color: var(--text-secondary); }
.pd-info-row .value { font-weight: 600; font-family: var(--font-mono); color: var(--text); }
.pd-info-row .value.green { color: var(--success); }
.pd-info-row .value.red { color: var(--danger); }
.pd-info-row .value.amber { color: var(--warning); }

/* ===== TOPBAR CONTROLS ===== */
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-controls { display: flex; align-items: center; gap: 8px; }
.sort-select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-main);
  font-weight: 500;
  cursor: pointer;
  outline: none;
}
.sort-select:focus { border-color: var(--primary); }
.view-toggle {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.view-toggle:hover { border-color: var(--primary); color: var(--primary); }
.view-toggle.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ===== SUMMARY STRIP ===== */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}
.summary-card-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.summary-card-value { font-size: 22px; font-weight: 800; font-family: var(--font-mono); color: var(--text); }
.summary-card-value.green { color: var(--success); }
.summary-card-value.red { color: var(--danger); }
.summary-card-value.purple { color: var(--primary); }
.summary-card-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== SPARKLINE ===== */
.pc-sparkline { margin-bottom: 10px; }
.pc-sparkline svg { display: block; width: 100%; height: 28px; }

/* ===== EXTRA METRICS ===== */
.pc-extras { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pc-extra-chip {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.pc-extra-chip.good { background: var(--success-dim); color: var(--success); border-color: transparent; }
.pc-extra-chip.warn { background: var(--warning-dim); color: var(--warning); border-color: transparent; }
.pc-extra-chip.bad { background: var(--danger-dim); color: var(--danger); border-color: transparent; }

/* ===== TABLE VIEW ===== */
.pairs-table-wrap { overflow-x: auto; }
.pairs-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.pairs-table th {
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  white-space: nowrap;
}
.pairs-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.pairs-table tr { cursor: pointer; transition: background 0.15s; }
.pairs-table tbody tr:hover { background: var(--bg-elevated); }
.pairs-table .mono { font-family: var(--font-mono); font-weight: 600; }
.pairs-table .green { color: var(--success); }
.pairs-table .red { color: var(--danger); }
.pairs-table .amber { color: var(--warning); }
.pairs-table .muted { color: var(--text-muted); }

.tbl-spark svg { width: 60px; height: 20px; display: block; }
.tbl-signal-chip {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}
.tbl-signal-chip.short { background: var(--danger-dim); color: var(--danger); }
.tbl-signal-chip.long { background: var(--success-dim); color: var(--success); }

/* ===== JOURNAL ===== */
.journal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.journal-header h2 { font-size: 18px; font-weight: 700; }
.journal-count { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.journal-table-wrap { overflow-x: auto; }
.journal-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.journal-table th {
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.journal-table td {
  padding: 8px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-light);
}
.journal-table .mono { font-family: var(--font-mono); font-weight: 600; font-size: 12px; }
.journal-table .green { color: var(--success); }
.journal-table .red { color: var(--danger); }
.journal-table .amber { color: var(--warning); }
.jrnl-action {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}
.jrnl-action.open { background: var(--info-dim); color: var(--info); }
.jrnl-action.close { background: var(--success-dim); color: var(--success); }
.jrnl-action.stop { background: var(--danger-dim); color: var(--danger); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .main { margin-left: 64px; }
  .logo-text, .nav-group-title, .nav-link span, .conn-text, .conn-desc { display: none; }
  .nav-link { justify-content: center; padding: 10px; }
  .pairs-grid { grid-template-columns: 1fr; }
  .pair-detail-content { grid-template-columns: 1fr; }
  .sidebar-header { padding: 16px; }
  .logo { justify-content: center; }
  .topbar-stats { gap: 12px; }
  .sort-select { display: none; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
}
