/* ==========================================================================
   Linyi Mincai Stationery - Products Catalog Stylesheet
   Two-Level Category Tree Menu, Cartoon & Playful Style, Unified Wide Width
   ========================================================================== */

:root {
  --orange: #ff621f;
  --orange-hover: #ff7d42;
  --navy: #10264f;
  --blue: #168cff;
  --text: #4a5d78;
  --bg-card: #ffffff;
  --border-card: #edf2f8;
}

.catalog-page {
  background: #fdfdfe;
  color: #243f70;
  font-size: 14px;
  min-height: 80vh;
}

/* ==========================================================================
   1. Wide Container (Unified with Full Site Standard)
   ========================================================================== */
.catalog-width {
  width: min(1480px, calc(100% - 64px));
  margin-inline: auto;
  box-sizing: border-box;
}

@media (min-width: 1680px) {
  .catalog-width {
    max-width: 1568px;
  }
}

/* ==========================================================================
   2. Hero Banner Section
   ========================================================================== */
.catalog-hero {
  position: relative;
  height: 250px;
  overflow: hidden;
  background: #c5edff url('../images/about-banner.png') left center / cover no-repeat;
  display: flex;
  align-items: center;
}

.catalog-hero-art {
  position: absolute;
  height: 100%;
  width: 58%;
  max-width: 820px;
  right: 0;
  top: 0;
  object-fit: cover;
  object-position: right center;
  pointer-events: none;
}

.catalog-hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 20px;
  box-sizing: border-box;
}

.catalog-hero h1 {
  font-family: 'Fredoka', 'Arial Rounded MT Bold', sans-serif;
  font-size: clamp(48px, 5.5vw, 76px);
  font-weight: 700;
  color: #0088ff;
  margin: 0 0 10px;
  line-height: 1.1;
  letter-spacing: -1.5px;
}

.catalog-hero h1 span {
  color: var(--orange);
}

.catalog-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}

.catalog-breadcrumb a {
  color: var(--navy);
  text-decoration: none;
  transition: color 0.2s ease;
}

.catalog-breadcrumb a:hover {
  color: var(--orange);
}

.catalog-breadcrumb i {
  font-size: 13px;
  color: #8fa5c2;
}

.catalog-breadcrumb span[aria-current="page"] {
  color: var(--orange);
}

/* ==========================================================================
   3. Two-Column Layout (Sidebar + Results)
   ========================================================================== */
.catalog-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 36px;
  padding: 48px 0 76px;
  align-items: start;
}

/* ==========================================================================
   4. Sidebar (Two-Level Categories Tree & Inquiry Card)
   ========================================================================== */
.catalog-sidebar {
  background: #ffffff;
  border: 2px solid #edf2f8;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(16, 38, 79, 0.05);
  position: sticky;
  top: 96px;
}

.catalog-sidebar h2 {
  background: linear-gradient(135deg, #ff7024 0%, #ff5213 100%);
  color: #ffffff;
  margin: 0;
  padding: 20px 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: 'Fredoka', 'Arial Rounded MT Bold', sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.2px;
}

.category-tree {
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Base Category Button */
.category-btn {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  color: #243f70;
  padding: 12px 16px;
  min-height: 46px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.22s ease;
}

.category-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 50px;
  background: #edf3fa;
  color: #556c8c;
  font-size: 11.5px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.category-btn:hover {
  background: #f4f8fe;
  color: var(--orange);
  transform: translateX(3px);
}

.category-btn.active,
.category-btn[aria-pressed='true'] {
  background: var(--orange);
  color: #ffffff;
  border-color: var(--orange);
  box-shadow: 0 4px 14px rgba(255, 98, 31, 0.32);
}

.category-btn.active .count-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Level 1 Group & Tree Parent Row */
.tree-group {
  border-radius: 16px;
  transition: background 0.22s ease;
}

.tree-group.open {
  background: #f9fbfe;
}

.tree-parent-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.tree-parent-row .parent-btn {
  flex: 1;
  min-width: 0;
}

/* Independent Toggle Expand Arrow Button */
.tree-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 44px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
  color: #9cb1cb;
  transition: all 0.22s ease;
  flex-shrink: 0;
}

.tree-toggle-btn:hover {
  background: #edf3fa;
  color: var(--orange);
}

.tree-arrow {
  font-size: 12px;
  color: inherit;
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.2s ease;
}

.tree-group.open .tree-toggle-btn {
  color: var(--orange);
}

.tree-group.open .tree-arrow {
  transform: rotate(180deg);
}

/* Level 2 Subcategory Menu List */
.tree-sub-list {
  list-style: none;
  margin: 0;
  padding: 4px 0 8px 30px;
  position: relative;
  display: none;
  flex-direction: column;
  gap: 4px;
}

.tree-group.open .tree-sub-list {
  display: flex;
  animation: subMenuSlide 0.22s ease-out;
}

@keyframes subMenuSlide {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tree-sub-list::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 6px;
  bottom: 12px;
  width: 2px;
  border-left: 2px dashed #dbe5f2;
}

.tree-sub-list li {
  margin: 0;
  padding: 0;
}

.sub-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #4a6182;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sub-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9db2cd;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.sub-btn:hover {
  color: var(--orange);
  background: #fff3ec;
  transform: translateX(4px);
}

