.markets-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.markets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.markets-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 0;
}

.markets-search {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
  pointer-events: none;
}

.search-input {
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  width: 240px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.search-input::placeholder {
  color: var(--muted-foreground);
}

.trending-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.trending-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.trending-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.15);
}

.trending-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.trending-info {
  flex: 1;
  min-width: 0;
}

.trending-badge {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(245, 158, 11, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 0.3rem;
}

.trending-name {
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.95rem;
}

.trending-symbol {
  color: var(--muted-foreground);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.trending-price {
  text-align: right;
  flex-shrink: 0;
}

.trending-price-value {
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.95rem;
  display: block;
  margin-bottom: 0.25rem;
}

.market-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.market-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(245, 158, 11, 0.2);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.market-table-wrapper {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: clip;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
}

.market-table thead {
  position: sticky;
  top: 64px;
  z-index: 10;
}

.market-table th {
  padding: 0.875rem 1rem;
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.market-table td {
  padding: 0.875rem 1rem;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

.market-table tbody tr:hover {
  background: rgba(245, 158, 11, 0.04);
}

.th-rank {
  width: 50px;
}

.td-rank {
  color: var(--muted-foreground);
  font-weight: 500;
}

.th-right, .td-right {
  text-align: right;
}

.coin-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.coin-info img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.coin-name {
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.9rem;
}

.coin-symbol {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.badge-up {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-up);
}

.badge-down {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-down);
}

@media (max-width: 768px) {
  .trending-cards {
    grid-template-columns: 1fr;
  }
  .markets-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .search-input {
    width: 100%;
  }
}

/* ── Category filter tabs ── */
.cat-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.cat-tab {
  padding: 0.35rem 0.9rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--muted-foreground);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cat-tab:hover {
  color: var(--foreground);
  border-color: var(--border);
}

.cat-tab--active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}

/* ── Sparkline ── */
.sparkline-svg { display: block; }
.sparkline-na { color: var(--muted-foreground); font-size: 0.85rem; }

/* ── Trending card upgrade ── */
.trending-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  margin-left: auto;
}

.trending-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Mono prices in table ── */
.td-mono {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

/* ── Arrow icon in badges ── */
.change-arrow {
  display: inline-block;
  vertical-align: middle;
  margin-right: 2px;
}

/* ── Table row hover ── */
#market-data-body tr:hover {
  background: var(--glass-bg);
}
