/* ============================================================
   StacksTasker Design System
   Airtasker-inspired dark mode UI
   ============================================================ */

/* ─── Google Fonts ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Design Tokens ─── */
:root {
  /* Backgrounds */
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2128;
  --surface-3: #21262d;

  /* Borders */
  --border: #30363d;
  --border-hover: #484f58;

  /* Text */
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-tertiary: #6e7681;

  /* Accents */
  --accent: #5546ff;
  --accent-hover: #6d5ffd;
  --accent-glow: rgba(85, 70, 255, 0.15);
  --orange: #f7931a;
  --orange-glow: rgba(247, 147, 26, 0.15);
  --green: #00d68f;
  --green-glow: rgba(0, 214, 143, 0.12);
  --red: #f85149;
  --red-glow: rgba(248, 81, 73, 0.12);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --container-max: 1200px;
  --section-padding: 80px 0;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

  /* Transitions */
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

/* ─── Layout ─── */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: var(--section-padding);
}

.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-header h2 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 17px;
  max-width: 560px;
  margin: 0 auto;
}

/* ─── Nav ─── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  transition: background 0.3s, backdrop-filter 0.3s, box-shadow 0.3s;
}
.nav.scrolled {
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
}

.nav-logo:hover { opacity: 0.9; }

.nav-logo img {
  height: 38px;
  width: auto;
}

/* ─── Mobile Hamburger ─── */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 101;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--surface-2);
}

#wallet-nav {
  margin-left: 10px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--orange);
  color: #000;
}
.btn-primary:hover {
  background: #ffa733;
  color: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(247, 147, 26, 0.35);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

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

.btn-green {
  background: var(--green);
  color: #000;
  font-weight: 700;
}
.btn-green:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 214, 143, 0.3);
}

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

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

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all var(--transition);
}

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

.card-clickable {
  cursor: pointer;
}
.card-clickable:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  transform: translateY(-2px);
}

/* ─── Tags ─── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.tag-category {
  background: var(--accent-glow);
  color: var(--accent-hover);
}

.tag-open {
  background: var(--green-glow);
  color: var(--green);
}

.tag-testnet {
  background: var(--orange-glow);
  color: var(--orange);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}
.tag-mainnet {
  background: var(--green-glow);
  color: var(--green);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.tag-assigned {
  background: var(--orange-glow);
  color: var(--orange);
}

.tag-submitted {
  background: var(--accent-glow);
  color: var(--accent-hover);
}

.tag-completed {
  background: var(--green-glow);
  color: var(--green);
}

.tag-cancelled {
  background: var(--red-glow);
  color: var(--red);
}

/* ─── Bounty Badge ─── */
.bounty {
  background: var(--green-glow);
  color: var(--green);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.bounty-lg {
  padding: 10px 24px;
  font-size: 20px;
}

/* ─── Form Elements ─── */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  transition: border-color var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(85, 70, 255, 0.1);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* ─── Footer ─── */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
  margin-top: 80px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  max-width: 280px;
}

.footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.footer-col a {
  display: block;
  color: var(--text-tertiary);
  font-size: 14px;
  padding: 4px 0;
  transition: color var(--transition);
}

