产品页面布局
.products-page {
    /* padding: 1rem 0; */
    background-color: var(--light-gray);
}

.products-layout {
    display: grid;
    position: relative; /* 添加这一行 */
    /* grid-template-columns: 250px 1fr;
    gap: 1.5rem; */
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(37, 99, 235, 0.1), rgba(168, 85, 247, 0.1));
  z-index: 0;
  pointer-events: none; /* 添加这一行 */
}

.hero-content {
  position: relative;
  max-width: 1280px;
  margin: 40px auto;
  text-align: center;
  z-index: 1;
  padding: 0 1rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: bold;
  color: #1f2937; /* gray-900 */
  margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
  .hero-title {
    font-size: 3.75rem;
  }
}

.highlight-text {
  background: linear-gradient(to right, #2563eb, #a855f7);
  -webkit-background-clip: text; /* For WebKit browsers (Chrome, Safari, older Edge) */
  background-clip: text; /* Standard property for wider compatibility */
  -webkit-text-fill-color: transparent;
  color: transparent; /* Fallback for browsers that don't support text-fill-color */
}
.hero-subtitle {
  font-size: 1.25rem;
  color: #4b5563; /* gray-600 */
  max-width: 768px;
  margin: 0 auto 2rem;
}

.hero-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  color: #6b7280; /* gray-500 */
  font-size: 0.875rem;
}

.feature {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  display: inline-block;
}