.sub-btn:hover .sub-dot {
  background: var(--orange);
  transform: scale(1.4);
}

.sub-btn.active {
  color: var(--orange);
  background: #fff0e6;
  border-color: #ffd8c2;
  font-weight: 700;
}

.sub-btn.active .sub-dot {
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 98, 31, 0.2);
}

/* Sidebar Art (clean bottom illustration) */
.category-art {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-top: 1px solid #edf2f8;
}

/* ==========================================================================
   5. Catalog Toolbar
   ========================================================================== */
.catalog-toolbar {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 4px 22px;
  border-bottom: 2px solid #edf2f8;
  margin-bottom: 28px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.catalog-toolbar p {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy);
}

.reset-filter {
  font-size: 12.5px;
  font-weight: 700;
  background: #fff0e8;
  color: var(--orange);
  padding: 5px 14px;
  border-radius: 50px;
  border: 1px solid #ffd8c4;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.reset-filter:hover {
  background: var(--orange);
  color: #ffffff;
}

.toolbar-right label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #496080;
}

.catalog-toolbar select {
  padding: 9px 36px 9px 16px;
  border: 1.5px solid #d9e3f1;
  border-radius: 50px;
  color: var(--navy);
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23ff621f' d='M6 8L0 0h12z'/%3E%3C/svg%3E") right 14px center / 10px no-repeat;
  appearance: none;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.catalog-toolbar select:focus {
  border-color: var(--orange);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 98, 31, 0.15);
}

/* ==========================================================================
   6. Product Cards Grid (Cartoon Style)
   ========================================================================== */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 20px;
}

.catalog-card {
  min-width: 0;
  background: #ffffff;
  border: 2px solid #edf2f8;
  border-radius: 20px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(16, 38, 79, 0.05);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 0.28s ease;
}

.catalog-card:hover {
  transform: translateY(-8px);
  border-color: #ffd8bf;
  box-shadow: 0 18px 40px rgba(255, 98, 31, 0.14);
}

.catalog-card > a {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.catalog-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #f0f7ff;
}

.catalog-card-media img,
.catalog-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 14px;
  transition: transform 0.4s ease;
}

.catalog-card:hover .catalog-card-media img,
.catalog-card:hover img {
  transform: scale(1.08);
}

.catalog-card-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 6px 8px;
  min-height: 52px;
  box-sizing: border-box;
}

.catalog-card h3 {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  color: var(--navy);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  transition: color 0.2s ease;
}

.catalog-card:hover h3 {
  color: var(--orange);
}

.card-arrow-circle,
.catalog-card-label > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff3ec;
  color: var(--orange);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 12px;
  transition: all 0.22s ease;
}

.catalog-card:hover .card-arrow-circle,
.catalog-card:hover .catalog-card-label > i {
  background: var(--orange);
  color: #ffffff;
  transform: translateX(3px);
  box-shadow: 0 4px 12px rgba(255, 98, 31, 0.35);
}

/* ==========================================================================
   7. Pagination Controls
   ========================================================================== */
.catalog-pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 48px;
}

.catalog-pagination button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid #e1e9f4;
  background: #ffffff;
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.catalog-pagination button:hover:not(:disabled) {
  border-color: var(--orange);
  color: var(--orange);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 98, 31, 0.16);
}

.catalog-pagination button[aria-current='page'],
.catalog-pagination button.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 98, 31, 0.35);
}

.catalog-pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* Empty State */
.catalog-empty {
  padding: 72px 20px;
  text-align: center;
  font-size: 15px;
  color: #7286a0;
}

/* Accessibility */
.catalog-page [hidden] {
  display: none !important;
}

.catalog-page a:focus-visible,
.catalog-page button:focus-visible,
.catalog-page select:focus-visible {
  outline: 3px solid #1687e9;
  outline-offset: 3px;
}

/* ==========================================================================
   8. Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1280px) {
  .catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px 16px;
  }
}

@media (max-width: 992px) {
  .catalog-layout {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    padding: 36px 0 56px;
  }
  .catalog-width {
    width: calc(100% - 40px);
  }
  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .catalog-hero {
    height: 220px;
  }
  .catalog-hero h1 {
    font-size: 46px;
  }
  .catalog-hero-art {
    width: 65%;
  }
}

@media (max-width: 768px) {
  .catalog-layout {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 24px;
  }
  .catalog-sidebar {
    position: static;
  }
  .category-art,
  .sidebar-inquiry-box {
    display: none;
  }
}

@media (max-width: 580px) {
  .catalog-width {
    width: calc(100% - 28px);
    padding-bottom: 48px;
  }
  .catalog-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .catalog-hero {
    height: 190px;
  }
  .catalog-hero-copy {
    padding-left: 10px;
  }
  .catalog-hero h1 {
    font-size: 38px;
  }
  .catalog-hero-art {
    width: 55%;
    opacity: 0.8;
  }
  .catalog-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .catalog-pagination button {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-card,
  .catalog-card-media img,
  .catalog-card img,
  .card-arrow-circle,
  .catalog-pagination button,
  .tree-arrow {
    transition: none !important;
  }
}
