/* ============================================
   THE AGENTS - CRYPTO FORENSIC LAB
   Global Stylesheet
   ============================================ */

/* CSS Variables */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2236;
  --bg-card-hover: #232d45;
  --bg-terminal: #0d1117;
  --border-color: #2a3449;
  --border-hover: #3d4f6f;

  --accent-cyan: #00e5ff;
  --accent-cyan-dim: rgba(0, 229, 255, 0.15);
  --accent-green: #00e676;
  --accent-green-dim: rgba(0, 230, 118, 0.15);
  --accent-red: #ff1744;
  --accent-red-dim: rgba(255, 23, 68, 0.15);
  --accent-amber: #ffc400;
  --accent-amber-dim: rgba(255, 196, 0, 0.15);
  --accent-purple: #e040fb;
  --accent-purple-dim: rgba(224, 64, 251, 0.15);

  --text-primary: #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dark: #0a0e17;

  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-glow-cyan: 0 0 20px rgba(0, 229, 255, 0.2);
  --shadow-glow-green: 0 0 20px rgba(0, 230, 118, 0.2);
  --shadow-glow-red: 0 0 20px rgba(255, 23, 68, 0.2);
}

/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--text-primary);
  text-shadow: 0 0 10px var(--accent-cyan);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px var(--accent-cyan); }
  50% { box-shadow: 0 0 20px var(--accent-cyan), 0 0 40px var(--accent-cyan); }
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

@keyframes typeCursor {
  0%, 100% { border-color: transparent; }
  50% { border-color: var(--accent-cyan); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes loadingPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

@keyframes gridMove {
  0% { background-position: 0 0; }
  100% { background-position: 50px 50px; }
}

.animate-fadeIn {
  animation: fadeIn 0.5s ease forwards;
}

.animate-slideInLeft {
  animation: slideInLeft 0.5s ease forwards;
}

.animate-slideInRight {
  animation: slideInRight 0.5s ease forwards;
}

/* Stagger delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ============================================
   BACKGROUND EFFECTS
   ============================================ */
.grid-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
}

/* ============================================
   NAVIGATION
   ============================================ */
.main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
}

.logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--nova), var(--vega));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--bg-primary);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
    flex-shrink: 0;
  }
  
  .logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.nav-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
  border-color: rgba(0, 229, 255, 0.2);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.nav-links a.active {
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.1);
}

/* ============================================
   MAIN CONTAINER
   ============================================ */
.main-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 600px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-green);
  background: var(--accent-green-dim);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid rgba(0, 230, 118, 0.2);
}

.status-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* ============================================
   SECTION HEADERS
   ============================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-title .icon {
  font-size: 1.2rem;
}

.section-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

/* ============================================
   COIN CARDS GRID
   ============================================ */
.coins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.coin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}

.coin-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.coin-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.coin-card:hover::before {
  opacity: 1;
}

.coin-card .card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.coin-card .coin-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.coin-card .coin-info {
  flex: 1;
  min-width: 0;
}

.coin-card .coin-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coin-card .coin-symbol {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.coin-card .coin-rank {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.coin-card .price-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.coin-card .coin-price {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
}

.coin-card .coin-change {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.change-positive {
  color: var(--accent-green);
  background: var(--accent-green-dim);
}

.change-negative {
  color: var(--accent-red);
  background: var(--accent-red-dim);
}

.coin-card .coin-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.coin-card .verified-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent-green);
  background: var(--accent-green-dim);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(0, 230, 118, 0.2);
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 1rem;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ============================================
   ERROR STATE
   ============================================ */
.error-container {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--accent-red);
}

.error-container button {
  margin-top: 1rem;
  padding: 0.6rem 1.5rem;
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border: 1px solid rgba(255, 23, 68, 0.3);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.error-container button:hover {
  background: var(--accent-red);
  color: white;
}

/* ============================================
   ANALYSIS PAGE - INPUT SECTION
   ============================================ */
.scan-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.scan-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan), var(--accent-green));
}

