/**
 * trading-animations.css - Auronix AI trading: engine badge, live panel,
 * trade card flash, profit glow, network/data flow, button animations.
 * Enhanced: breathing glow, energy waves, lightning, profit burst, matrix bg.
 */

/* -------------------------------------------------------------------------
   AI root container
   ------------------------------------------------------------------------- */
.auronix-ai-root {
  margin: 1rem 0 1.5rem;
  position: relative;
}

.auronix-ai-root .hidden {
  display: none !important;
}

/* -------------------------------------------------------------------------
   Start form
   ------------------------------------------------------------------------- */
.auronix-ai-start-wrap {
  animation: auronix-ai-fade-in 0.4s ease-out;
}

.auronix-ai-heading {
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
  color: rgba(255, 255, 255, 0.95);
}

.auronix-ai-desc {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  margin: 0 0 1rem;
}

.auronix-ai-form {
  padding: 1.25rem;
  border-radius: 16px;
  max-width: 360px;
}

.auronix-ai-form .form-group {
  margin-bottom: 1rem;
}

.auronix-ai-form label {
  display: block;
  margin-bottom: 0.35rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.auronix-ai-form input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(220, 20, 60, 0.35);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1rem;
}

/* -------------------------------------------------------------------------
   Start button: glow pulse, loading state
   ------------------------------------------------------------------------- */
.auronix-ai-btn-start {
  margin-top: 0.5rem;
  min-width: 160px;
  position: relative;
  overflow: hidden;
  animation: auronix-btn-glow-pulse 2s ease-in-out infinite;
}

.auronix-ai-btn-start:hover {
  animation: auronix-btn-glow-pulse 1s ease-in-out infinite;
}

.auronix-ai-btn-start:disabled {
  opacity: 0.6;
  animation: none;
}

.auronix-ai-btn-start.loading {
  pointer-events: none;
  color: transparent;
}

.auronix-ai-btn-start.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auronix-spin 0.7s linear infinite;
}

@keyframes auronix-btn-glow-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(233, 30, 99, 0.4), 0 0 32px rgba(233, 30, 99, 0.2); }
  50%      { box-shadow: 0 0 28px rgba(233, 30, 99, 0.7), 0 0 48px rgba(233, 30, 99, 0.35); }
}

/* Start button: charging animation before start (stronger glow) */
.auronix-ai-btn-start.charging {
  animation: auronix-btn-charging 1.2s ease-in-out infinite;
}

@keyframes auronix-btn-charging {
  0%, 100% { box-shadow: 0 0 20px rgba(233, 30, 99, 0.5); filter: brightness(1.05); }
  50%      { box-shadow: 0 0 36px rgba(233, 30, 99, 0.8), 0 0 56px rgba(233, 30, 99, 0.3); filter: brightness(1.15); }
}

@keyframes auronix-spin {
  to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------------------
   Active wrap & AI Engine badge (pulsing brain / core)
   ------------------------------------------------------------------------- */
.auronix-ai-active-wrap {
  animation: auronix-ai-fade-in 0.4s ease-out;
}

.auronix-ai-engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(220, 20, 60, 0.2), rgba(139, 0, 0, 0.15));
  border: 1px solid rgba(220, 20, 60, 0.4);
  position: relative;
  overflow: hidden;
}

.auronix-ai-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e91e63;
  box-shadow: 0 0 12px #e91e63, 0 0 24px rgba(233, 30, 99, 0.5);
  animation: auronix-brain-pulse 1.2s ease-in-out infinite;
}

.auronix-ai-engine-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.02em;
}

@keyframes auronix-brain-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.2); opacity: 0.85; }
}

@keyframes auronix-ai-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------------------
   Live panel: grid, status, glowing lines
   ------------------------------------------------------------------------- */
.auronix-ai-live-panel {
  padding: 1.25rem;
  border-radius: 16px;
  border: 1px solid rgba(220, 20, 60, 0.25);
  position: relative;
  overflow: hidden;
}

