/* Import Inter Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;500;700;900&display=swap');

:root {
  /* Palette */
  --bg-deep: #0f172a;
  --bg-dark: #020617;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Accents */
  --purple-primary: #8b5cf6;
  --purple-glow: rgba(139, 92, 246, 0.6);
  --blue-primary: #3b82f6;
  --blue-glow: rgba(59, 130, 246, 0.6);
  --green-success: #10b981;
  --red-error: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* { box-sizing: border-box; }

.swap-view {
  width: 100%;
  height: 100%;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(circle at 100% 0%, rgba(139, 92, 246, 0.15) 0%, transparent 60%),
    linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

/* Ambient Effects */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  z-index: 0;
  animation: float 10s infinite ease-in-out;
}
.glow-purple { width: 400px; height: 400px; background: var(--purple-primary); top: -100px; right: -100px; }
.glow-blue { width: 300px; height: 300px; background: var(--blue-primary); bottom: -50px; left: -50px; animation-delay: -3s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -20px); }
}

/* Header */
.swap-header { text-align: center; z-index: 2; margin-bottom: 2rem; flex-shrink: 0; }

.header-badge {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 3px;
  font-weight: 700;
  color: var(--purple-primary);
  background: rgba(139, 92, 246, 0.1);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  margin-bottom: 0.5rem;
}

.swap-header h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 900;
  text-transform: uppercase;
  background: linear-gradient(to right, #fff, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
}

/* Stage */
.swap-stage {
  flex: 1;
  display: flex;
  gap: 1.5rem;
  z-index: 2;
  min-height: 0;
  padding-bottom: 1rem;
}

/* LEFT PANEL: CORE */
.panel-core {
  flex: 1;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.core-housing {
  width: 200px; height: 200px;
  display: flex; justify-content: center; align-items: center;
  position: relative;
}

.quantum-core {
  position: relative; width: 100%; height: 100%;
}

.core-nucleus {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 50px; height: 50px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 30px var(--purple-primary);
  z-index: 10;
  transition: all 0.3s ease;
}

.orbital-ring {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all 0.5s ease;
}

.ring-1 { width: 100%; height: 100%; border-top-color: var(--purple-primary); border-bottom-color: var(--purple-primary); opacity: 0.5; }
.ring-2 { width: 70%; height: 70%; border-left-color: var(--blue-primary); border-right-color: var(--blue-primary); opacity: 0.5; }
.ring-3 { width: 40%; height: 40%; border: 1px dashed #fff; opacity: 0.3; }

.core-status {
  margin-top: 2rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-family: monospace;
}

/* Core Animations */
.quantum-core.state-idle .ring-1 { animation: spin 8s infinite linear; }
.quantum-core.state-idle .ring-2 { animation: spin-rev 6s infinite linear; }

.quantum-core.state-charging .core-nucleus { background: var(--purple-primary); transform: translate(-50%, -50%) scale(1.2); }
.quantum-core.state-charging .ring-1 { animation: spin 1s infinite linear; border-color: #fff; opacity: 1; }
.quantum-core.state-charging .ring-2 { animation: spin-rev 0.8s infinite linear; border-color: var(--purple-primary); opacity: 1; }

.quantum-core.state-active .core-nucleus { background: #fff; box-shadow: 0 0 80px var(--purple-primary); }
.quantum-core.state-active .ring-1, .quantum-core.state-active .ring-2 { border-color: #fff; width: 120%; height: 120%; opacity: 0; }
.quantum-core.state-active { animation: shake 0.2s infinite; }

.quantum-core.state-success .core-nucleus { background: var(--green-success); box-shadow: 0 0 50px var(--green-success); }

/* RIGHT PANEL: TARGETS */
.panel-targets {
  flex: 1;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.targets-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.7rem; font-weight: 700; color: var(--text-muted); letter-spacing: 1px;
}
.count-badge { background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 4px; color: #fff; }

.targets-list {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 1rem;
}

.target-row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.03);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.3s ease;
  opacity: 0; transform: translateX(20px); /* Setup for reveal anim */
}
.target-row.revealed { opacity: 1; transform: translateX(0); }

.t-avatar { width: 32px; height: 32px; background: rgba(0,0,0,0.3); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.t-info { flex: 1; }
.t-name { font-weight: 700; font-size: 1rem; }
.t-loc { font-size: 0.7rem; color: var(--text-muted); }
.t-action { color: var(--text-muted); font-size: 1.2rem; opacity: 0.5; }

.status-indicator {
  position: absolute; right: 12px; top: 12px;
  font-size: 0.6rem; font-weight: 900; letter-spacing: 1px;
  color: var(--purple-primary); opacity: 0;
  background: rgba(139, 92, 246, 0.1); padding: 2px 6px; border-radius: 4px;
}

/* Row States */
.target-row.selected {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--purple-primary);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}
.target-row.selected .status-indicator { opacity: 1; }
.target-row.dimmed { opacity: 0.3; filter: grayscale(1); }
.target-row.complete {
  border-color: var(--green-success);
  background: rgba(16, 185, 129, 0.1);
}
.target-row.complete .status-indicator { color: var(--green-success); content: "SWAPPED"; }

/* Footer */
.hud-footer { margin-top: 1rem; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 1rem; flex-shrink: 0; }

.player-pill {
  display: flex; gap: 10px; background: rgba(0,0,0,0.4); padding: 8px 16px; border-radius: 50px; border: 1px solid var(--glass-border); font-size: 0.8rem;
}
.player-pill .label { color: var(--text-muted); font-weight: 700; font-size: 0.6rem; letter-spacing: 1px; }
.player-pill .value { font-weight: 700; color: #fff; }
.player-pill .coord { color: var(--blue-primary); font-family: monospace; font-weight: 700; margin-left: 8px; }

.message-glass {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
  text-align: center;
  min-width: 350px;
  font-weight: 500;
  font-family: monospace;
}
.message-glass.active { border-color: var(--purple-primary); color: var(--purple-primary); }
.message-glass.highlight { border-color: var(--blue-primary); color: var(--blue-primary); }
.message-glass.success { border-color: var(--green-success); color: var(--green-success); }
.message-glass.magic { border-color: #fff; background: rgba(255,255,255,0.1); color: #fff; }

/* Overlay Flash */
.transfer-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: #fff; opacity: 0; pointer-events: none; z-index: 100;
}
.transfer-overlay.flash { animation: flash-white 0.5s ease-out; }

/* Animations */
@keyframes spin { 100% { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes spin-rev { 100% { transform: translate(-50%, -50%) rotate(-360deg); } }
@keyframes shake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-2px, 2px); } 75% { transform: translate(2px, -2px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes flash-white { 0% { opacity: 0.8; } 100% { opacity: 0; } }

/* Scrollbar */
.targets-list::-webkit-scrollbar { width: 4px; }
.targets-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.targets-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }