/* ================================================================
   Blinkit-Style Shop / Category Listing — Shared Styles
   Used by: products/index.php  &  categories/listing.php
   ================================================================ */

/* ── Page wrappers ─────────────────────────────────────────────── */
body { background: #f8fafc; }

.shop-page-wrap,
.cat-page-wrap {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
  background: #f8fafc;
}

/* ── LEFT SIDEBAR ──────────────────────────────────────────────── */
.subcat-sidebar {
  width: 88px;
  flex-shrink: 0;
  background: #fff;
  height: calc(100vh - var(--header-h, 64px));
  position: sticky;
  top: var(--header-h, 64px);
  overflow-y: auto;
  border-right: 1px solid #f1f5f9;
  padding: 8px 0 100px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.subcat-sidebar::-webkit-scrollbar { display: none; }

.subcat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  text-decoration: none;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s;
}
.subcat-item:hover { background: #f0fdf4; }
.subcat-item.active {
  background: #f0fdf4;
  border-left-color: var(--primary);
}

/* Thumbnail image box */
.subcat-img-wrap,
.subcat-thumb {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.subcat-item.active .subcat-img-wrap,
.subcat-item.active .subcat-thumb {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .12);
}
.subcat-img-wrap img,
.subcat-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* "All" button — subtle light green */
.subcat-all .subcat-img-wrap,
.subcat-thumb-all {
  background: #f0fdf4;
  border-color: #dcfce7;
}
.subcat-all.active .subcat-img-wrap,
.subcat-item.active .subcat-thumb-all {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(34, 197, 94, .15);
}
.subcat-thumb-all svg { fill: var(--primary); }

/* Emoji fallback */
.subcat-icon-placeholder,
.subcat-emoji { font-size: 1.4rem; line-height: 1; }

/* Label below icon */
.subcat-label {
  font-size: 0.58rem;
  font-weight: 600;
  color: #64748b;
  text-align: center;
  line-height: 1.25;
  word-break: break-word;
  padding: 0 2px;
}
.subcat-item.active .subcat-label {
  color: var(--primary);
  font-weight: 700;
}

/* ── RIGHT CONTENT AREA ────────────────────────────────────────── */
.shop-content,
.cat-content {
  flex: 1;
  min-width: 0;
}

/* Top bar / Header */
.shop-header,
.cat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 8px;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
}
.shop-header-title,
.cat-topbar-title {
  font-size: 1rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
  line-height: 1.2;
}
.shop-header-count,
.cat-topbar-count {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
  font-weight: 500;
}

/* Sort dropdown */
.shop-sort-btn,
.sort-select {
  padding: 7px 28px 7px 12px;
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-color: white;
}
.shop-sort-btn:focus,
.sort-select:focus { outline: none; border-color: var(--primary); }

/* ── Products Grid ─────────────────────────────────────────────── */
.shop-grid-wrap,
.cat-grid-wrap { padding: 8px 10px 20px; }

.blinkit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 440px)  { .blinkit-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px)  {
  .blinkit-grid { grid-template-columns: repeat(4, 1fr); }
  .subcat-sidebar { width: 96px; }
}
@media (min-width: 1024px) { .blinkit-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1280px) { .blinkit-grid { grid-template-columns: repeat(6, 1fr); } }

/* ── Horizontal filter chips (no-subcategory fallback) ─────────── */
.filter-bar-sticky {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #f8fafc;
  border-bottom: 1px solid #f0f0f0;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
  background: white;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  display: inline-flex;
  align-items: center;
}
.filter-chip:active { transform: scale(0.96); }
.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 3px 10px rgba(34, 197, 94, 0.25);
}

/* ── Standard (no-subcategory) full-width layout ───────────────── */
.cat-page-standard { max-width: 1200px; margin: 0 auto; padding: 16px 16px 80px; }