.auronix-ai-live-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(233, 30, 99, 0.6), transparent);
  animation: auronix-line-flow 3s linear infinite;
}

@keyframes auronix-line-flow {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.auronix-ai-status-row {
  margin-bottom: 1rem;
}

.auronix-ai-status {
  font-size: 1rem;
  color: rgba(233, 30, 99, 0.95);
  font-weight: 600;
  display: inline-block;
  animation: auronix-status-blink 0.5s ease-out;
}

@keyframes auronix-status-blink {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.9; }
}

.auronix-ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.auronix-ai-cell {
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(220, 20, 60, 0.2);
}

.auronix-ai-cell .label {
  display: block;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.25rem;
}

.auronix-ai-cell .value {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

/* -------------------------------------------------------------------------
   Trade card: lines moving, buy→sell, flash
   ------------------------------------------------------------------------- */
.auronix-ai-trade-card {
  min-height: 60px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(220, 20, 60, 0.2);
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.auronix-ai-trade-card.flash {
  box-shadow: 0 0 24px rgba(233, 30, 99, 0.5);
  border-color: rgba(233, 30, 99, 0.5);
  animation: auronix-card-flash 0.4s ease-out;
}

@keyframes auronix-card-flash {
  0%   { filter: brightness(1.4); }
  100% { filter: brightness(1); }
}

.auronix-ai-trade-flow {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 20px,
    rgba(233, 30, 99, 0.06) 20px,
    rgba(233, 30, 99, 0.06) 21px
  );
  animation: auronix-data-flow 2s linear infinite;
  pointer-events: none;
}

@keyframes auronix-data-flow {
  0%   { transform: translateX(0); }
  100% { transform: translateX(21px); }
}

/* -------------------------------------------------------------------------
   Profit % glow when updated
   ------------------------------------------------------------------------- */
.auronix-ai-cell .value.profit-flash {
  animation: auronix-profit-glow 0.6s ease-out;
}

@keyframes auronix-profit-glow {
  0%   { color: #4ade80; text-shadow: 0 0 12px rgba(74, 222, 128, 0.8); }
  100% { color: #fff; text-shadow: none; }
}

/* -------------------------------------------------------------------------
   Stop button: red glow, fade-out effect
   ------------------------------------------------------------------------- */
.auronix-ai-btn-stop {
  width: 100%;
  padding: 0.75rem 1.25rem;
  margin-top: 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(220, 20, 60, 0.5);
  background: rgba(180, 20, 50, 0.25);
  color: #ff6b8a;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.auronix-ai-btn-stop:hover {
  background: rgba(220, 20, 60, 0.35);
  box-shadow: 0 0 20px rgba(220, 20, 60, 0.4);
}

.auronix-ai-btn-stop:active {
  opacity: 0.9;
}

.auronix-ai-btn-stop.stopping {
  animation: auronix-stop-fade 0.5s ease-out;
}

@keyframes auronix-stop-fade {
  0%   { opacity: 1; box-shadow: 0 0 24px rgba(220, 20, 60, 0.6); filter: brightness(1); }
  100% { opacity: 0.65; box-shadow: 0 0 8px rgba(220, 20, 60, 0.25); filter: brightness(0.85); }
}

.auronix-ai-btn-stop.shutdown {
  animation: auronix-stop-shutdown 0.6s ease-out forwards;
}

@keyframes auronix-stop-shutdown {
  0%   { opacity: 1; box-shadow: 0 0 28px rgba(220, 20, 60, 0.7); }
  50%  { opacity: 0.8; box-shadow: 0 0 14px rgba(220, 20, 60, 0.4); }
  100% { opacity: 0.6; box-shadow: none; filter: brightness(0.8); }
}

/* -------------------------------------------------------------------------
   Network / matrix-style background (optional wrapper)
   ------------------------------------------------------------------------- */
.auronix-ai-live-panel.network-bg::after {
  content: '';
  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: 24px 24px;
  pointer-events: none;
  border-radius: inherit;
}

/* Orbit lines (decorative) */
.auronix-ai-active-wrap .auronix-ai-orbit {
  position: absolute;
  border: 1px solid rgba(233, 30, 99, 0.15);
  border-radius: 50%;
  animation: auronix-orbit 8s linear infinite;
}

@keyframes auronix-orbit {
  to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------------------
   Status text: glitch + flicker
   ------------------------------------------------------------------------- */
.auronix-ai-engine-status.status-glitch {
  animation: auronix-status-glitch 4s ease-in-out infinite;
}

@keyframes auronix-status-glitch {
  0%, 90%, 100% { opacity: 1; text-shadow: 0 0 8px rgba(233, 30, 99, 0.5); }
  92%  { opacity: 0.85; transform: translate(-1px, 0); text-shadow: 2px 0 0 rgba(233, 30, 99, 0.8), -2px 0 0 rgba(139, 0, 0, 0.5); }
  94%  { opacity: 1; transform: translate(1px, 0); }
  96%  { opacity: 0.9; transform: translate(0, 0); }
}

/* -------------------------------------------------------------------------
   AI Core: breathing glow + blur + bloom, energy waves, inner rotating gradient
   ------------------------------------------------------------------------- */
.auronix-ai-engine-core-wrap .auronix-ai-engine-core {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
}

.auronix-ai-engine-core-wrap .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 at 30% 30%, #ff4d7a, #e91e63 40%, #8b0000 100%);
  box-shadow: 0 0 30px #e91e63, 0 0 60px rgba(233, 30, 99, 0.5);
  animation: auronix-core-breathe 2.5s ease-in-out infinite;
  filter: blur(0);
}

.auronix-ai-engine-core-wrap .auronix-ai-engine-core.core-bloom .core-inner {
  filter: blur(1px);
  box-shadow: 0 0 40px #e91e63, 0 0 80px rgba(233, 30, 99, 0.6);
}

@keyframes auronix-core-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; box-shadow: 0 0 30px #e91e63, 0 0 60px rgba(233, 30, 99, 0.4); }
  50%      { transform: translate(-50%, -50%) scale(1.12); opacity: 0.95; box-shadow: 0 0 45px #e91e63, 0 0 85px rgba(233, 30, 99, 0.55); }
}

/* Energy waves expanding outward */
.auronix-ai-engine-core-wrap .auronix-ai-engine-core::before,
.auronix-ai-engine-core-wrap .auronix-ai-engine-core::after {
  content: '';
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(233, 30, 99, 0.35);
  border-radius: 50%;
  animation: auronix-energy-wave 3s ease-out infinite;
  pointer-events: none;
}

.auronix-ai-engine-core-wrap .auronix-ai-engine-core::after {
  animation-delay: 1.5s;
}

@keyframes auronix-energy-wave {
  0%   { width: 60px; height: 60px; opacity: 0.8; }
  100% { width: 140px; height: 140px; opacity: 0; }
}

/* Inner rotating gradient (conic on core wrapper) */
.auronix-ai-engine-core-wrap .auronix-ai-engine-core .core-ring {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, rgba(233, 30, 99, 0.5), transparent, rgba(233, 30, 99, 0.3), transparent);
  animation: auronix-ring-rotate 8s linear infinite;
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), black calc(100% - 2px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), black calc(100% - 2px));
}

