:root {
  --fasto: #ff3158;
  --ink: #0b1320;
  --muted: #6b7280;
  --line: #eef1f5;
  --soft: #fff5f7;
  --green: #16a34a;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--ink);
  background: #fff
}

.cat-detail {
  padding: 28px 0
}

.cat-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 260px 1fr;
  /* ~20% / 80% feel */
  gap: 24px;
}

/* Sidebar */
.cat-sidebar {
  background: #fff;
}

.cat-sidebar-inner {
  position: sticky;
  top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.cat-side-head {
  padding: 6px 10px 10px
}

.cat-side-title {
  font-weight: 700;
  color: var(--fasto);
  text-align: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.cat-subnav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px
}

.cat-subnav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
}

.cat-subnav-item:hover {
  background: #fafafa;
  border-color: var(--line)
}

.cat-subnav-item.is-active {
  background: #fff0f3;
  border-color: #ffd6df
}

.cat-subnav-item .icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center
}

.cat-subnav-item .icon img {
  width: 24px;
  height: 24px;
  object-fit: contain
}

.cat-subnav-item .name {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.badge-green {
  background: #e8f6ec;
  color: #136c31;
  border-radius: 999px;
  font-weight: 700;
  padding: 2px 8px;
  font-size: .72rem;
}

.cat-empty {
  padding: 16px;
  color: var(--muted)
}

.cat-empty.small {
  padding: 8px;
  text-align: center
}

/* Main */
.cat-main {}

.cat-main-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.cat-main-title {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: .4px
}

.cat-main-meta {
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: .9rem
}

.see-all {
  color: var(--fasto);
  text-decoration: none;
  font-weight: 600
}

/* Make product grid cells equal height */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  /* same width */
  gap: 20px;
  align-items: stretch;
}

.product-card {
  text-decoration: none;
  color: inherit;
  display: flex;
}

.product-card__inner {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(16, 24, 40, .05);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* fill the grid cell */
  min-width: 220px;
  /* fixed min width */
  max-width: 220px;
  /* fixed max width */
  min-height: 320px;
  /* fixed min height */
  max-height: 320px;
  /* fixed max height */
  margin: auto;
  /* center inside cell if narrower */
}

.product-thumb {
  height: 192px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-meta-top {
  display: flex;
  gap: 8px;
  margin: 10px 0 6px
}

.pill {
  background: #fff0f3;
  color: #b4234d;
  border: 1px solid #ffd6df;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .72rem;
  font-weight: 600;
}

.pill.light {
  background: #f8fafc;
  color: #0b1320;
  border-color: #edf2f7
}

.product-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px
}

/* Clip product name to one line */
.product-name {
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.rating-row {
  display: flex;
  gap: 6px;
  align-items: center;
  color: #9aa1ac;
  font-size: .86rem
}

.stars {
  color: #f59e0b
}

.votes {
  color: #9aa1ac
}

.price-row {
  display: flex;
  gap: 8px;
  align-items: center
}

.price {
  font-weight: 800
}

.mrp {
  color: #9aa1ac;
  text-decoration: line-through
}

.discount-pill {
  margin-left: auto;
  background: #d1fae5;
  /* light green background */
  color: #065f46;
  border-radius: 8px;
  padding: 2px 6px;
  font-size: .72rem;
  font-weight: 700
}

.btn-add {
  margin-top: 6px;
  border: 2px solid #ff9bb0;
  background: #fff;
  color: #d21f49;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer
}

.btn-add:hover {
  background: #fff7fa;
  cursor: pointer;

}

.stock {
  margin-top: 4px;
  font-size: .75rem;
  font-weight: 700
}

.stock.in {
  color: #1b5e20
}

.stock.out {
  color: #991b1b
}

/* Pagination */
.cat-pagination {
  margin: 24px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.page-link {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink)
}

.page-link.is-disabled {
  opacity: .5;
  pointer-events: none
}

.page-status {
  color: var(--muted)
}

/* Responsive */
@media (max-width: 1100px) {
  .cat-shell {
    grid-template-columns: 1fr
  }

  .cat-sidebar-inner {
    position: static
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .product-card__inner {
    width: 90%;
    /* take up more space */
    max-width: 400px;
    /* limit so it doesn't look too stretched */
  }
}

@media (max-width: 520px) {
  .product-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    /* center the card */
  }

  .product-card {
    width: 90%;
    /* take up more space */
    max-width: 420px;
    /* limit so it doesn't look too stretched */
  }

  .product-card__inner {
    width: 90%;
    /* take up more space */
    max-width: 500px;
    /* limit so it doesn't look too stretched */
  }
}


.download-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 19, 32, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.download-backdrop.is-open {
  display: flex;
}

.download-modal {
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.18);
}

.download-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.download-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: bold;
}

.download-close {
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}

.store-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.store-btn img {
  height: 50px;
  width: auto;
  display: block;
}

.browse-section {
  background: var(--soft);
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.browse-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* center the whole thing */
  gap: 10px;
}