.footer-col a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  max-width: var(--container-max);
  margin: 32px auto 0;
  padding: 24px 24px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer-badges {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ─── Grid Utilities ─── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* ─── Flex Utilities ─── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* ─── Text Utilities ─── */
.text-center { text-align: center; }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.font-bold { font-weight: 700; }

/* ─── Spacing Utilities ─── */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ─── Animations ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

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

.animate-fade-in {
  animation: fadeIn 0.4s ease;
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s ease;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

/* ─── Skeleton Loader ─── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 24px;
}

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

@media (max-width: 768px) {
  :root {
    --section-padding: 48px 0;
  }

  .container { padding: 0 16px; }

  .nav-inner { padding: 0 16px; }
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 100;
    padding: 24px;
  }
  .nav-links.open { display: flex; }
  .nav-links .nav-link { padding: 12px 24px; font-size: 16px; }
  .nav-links .nav-post-btn { display: inline-flex; margin-top: 12px; }
  .nav-link.hide-mobile { display: none; }

  .section-header h2 { font-size: 24px; }
  .section-header p { font-size: 15px; }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .btn-lg { padding: 12px 24px; font-size: 15px; }
}

@media (max-width: 480px) {
  .nav-link.hide-small { display: none; }
  .bounty-lg { padding: 8px 16px; font-size: 16px; }
}

/* "Post a Task" button in nav */
.nav-post-btn { display: inline-flex; }

/* ─── Wallet Connect ─── */
.btn-wallet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid var(--orange);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--orange);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-wallet:hover {
  background: rgba(247, 147, 26, 0.1);
  transform: translateY(-1px);
}

.wallet-connected {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.wallet-addr {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
}

.wallet-disconnect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
  padding: 0;
  font-family: inherit;
}
.wallet-disconnect:hover {
  background: var(--red-glow);
  color: var(--red);
}

/* ─── Testnet Banner ─── */
.testnet-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--orange);
  color: #000;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
}

/* ─── Status Tags (new statuses) ─── */
.tag-bidding {
  background: var(--orange-glow);
  color: var(--orange);
}
.tag-in-progress {
  background: var(--accent-glow);
  color: var(--accent-hover);
}
.tag-closed {
  background: var(--surface-3);
  color: var(--text-tertiary);
}

/* ─── Bid Cards ─── */
.bid-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: all var(--transition);
}
.bid-card:hover {
  border-color: var(--border-hover);
}
.bid-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.bid-card-body {
  flex: 1;
  min-width: 0;
}
.bid-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.bid-card-agent {
  font-size: 14px;
  font-weight: 600;
}
.bid-card-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
}
.bid-card-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}
.bid-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bid-card-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ─── Platform Fee Display ─── */
.fee-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.fee-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}
.fee-label {
  color: var(--text-secondary);
}
.fee-value {
  font-weight: 600;
}

/* ─── Mainnet Banner ─── */
.mainnet-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--green);
  color: #000;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
}

/* ─── Network Toggle ─── */
.network-toggle {
  position: fixed;
  bottom: 52px;
  right: 20px;
  z-index: 199;
  display: flex;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 3px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}

.network-toggle-btn {
  position: relative;
  padding: 6px 16px;
  border: none;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  background: transparent;
  color: var(--text-tertiary);
  transition: all 0.3s ease;
}

.network-toggle-btn.active-testnet {
  background: var(--orange);
  color: #000;
  box-shadow:
    0 0 12px rgba(247, 147, 26, 0.5),
    0 0 24px rgba(247, 147, 26, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.network-toggle-btn.active-mainnet {
  background: var(--green);
  color: #000;
  box-shadow:
    0 0 12px rgba(0, 214, 143, 0.5),
    0 0 24px rgba(0, 214, 143, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.network-toggle-btn:not(.active-testnet):not(.active-mainnet):hover {
  color: var(--text-secondary);
  background: var(--surface-2);
}

.network-toggle-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.active-testnet .network-toggle-dot {
  background: #000;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
  animation: glow-orange 2s ease-in-out infinite;
}

.active-mainnet .network-toggle-dot {
  background: #000;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
  animation: glow-green 2s ease-in-out infinite;
}

@keyframes glow-orange {
  0%, 100% { box-shadow: 0 0 4px rgba(247, 147, 26, 0.6); }
  50% { box-shadow: 0 0 10px rgba(247, 147, 26, 1); }
}

@keyframes glow-green {
  0%, 100% { box-shadow: 0 0 4px rgba(0, 214, 143, 0.6); }
  50% { box-shadow: 0 0 10px rgba(0, 214, 143, 1); }
}

@media (max-width: 480px) {
  .network-toggle {
    right: 12px;
    bottom: 48px;
  }
  .network-toggle-btn {
    padding: 5px 12px;
    font-size: 10px;
  }
}

/* ─── Wallet-gated Notice ─── */
.wallet-gate {
  text-align: center;
  padding: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.wallet-gate p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}
