:root {
  --primary: #1a1a2e;
  --accent: #e94560;
  --bg: #f4f5f7;
  --card-bg: #fff;
  --text: #222;
  --text-muted: #777;
  --border: #e0e0e0;
  --radius: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
.header {
  background: var(--primary);
  color: #fff;
  padding: 1rem 1.25rem;
  text-align: center;
}
.header h1 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.5px; }
.header p  { font-size: 0.78rem; opacity: 0.75; margin-top: 0.2rem; }

/* ── Controls bar ── */
.controls {
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.search-box {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg);
  margin-bottom: 0.65rem;
}
.search-box:focus { border-color: var(--accent); background: #fff; }

/* ── Category pills ── */
.filter-pills {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.filter-pills::-webkit-scrollbar { display: none; }

.pill {
  flex-shrink: 0;
  padding: 0.3rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.pill:hover  { border-color: var(--primary); color: var(--primary); }
.pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Items grid ── */
.items-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  padding: 0.75rem;
}
@media (min-width: 540px)  { .items-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 800px)  { .items-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; padding: 1rem; } }
@media (min-width: 1100px) { .items-grid { grid-template-columns: repeat(5, 1fr); } }

/* ── Item card ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  display: flex;
  flex-direction: column;
  transition: transform 0.12s, box-shadow 0.12s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }

.card-img {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  background: #eee;
  display: block;
}
.card-img-placeholder {
  aspect-ratio: 1;
  width: 100%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #ccc;
}

.card-body {
  padding: 0.55rem 0.6rem 0.65rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.28rem;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}

.card-category {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  padding: 0.12rem 0.45rem;
  border-radius: 10px;
  align-self: flex-start;
  letter-spacing: 0.2px;
}

.card-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent);
  margin-top: auto;
}

.source-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.card-link {
  display: block;
  margin-top: 0.4rem;
  padding: 0.42rem 0.5rem;
  text-align: center;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: opacity 0.12s;
}
.card-link:hover { opacity: 0.88; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  line-height: 1.8;
}
.empty-state a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem 1.5rem;
}

.page-btn {
  padding: 0.5rem 1.25rem;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  background: #fff;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.page-btn:hover { background: var(--primary); color: #fff; }

.page-btn--disabled {
  border-color: var(--border);
  color: var(--text-muted);
  pointer-events: none;
}

.page-current {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 4.5rem;
  text-align: center;
}
