/* Traktion — design system */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #1a1a26;
  --border: #1e1e2e;
  --border-light: #2a2a3e;
  --text: #e8e8ed;
  --muted: #8888a0;
  --accent: #c4f542;
  --accent-dim: #8fb830;
  --accent-glow: rgba(196, 245, 66, 0.15);
  --purple: #a855f7;
  --purple-dim: #7c3aed;
  --gradient: linear-gradient(135deg, #c4f542 0%, #a855f7 100%);
  --red: #f87171;
  --green: #4ade80;
  --yellow: #facc15;
}

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

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

h1, h2, h3, h4, h5 {
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.2;
}

/* Grain texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
}

/* ─── NAV ─────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(20px);
  background: rgba(10, 10, 15, 0.85);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.nav-links { display: flex; align-items: center; gap: 1rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
  font-weight: 600;
}
.btn-primary:hover { background: #d4ff55; transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border-light); color: var(--text); }

.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.25); }

.btn-purple {
  background: var(--purple);
  color: white;
  font-weight: 600;
}
.btn-purple:hover { background: #be7aff; transform: translateY(-1px); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ─── LANDING ─────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 8rem 2rem 4rem;
  text-align: center;
  position: relative;
}

.hero-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(196, 245, 66, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  background: rgba(196, 245, 66, 0.1);
  border: 1px solid rgba(196, 245, 66, 0.3);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }

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

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: 1.25rem;
  max-width: 800px;
}

.hero h1 .grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 520px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 2.5rem;
  justify-content: center;
  margin-top: 4rem;
  flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-item .num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-item .label { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

/* Features section */
.features {
  padding: 5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--border-light); }

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}
.feature-icon.green { background: rgba(196, 245, 66, 0.12); }
.feature-icon.purple { background: rgba(168, 85, 247, 0.12); }
.feature-icon.blue { background: rgba(96, 165, 250, 0.12); }

.feature-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.875rem; color: var(--muted); line-height: 1.6; }

/* CTA section */
.cta-section {
  padding: 5rem 2rem;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}
.cta-section h2 { font-size: 2.25rem; font-weight: 700; margin-bottom: 1rem; }
.cta-section p { color: var(--muted); margin-bottom: 2rem; }

/* ─── DASHBOARD ───────────────────────────────────── */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  padding-top: 65px;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: fixed;
  top: 65px;
  left: 0;
  width: 260px;
  height: calc(100vh - 65px);
  overflow-y: auto;
}

.sidebar-section { margin-bottom: 2rem; }
.sidebar-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: rgba(196, 245, 66, 0.1); color: var(--accent); }
.nav-item .icon { font-size: 1rem; width: 20px; text-align: center; }

/* Artist badge in sidebar */
.artist-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.artist-badge .artist-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }
.artist-badge .artist-genre { font-size: 0.75rem; color: var(--muted); }
.artist-badge .setup-hint { font-size: 0.75rem; color: var(--accent); cursor: pointer; margin-top: 0.25rem; }

/* Main content */
.main-content {
  margin-left: 260px;
  padding: 2rem;
  max-width: 1100px;
}

/* Page sections */
.page-section { display: none; }
.page-section.active { display: block; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.card-title { font-size: 0.9rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Grid layouts */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* Metric cards */
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
.metric-label { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.5rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-family: 'Space Grotesk', sans-serif; font-size: 1.75rem; font-weight: 700; }
.metric-delta {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.metric-delta.up { color: var(--green); }
.metric-delta.neutral { color: var(--muted); }

/* Post cards */
.post-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}
.post-card:hover { border-color: var(--border-light); }

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 0.725rem;
  font-weight: 600;
}
.platform-badge.instagram { background: rgba(168, 85, 247, 0.15); color: var(--purple); border: 1px solid rgba(168, 85, 247, 0.3); }
.platform-badge.x { background: rgba(232, 232, 237, 0.1); color: var(--text); border: 1px solid var(--border); }

.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
}
.status-badge.draft { background: rgba(250, 204, 21, 0.12); color: var(--yellow); border: 1px solid rgba(250, 204, 21, 0.25); }
.status-badge.posted { background: rgba(74, 222, 128, 0.12); color: var(--green); border: 1px solid rgba(74, 222, 128, 0.25); }

.post-caption { font-size: 0.875rem; line-height: 1.6; color: var(--text); margin-bottom: 0.75rem; }
.post-hashtags { font-size: 0.75rem; color: var(--purple); line-height: 1.5; margin-bottom: 0.875rem; }

.post-actions { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; }
.post-meta { font-size: 0.75rem; color: var(--muted); }

/* Activity feed */
.action-item {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}
.action-item:last-child { border-bottom: none; }

.action-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.action-icon.follow { background: rgba(196, 245, 66, 0.12); }
.action-icon.hashtag_engage { background: rgba(168, 85, 247, 0.12); }
.action-icon.comment_reply { background: rgba(96, 165, 250, 0.12); }
.action-icon.story_engagement { background: rgba(251, 146, 60, 0.12); }
.action-icon.collab_reach { background: rgba(74, 222, 128, 0.12); }

.action-body { flex: 1; }
.action-type { font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 0.15rem; text-transform: capitalize; }
.action-target { font-size: 0.8rem; color: var(--muted); }
.action-time { font-size: 0.7rem; color: var(--muted); flex-shrink: 0; }

/* Agent run status */
.run-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: 10px;
  background: var(--surface-2);
  margin-bottom: 0.5rem;
}
.run-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.run-status-dot.completed { background: var(--green); }
.run-status-dot.running { background: var(--yellow); animation: pulse 1.5s infinite; }
.run-status-dot.failed { background: var(--red); }

.run-info { flex: 1; }
.run-title { font-size: 0.825rem; font-weight: 500; }
.run-meta { font-size: 0.75rem; color: var(--muted); margin-top: 0.1rem; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.04em; }

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { appearance: none; cursor: pointer; }

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

/* Agent run button */
.agent-trigger {
  background: linear-gradient(135deg, rgba(196, 245, 66, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.agent-trigger h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.agent-trigger p { font-size: 0.875rem; color: var(--muted); margin-bottom: 1.25rem; }

/* Chart placeholder */
.chart-area {
  height: 160px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 1rem 0 0;
}
.chart-bar {
  flex: 1;
  background: linear-gradient(to top, var(--accent-dim), var(--accent));
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.chart-bar:hover { opacity: 1; }

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  z-index: 9999;
  display: none;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.toast.show { display: flex; align-items: center; gap: 0.75rem; }
.toast.success { border-color: rgba(74, 222, 128, 0.4); }
.toast.error { border-color: rgba(248, 113, 113, 0.4); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h4 { font-size: 0.9rem; color: var(--text); margin-bottom: 0.375rem; }
.empty-state p { font-size: 0.8rem; }

/* Page header */
.page-header { margin-bottom: 1.75rem; }
.page-header h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-header p { font-size: 0.875rem; color: var(--muted); }

/* Section title */
.section-title { font-size: 0.85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 1rem; }

/* Copy button */
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-light); }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* Responsive */
@media (max-width: 768px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 1rem; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
