/* ============================================
   PHARMALINK B2B - CATEGORY & PRODUCT STYLES
   ============================================ */

/* ---- Category Cards (Home page) ---- */
.categories-section .section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: var(--space-md);
}
.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
  background: var(--white);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
  border: 1.5px solid var(--border);
  text-decoration: none;
  color: var(--text-primary);
}
.cat-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  background: var(--primary-light);
}
.cat-icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: var(--space-xs);
  transition: transform var(--transition-spring);
}
.cat-card:hover .cat-icon-wrap { transform: scale(1.1) rotate(-3deg); }
.cat-card span {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
}

/* Category icon backgrounds */
.cat-color-1 { background: #E6F4F0; color: #007B5E; }
.cat-color-2 { background: #FFF1E8; color: #F97316; }
.cat-color-3 { background: #EFF6FF; color: #3B82F6; }
.cat-color-4 { background: #FEF9C3; color: #CA8A04; }
.cat-color-5 { background: #FCE7F3; color: #DB2777; }
.cat-color-6 { background: #F0FDF4; color: #16A34A; }
.cat-color-7 { background: #EDE9FE; color: #7C3AED; }
.cat-color-8 { background: #FEF2F2; color: #DC2626; }

/* ---- Sidebar (Category/Product pages) ---- */
.cat-sidebar {
  position: sticky;
  top: calc(var(--header-height-desktop) + var(--space-lg));
}
.sidebar-widget {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  overflow: hidden;
  margin-bottom: var(--space-md);
}
.sidebar-widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
}
.sidebar-widget-body { padding: var(--space-md) var(--space-lg); }

/* Categories tree in sidebar */
.sidebar-cat-list { display: flex; flex-direction: column; gap: 2px; }
.sidebar-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.sidebar-cat-item:hover, .sidebar-cat-item.active {
  background: var(--primary-light);
  color: var(--primary);
  padding-left: 14px;
}
.sidebar-cat-item .count {
  font-size: 0.75rem;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  color: var(--text-muted);
}
.sidebar-cat-item.active .count {
  background: var(--primary);
  color: var(--white);
}

/* Filter checkboxes */
.filter-group { display: flex; flex-direction: column; gap: 8px; }
.filter-check {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}
.filter-check input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.filter-check label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.filter-check .count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Price range */
.price-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}
input[type=range] {
  width: 100%;
  accent-color: var(--primary);
  height: 4px;
}

/* ---- Product Grid ---- */
.products-area { flex: 1; min-width: 0; }
.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  gap: var(--space-md);
  flex-wrap: wrap;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.sort-select {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--white);
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23007B5E' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.view-toggle {
  display: flex;
  gap: 4px;
}
.view-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}
.view-btn.active, .view-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* Product Card */
.product-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  overflow: hidden;
  transition: all var(--transition-base);
  position: relative;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.product-card-badge {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 2;
}
.product-card-actions {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transform: translateX(10px);
  transition: all var(--transition-base);
}
.product-card:hover .product-card-actions { opacity: 1; transform: translateX(0); }
.product-action-btn {
  width: 32px;
  height: 32px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-xs);
}
.product-action-btn:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }
.product-img-wrap {
  position: relative;
  padding: var(--space-lg);
  background: var(--bg);
  text-align: center;
  overflow: hidden;
}
.product-img-wrap img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  transition: transform var(--transition-base);
}
.product-card:hover .product-img-wrap img { transform: scale(1.06); }
.product-body { padding: var(--space-md); flex: 1; display: flex; flex-direction: column; }
.product-cat { font-size: 0.72rem; font-weight: 600; color: var(--primary); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 5px; }
.product-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-sm);
}
.product-manufacturer { font-size: 0.78rem; color: var(--text-muted); margin-bottom: var(--space-sm); }
.product-rating {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: var(--space-sm);
}
.stars { color: #FBBF24; font-size: 0.75rem; letter-spacing: 1px; }
.rating-count { font-size: 0.75rem; color: var(--text-muted); }
.product-price { margin-top: auto; }
.price-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.price-current {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}
.price-original {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: line-through;
}
.price-discount {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--success);
  background: #DCFCE7;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}
.product-moq { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.product-footer {
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.btn-enquire {
  width: 100%;
  padding: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.btn-enquire:hover { opacity: 0.9; transform: translateY(-1px); }

/* List view */
.products-grid.list-view {
  grid-template-columns: 1fr !important;
}
.products-grid.list-view .product-card {
  flex-direction: row;
}
.products-grid.list-view .product-img-wrap {
  width: 180px;
  flex-shrink: 0;
}
.products-grid.list-view .product-body {
  flex-direction: row;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
}
.products-grid.list-view .product-price { margin-top: 0; }
.products-grid.list-view .product-footer {
  border-top: none;
  border-left: 1px solid var(--border);
  padding: var(--space-md);
  display: flex;
  align-items: center;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-2xl);
}
.page-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.page-btn.dots { border: none; background: none; cursor: default; }

/* ---- Sidebar mobile close bar ---- */
.sidebar-mobile-close-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-md);
  font-weight: 700;
  font-size: .95rem;
}
@media(max-width:768px) {
  .sidebar-mobile-close-bar { display: flex; }
  .page-with-sidebar { grid-template-columns: 1fr !important; }
  .cat-sidebar {
    display: none;
  }
  .cat-sidebar.mobile-visible {
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(300px, 88vw);
    z-index: calc(var(--z-overlay) + 5);
    overflow-y: auto;
    background: var(--white);
    padding: 0;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-xl);
  }
  .cat-sidebar.mobile-visible.open { transform: translateX(0); }
  .mobile-filter-btn { display: flex !important; }
}

/* Sidebar hidden widget body */
.sidebar-widget-body.hidden { display: none; }