.auronix-ai-engine-core-wrap .auronix-ai-engine-core .core-ring:nth-child(3) {
  inset: 10px;
  animation-duration: 6s;
  animation-direction: reverse;
}

.auronix-ai-engine-core-wrap .auronix-ai-engine-core .core-ring:nth-child(4) {
  inset: 25px;
  animation-duration: 10s;
}

@keyframes auronix-ring-rotate {
  to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------------------
   Matrix-style background + floating particles (middle section)
   ------------------------------------------------------------------------- */
.auronix-ai-middle.engine-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(233, 30, 99, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(233, 30, 99, 0.04) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  border-radius: inherit;
  animation: auronix-matrix-shift 20s linear infinite;
}

@keyframes auronix-matrix-shift {
  0%   { background-position: 0 0; }
  100% { background-position: 22px 22px; }
}

.auronix-ai-middle.engine-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 50%, rgba(233, 30, 99, 0.06) 0%, transparent 70%);
  pointer-events: none;
  border-radius: inherit;
}

/* -------------------------------------------------------------------------
   Live data flow: moving dots (horizontal + vertical)
   ------------------------------------------------------------------------- */
.auronix-ai-trade-flow {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 18px,
    rgba(233, 30, 99, 0.08) 18px,
    rgba(233, 30, 99, 0.08) 20px
  );
  animation: auronix-data-flow 2s linear infinite;
  pointer-events: none;
}

