:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --primary: #38bdf8;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --accent: #22c55e;
  --strike: #ef4444;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  padding: 2rem 1rem;
  min-height: 100vh;
}
.container { max-width: 1280px; margin: 0 auto; }
header { margin-bottom: 2rem; }
h1 { font-size: 1.875rem; font-weight: 700; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-muted); font-size: 0.95rem; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--surface);
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  margin-bottom: 2rem;
  align-items: center;
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 220px;
}
.control-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
input[type="text"], select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
input[type="text"]:focus, select:focus {
  border-color: var(--primary);
}

.stats-bar {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}
.img-wrapper {
  width: 100%;
  height: 220px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
}
.img-wrapper::after {
  content: '🔍 Click to expand';
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 0.7rem;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.img-wrapper:hover::after {
  opacity: 1;
}
.img-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}
.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.75rem;
}
.sku-badge {
  font-size: 0.7rem;
  background: var(--surface-hover);
  color: var(--primary);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  align-self: flex-start;
  font-family: monospace;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 3.5rem;
  overflow: hidden;
}
.tag {
  font-size: 0.7rem;
  background: rgba(56, 189, 248, 0.1);
  color: var(--primary);
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
  white-space: nowrap;
}
.pricing {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}
.listprice {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: line-through;
}
.card-footer {
  padding: 0 1.25rem 1.25rem;
}
.btn-link {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--primary);
  color: #0f172a;
  text-decoration: none;
  font-weight: 600;
  padding: 0.6rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: opacity 0.2s;
}
.btn-link:hover { opacity: 0.9; }
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

/* Modal / Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  padding: 1.5rem;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}
.modal-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  background: #ffffff;
  border-radius: 0.5rem;
}
.modal-caption {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  max-width: 600px;
}
.modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  background: var(--strike);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.modal-close:hover { opacity: 0.9; }