.scan-input-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.scan-input {
  flex: 1;
  padding: 0.85rem 1.25rem;
  background: var(--bg-terminal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.scan-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

.scan-input::placeholder {
  color: var(--text-muted);
}

.scan-btn {
  padding: 0.85rem 2rem;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: var(--text-dark);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.scan-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-cyan);
}

.scan-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================
   AGENT LAB INTERFACE
   ============================================ */
.agent-lab {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.agent-lab.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

.lab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.lab-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lab-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.status-dot.active { background: var(--accent-green); }
.status-dot.waiting { background: var(--accent-amber); }
.status-dot.complete { background: var(--accent-cyan); }

/* Agent Chat Container */
.agent-chat {
  padding: 1.5rem;
  max-height: 600px;
  overflow-y: auto;
  font-family: var(--font-mono);
}

/* Agent Message */
.agent-message {
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}

.agent-message-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.agent-avatar.nova {
  background: var(--accent-cyan-dim);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.agent-avatar.simulator {
  background: var(--accent-purple-dim);
  border: 1px solid rgba(224, 64, 251, 0.3);
}

.agent-avatar.decision {
  background: var(--accent-amber-dim);
  border: 1px solid rgba(255, 196, 0, 0.3);
}

.agent-name {
  font-weight: 700;
  font-size: 0.85rem;
}

.agent-name.nova { color: var(--accent-cyan); }
.agent-name.simulator { color: var(--accent-purple); }
.agent-name.decision { color: var(--accent-amber); }

.agent-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.agent-timestamp {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: auto;
}

.agent-bubble {
  background: var(--bg-terminal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-left: 2.5rem;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-secondary);
  position: relative;
}

.agent-bubble::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  width: 3px;
  height: 100%;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.agent-bubble.nova::before { background: var(--accent-cyan); }
.agent-bubble.simulator::before { background: var(--accent-purple); }
.agent-bubble.decision::before { background: var(--accent-amber); }

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: loadingPulse 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

/* ============================================
   ANALYSIS RESULTS
   ============================================ */
.result-section {
  margin-top: 1rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.result-item {
  background: var(--bg-secondary);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.result-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.result-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Final verdict */
.verdict-box {
  margin-top: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.85rem;
  line-height: 1.7;
}

.verdict-box.safe {
  background: var(--accent-green-dim);
  border-color: rgba(0, 230, 118, 0.3);
  color: var(--accent-green);
}

.verdict-box.caution {
  background: var(--accent-amber-dim);
  border-color: rgba(255, 196, 0, 0.3);
  color: var(--accent-amber);
}

.verdict-box.danger {
  background: var(--accent-red-dim);
  border-color: rgba(255, 23, 68, 0.3);
  color: var(--accent-red);
}

.verdict-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-container {
  padding: 1.25rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.progress-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  border-radius: 2px;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

/* ============================================
   TOKEN SUMMARY CARD (in analysis)
   ============================================ */
.token-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.token-summary-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
}

.token-summary-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
}

.token-summary-info p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .main-container {
    padding: 1rem;
  }

  .nav-container {
    padding: 0 1rem;
  }

  .nav-links {
    gap: 0.25rem;
  }

  .nav-links a {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
  }

  .nav-brand span {
    display: none;
  }

  .coins-grid {
    grid-template-columns: 1fr;
  }

  .scan-input-group {
    flex-direction: column;
  }

  .scan-btn {
    width: 100%;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   UTILITY
   ============================================ */
.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-amber { color: var(--accent-amber); }
.text-purple { color: var(--accent-purple); }
.text-muted { color: var(--text-muted); }

.font-mono { font-family: var(--font-mono); }

.hidden { display: none !important; }

.glow-cyan { text-shadow: 0 0 10px rgba(0, 229, 255, 0.4); }
.glow-green { text-shadow: 0 0 10px rgba(0, 230, 118, 0.4); }
.glow-red { text-shadow: 0 0 10px rgba(255, 23, 68, 0.4); }
