/* ═══════════════════════════════════════════════
   Products — Category & Detail Pages
   ═══════════════════════════════════════════════ */

/* ── Breadcrumb ────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: #888;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.bc-sep { color: #ccc; }
.bc-current { color: #333; font-weight: 600; }

/* ── Category Layout ───────────────────────────── */
.cat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Sidebar */
.cat-sidebar { position: sticky; top: 90px; }
.sidebar-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.sidebar-title {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  padding: .9rem 1rem;
  font-size: .92rem;
  letter-spacing: .3px;
}
.sidebar-cats { list-style: none; padding: .4rem 0; margin: 0; }
.sidebar-cats > li { border-bottom: 1px solid #f5f5f5; }
.sidebar-cats > li:last-child { border-bottom: none; }

.sidebar-parent {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem 1rem;
  font-size: .9rem;
  color: #444;
  font-weight: 500;
  transition: color .15s, background .15s;
}
.sidebar-parent:hover { color: var(--primary); background: var(--primary-light); }
.sidebar-parent.sidebar-active { color: var(--primary); font-weight: 700; background: var(--primary-light); }
.sidebar-arrow { font-size: 1rem; color: #bbb; }

.sidebar-sub {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.sidebar-sub.open { max-height: 500px; }
.sidebar-sub li a {
  display: block;
  padding: .45rem 1rem .45rem 1.8rem;
  font-size: .85rem;
  color: #666;
  position: relative;
  transition: color .15s, padding-right .15s;
}
.sidebar-sub li a::before { content: '›'; position: absolute; right: 1rem; color: var(--accent); }
.sidebar-sub li a:hover { color: var(--primary); padding-right: 1.2rem; }
.sidebar-sub li a.sidebar-active { color: var(--primary); font-weight: 700; }

/* ── Category Header + Sort ────────────────────── */
.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}
.cat-title-wrap { display: flex; align-items: baseline; gap: .8rem; }
.cat-title { font-size: 1.4rem; font-weight: 800; color: var(--primary); margin: 0; }
.cat-count {
  font-size: .82rem;
  color: #888;
  background: #f0f0f0;
  padding: .2rem .7rem;
  border-radius: 20px;
}
.sort-bar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.sort-label { font-size: .82rem; color: #999; white-space: nowrap; }
.sort-btn {
  font-size: .82rem;
  padding: .3rem .75rem;
  border-radius: 20px;
  color: #666;
  border: 1px solid #ddd;
  background: #fff;
  transition: all .15s;
  white-space: nowrap;
}
.sort-btn:hover { border-color: var(--primary); color: var(--primary); }
.sort-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Product Grid (Category Page) ──────────────── */
.pcat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 1rem;
}

.pcat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s, box-shadow .2s;
  color: inherit;
}
.pcat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

/* Image */
.pcat-img-wrap {
  position: relative;
  background: #f8f8f8;
  aspect-ratio: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pcat-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.pcat-card:hover .pcat-img-wrap img { transform: scale(1.05); }
.pcat-placeholder { font-size: 3.5rem; opacity: .3; }

.pcat-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--sale);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 6px;
  z-index: 1;
}
.pcat-wish {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,.9);
  border: none;
  border-radius: 50%;
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  backdrop-filter: blur(4px);
  transition: transform .15s;
}
.pcat-wish:hover { transform: scale(1.15); }

