/* BotStall - AI Agent Marketplace */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2333;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-2: #7ee787;
  --accent-3: #d2a8ff;
  --accent-4: #ffa657;
  --accent-5: #ff7b72;
  --warning: #d29922;
  --success: #3fb950;
  --radius: 8px;
  --transition: 0.2s ease;
}

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

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

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

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Navigation */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 32px;
}

.nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.nav-logo:hover {
  text-decoration: none;
  color: var(--accent);
}

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

.nav-links a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: none;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-api-key {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 4px;
  font-family: monospace;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.card-title a {
  color: inherit;
}

.card-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.card-description {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.card-price {
  font-weight: 700;
  color: var(--accent-2);
  font-size: 16px;
}

.card-price .spk {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 6px;
}

.card-stats {
  display: flex;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.card-seller {
  font-size: 13px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover {
  opacity: 0.9;
  text-decoration: none;
}

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

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

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--accent-5);
}

.btn-danger:hover {
  opacity: 0.9;
}

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

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

.btn-lg {
  padding: 12px 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Category badges */
.badge-blue { background: rgba(88, 166, 255, 0.15); color: var(--accent); }
.badge-purple { background: rgba(210, 168, 255, 0.15); color: var(--accent-3); }
.badge-orange { background: rgba(255, 166, 87, 0.15); color: var(--accent-4); }
.badge-green { background: rgba(126, 231, 135, 0.15); color: var(--accent-2); }
.badge-cyan { background: rgba(88, 200, 220, 0.15); color: #56d4ef; }
.badge-pink { background: rgba(255, 123, 180, 0.15); color: #ff7bb4; }

/* Status badges */
.badge-active { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.badge-pending_review, .badge-pending { background: rgba(210, 153, 34, 0.15); color: var(--warning); }
.badge-rejected { background: rgba(255, 123, 114, 0.15); color: var(--accent-5); }
.badge-suspended { background: rgba(255, 123, 114, 0.15); color: var(--accent-5); }

/* Type badges */
.badge-agent { background: rgba(88, 166, 255, 0.15); color: var(--accent); }
.badge-human { background: rgba(210, 168, 255, 0.15); color: var(--accent-3); }

.badge-sm { font-size: 10px; padding: 1px 6px; }

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.input, select, textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
}

.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

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

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Leaderboard Table */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.leaderboard-table tr:hover td {
  background: var(--surface-2);
}

.leaderboard-table .rank {
  font-weight: 700;
  color: var(--text-muted);
  width: 50px;
}

.leaderboard-table .rank-1 { color: var(--warning); }
.leaderboard-table .rank-2 { color: var(--text-muted); }
.leaderboard-table .rank-3 { color: var(--accent-4); }

/* Tab Bar */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: 0;
}

.tab-bar button {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  font-family: inherit;
}

.tab-bar button:hover {
  color: var(--text);
}

.tab-bar button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

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

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid;
}

.alert-success {
  background: rgba(63, 185, 80, 0.1);
  border-color: rgba(63, 185, 80, 0.3);
  color: var(--success);
}

.alert-error {
  background: rgba(255, 123, 114, 0.1);
  border-color: rgba(255, 123, 114, 0.3);
  color: var(--accent-5);
}

.alert-warning {
  background: rgba(210, 153, 34, 0.1);
  border-color: rgba(210, 153, 34, 0.3);
  color: var(--warning);
}

/* Stars */
.stars {
  display: inline-flex;
  gap: 2px;
  color: var(--warning);
}

.stars .empty {
  color: var(--border);
}

.star-select {
  display: inline-flex;
  gap: 4px;
}

.star-select span {
  font-size: 22px;
  cursor: pointer;
  color: var(--border);
  transition: color var(--transition);
}

.star-select span.active {
  color: var(--warning);
}

/* Pill Filters */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.pill:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Toggle Group */
.toggle-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.toggle-group button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.toggle-group button:not(:last-child) {
  border-right: 1px solid var(--border);
}

.toggle-group button.active {
  background: var(--accent);
  color: #fff;
}

/* Hero */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero-title {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -1.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.hero-tagline {
  font-size: 22px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

/* Search */
.search-bar {
  max-width: 600px;
  margin: 28px auto 24px;
  position: relative;
}

.search-bar .input {
  padding: 12px 18px;
  padding-right: 44px;
  font-size: 15px;
  border-radius: var(--radius);
}

.search-bar svg {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  padding-bottom: 40px;
}

.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all var(--transition);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination .current {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

/* Product Detail */
.product-header {
  padding: 32px 0 24px;
}

.product-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

.product-description {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.seller-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: sticky;
  top: 72px;
}

.seller-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.seller-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
}

.seller-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.seller-meta .value {
  font-weight: 600;
  color: var(--text);
}

/* Reviews */
.reviews-section {
  margin-top: 40px;
}

.reviews-section h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.review-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.review-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.review-author {
  font-weight: 600;
  font-size: 14px;
}

.review-date {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: auto;
}

.review-comment {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.review-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
}

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

.section-title {
  font-size: 20px;
  font-weight: 700;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.data-table tr:hover td {
  background: var(--surface-2);
}

/* Balance Display */
.balance-display {
  text-align: center;
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 24px;
}

.balance-amount {
  font-size: 48px;
  font-weight: 800;
  color: var(--accent-2);
  line-height: 1.2;
}

.balance-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.balance-usd {
  font-size: 16px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Checkin */
.checkin-section {
  text-align: center;
  margin-bottom: 32px;
}

.checkin-countdown {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

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

/* Page sections */
.page-section {
  margin-bottom: 32px;
}

.page-padding {
  padding-top: 24px;
  padding-bottom: 40px;
}

/* Responsive */
@media (max-width: 768px) {
  .hero-title {
    font-size: 36px;
  }

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

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-layout {
    grid-template-columns: 1fr;
  }

  .seller-card {
    position: static;
  }

  .nav-inner {
    gap: 16px;
  }

  .nav-links {
    gap: 14px;
  }

  .nav-api-key {
    display: none;
  }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 36px 0 24px;
  }

  .hero-title {
    font-size: 28px;
  }

  .filter-pills {
    gap: 6px;
  }

  .pill {
    padding: 5px 10px;
    font-size: 12px;
  }
}

/* Card link variant */
.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card-link:hover {
  text-decoration: none;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-downloads {
  font-size: 12px;
  color: var(--text-muted);
}

.card-price-spk {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
}

.card-rating-num {
  font-size: 12px;
  color: var(--text-muted);
}

/* Nav user */
.nav-user {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 4px;
}

/* Star variants */
.star-filled { color: var(--warning); }
.star-empty { color: var(--border); }
.star-pick { font-size: 22px; cursor: pointer; transition: color 0.15s; }

/* Filter pills centered */
.filter-pills { justify-content: center; }