.auronix-ai-trade-card .auronix-ai-trade-flow::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 14px,
    rgba(233, 30, 99, 0.05) 14px,
    rgba(233, 30, 99, 0.05) 16px
  );
  animation: auronix-data-flow-vertical 2.5s linear infinite;
}

@keyframes auronix-data-flow-vertical {
  0%   { transform: translateY(0); }
  100% { transform: translateY(16px); }
}

/* -------------------------------------------------------------------------
   Heat zones: active trading areas glow stronger (pulsating)
   ------------------------------------------------------------------------- */
.auronix-ai-cell.value-active,
.auronix-ai-grid.heat-active .auronix-ai-cell {
  animation: auronix-heat-pulse 1.5s ease-in-out infinite;
}

@keyframes auronix-heat-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(233, 30, 99, 0.25); border-color: rgba(233, 30, 99, 0.3); }
  50%      { box-shadow: inset 0 0 12px rgba(233, 30, 99, 0.15), 0 0 16px rgba(233, 30, 99, 0.2); border-color: rgba(233, 30, 99, 0.5); }
}

/* -------------------------------------------------------------------------
   Profit burst: explosion of particles / coins (class .profit-burst on container)
   ------------------------------------------------------------------------- */
.trading-profit-popup.profit-burst {
  animation: auronix-profit-burst 1.4s ease-out forwards;
}

@keyframes auronix-profit-burst {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); filter: blur(4px); }
  15%  { opacity: 1; transform: translate(-50%, -55%) scale(1.15); filter: blur(0); }
  85%  { opacity: 1; transform: translate(-50%, -85%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -110%) scale(1); }
}

/* -------------------------------------------------------------------------
   Target lock: crosshair when AI selects pair (brief)
   ------------------------------------------------------------------------- */
.auronix-ai-engine-core-wrap.target-lock::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 80px;
  height: 80px;
  border: 2px solid rgba(233, 30, 99, 0.7);
  border-radius: 50%;
  animation: auronix-target-lock 0.8s ease-out forwards;
  pointer-events: none;
}

.auronix-ai-engine-core-wrap.target-lock::before {
  content: '+';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 24px;
  height: 24px;
  font-size: 24px;
  line-height: 1;
  color: rgba(233, 30, 99, 0.9);
  animation: auronix-target-lock 0.8s ease-out forwards;
  pointer-events: none;
}

@keyframes auronix-target-lock {
  0%   { opacity: 0; transform: scale(0.5); }
  30%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.1); }
}

/* -------------------------------------------------------------------------
   AI thinking: animated dots "..." (optional element)
   ------------------------------------------------------------------------- */
.auronix-ai-thinking-dots::after {
  content: '';
  animation: auronix-thinking-dots 1.2s steps(4, end) infinite;
}

@keyframes auronix-thinking-dots {
  0%, 25%   { content: ''; }
  50%       { content: '.'; }
  75%       { content: '..'; }
  100%      { content: '...'; }
}

/* Lightning flash (when trade executes - add .lightning-flash to wrapper) */
.auronix-ai-active-wrap.lightning-flash::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(255, 255, 255, 0.15) 50%, transparent 60%);
  animation: auronix-lightning 0.25s ease-out;
  pointer-events: none;
  z-index: 10;
}

@keyframes auronix-lightning {
  0%   { opacity: 0; }
  50%  { opacity: 1; }
  100% { opacity: 0; }
}
