/**
 * trading-dashboard.css - Full market overview, AI Engine central, trading animations.
 * Dark theme, red/crimson glow, glassmorphism, neon. No manual selection UI.
 */

/* -------------------------------------------------------------------------
   Market overview container
   ------------------------------------------------------------------------- */
.trading-market-overview {
  padding: 0 0 1.5rem;
  position: relative;
}

.trading-market-overview h3 {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 1rem;
  font-weight: 600;
}

.trading-market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

/* -------------------------------------------------------------------------
   Exchange block: title + pair cards
   ------------------------------------------------------------------------- */
.trading-exchange-block {
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid rgba(220, 20, 60, 0.2);
  border-radius: 14px;
  padding: 0.9rem;
  backdrop-filter: blur(12px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.trading-exchange-block.active-node {
  border-color: rgba(233, 30, 99, 0.6);
  box-shadow: 0 0 28px rgba(233, 30, 99, 0.25), inset 0 0 20px rgba(233, 30, 99, 0.05);
  animation: trading-node-pulse 1.5s ease-in-out infinite;
}

@keyframes trading-node-pulse {
  0%, 100% { box-shadow: 0 0 28px rgba(233, 30, 99, 0.25), inset 0 0 20px rgba(233, 30, 99, 0.05); }
  50%      { box-shadow: 0 0 40px rgba(233, 30, 99, 0.4), inset 0 0 24px rgba(233, 30, 99, 0.08); }
}

.trading-exchange-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(220, 20, 60, 0.2);
  letter-spacing: 0.02em;
}

.trading-pair-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* -------------------------------------------------------------------------
   Pair card: price, volume, spread, liquidity
   ------------------------------------------------------------------------- */
.trading-pair-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.trading-pair-card.pair-active {
  border-color: rgba(233, 30, 99, 0.6);
  box-shadow: 0 0 20px rgba(233, 30, 99, 0.3);
  transform: scale(1.02);
  animation: trading-pair-glow 0.8s ease-out;
}

@keyframes trading-pair-glow {
  0%   { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}

.trading-pair-card .pair-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 0.35rem;
}

.trading-pair-card .pair-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e91e63;
  transition: opacity 0.2s ease;
}

.trading-pair-card .pair-price.updated {
  animation: trading-price-flash 0.5s ease-out;
}

@keyframes trading-price-flash {
  0%   { opacity: 0.5; }
  50%  { opacity: 1; }
  100% { opacity: 1; }
}

.trading-pair-card .pair-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
}

.trading-pair-card .pair-meta span {
  display: inline-block;
}

/* -------------------------------------------------------------------------
   Auronix AI Engine central (when trading active)
   ------------------------------------------------------------------------- */
.auronix-ai-engine-wrap {
  position: relative;
  margin: 1.5rem 0;
  padding: 1.5rem;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(10, 10, 10, 0.95), rgba(20, 5, 10, 0.9));
  border: 1px solid rgba(220, 20, 60, 0.35);
  overflow: hidden;
  display: none;
}

.auronix-ai-engine-wrap.visible {
  display: block;
  animation: trading-engine-in 0.5s ease-out;
}

@keyframes trading-engine-in {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

.auronix-ai-engine-core {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
}

.auronix-ai-engine-core .core-inner {
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, #e91e63 0%, #8b0000 100%);
  box-shadow: 0 0 30px #e91e63, 0 0 60px rgba(233, 30, 99, 0.4);
  animation: trading-core-pulse 2s ease-in-out infinite;
}

.auronix-ai-engine-core .core-ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(233, 30, 99, 0.4);
  border-radius: 50%;
  animation: trading-ring-rotate 8s linear infinite;
}

.auronix-ai-engine-core .core-ring:nth-child(3) {
  inset: 10px;
  animation-duration: 6s;
  animation-direction: reverse;
}

.auronix-ai-engine-core .core-ring:nth-child(4) {
  inset: 25px;
  animation-duration: 10s;
}

@keyframes trading-core-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50%      { transform: translate(-50%, -50%) scale(1.1); opacity: 0.9; }
}

@keyframes trading-ring-rotate {
  to { transform: rotate(360deg); }
}

.auronix-ai-engine-title {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.5rem;
  letter-spacing: 0.03em;
}

.auronix-ai-engine-status {
  text-align: center;
  font-size: 1rem;
  color: rgba(233, 30, 99, 0.95);
  font-weight: 600;
  min-height: 1.5em;
  transition: opacity 0.3s ease;
}

