/* Autocompound – Shared Design Tokens & Dashboard Styles */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-deep: #0a0a0f;
  --bg-card: #111118;
  --bg-elevated: #1a1a24;
  --bg-hover: #1e1e2a;
  --accent: #00ff88;
  --accent-dim: #00cc6a;
  --accent-glow: rgba(0, 255, 136, 0.15);
  --accent-bg: rgba(0, 255, 136, 0.08);
  --text-primary: #e8e8ef;
  --text-secondary: #8888a0;
  --text-dim: #555570;
  --border: #222235;
  --border-light: #2a2a40;
  --red: #ff4466;
  --red-bg: rgba(255, 68, 102, 0.1);
  --green: #00ff88;
  --green-bg: rgba(0, 255, 136, 0.1);
  --yellow: #e0af68;
  --yellow-bg: rgba(224, 175, 104, 0.1);
  --blue: #7aa2f7;
  --blue-bg: rgba(122, 162, 247, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
}

.mono { font-family: 'JetBrains Mono', monospace; }

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(0,255,136,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,136,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ─── Dashboard Nav ─────────────────────────────── */
.dash-nav {
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.dash-nav .logo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.dash-nav .logo-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 10px var(--accent); }
  50% { opacity: 0.6; box-shadow: 0 0 4px var(--accent); }
}

.dash-nav .nav-links {
  display: flex;
  gap: 6px;
}

.dash-nav .nav-links a {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.15s;
}

.dash-nav .nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.dash-nav .nav-links a.active {
  color: var(--accent);
  background: var(--accent-bg);
}

.mode-badge {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.mode-badge.demo {
  color: var(--yellow);
  background: var(--yellow-bg);
  border: 1px solid rgba(224, 175, 104, 0.2);
}

.mode-badge.live {
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid rgba(0, 255, 136, 0.2);
}

/* ─── Dashboard Layout ──────────────────────────── */
.dash-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 32px;
  position: relative;
  z-index: 1;
}

/* ─── Stat Cards ────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: border-color 0.15s;
}

.stat-card:hover {
  border-color: var(--border-light);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -1px;
  font-family: 'JetBrains Mono', monospace;
}

.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.blue { color: var(--blue); }

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ─── Section Headers ───────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  margin-top: 12px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.section-count {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-left: 10px;
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Buttons ───────────────────────────────────── */
.btn {
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}

.btn-primary:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(255, 68, 102, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 68, 102, 0.2);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.75rem;
}

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

/* ─── Tables ────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
}

.data-table th {
  text-align: left;
  padding: 12px 18px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.data-table td {
  padding: 14px 18px;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(34,34,53,0.4);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(26, 26, 36, 0.5);
}

.data-table .mono {
  font-size: 0.82rem;
}

/* ─── Status Badges ─────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-pending { color: var(--yellow); background: var(--yellow-bg); }
.badge-accepted, .badge-holding { color: var(--blue); background: var(--blue-bg); }
.badge-sold, .badge-active { color: var(--green); background: var(--green-bg); }
.badge-expired, .badge-cancelled, .badge-failed { color: var(--red); background: var(--red-bg); }

/* ─── Cards ─────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}

.card:hover {
  border-color: var(--border-light);
}

.collection-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.collection-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.collection-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.collection-details h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 3px;
}

.collection-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
}

.collection-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.collection-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ─── Forms & Modals ────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  position: relative;
}

.modal h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.form-group input::placeholder {
  color: var(--text-dim);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ─── Empty State ───────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ─── Loading / Spinner ─────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* ─── Toast Notifications ───────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast-success {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.toast-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(255, 68, 102, 0.2);
}

.toast-info {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid rgba(122, 162, 247, 0.2);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Toggle Switch ─────────────────────────────── */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle input {
  display: none;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: all 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-bg);
  border-color: var(--accent-dim);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--accent);
}

/* ─── Rarity Score ──────────────────────────────── */
.rarity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rarity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.rarity-dot.legendary { background: #ff9900; box-shadow: 0 0 6px #ff9900; }
.rarity-dot.epic { background: #bb77ff; box-shadow: 0 0 6px #bb77ff; }
.rarity-dot.rare { background: var(--blue); box-shadow: 0 0 6px var(--blue); }
.rarity-dot.common { background: var(--text-dim); }

/* ─── Profit Display ────────────────────────────── */
.profit-positive { color: var(--green); }
.profit-negative { color: var(--red); }

/* ─── Scan Animation ────────────────────────────── */
.scanning {
  position: relative;
}

.scanning::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scanLine 1.5s ease-in-out infinite;
}

@keyframes scanLine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ─── Responsive ────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dash-nav { padding: 12px 16px; }
  .dash-container { padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .collection-card { flex-direction: column; align-items: flex-start; }
  .collection-actions { width: 100%; justify-content: flex-end; }
  .data-table { font-size: 0.82rem; }
  .data-table th, .data-table td { padding: 10px 12px; }
}