.cat-prev-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--fasto);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.cat-prev-btn:hover {
  background: rgba(255, 49, 88, 0.08);
}

.cat-browse-text {
  font-size: 1.5rem;
  color: var(--ink);
}

.cat-browse-text strong {
  color: var(--fasto);
}

/* Backdrop + container */
.pqv-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 19, 32, .45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.pqv-backdrop.is-open {
  display: flex;
}

/* Narrower width + scroll if very tall */
.pqv-modal {
  width: min(760px, 92vw);
  /* was ~960px */
  max-height: 88vh;
  /* keep within viewport height */
  overflow: auto;
  /* scroll inside if content overflows */
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .18);
  position: relative;
  padding: 16px 18px;
}

/* Default desktop layout */
.pqv-grid {
  display: grid;
  grid-template-columns: 0.6fr 1.4fr;
  gap: 18px;
  align-items: center;
}

/* Let grid children shrink on narrow screens (prevents overflow) */
.cat-sidebar,
.cat-main {
  min-width: 0;
}

/* Mobile: stack image on top */
@media (max-width: 450px) {
  .pqv-grid {
    grid-template-columns: 1fr;
    /* Stack */
    gap: 12px;
  }

  .pqv-left {
    order: -1;
    /* Image first */
    text-align: center;
  }

  .pqv-image-wrap img {
    max-width: 100%;
    max-height: 30vh !important;
    object-fit: contain;
  }

  .pqv-actions {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping on small widths */
    gap: 10px;
    justify-content: center;
  }

  .pqv-actions a {
    flex: 1 1 auto;
    /* Buttons scale to available space */
    min-width: 120px;
  }

  /* Reduce page padding so the sidebar card isn't pushed in */
  .cat-shell {
    padding: 0 8px;
  }

  /* Sidebar box: use full width and smaller padding */
  .cat-sidebar-inner {
    margin: 0;
    /* no unexpected horizontal offset */
    width: 100%;
    padding: 10px;
    /* was 12px */
    border-radius: 10px;
  }

  /* Subcategory row spacing + consistent left alignment */
  .cat-subnav {
    gap: 8px;
  }

  .cat-subnav-item {
    padding: 8px 10px;
    /* slightly tighter */
    gap: 8px;
  }

  .cat-subnav-item .icon {
    width: 24px;
    height: 24px;
  }

  .cat-subnav-item .icon img {
    width: 22px;
    height: 22px;
  }

  /* Ensure the green count badge doesn't force extra right spacing */
  .badge-green {
    padding: 2px 7px;
    font-size: .7rem;
  }

  /* Make product cards take full width */
  .product-card {
    flex: 1 1 100%;
    /* allow it to wrap and fill */
    max-width: 100%;
    min-width: 0;
    /* allow shrinking */
    box-sizing: border-box;
  }

  /* Ensure image container doesn't overflow */
  .product-thumb {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }

  /* Image should scale down on small screens */
  .product-thumb img {
    max-width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .product-grid {
    gap: 16px;
  }
}

/* ===== Phones ≤ 450px ===== */
@media (max-width: 450px) {

  /* Image on top; single column */
  .pqv-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
  }

  .pqv-left {
    order: -1;
  }

  /* move image above text */
  .pqv-image-wrap {
    max-width: 100%;
    width: 100%;
    max-height: 40vh;
    /* visible but not huge */
    min-height: 180px;
    margin: 0 auto;
  }

  /* Buttons: 2-up then stack if tighter */
  .pqv-actions .store-btn {
    flex: 1 1 calc(50% - 12px);
    min-width: 0;
  }

  .pqv-actions .store-btn img {
    max-width: 100%;
  }

  /* Tighter title so it doesn't push width */
  .pqv-title {
    font-size: 1.15rem;
    line-height: 1.25;
  }
}


/* Image box defaults */
.pqv-left {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pqv-image-wrap {
  max-width: 220px;
  /* desktop thumbnail size */
  max-height: 280px;
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pqv-image-wrap img {
  max-width: 100%;
  object-fit: contain;
  display: block;
  max-height: 40vh;
}

/* Right side */
.pqv-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pqv-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
}

.pqv-desc {
  margin: 2px 0 6px;
  color: var(--muted);
  line-height: 1.45;
  font-size: .95rem;
}

.pqv-meta-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pqv-price-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pqv-price {
  font-weight: 800;
  font-size: 1.1rem;
}

.pqv-mrp {
  color: #9aa1ac;
  text-decoration: line-through;
}

.pqv-disc {
  background: #d1fae5;
  color: #065f46;
  border-radius: 8px;
  padding: 2px 6px;
  font-size: .72rem;
  font-weight: 700;
}

/* Close */
.pqv-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}

.pqv-actions {
  flex-shrink: 0;
  /* don't shrink */
  position: sticky;
  /* stick to bottom of modal */
  bottom: 0;
  background: #fff;
  /* so it's not transparent */
  padding: 12px 0;
  display: flex;
  flex-direction: row;
  gap: 16px;
}