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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft JhengHei", sans-serif;
  font-size: 14px;
  color: #1f2937;
  background: #f3f4f6;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 50;
}
.logo {
  font-size: 18px;
  font-weight: 700;
  color: #2563eb;
}
.nav { display: flex; gap: 6px; }
.nav-link {
  padding: 6px 14px;
  text-decoration: none;
  color: #6b7280;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}
.nav-link:hover { background: #f3f4f6; color: #1f2937; }
.nav-link.active { background: #eff6ff; color: #2563eb; }

.user-info {
  font-size: 12px;
  color: #6b7280;
  background: #f9fafb;
  padding: 6px 12px;
  border-radius: 16px;
}

.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 32px 80px;
}

.hero { margin-bottom: 24px; }
.hero h1 { font-size: 26px; font-weight: 700; color: #111827; }
.subtitle { font-size: 13px; color: #6b7280; margin-top: 4px; }

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.search-input:focus { outline: none; border-color: #2563eb; }
.filter-select {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.listing-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.listing-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.listing-card.selected {
  outline: 3px solid #2563eb;
}
.listing-card .card-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  background: #e5e7eb;
  object-fit: cover;
  display: block;
}
.listing-card .card-checkbox {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255,255,255,0.9);
  border: 2px solid #d1d5db;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.listing-card.selected .card-checkbox {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.card-body { padding: 12px 14px; }
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  min-height: 2.8em;
}
.card-price { font-size: 18px; font-weight: 700; color: #dc2626; margin-bottom: 4px; }
.card-meta { font-size: 12px; color: #6b7280; }
.card-meta span { margin-right: 8px; }
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #f9fafb;
  font-size: 11px;
  color: #9ca3af;
}
.card-footer a {
  color: #2563eb;
  text-decoration: none;
}
.card-footer a:hover { text-decoration: underline; }

.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: #6b7280;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}
.empty h3 { color: #374151; margin-bottom: 8px; font-size: 16px; }

/* Comparison bar (sticky bottom) */
.comparison-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: #1f2937;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 40;
}
.bar-info { font-size: 13px; }

.btn-primary, .btn-secondary {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary {
  background: #fff;
  color: #374151;
  border-color: #d1d5db;
}
.comparison-bar .btn-secondary {
  background: transparent;
  color: #d1d5db;
  border-color: #4b5563;
}
.comparison-bar .btn-secondary:hover {
  background: #374151;
  color: #fff;
}