/* -------------------------------------------------------------------------
   Flow line (between exchanges - drawn via element or pseudo)
   ------------------------------------------------------------------------- */
.trading-flow-line {
  position: fixed;
  pointer-events: none;
  z-index: 5;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(233, 30, 99, 0.8), transparent);
  transform-origin: left center;
  animation: trading-flow-dash 0.8s linear infinite;
}

@keyframes trading-flow-dash {
  to { background-position: 20px 0; }
}

/* -------------------------------------------------------------------------
   Floating labels: BUY / SELL
   ------------------------------------------------------------------------- */
.trading-floating-label {
  position: fixed;
  z-index: 100;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  animation: trading-float-in 0.4s ease-out;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.trading-floating-label.buy {
  background: rgba(34, 197, 94, 0.9);
  color: #fff;
  border: 1px solid rgba(34, 197, 94, 1);
}

.trading-floating-label.sell {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: 1px solid rgba(239, 68, 68, 1);
}

@keyframes trading-float-in {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* -------------------------------------------------------------------------
   Profit popup: +$23.54 floating up + glow
   ------------------------------------------------------------------------- */
.trading-profit-popup {
  position: fixed;
  z-index: 101;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 1rem 1.5rem;
  border-radius: 14px;
  font-size: 1.5rem;
  font-weight: 800;
  color: #4ade80;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid rgba(74, 222, 128, 0.6);
  box-shadow: 0 0 40px rgba(74, 222, 128, 0.4);
  pointer-events: none;
  animation: trading-profit-float 1.2s ease-out forwards;
}

@keyframes trading-profit-float {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  20%  { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  80%  { opacity: 1; transform: translate(-50%, -80%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -100%) scale(1); }
}

/* -------------------------------------------------------------------------
   Data flow / matrix style background
   ------------------------------------------------------------------------- */
.trading-matrix-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(233, 30, 99, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(233, 30, 99, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  border-radius: inherit;
}

/* -------------------------------------------------------------------------
   Auronix AI layout: TOP = amount + buttons, MIDDLE = engine, BOTTOM = data + history
   ------------------------------------------------------------------------- */
.auronix-ai-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.auronix-ai-top.controls-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.auronix-ai-top .auronix-ai-form.glass {
  flex: 1;
  min-width: 200px;
  max-width: 280px;
}

.auronix-ai-top .auronix-ai-locked.glass {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  flex: 1;
  min-width: 120px;
}

.auronix-ai-locked-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auronix-ai-locked-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #e91e63;
}

.auronix-ai-middle.engine-wrap {
  position: relative;
  padding: 1.25rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(10, 10, 10, 0.95), rgba(20, 5, 10, 0.9));
  border: 1px solid rgba(220, 20, 60, 0.35);
  overflow: hidden;
}

.auronix-ai-middle .auronix-ai-engine-core-wrap.glass {
  padding: 1.5rem;
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
}

.auronix-ai-bottom.data-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auronix-ai-bottom .auronix-ai-grid.glass {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.auronix-ai-bottom .auronix-ai-grid .cell-timer {
  order: 1;
}

.auronix-ai-bottom .auronix-ai-grid .cell-profit {
  order: 2;
}

.auronix-ai-bottom .auronix-ai-grid .cell-exchange {
  order: 3;
}

.auronix-ai-bottom .auronix-ai-grid .cell-pair {
  order: 4;
}

.auronix-ai-history {
  margin-top: 0.25rem;
}

.auronix-ai-history-title {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.auronix-ai-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 180px;
  overflow-y: auto;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(220, 20, 60, 0.2);
  padding: 0.5rem;
}

.auronix-ai-history-item {
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.auronix-ai-history-item:last-child {
  border-bottom: none;
}

.auronix-ai-history-item .hist-pair {
  font-weight: 600;
  color: #e91e63;
}

.auronix-ai-history-item .hist-exchange {
  color: rgba(255, 255, 255, 0.7);
}

.auronix-ai-history-item .hist-profit {
  color: #4ade80;
  font-weight: 600;
  margin-left: auto;
}

/* -------------------------------------------------------------------------
   Hide old selectors when using new dashboard
   ------------------------------------------------------------------------- */
.trading-dashboard .trading-selectors.hidden,
.trading-dashboard .trading-live-row.hidden,
.trading-dashboard .trading-chart-row.hidden,
.trading-dashboard .arbitrage-section.hidden {
  display: none !important;
}
