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

:root {
  --bg:           #f5f5f3;
  --surface:      #ffffff;
  --border:       rgba(0,0,0,0.10);
  --border-hover: rgba(0,0,0,0.22);
  --text:         #1a1a18;
  --muted:        #6b6b68;
  --accent:       #1D9E75;
  --wa:           #25D366;
  --wa-hover:     #1ebe5d;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #111110;
    --surface: #1c1c1a;
    --border:       rgba(255,255,255,0.10);
    --border-hover: rgba(255,255,255,0.22);
    --text:    #f0ede8;
    --muted:   #9a9894;
    --accent:  #5DCAA5;
  }
}

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

.page-wrapper { max-width: 980px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }

.page-header { margin-bottom: 1.75rem; }
.page-header h1 { font-size: 22px; font-weight: 500; margin-bottom: 3px; }
.page-header p  { font-size: 13px; color: var(--muted); }

/* TOOLBAR */
.top-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.85rem;
}

.search-input {
  flex: 1;
  min-width: 160px;
  height: 36px;
  padding: 0 12px;
  border: 0.5px solid var(--border-hover);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--accent); }

.sort-select {
  height: 36px;
  padding: 0 10px;
  border: 0.5px solid var(--border-hover);
  border-radius: var(--r-md);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.result-count { font-size: 12px; color: var(--muted); margin-left: auto; white-space: nowrap; }

/* PILLS */
.filter-group { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 1.25rem; }

.pill {
  padding: 4px 13px;
  border-radius: var(--r-pill);
  border: 0.5px solid var(--border-hover);
  font-size: 12px;
  cursor: pointer;
  background: var(--surface);
  color: var(--muted);
  transition: all 0.15s;
  user-select: none;
}
.pill:hover  { background: var(--bg); color: var(--text); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* GRID — always 3 cols on desktop */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
@media (max-width: 380px) { .grid { grid-template-columns: 1fr; gap: 10px; } }

/* CARD — flex column so WA button always at bottom */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--border-hover); transform: translateY(-2px); }

/* image — compact square, max-height keeps grid tight */
.card-img {
  width: 100%;
  aspect-ratio: 1;
  max-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: var(--bg);
  flex-shrink: 0;
}

.card-body {
  padding: 9px 11px 11px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0;
}

.card-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.card-desc {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin-bottom: 8px;
}

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

.price { font-size: 14px; font-weight: 500; color: var(--accent); }

.badge-cat {
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--muted);
  border: 0.5px solid var(--border);
  white-space: nowrap;
}

/* WHATSAPP BUTTON */
.btn-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  padding: 6px 4px;
  border-radius: var(--r-md);
  border: none;
  background: var(--wa);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}
.btn-wa:hover  { background: var(--wa-hover); }
.btn-wa:active { transform: scale(0.97); }
.btn-wa svg { width: 12px; height: 12px; fill: #fff; flex-shrink: 0; }

/* STAR */
.star-badge {
  position: absolute;
  top: 7px; right: 7px;
  font-size: 13px;
  line-height: 1;
  pointer-events: none;
}

/* EMPTY */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 0;
  color: var(--muted);
  font-size: 14px;
}
.empty-state .icon { display: block; font-size: 30px; margin-bottom: 10px; }