.green { background-color: #22c55e; }  /* green-500 */
.blue { background-color: #3b82f6; }   /* blue-500 */
.purple { background-color: #8b5cf6; } /* purple-500 */

/* 侧边栏样式 */
.categories-sidebar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 20px 10%;
    background-color: var(--light-gray);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.sidebar-right{
    width: 100%;
    display: flex;
}

.categories-list {
    display: flex;
    list-style: none;
    flex-wrap: wrap;
    margin: 0;
    width: 70%;
    /* overflow-x: hidden; */
    overflow: hidden;
    max-height: 60px;
    /* white-space: nowrap; */
    justify-content: flex-start; /* 可选：让项目靠左对齐 */
    gap: 10px; /* 可选：使用 gap 属性来设置间距，比 margin 更简洁 */
}

.categories-list.expanded {
    max-height: none; /* 展开后没有高度限制 */
    overflow: visible;
}

.show-all-btn {
    /* 基础样式 */
    background-color: var(--light-gray, #f3f4f6); /* 使用一个柔和的背景色，与产品页面的light-gray相呼应 */
    border: 1px solid var(--border-color, #d1d5db); /* 添加一个轻微的边框，增加质感，使用CSS变量 */
    color: var(--dark-color, #374151); /* 默认文本颜色，比primary-color更柔和 */
    font-size: 15px; /* 稍微调整字体大小，更精致 */
    font-weight: 600; /* 更粗的字体，增加强调 */
    padding: 10px 18px; /* 增加内边距，让按钮看起来更饱满 */
    display: flex;
    align-items: center;
    justify-content: center; /* 居中对齐内容 */
    gap: 0.6rem; /* 增大文本和图标的间距 */
    cursor: pointer;
    border-radius: 8px; /* 增大圆角，与产品卡片等元素保持一致 */
    transition: all 0.3s ease; /* 统一所有变化的过渡效果，更平滑 */
    outline: none; /* 移除默认焦点轮廓 */
    text-decoration: none;
    white-space: nowrap; /* 防止文本换行 */
}

/* 鼠标悬停效果 */
.show-all-btn:hover {
    background-color: var(--primary-color, #007bff); /* 悬停时变为品牌主色 */
    color: white; /* 文本变为白色 */
    border-color: var(--primary-color, #007bff); /* 边框颜色也变为主色 */
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2); /* 添加轻微的阴影效果，提升浮动感 */
}

/* 鼠标按下/激活效果 */
.show-all-btn:active {
    background-color: var(--dark-color, #0056b3); /* 按下时颜色更深 */
    border-color: var(--dark-color, #0056b3);
    transform: translateY(1px); /* 模拟按下 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* 阴影变小，增加按压感 */
}

/* 焦点（键盘Tab键选中）效果，提高可访问性 */
.show-all-btn:focus {
    outline: 2px solid var(--primary-color, #007bff);
    outline-offset: 3px; /* 增大偏移，使其更明显 */
}

/* 图标旋转效果 (保持不变，因为这部分逻辑是好的) */
.show-all-btn.active .fas.fa-chevron-down {
    transform: rotate(180deg);
}

/* 图标过渡效果 (保持不变) */
.show-all-btn i {
    transition: transform 0.3s ease;
    display: inline-block;
}

.category-item {
    flex-shrink: 0;
    padding: 12px 20px;
    margin: 0px 10px;
    cursor: pointer;
    border-radius: 0px;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--dark-color);
    border-left: 3px solid transparent;
    font-family: Arial, sans-serif;
    background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
}

.category-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
    border-left-color: var(--primary-color);
}

.category-item.active {
    background-color: var(--primary-color);
    color: white;
    border-left-color: var(--primary-color);
}

/* 产品内容区域 */
.products-content {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.products-header h1 {
    font-size: 1.5rem;
    color: var(--dark-color);
    font-family: Amazon Ember, Arial, sans-serif;
}

.products-filters {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#sort-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    background-color: white;
    color: var(--dark-color);
}

.view-options {
    display: none;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.5rem;
    border: 1px solid var(--light-gray);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 子分类导航 */

.subcategories-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.subcategory-item {
    padding: 8px 15px;
    background-color: white;
    border: 1px solid var(--light-gray);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: var(--dark-color);
}

.subcategory-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
    border-color: var(--primary-color);
}

.subcategory-item.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}


/* 骨架屏容器 */
.skeleton-grid-container {
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.skeleton-grid-container.hidden {
    opacity: 0;
    pointer-events: none; /* 隐藏后禁用事件 */
    position: absolute; /* 使其不占据布局空间 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* 确保它在产品加载后位于下方 */
}

/* 骨架卡片 */
.skeleton-card {
    background-color: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative; /* 用于微光效果 */
    animation: pulse 1.5s infinite ease-in-out; /* 可选的呼吸灯效果 */
}

/* 骨架图片占位符 */
.skeleton-image {
    width: 100%;
    padding-top: 100%; /* 保持正方形 */
    background-color: #e0e0e0;
    position: relative;
    overflow: hidden;
}

/* 骨架信息区 */
.skeleton-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* 骨架文本行占位符 */
.skeleton-text-line {
    height: 1em; /* 行高 */
    background-color: #e0e0e0;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.skeleton-text-line.short {
    width: 60%;
}

.skeleton-text-line.medium {
    width: 80%;
}

.skeleton-text-line.long {
    width: 100%;
}

/* 微光效果 */
.skeleton-card::after,
.skeleton-image::after,
.skeleton-text-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.5s infinite;
}

/* 微光动画 */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* 可选：呼吸灯动画 */
@keyframes pulse {
    0% {
        background-color: #f0f0f0;
    }
    50% {
        background-color: #e5e5e5;
    }
    100% {
        background-color: #f0f0f0;
    }
}

/* 产品网格 */

.products-grid {
    display: grid;
    /* Base for grid-cols-1 */
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem; /* Equivalent to Tailwind's gap-6 */
    margin-bottom: 2rem; /* Equivalent to Tailwind's mb-8 */
}

/* Equivalent to sm:grid-cols-2 */
@media (min-width: 640px) { /* Tailwind's 'sm' breakpoint */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Equivalent to lg:grid-cols-3 */
@media (min-width: 1024px) { /* Tailwind's 'lg' breakpoint */
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        /* Tailwind's lg:gap-8 means a gap of 2rem (32px), so adjust if needed */
        gap: 2rem;
    }
}

/* Equivalent to xl:grid-cols-4 */
@media (min-width: 1280px) { /* Tailwind's 'xl' breakpoint */
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        width: 85%;
        margin: auto;
    }
}

/* 列表视图 */
.products-grid.list-view {
    grid-template-columns: 1fr;
}

/* 产品卡片 */
.product-card {
    background: white;
    border-radius: 7px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-image {
    position: relative;
    padding-top: 100%;
    background-color: #f5f5f5;
    overflow: hidden;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    z-index: 1;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3); /* 半透明黑色遮罩 */
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.product-image:hover .image-overlay {
    opacity: 1;
}

.product-image:hover img {
    transform: scale(1.05); /* 鼠标悬停时放大 */
}

.product-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-info h2 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: var(--dark-color);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    display: -moz-box;
    -moz-line-clamp: 2;
    -moz-box-orient: vertical;
    display: box;
    line-clamp: 2;
    box-orient: vertical;
    overflow: hidden;
    white-space: nowrap;
}

/* .product-type {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
} */
.product-original-price {
    color: #9e9e9e;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    text-decoration: line-through; /* 添加删除线 */
  }

.product-price {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.product-stock {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.product-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    display: -moz-box;
    -moz-line-clamp: 2;
    -moz-box-orient: vertical;
    display: box;
    line-clamp: 2;
    box-orient: vertical;
    flex: 1;
}
.product-items-center{
    display: flex;
    align-items: baseline
}
.product-items-center p{
    margin-right: 10px;

}

.add-to-cart-btn {
    width: 100%;
    padding: 0.7rem;
    background: linear-gradient(135deg, #32CD32, #228B22); /* 渐变绿 */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 0.9rem;
    margin-top: auto;
}

.btn-primary.add-to-cart-btn{
    display: flex;
    align-items: center;
    justify-content: center
}

.add-to-cart-btn:hover {
    background: linear-gradient(135deg, #2E8B57, #006400); /* 深绿色渐变 */
}


/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding: 20px 0;
}

.page-numbers {
    display: flex;
    gap: 8px;
    align-items: center;
    background-color: var(--light-gray);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid var(--light-gray);
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--dark-color);
}

.page-btn:hover:not(:disabled) {
    background-color: rgba(0, 123, 255, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--light-gray);
}

/* 悬浮购物车按钮样式 */
.floating-cart-btn {
    position: fixed;
    bottom: 5%; /* 距离底部 20px */
    right: 5%; /* 距离右边 20px */
    background-color: #d68c45;
    color: white;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000; /* 确保按钮在最上层 */
    transition: all 0.3s ease;
}

.floating-cart-btn a {
    color: white;
    font-size: 1.5rem;
    text-decoration: none;
}

.floating-cart-btn .cart-count {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #f00; /* 红色背景 */
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 50%;
    min-width: 20px;
    text-align: center;
}
.fa-solid, .fas {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}
/* 悬浮按钮悬停时的效果 */
.floating-cart-btn:hover {
    background-color: #db7515; /* 更改按钮颜色 */
    cursor: pointer;
}

.search-overlay {
    z-index: 1000;
}


/* 响应式设计 */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product-info h2 {
        font-size: 0.95rem;
    }
    
    .product-price {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .view-options {
        display: flex;
    }
    .products-layout {
        display: grid;
        grid-template-columns: 1fr; /* 强制单列布局 */
        gap: 1rem;
        flex-direction: column;
    }
    
    .categories-sidebar {
        width: 100%;
        margin-right: 0;
        /* overflow-x: auto; */
        /* flex-wrap: nowrap; */
        padding: 0px;
        flex-direction: column;
    }
    
    .subcategories-list {
        justify-content: center;
    }
    
    .page-numbers {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .products-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .products-filters {
        width: 100%;
        justify-content: space-between;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* 切换到列表视图，强制单列 */
    .products-grid.list-view {
        grid-template-columns: repeat(1, 1fr);
    }
        
    .product-card {
        width: 100%;
    }
    /* 产品导航栏 */
    /* .categories-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        gap: 1rem;
        padding: 0.5rem 0;
    } */
    .categories-list {
        display: none; /* 默认隐藏菜单列表 */
        max-height: none; /* 覆盖桌面端可能设置的最大高度 */
        overflow: visible; /* 确保所有内容可见 */
        width: 100%; /* 默认宽度 */
        justify-content: center; /* 让菜单项居中 */
        flex-direction: row; /* 保持项目横向排列 */
        padding: 0.5rem 0; /* 保持垂直内边距 */
        /* 移除之前所有冲突的 flex-wrap, overflow-x, white-space 等属性 */
    }
    .categories-list.is-floating {
        display: flex;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: 100%; /* 保持或稍微增加此宽度，确保有足够的空间容纳两列 */
        max-width: 400px; /* 保持或稍微增加此最大宽度 */
        background-color: white;
        border-radius: 8px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.2);
        z-index: 1001;
        flex-direction: row;
        flex-wrap: wrap; /* 确保这里是 wrap，已在之前提供 */
        justify-content: center; /* 让菜单项在行内居中对齐 */
        border: 1px solid var(--light-gray);
    }

    /* 新增或修改这个规则，专门控制浮动菜单中的每个分类项的宽度 */
    .categories-list.is-floating .category-item {
        flex: 1 1 calc(50% - 7.5px); /* 让每个项大致占据容器的一半宽度，并减去一半的gap */
        min-width: 120px; /* 防止在极小屏幕上过窄 */
        max-width: 180px; /* 防止在较大屏幕上过宽 */
        box-sizing: border-box; /* 确保内边距和边框包含在宽度计算内 */
        margin: 0; /* 移除任何可能阻止并排显示的外部 margin */
        text-align: center; /* 继续保持文字居中 */
    }

    .show-all-btn {
        margin-top: 10px; /* 在"Show All"按钮上方增加一些空间 */
        align-self: flex-start; /* 在垂直堆叠的父容器中靠左对齐 */
        padding-left: 10%; /* 与侧边栏对齐的内边距 */
    }

    .products-filters {
        width: 100%;
        justify-content: space-between;
        padding: 0 10px; /* 调整左右内边距 */
    }

    /* 隐藏滚动条 - Chrome/Safari */
    .categories-list::-webkit-scrollbar {
        display: none;
    }
    .category-item {
        flex-shrink: 0; /* 禁止收缩 */
        padding: 0.75rem 1.25rem;
        background: #f5f5f5;
        font-size: 0.9rem;
        color: #333;
        transition: all 0.3s ease;
        width: auto;
        overflow-x: visible;
        text-align: center;
        margin: 0px 5px;
    }
    .products-header h1{
        font-size: 1rem;
    }
    .floating-cart-btn {
        bottom: 5%; /* 距离底部 20px */
        right: 9%; /* 距离右边 20px */
    }
    .hero-content{
        display: none;
    }
    .sidebar-right{
        width: 100%;
    }
}

@media (max-width: 480px) {
    
    .products-content {
        padding: 0.75rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .product-card {
        flex-direction: column;
    }
    
    .product-image {
        padding-top: 100%;
    }
    
    .product-info {
        padding: 0.75rem;
    }
    
    .product-info h2 {
        font-size: 0.9rem;
        /* -webkit-line-clamp: 1; */
    }
    
    .product-description {
        display: none;
    }
    
    .product-price {
        font-size: 0.95rem;
    }
    
    .add-to-cart-btn {
        padding: 0.5rem;
        font-size: 0.5rem;
    }

}