/* Mobile-first: base styles are for phones, wider screens are added below */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #e62117;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Poppins", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-size: 1.3rem; font-weight: 700; }
.logo span { color: var(--accent); }
.social { display: flex; gap: 6px; }
.yt-btn, .ig-btn {
  display: inline-flex; align-items: center; gap: 5px;
  color: #fff; font-weight: 600; font-size: 0.8rem; white-space: nowrap;
  padding: 7px 12px; border-radius: 999px;
}
.yt-btn { background: var(--accent); }
.ig-btn { background: linear-gradient(45deg, #f9a825, #e1306c 45%, #833ab4); }
@media (max-width: 359px) { /* very small phones */
  .logo { font-size: 1.1rem; }
  .yt-btn, .ig-btn { padding: 6px 9px; font-size: 0.72rem; gap: 4px; }
}

/* Intro + search */
.intro { padding: 20px 0 12px; }
.intro h1 { font-size: 1.35rem; line-height: 1.25; }
.intro p { color: var(--muted); font-size: 0.9rem; }
.search-wrap { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
#search {
  flex: 1; min-width: 0;
  font: inherit; font-size: 16px; /* 16px stops iPhone zoom-in */
  padding: 11px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
}
#search:focus { outline: none; border-color: var(--accent); }
.clear-search {
  flex: none; font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  padding: 10px 12px; border-radius: 12px; border: none; background: var(--text); color: #fff;
}

/* Category chips: one row, swipe sideways on phones, stays visible under the header while scrolling */
.filters {
  position: sticky; top: 57px; z-index: 9; /* 57px = header height + its border */
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: -6px -16px 8px; padding: 8px 16px; /* full-width background on phones */
  background: var(--bg);
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font: inherit; font-size: 0.85rem; cursor: pointer;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
}
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }

/* Product grid: 3 per row on phones, 4 on tablets, 6 on computers */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-bottom: 24px; }
.card {
  position: relative;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column;
}
.card-link { display: block; flex: 1; }
.card-media { position: relative; aspect-ratio: 16 / 9; background: #fff; overflow: hidden; }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card-media img.thumb { object-fit: cover; }   /* YouTube thumbnail fills the box */
.card-media img.photo { object-fit: contain; } /* product photo is shown whole */
.placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: #eef0f3; font-size: 1.5rem; font-weight: 700; color: #b8bec9;
}
.card h3 {
  font-size: 0.72rem; font-weight: 600; line-height: 1.3; margin: 6px 6px 4px;
  /* max 2 lines, then "…" */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-link:active h3 { color: var(--accent); }

/* Share button: small circle on the image's top-right corner */
.share-btn {
  position: absolute; top: 4px; right: 4px; z-index: 1;
  width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.92); color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.share-btn:active { transform: scale(0.92); }


/* Bottom line of a card: product number + review link */
.meta { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 0 6px 7px; }
.pno { font-size: 0.62rem; color: var(--muted); font-weight: 500; }
.yt-link { font-size: 0.62rem; color: var(--accent); font-weight: 600; white-space: nowrap; }
.yt-link:hover { text-decoration: underline; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; grid-column: 1 / -1; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 20px 0 28px; color: var(--muted); font-size: 0.78rem; }
.site-footer p + p { margin-top: 8px; }
.site-footer a { color: var(--accent); }

/* Tablets and up */
@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .intro h1 { font-size: 1.6rem; }
  .search-wrap { max-width: 420px; }
  .card h3 { font-size: 0.82rem; margin: 8px 8px 5px; }
  .share-btn { width: 30px; height: 30px; top: 6px; right: 6px; }
  .meta { padding: 0 8px 8px; }
  .pno, .yt-link { font-size: 0.7rem; }
}
@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .share-btn:hover { background: #fff; color: var(--accent); }
  .card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); }
  .card-link:hover h3 { color: var(--accent); }
}

/* ---------- Admin page ---------- */
.admin-main { max-width: 640px; padding-top: 16px; }
.admin-tag { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.header-actions { display: flex; gap: 8px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel h2 { font-size: 1.1rem; margin-bottom: 12px; }
.login { max-width: 380px; margin: 40px auto; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field > label { font-size: 0.82rem; font-weight: 500; }
.field small { color: var(--muted); font-size: 0.75rem; }
.field input:not([type="checkbox"]):not([type="file"]), .field select, .inline-form input {
  font: inherit; font-size: 16px; width: 100%;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .inline-form input:focus { outline: none; border-color: var(--accent); }
.field small a { color: var(--accent); }
.hint { color: var(--muted); font-size: 0.78rem; margin: -6px 0 12px; }
.inline-form { display: flex; gap: 8px; margin-bottom: 12px; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form .btn { flex: none; }
.field input[type="file"] { font-size: 0.85rem; max-width: 100%; }
.image-picker { display: flex; gap: 12px; align-items: center; }
.image-picker img { width: 96px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); flex: none; }
.image-picker > div { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.check input { width: 18px; height: 18px; flex: none; }
.error { color: #dc2626; font-size: 0.85rem; margin-bottom: 10px; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: none;
  padding: 11px 16px; border-radius: 10px; font-size: 0.92rem;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-red { background: var(--accent); color: #fff; }
.btn-light { background: #eef0f3; color: var(--text); }
.btn-dark { background: var(--text); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; }

.admin-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.admin-item { display: flex; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 12px; }
.admin-item img, .admin-item .thumb {
  width: 64px; height: 36px; object-fit: cover; border-radius: 6px; background: #e9ebef; flex: none;
}
.admin-item .info { flex: 1; min-width: 0; }
.admin-item .info b { display: block; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-item .info span { font-size: 0.72rem; color: var(--muted); }
.admin-item .btn { padding: 7px 9px; font-size: 0.8rem; flex: none; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60; max-width: 480px; margin: 0 auto;
  background: #16a34a; color: #fff; padding: 12px 16px; border-radius: 12px;
  font-size: 0.9rem; font-weight: 500; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
.toast.error { background: #dc2626; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 0.85em; }
