/* SpiderAlgo v2 - Dark Purple Spider Theme */

:root {
  --bg-primary: #0a0614;
  --bg-secondary: #130a25;
  --bg-tertiary: #1b0f33;
  --bg-card: #1f1238;
  --bg-card-hover: #271547;
  --purple-primary: #8b5cf6;
  --purple-light: #a78bfa;
  --purple-dark: #6d28d9;
  --purple-accent: #c084fc;
  --purple-glow: rgba(139, 92, 246, 0.3);
  --text-primary: #f5f3ff;
  --text-secondary: #c4b5fd;
  --text-muted: #9b87d4;
  --text-dim: #6d5d9a;
  --border: rgba(139, 92, 246, 0.2);
  --border-strong: rgba(139, 92, 246, 0.4);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(139, 92, 246, 0.15);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(139, 92, 246, 0.2);
  --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.4);
}

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

html, body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(ellipse at top left, rgba(139, 92, 246, 0.15), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(109, 40, 217, 0.1), transparent 50%),
    var(--bg-primary);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

a {
  color: var(--purple-light);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--purple-accent);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Navbar */
.navbar {
  background: rgba(19, 10, 37, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.brand {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon {
  font-size: 1.8rem;
}

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

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 0.95rem;
  font-family: inherit;
  text-align: center;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-primary), var(--purple-dark));
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
  color: #fff;
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--purple-primary);
}

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

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-block {
  display: block;
  width: 100%;
}

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

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.card-hover:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  transition: all 0.2s;
}

.card-highlight {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-tertiary));
  border: 1px solid var(--purple-primary);
  box-shadow: var(--shadow-glow);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], textarea, select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--purple-primary);
  box-shadow: 0 0 0 3px var(--purple-glow);
}

.input-group {
  position: relative;
}

.input-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  border-left: 3px solid;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
  color: #6ee7b7;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: #fca5a5;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--warning);
  color: #fcd34d;
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--info);
  color: #93c5fd;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-pending { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.badge-active { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.badge-expired { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.badge-purple { background: var(--purple-glow); color: var(--purple-accent); }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-change {
  font-size: 0.85rem;
  margin-top: 0.25rem;
  color: var(--text-muted);
}

/* Hero */
.hero {
  padding: 4rem 0 5rem;
  text-align: center;
}

.hero h1 {
  font-size: 3.5rem;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-primary), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 2rem;
  line-height: 1.5;
}

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

/* Sections */
section {
  padding: 4rem 0;
}

section h2 {
  text-align: center;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 3rem;
}

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

.feature {
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  transition: all 0.3s;
}

.feature:hover {
  border-color: var(--purple-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--purple-primary), var(--purple-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.feature h3 {
  margin-bottom: 0.75rem;
}

.feature p {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Pricing */
.pricing-card {
  max-width: 480px;
  margin: 0 auto;
  padding: 2.5rem;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-tertiary));
  border: 1px solid var(--purple-primary);
  border-radius: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-glow);
}

.price {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple-light), var(--purple-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 1rem 0;
}

.price-period {
  color: var(--text-muted);
  font-size: 1rem;
}

.price-features {
  text-align: left;
  margin: 2rem 0;
  list-style: none;
}

.price-features li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  display: flex;
  align-items: start;
  gap: 0.65rem;
}

.price-features li::before {
  content: "✓";
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  counter-reset: step;
}

.step {
  position: relative;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple-primary), var(--purple-dark));
  color: #fff;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Footer */
footer {
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

footer a { color: var(--text-secondary); }

.footer-disclaimer {
  max-width: 720px;
  margin: 1.5rem auto 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* Auth forms */
.auth-wrap {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-lg);
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.auth-alt {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  padding: 2rem 0;
}

.sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  height: fit-content;
  position: sticky;
  top: 90px;
}

.sidebar-link {
  display: block;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.25rem;
  border-radius: 0.5rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.2s;
}

.sidebar-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--purple-glow);
  color: var(--purple-accent);
}

.main-area {
  min-width: 0;
}

/* Checklist */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.check-item {
  display: flex;
  align-items: start;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  transition: all 0.2s;
}

.check-item.done {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.05);
}

.check-item.current {
  border-color: var(--purple-primary);
  background: var(--purple-glow);
}

.check-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 2px solid var(--border);
  color: var(--text-muted);
}

.check-item.done .check-icon {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.check-item.current .check-icon {
  background: var(--purple-primary);
  border-color: var(--purple-primary);
  color: #fff;
}

.check-body {
  flex: 1;
}

.check-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.check-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border-radius: 0.75rem;
  overflow: hidden;
}

th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:last-child td { border-bottom: none; }
tr:hover { background: var(--bg-card-hover); }

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.25rem; }
  .hero p { font-size: 1rem; }
  h2 { font-size: 1.5rem; }
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .sidebar {
    position: static;
  }
  .navbar-inner {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .nav-links {
    gap: 0.5rem;
    width: 100%;
    justify-content: flex-start;
  }
  .nav-links .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }
  .hero-cta {
    flex-direction: column;
  }
  .hero-cta .btn {
    width: 100%;
  }
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Copyable code */
.code-box {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: 0.9rem;
  color: var(--purple-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  word-break: break-all;
}

.copy-btn {
  padding: 0.25rem 0.75rem;
  background: var(--purple-primary);
  color: #fff;
  border: none;
  border-radius: 0.35rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.copy-btn:hover { background: var(--purple-dark); }

/* Loading */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Tree (referrals) */
.tree-node {
  margin-left: 1rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--border);
  margin-bottom: 0.5rem;
}

.tree-root {
  margin-left: 0;
  border-left: none;
  padding: 0.85rem;
  background: var(--bg-card);
  border-radius: 0.5rem;
  border: 1px solid var(--purple-primary);
  margin-bottom: 1rem;
}
