/* ========================================
   Products Catalog Page Stylesheet V3
   GUANGZHOU WELL FILTER TECHNOLOGY CO., LTD.
   ======================================== */

/* --- Page Banner --- */
.page-banner {
  background: url('../images/products-banner.jpg') center center / cover no-repeat;
  background-attachment: fixed;
  color: var(--white);
  text-align: center;
  padding: 120px 20px;
  position: relative;
  overflow: hidden;
}
.page-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,42,74,0.75) 0%, rgba(10,42,74,0.55) 100%);
  z-index: 0;
}
.page-banner::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(to top, rgba(10,42,74,0.5), transparent);
  z-index: 0;
}
.page-banner .container { position: relative; z-index: 1; }
.page-banner h1 {
  font-size: 2.6rem; font-weight: 700; margin-bottom: 12px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4); letter-spacing: 1px;
}
.page-banner p {
  font-size: 1.1rem; opacity: 0.9;
  font-family: var(--font-en); text-shadow: 0 1px 8px rgba(0,0,0,0.3);
}

/* ========================================
   Layout
   ======================================== */
.products-layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 60px;
  gap: 36px;
}

/* ========================================
   Sidebar Accordion
   ======================================== */
.products-sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
  align-self: flex-start;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  background: var(--white);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: -40px;
  z-index: 10;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
}
.sidebar-collapse {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--mid-gray);
  background: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--mid-gray);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s;
}
.sidebar-collapse:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Accordion */
.sidebar-accordion {
  list-style: none;
  padding: 4px 0;
}

.sa-item {
  border-bottom: 1px solid #f0f1f3;
}
.sa-item:last-child { border-bottom: none; }

/* Accordion Header */
.sa-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.sa-header:hover { background: #f5f7fa; }

/* Radio dot */
.sa-dot {
  font-size: 0.75rem;
  color: var(--mid-gray);
  flex-shrink: 0;
  transition: all 0.2s;
}
.sa-item.open > .sa-header .sa-dot,
.sa-item.active-scroll > .sa-header .sa-dot {
  color: var(--accent);
  font-size: 0.85rem;
}

/* Label */
.sa-label {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-gray);
  font-family: var(--font-en);
  line-height: 1.3;
}
.sa-item.open > .sa-header .sa-label,
.sa-item.active-scroll > .sa-header .sa-label {
  color: var(--primary);
}

/* Toggle */
.sa-toggle {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--mid-gray);
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  transition: transform 0.3s ease;
}
.sa-item.open > .sa-header .sa-toggle {
  transform: rotate(45deg);
}

/* Subcategory list */
.sa-sub {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  background: #fafbfd;
}
.sa-item.open > .sa-sub { max-height: 400px; }

/* Nested subcategories (e.g. Dust Filter Bag) */
.sa-sub-nested {
  background: #f5f7fa;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}
.sa-item.open > .sa-sub-nested {
  max-height: 600px;
}

.sa-sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border-top: 1px solid #eef0f3;
}
.sa-sub-item:first-child { border-top: none; }
.sa-sub-item.no-items { opacity: 0.45; pointer-events: none; }

.sa-sub-dot {
  font-size: 0.65rem;
  color: var(--mid-gray);
  flex-shrink: 0;
  margin-left: 20px;
  transition: color 0.2s;
}
.sa-sub-item.active .sa-sub-dot {
  color: var(--accent);
  font-size: 0.75rem;
}

.sa-sub-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 9px 0;
  font-size: 0.8rem;
  color: var(--text-light);
  font-family: var(--font-en);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sa-sub-item.active .sa-sub-link {
  color: var(--primary);
  background: #eef2f7;
  border-left-color: var(--accent);
  font-weight: 600;
}
.sa-sub-link:hover {
  color: var(--primary);
  background: #eef2f7;
  border-left-color: var(--accent);
}
.sa-sub-link small {
  font-size: 0.7rem;
  color: var(--mid-gray);
  font-weight: 400;
  margin-left: 6px;
}

.sa-sub li { border-top: 1px solid #f0f0f0; }
.sa-sub a {
  display: block;
  padding: 9px 14px 9px 40px;
  font-size: 0.8rem;
  color: var(--text-light);
  font-family: var(--font-en);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sa-sub a:hover {
  color: var(--primary);
  background: #eef2f7;
  border-left-color: var(--accent);
}

/* Sidebar Footer - Admin Link */
.sidebar-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
}
.admin-entry {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  font-family: var(--font-en);
  color: var(--mid-gray);
  text-decoration: none;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.admin-entry:hover {
  background: #f0f2f5;
  color: var(--primary);
}

/* ========================================
   Filter Bar
   ======================================== */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  margin-bottom: 24px;
  background: #e8f0fe;
  border-radius: 8px;
  border: 1px solid #c6d9f5;
}
.filter-bar-label {
  font-family: var(--font-en);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary);
}
.filter-bar-clear {
  font-family: var(--font-en);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 16px;
  border-radius: 6px;
  border: 1.5px solid var(--accent);
  transition: all 0.2s;
}
.filter-bar-clear:hover {
  background: var(--accent);
  color: #fff;
}