/* Body */
.pcat-body { padding: .75rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.pcat-cat { font-size: .72rem; color: #aaa; }
.pcat-name {
  font-size: .88rem;
  font-weight: 600;
  color: #333;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.pcat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .4rem;
  gap: .3rem;
}
.pcat-price-wrap { display: flex; flex-direction: column; }
.pcat-old {
  font-size: .75rem;
  color: #bbb;
  text-decoration: line-through;
  line-height: 1.2;
}
.pcat-final {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}
.pcat-final small { font-size: .7rem; font-weight: 400; color: #888; }
.pcat-stock {
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 20px;
  white-space: nowrap;
}
.pcat-stock.in  { background: #eafaf1; color: #27AE60; }
.pcat-stock.out { background: #fef0ef; color: var(--sale); }

/* Empty */
.empty-state { text-align: center; padding: 4rem 2rem; color: #bbb; }
.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state p { font-size: 1rem; }

/* ═══════════════════════════════════════════════
   Product Detail Page
   ═══════════════════════════════════════════════ */
.pd-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

/* Gallery */
.pd-main-img {
  border-radius: 14px;
  overflow: hidden;
  background: #f8f8f8;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}
.pd-main-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.pd-main-img:hover img { transform: scale(1.04); }
.pd-img-placeholder { font-size: 5rem; opacity: .25; }

.pd-thumbs { display: flex; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; }
.pd-thumb {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .2s;
  background: #f0f0f0;
}
.pd-thumb.active, .pd-thumb:hover { border-color: var(--primary); }

/* Info */
.pd-category { font-size: .8rem; color: #aaa; margin-bottom: .3rem; }
.pd-name { font-size: 1.5rem; font-weight: 800; color: #222; margin: 0 0 1.2rem; line-height: 1.5; }
.pd-price-box {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}
.pd-discount-badge {
  display: inline-block;
  background: var(--sale);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 6px;
  margin-bottom: .4rem;
}
.pd-price-original { color: #aaa; text-decoration: line-through; font-size: .9rem; margin-bottom: .2rem; }
.pd-price-final { color: var(--primary); font-size: 1.6rem; font-weight: 800; }
.pd-stock { font-size: .9rem; font-weight: 600; margin-bottom: 1.2rem; }
.pd-stock.in-stock { color: #27AE60; }
.pd-stock.no-stock { color: var(--sale); }
.pd-desc { margin-bottom: 1.5rem; }
.pd-desc-title { font-weight: 700; color: #333; margin-bottom: .5rem; }
.pd-desc-body { font-size: .92rem; color: #555; line-height: 2; }
.pd-actions { display: flex; gap: .8rem; align-items: center; }
.btn-primary-lg {
  flex: 1;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: .9rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, transform .1s;
}
.btn-primary-lg:hover { background: var(--primary-dark); }
.btn-primary-lg:active { transform: scale(.97); }
.btn-primary-lg:disabled { background: #ccc; cursor: not-allowed; }
.btn-wishlist {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 12px;
  width: 52px;
  height: 52px;
  font-size: 1.3rem;
  cursor: pointer;
  transition: border-color .2s;
}
.btn-wishlist:hover { border-color: var(--accent); }

/* Related */
.related-section { margin-top: 2rem; }
.related-section .section-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.related-section .section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--accent);
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════
   All Categories Page
   ═══════════════════════════════════════════════ */
.allcats-header { margin-bottom: 2rem; text-align: center; }
.allcats-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: .4rem;
}
.allcats-sub { color: #888; font-size: .95rem; }

.allcats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
}

.allcat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.allcat-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  transform: translateY(-3px);
}

.allcat-parent {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem 1rem;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  transition: background .15s;
}
.allcat-parent:hover { background: var(--primary-light); }

.allcat-icon {
  width: 72px;
  height: 72px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .8rem;
  overflow: hidden;
}
.allcat-icon img { width: 100%; height: 100%; object-fit: cover; }
.allcat-emoji { font-size: 2rem; }
.allcat-name { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: .2rem; }
.allcat-count { font-size: .78rem; color: #aaa; }

.allcat-subs {
  list-style: none;
  padding: .6rem .8rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.allcat-subs li a {
  display: block;
  padding: .35rem .5rem;
  font-size: .83rem;
  color: #666;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.allcat-subs li a:hover {
  background: var(--primary-light);
  color: var(--primary);
  padding-right: .8rem;
}
.allcat-subs li a::before { content: '› '; color: var(--accent); }

/* ── Filter Card ────────────────────────────────── */
.filter-card {
  margin-top: 1rem;
  background: #fff;
  border: 1px solid #dde5f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(61,90,128,.08);
}
.filter-card-head {
  background: var(--primary);
  padding: .8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filter-card-title {
  color: #fff;
  font-size: .88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.filter-active-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #E07A5F;
  border-radius: 50%;
  margin-right: .1rem;
  box-shadow: 0 0 0 2px rgba(224,122,95,.35);
  animation: fdot 1.6s ease-in-out infinite;
}
@keyframes fdot {
  0%,100% { box-shadow: 0 0 0 2px rgba(224,122,95,.35); }
  50%      { box-shadow: 0 0 0 4px rgba(224,122,95,.15); }
}
.filter-reset-link {
  font-size: .72rem;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  padding: .18rem .55rem;
  transition: all .15s;
}
.filter-reset-link:hover { background: rgba(255,255,255,.15); color: #fff; }

.filter-card-body { padding: .95rem 1rem; }

.filter-section {
  padding-bottom: .85rem;
  margin-bottom: .85rem;
  border-bottom: 1px solid #f0f4f8;
}
.filter-section:last-of-type {
  border: none;
  margin: 0;
  padding: 0;
}
.filter-sec-title {
  font-size: .8rem;
  font-weight: 700;
  color: #4a5568;
  margin-bottom: .65rem;
}

/* Price inputs — stacked */
.price-stack { display: flex; flex-direction: column; gap: .5rem; }
.price-stack-row { display: flex; flex-direction: column; gap: .2rem; }
.price-stack-row span {
  font-size: .7rem;
  color: #9aabbc;
  font-weight: 600;
}
.price-stack-row input {
  width: 100%;
  padding: .55rem .75rem;
  border: 1.5px solid #dde5ee;
  border-radius: 9px;
  font-size: .88rem;
  font-family: inherit;
  direction: ltr;
  text-align: right;
  background: #f8fafc;
  color: #333;
  transition: border-color .18s, box-shadow .18s, background .18s;
  box-sizing: border-box;
}
.price-stack-row input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(61,90,128,.1);
}

/* Custom checkboxes */
.filter-check-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem 0;
  cursor: pointer;
  user-select: none;
  font-size: .86rem;
  color: #4a5568;
  font-weight: 500;
}
.filter-check-item + .filter-check-item { border-top: 1px solid #f5f7fa; }
.filter-check-item input[type=checkbox] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #c9d5e0;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: all .18s;
}
.filter-check-item input:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.filter-check-item input:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  padding-top: 1px;
}

/* Apply + clear */
.filter-apply-btn {
  width: 100%;
  padding: .72rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: .2px;
  transition: background .18s, transform .18s, box-shadow .18s;
}
.filter-apply-btn:hover {
  background: #2d4560;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(61,90,128,.28);
}
.filter-clear-btn {
  display: block;
  text-align: center;
  margin-top: .55rem;
  font-size: .78rem;
  color: var(--accent);
  text-decoration: none;
}
.filter-clear-btn:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 900px) {
  .cat-layout { grid-template-columns: 1fr; }
  .cat-sidebar { position: static; }
  .pd-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .pcat-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-header { flex-direction: column; align-items: flex-start; }
}
