/* ── catalog.css — CJTrader light theme ── */
@import url('theme.css');

/* ─── Layout ─────────────────────────────────────── */
.cat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  max-width: 1320px;
  margin: 2rem auto;
  padding: 0 1rem;
  align-items: start;
}

/* ─── Sidebar ─────────────────────────────────────── */
.cat-sidebar {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E8E0D0;
  padding: 1.25rem;
  position: sticky;
  top: 1rem;
}

.cat-sidebar-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #9CA3AF;
  margin-bottom: .6rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid #F0EBE3;
}

.cat-category-list {
  list-style: none;
  padding: 0;
  margin: 0 0 .5rem;
}

.cat-category-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .45rem .5rem;
  border-radius: 7px;
  color: #1A1A1A;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.cat-category-list li a:hover {
  background: #FAF3E5;
  color: var(--gold);
}

.cat-category-list li a.active {
  background: var(--gold);
  color: #fff;
  font-weight: 700;
}

.cat-count {
  font-size: .75rem;
  background: #F3F4F6;
  border-radius: 20px;
  padding: .1rem .45rem;
  color: #6B7280;
}

.cat-category-list li a.active .cat-count {
  background: rgba(255,255,255,.3);
  color: #fff;
}

/* Filter chips (type: STL / 3DM) */
.cat-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .25rem;
}

.cat-chip {
  display: inline-block;
  padding: .3rem .75rem;
  border-radius: 20px;
  border: 1.5px solid #E5E7EB;
  font-size: .8rem;
  font-weight: 600;
  color: #374151;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}

.cat-chip:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.cat-chip.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

/* Filter list (new, discount, promo…) */
.cat-filter-list {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.cat-filter-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .5rem;
  border-radius: 7px;
  font-size: .875rem;
  color: #374151;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.cat-filter-item:hover {
  background: #FAF3E5;
  color: var(--gold);
}

.cat-filter-item.active {
  background: #FAF3E5;
  color: var(--gold);
  font-weight: 700;
}

/* ─── Main area ───────────────────────────────────── */
.cat-main {
  min-width: 0;
}

/* Topbar: search + results count */
.cat-topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.cat-search-form {
  flex: 1;
  min-width: 220px;
}

.cat-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.cat-search-icon {
  position: absolute;
  left: .75rem;
  font-size: .9rem;
  pointer-events: none;
}

.cat-search-input {
  width: 100%;
  padding: .55rem 5.5rem .55rem 2.25rem;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  font-size: .9rem;
  font-family: 'Montserrat', sans-serif;
  background: #fff;
  color: #1A1A1A;
  transition: border-color .2s;
}

.cat-search-input:focus {
  outline: none;
  border-color: var(--gold);
}

.cat-search-btn {
  position: absolute;
  right: .35rem;
  padding: .35rem .85rem;
  border-radius: 6px;
  border: none;
  background: var(--gold);
  color: #fff;
  font-weight: 600;
  font-size: .82rem;
  cursor: pointer;
  transition: opacity .15s;
}

.cat-search-btn:hover { opacity: .85; }

.cat-results-count {
  font-size: .85rem;
  color: #6B7280;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.cat-reset-btn {
  color: #EF4444;
  text-decoration: none;
  font-weight: 600;
  font-size: .8rem;
}

.cat-reset-btn:hover { text-decoration: underline; }

/* Mobile filter toggle (hidden on desktop) */
.cat-filter-toggle {
  display: none;
  align-items: center;
  gap: .4rem;
  padding: .5rem .9rem;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
  font-size: .875rem;
  cursor: pointer;
  color: #374151;
}

/* ─── Product grid ────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

/* ─── Card ────────────────────────────────────────── */
.cat-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E8E0D0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}

.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.09);
}

.cat-card-img-wrap {
  position: relative;
  display: block;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #F3F4F6;
}

.cat-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}

.cat-card:hover .cat-card-img {
  transform: scale(1.04);
}

.cat-card-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 2rem;
  font-weight: 800;
  color: #D1D5DB;
  font-family: 'Montserrat', sans-serif;
}

/* Badges */
.cat-badge {
  position: absolute;
  top: .5rem;
  padding: .25rem .55rem;
  border-radius: 5px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #fff;
  z-index: 2;
}

.cat-badge-new  { left: .5rem;  background: #EF4444; }
.cat-badge-sale { right: .5rem; background: #10B981; }
.cat-badge-promo{ left: .5rem;  background: #3B82F6; top: 2rem; }

/* Format chips on card image */
.cat-format-chips {
  position: absolute;
  bottom: .5rem;
  left: .5rem;
  display: flex;
  gap: .3rem;
  z-index: 2;
}

.cat-fmt {
  display: inline-block;
  padding: .15rem .4rem;
  background: rgba(0,0,0,.6);
  color: #fff;
  border-radius: 4px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
}

/* Card body */
.cat-card-body {
  padding: .9rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: .35rem;
}

.cat-card-name {
  font-size: .9rem;
  font-weight: 700;
  color: #1A1A1A;
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cat-card-views {
  font-size: .75rem;
  color: #9CA3AF;
}

.cat-card-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem;
  margin-top: auto;
}

.cat-price-old {
  text-decoration: line-through;
  color: #9CA3AF;
  font-size: .8rem;
}

.cat-price-now {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1A1A1A;
  font-family: 'Montserrat', sans-serif;
}

.cat-price-usd {
  font-size: .8rem;
  color: #9CA3AF;
  font-weight: 500;
}

.cat-buy-btn {
  display: block;
  margin-top: .6rem;
  width: 100%;
  padding: .55rem;
  background: var(--gold);
  color: #fff;
  border-radius: 8px;
  text-align: center;
  font-weight: 700;
  font-size: .85rem;
  text-decoration: none;
  transition: opacity .15s;
}

.cat-buy-btn:hover {
  opacity: .88;
  color: #fff;
}

/* Empty state */
.cat-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: #9CA3AF;
}

.cat-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ─── Pagination ─────────────────────────────────── */
.cat-pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: 2rem;
  padding: 1rem 0 2rem;
}

.cat-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 .6rem;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  color: #374151;
  text-decoration: none;
  background: #fff;
  transition: border-color .15s, background .15s, color .15s;
}

.cat-page-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.cat-page-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.cat-page-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 38px;
  color: #9CA3AF;
  font-size: 1rem;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 900px) {
  .cat-layout {
    grid-template-columns: 1fr;
  }

  .cat-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    z-index: 9999;
    border-radius: 0;
    border-right: 1px solid #E8E0D0;
    box-shadow: 4px 0 20px rgba(0,0,0,.12);
  }

  .cat-sidebar.open {
    display: block;
  }

  .cat-filter-toggle {
    display: flex;
  }
}

@media (max-width: 576px) {
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
  }

  .cat-card-body {
    padding: .65rem;
  }

  .cat-price-now {
    font-size: 1rem;
  }

  .cat-buy-btn {
    font-size: .78rem;
    padding: .45rem;
  }
}
