/* 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); }
.yt-btn {
  background: var(--accent); color: #fff; font-weight: 600; font-size: 0.85rem;
  padding: 7px 14px; border-radius: 999px;
}

/* 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 {
  width: 100%; margin-bottom: 14px;
  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); }

/* 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 {
  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); }

/* Small store buttons (Amazon, Flipkart, …) */
.store-row { display: flex; flex-wrap: wrap; gap: 3px; padding: 0 6px 6px; }
.store {
  font-size: 0.6rem; font-weight: 600; line-height: 1;
  padding: 4px 6px; border-radius: 5px; color: #fff;
}
.store:active { opacity: 0.8; }
.store-amazon   { background: #ff9900; color: #111; }
.store-flipkart { background: #2874f0; }
.store-meesho   { background: #f43397; }
.store-myntra   { background: #ff3f6c; }
.store-croma    { background: #12a19a; }
.store-ajio     { background: #2c4152; }

.yt-link { font-size: 0.62rem; color: var(--accent); padding: 0 6px 7px; font-weight: 500; }
.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 { max-width: 320px; }
  .card h3 { font-size: 0.82rem; margin: 8px 8px 5px; }
  .store-row { padding: 0 8px 8px; gap: 4px; }
  .store { font-size: 0.68rem; padding: 5px 7px; }
  .yt-link { font-size: 0.7rem; padding: 0 8px 8px; }
}
@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .store:hover { filter: brightness(1.08); }
  .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"]) {
  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 { outline: none; border-color: var(--accent); }
.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; }
.hint { color: var(--muted); font-size: 0.78rem; margin: -6px 0 12px; }
.store-label { display: inline-block; width: fit-content; font-size: 0.7rem; padding: 3px 8px; border-radius: 5px; }

.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-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; }
