:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #14202e;
  --muted: #5d6b7c;
  --line: #dde3ea;
  --brand: #0f2a44;
  --accent: #1d6fd8;
  --ok: #1a8a4a;
  --wait: #b26a00;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141b;
    --card: #17202b;
    --text: #e6edf5;
    --muted: #93a3b5;
    --line: #273443;
    --brand: #0a1c2e;
    --accent: #5ea2ff;
    --ok: #4cc27f;
    --wait: #f0a83c;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Κεφαλίδα ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--brand); color: #fff;
  padding: 12px 16px 0;
  padding-top: max(12px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { display: block; font-size: 1.05rem; }
.brand span { font-size: .85rem; opacity: .75; }
.tools { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
#q {
  flex: 1 1 260px; min-width: 0;
  font: inherit; padding: 11px 14px; border-radius: 10px; border: 0;
  background: rgba(255,255,255,.12); color: #fff;
}
#q::placeholder { color: rgba(255,255,255,.6); }
.toggle { display: flex; gap: 8px; align-items: center; font-size: .95rem; white-space: nowrap; }
.toggle input { width: 20px; height: 20px; }
.cats {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 0;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cats button {
  flex: none; font: inherit; font-size: .92rem;
  padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25);
  background: transparent; color: #fff; cursor: pointer;
}
.cats button[aria-pressed="true"] { background: #fff; color: var(--brand); border-color: #fff; }

/* ---------- Πλέγμα ---------- */
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
.status { color: var(--muted); text-align: center; margin: 24px 0; }
.status:empty { display: none; }
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  cursor: pointer; text-align: left; font: inherit; color: inherit; padding: 0;
  transition: transform .12s ease;
}
.card:active { transform: scale(.98); }
.card .img { aspect-ratio: 4 / 3; background: var(--line); position: relative; }
.card .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .ribbon {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent); color: #fff; font-size: .78rem; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.card .sub { color: var(--muted); font-size: .9rem; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .foot { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding-top: 6px; }
.price { font-weight: 700; font-size: 1.15rem; }
.price.ask { font-weight: 500; font-size: .9rem; color: var(--muted); }

.pill { font-size: .8rem; padding: 3px 10px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.pill.ok { color: var(--ok); }
.pill.wait { color: var(--wait); }
.tag { font-size: .78rem; color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; border-radius: 6px; }

/* ---------- Καρτέλα προϊόντος ---------- */
.detail {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.detail[hidden] { display: none; }
.sheet {
  position: relative;
  background: var(--card); border-radius: 18px; overflow: hidden;
  width: min(1100px, 100%); max-height: 100%;
  display: grid; grid-template-columns: 1.1fr 1fr;
}
.close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.55); color: #fff; font-size: 1.1rem; cursor: pointer;
}
.gallery { position: relative; background: #000; min-height: 0; }
.slides {
  display: flex; height: 100%; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.slides::-webkit-scrollbar { display: none; }
.slides img {
  flex: none; width: 100%; height: 100%; max-height: calc(100vh - 48px);
  object-fit: contain; scroll-snap-align: center;
}
.slides .noimg { flex: none; width: 100%; display: grid; place-items: center; color: #889; min-height: 260px; }
.dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.4); }
.dots span.on { background: #fff; }

.info { padding: 22px 24px 28px; overflow-y: auto; max-height: calc(100vh - 48px); }
.meta { display: flex; gap: 8px; flex-wrap: wrap; }
.info h2 { margin: 10px 0 8px; font-size: 1.5rem; line-height: 1.25; }
.buy { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.buy .price { font-size: 1.6rem; }
.short { color: var(--muted); margin: 8px 0; }
.desc { margin: 10px 0; }
.desc :first-child { margin-top: 0; }
.desc img { max-width: 100%; height: auto; }
.info h3 { font-size: 1rem; margin: 22px 0 8px; }
.specs { width: 100%; border-collapse: collapse; font-size: .95rem; }
.specs th, .specs td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.specs th { color: var(--muted); font-weight: 500; width: 40%; }
.specs td.full { color: var(--text); }
.sku { color: var(--muted); font-size: .8rem; margin-top: 16px; }

@media (max-width: 820px) {
  .detail { padding: 0; align-items: stretch; }
  .sheet { grid-template-columns: 1fr; border-radius: 0; max-height: none; height: 100%; overflow-y: auto; display: block; }
  .gallery { height: min(60vh, 75vw); }
  .slides img { max-height: none; }
  .info { max-height: none; overflow: visible; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
}