/* ========================================
   Main Content
   ======================================== */
.products-main {
  flex: 1;
  min-width: 0;
  padding-top: 10px;
}

/* Category Section */
.cat-section {
  margin-bottom: 48px;
  scroll-margin-top: 100px;
}
.cat-section:last-child { margin-bottom: 0; }

/* Parent category (has subcategories) */
.cat-parent {
  margin-bottom: 56px;
}
.cat-header-parent {
  margin-bottom: 28px;
}

.cat-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.cat-title {
  font-size: 1.45rem;
  color: var(--primary);
  font-weight: 700;
  font-family: var(--font-en);
}
.cat-cn {
  font-size: 0.85rem;
  color: var(--mid-gray);
  font-weight: 400;
  margin-left: 8px;
  font-family: var(--font-main);
}
.cat-count {
  font-size: 0.82rem;
  color: var(--text-light);
  font-family: var(--font-en);
  white-space: nowrap;
}

/* Subcategory section inside Dust Filter Bag */
.cat-sub-section {
  scroll-margin-top: 100px;
  margin-bottom: 32px;
  padding-top: 8px;
}
.cat-sub-section:last-child { margin-bottom: 0; }

.cat-sub-title {
  font-size: 1.1rem;
  color: var(--dark-gray);
  font-weight: 600;
  font-family: var(--font-en);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef0f3;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cat-sub-title .cat-cn {
  font-size: 0.78rem;
  font-weight: 400;
}
.cat-count-small {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 400;
  margin-left: auto;
  font-family: var(--font-en);
}

/* Empty placeholder */
.cat-empty {
  text-align: center;
  padding: 24px 16px;
  background: #f8f9fb;
  border-radius: 10px;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}
.cat-empty p {
  font-size: 0.85rem;
  color: var(--text-light);
  font-family: var(--font-en);
  margin: 0;
}
.cat-empty code {
  background: #eef2f7;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--primary);
}

/* Grid */
.showcase-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.showcase-single {
  grid-template-columns: 1fr;
  max-width: 600px;
  margin: 0 auto;
}

/* Empty */
.empty-category {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  background: #f8f9fb;
  border-radius: 10px;
  border: 2px dashed var(--border);
}
.empty-category p {
  font-size: 0.9rem;
  color: var(--text-light);
  font-family: var(--font-en);
}
.empty-category a {
  color: var(--primary);
  font-weight: 600;
}

/* ========================================
   Showcase Item
   ======================================== */
.showcase-item {
  background: var(--white);
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.showcase-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(10,42,74,0.12), 0 2px 8px rgba(0,0,0,0.06);
  border-color: #c8d4e0;
}
.showcase-img {
  width: 100%;
  aspect-ratio: 5 / 3;
  cursor: pointer;
  background: #dcdfe4;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.showcase-img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease;
}
.showcase-item:hover .showcase-img img {
  transform: scale(1.04);
}
.showcase-name {
  font-family: var(--font-en);
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  text-align: center;
  margin: 0;
  line-height: 1.4;
  padding: 0 10px;
}
.btn-book {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #1a73e8;
  color: #fff;
  padding: 11px 28px;
  border-radius: 8px;
  font-family: var(--font-en);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.25s, transform 0.25s;
  margin-bottom: 4px;
}
.btn-book:hover {
  background: #1557b0;
  transform: scale(1.03);
}
.btn-book svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
  .showcase-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .products-layout {
    flex-direction: column;
    gap: 20px;
    padding: 0 16px 40px;
  }
  .products-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    margin-top: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
  }
  .sidebar-accordion {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 0;
  }
  .sa-item { border: none; }
  .sa-header {
    padding: 8px 14px;
    background: var(--light-gray);
    border-radius: 20px;
    gap: 6px;
  }
  .sa-sub { display: none !important; }
  .sa-sub-nested { display: none !important; }
  .sa-toggle { display: none; }
  .products-main { padding-top: 0; }
  .cat-sub-title { font-size: 0.95rem; }
}

@media (max-width: 768px) {
  .page-banner { padding: 70px 16px 60px; background-attachment: scroll; }
  .page-banner h1 { font-size: 1.7rem; }
  .page-banner p { font-size: 0.95rem; }
  .showcase-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .cat-title { font-size: 1.2rem; }
  .cat-section { margin-bottom: 32px; }
}

@media (max-width: 480px) {
  .showcase-grid { grid-template-columns: 1fr; }
}
