/* ========== Mall ========== */
/* ========== Mall Page ========== */

/* ===== Breadcrumb ===== */
.mall-breadcrumb {
  padding: 0.875rem 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.mall-breadcrumb a {
  color: var(--muted-foreground);
  transition: color 0.2s;
}
.mall-breadcrumb a:hover {
  color: var(--primary);
}
.mall-breadcrumb .sep {
  margin: 0 0.375rem;
}
.mall-breadcrumb .current {
  color: var(--foreground);
  font-weight: 500;
}

/* ===== Layout ===== */
.mall-layout {
  display: flex;
  gap: 1.5rem;
  padding-bottom: 3rem;
}

/* ===== Sidebar Categories ===== */
.mall-sidebar {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  width: 14rem;
  position: sticky;
  top: 5rem;
  overflow-y: auto;
}

.mall-sidebar-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.mall-sidebar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  background: var(--primary);
  color: var(--primary-foreground);
}
.mall-sidebar-title svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* Category tree */
.cat-tree {
  padding: 0.5rem 0;
}
.cat-group {
  border-bottom: 1px solid var(--border);
}
.cat-group:last-child {
  border-bottom: none;
}
.cat-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.cat-parent:hover {
  background: var(--muted);
  color: var(--primary);
}
.cat-parent.active {
  color: var(--primary);
}
.cat-parent-arrow {
  transition: transform 0.25s;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.cat-parent.active .cat-parent-arrow {
  transform: rotate(90deg);
  color: var(--primary);
}
.cat-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.cat-children.open {
  max-height: 500px;
}
.cat-child {
  display: block;
  padding: 0.375rem 1rem 0.375rem 1.75rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.2s;
}
.cat-child:hover,
.cat-child.active {
  color: var(--primary);
  background: rgba(26, 26, 46, 0.03);
}

/* ===== Main Content ===== */
.mall-main {
  flex: 1;
  min-width: 0;
}

/* Search bar in mall */
.mall-search {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.mall-search-input {
  flex: 1;
  padding: 0.625rem 0.875rem 0.625rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font-sans);
  background: var(--background) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 0.75rem center;
}
.mall-search-input:focus {
  border-color: var(--primary);
}
.mall-search-btn {
  padding: 0.625rem 1.5rem;
}

/* Mobile category toggle */
.mall-cat-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--foreground);
  background: var(--background);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mall-cat-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.mall-cat-toggle svg {
  width: 1rem;
  height: 1rem;
}

/* Active filters */
.mall-filters {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.mall-filter-tag {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 9999px;
  font-size: 0.75rem;
}
.mall-filter-remove {
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.mall-filter-remove:hover {
  opacity: 1;
}
.mall-filter-clear {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.2s;
}
.mall-filter-clear:hover {
  color: var(--primary);
}

/* Mobile category overlay */
.mall-cat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
}
.mall-cat-overlay.open {
  display: block;
}
.mall-cat-drawer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 16rem;
  background: var(--background);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s;
}
.mall-cat-overlay.open .mall-cat-drawer {
  transform: translateX(0);
}
.mall-cat-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.mall-cat-drawer-close {
  cursor: pointer;
  color: var(--muted-foreground);
  padding: 0.25rem;
}
.mall-cat-drawer-close:hover {
  color: var(--foreground);
}

/* Toolbar */
.mall-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.mall-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.mall-result-count {
  font-weight: 600;
  color: var(--primary);
}
.mall-sort-btn {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.2s;
}
.mall-sort-btn:hover,
.mall-sort-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(26, 26, 46, 0.03);
}

/* ===== Product Grid ===== */
.mall-products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.product-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.product-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.product-placeholder-icon {
  color: var(--muted-foreground);
  opacity: 0.25;
}

.product-body {
  padding: 0.875rem;
}
.product-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.product-bottom {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: 0.75rem;
  gap: 0.5rem;
}
.product-price {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
}
.product-price .currency {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--red);
}
.product-price .amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--red);
}
.product-price .original {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  text-decoration: line-through;
}
.product-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.product-add-btn:hover {
  background: var(--primary);
  color: var(--primary-foreground);
}
.product-add-btn svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* ===== Pagination ===== */
.mall-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 2rem;
}
.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--foreground);
  background: var(--background);
  cursor: pointer;
  transition: all 0.2s;
}
.page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}
.page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.page-ellipsis {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  padding: 0 0.25rem;
}

/* ===== Toast ===== */
.mall-toast {
  position: fixed;
  top: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-1rem);
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 300;
  white-space: nowrap;
}
.mall-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (min-width: 640px) {
  .mall-products {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .mall-sidebar {
    display: flex;
  }
  .mall-cat-toggle {
    display: none;
  }
  .mall-products {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .mall-products {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

@media (min-width: 1280px) {
  .mall-products {
    grid-template-columns: repeat(4, 1fr);
  }
}
