/* Category页面专用样式 */

/* 面包屑导航 */
.breadcrumb {
    padding: 20px 0;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
}

.breadcrumb .container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: var(--primary-purple);
}

.breadcrumb span {
    color: var(--text-light);
}

/* 主要内容区域 */
.category-main {
    padding: 40px 0;
    min-height: 80vh;
}

.category-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
}

/* 左侧筛选栏 */
.category-sidebar {
    background-color: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    position: sticky;
    top: 120px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.sidebar-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-purple);
    margin: 0;
    text-align: center;
    flex: 1;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--primary-purple);
    font-size: 16px;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.sidebar-content {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.filter-section {
    margin-bottom: 30px;
}

.filter-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 分类列表 */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 8px;
}

.category-list a {
    display: block;
    padding: 10px 15px;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.category-list a:hover,
.category-list a.active {
    background-color: var(--primary-purple);
    color: white;
}

/* 价格范围筛选 */
.price-range {
    padding: 10px 0;
}

.price-slider {
    position: relative;
    margin-bottom: 15px;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-purple);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-purple);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.price-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light);
}

/* 尺寸选项 */
.size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.size-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    background-color: var(--bg-white);
    color: var(--text-dark);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.size-btn:hover,
.size-btn.active {
    background-color: var(--primary-purple);
    color: white;
    border-color: var(--primary-purple);
}

/* 颜色选项 */
.color-options {
    display: flex;
    gap: 12px;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: var(--text-dark);
    transform: scale(1.1);
}

.color-btn.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

/* 右侧产品展示区域 */
.category-content {
    overflow: hidden;
}

/* 内容头部 */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 30px;
    padding-bottom: 20px;
}

.sort-options {
    display: flex;
    align-items: center;
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background-color: var(--bg-white);
    color: var(--text-dark);
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

.sort-select:focus {
    border-color: var(--primary-purple);
}

/* 视图选项 */
.view-options {
    display: flex;
    gap: 8px;
}

.view-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-light);
    background-color: var(--bg-white);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

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

.view-btn img {
    width: 16px;
    height: 16px;
    filter: brightness(0) saturate(100%) invert(50%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(0.5);
}

.view-btn.active img {
    filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(1);
}

/* 产品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* 产品卡片 */
.product-card {
    background-color: var(--bg-white);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.product-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background-color: #f8f8f8;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: #ff4757;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.product-info {
    padding: 0;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.4;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.stars {
    color: #ffd700;
    font-size: 14px;
}

.rating-text {
    font-size: 12px;
    color: var(--text-light);
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.current-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.original-price {
    font-size: 14px;
    color: var(--text-light);
    text-decoration: line-through;
}

.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-purple);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-to-cart-btn:hover {
    background-color: #4a2a6b;
}

.add-to-cart-btn .cart-icon {
    width: 16px;
    height: 16px;
    filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(1);
}

/* Footer样式 */
.footer-main {
    padding-top: 40px;
}

/* 响应式设计 */

/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
    .category-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .category-sidebar {
        position: static;
        order: 1;
        padding: 20px;
    }
    
    .category-content {
        order: 2;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .content-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .sort-options {
        width: 100%;
    }
    
    .sort-select {
        width: 100%;
    }
    
    .view-options {
        align-self: flex-end;
    }
    
    .product-info {
        padding: 0;
    }
    
    .product-name {
        font-size: 14px;
    }
    
    .current-price {
        font-size: 16px;
    }
    
    .add-to-cart-btn {
        padding: 10px;
        font-size: 13px;
    }
}

/* 移动设备 (最大 767px) */
@media (max-width: 767px) {
    .category-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .category-sidebar {
        position: static;
        order: 1;
        padding: 20px;
    }
    
    .category-content {
        order: 2;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .content-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .sort-options {
        width: 100%;
    }
    
    .sort-select {
        width: 100%;
    }
    
    .view-options {
        align-self: flex-end;
    }
    
    .product-info {
        padding: 0;
    }
    
    .product-name {
        font-size: 14px;
    }
    
    .current-price {
        font-size: 16px;
    }
    
    .add-to-cart-btn {
        padding: 10px;
        font-size: 13px;
    }
}

/* 小米 Fold 4 特殊优化 - 折叠状态 (约 393px) */
@media (max-width: 393px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .category-sidebar {
        padding: 15px;
    }
    
    .sidebar-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .filter-section {
        margin-bottom: 20px;
    }
    
    .size-options {
        gap: 6px;
    }
    
    .size-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .content-header {
        padding: 10px;
    }
    
    .view-btn {
        width: 35px;
        height: 35px;
    }
    
    .view-btn img {
        width: 14px;
        height: 14px;
    }
}

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

.products-grid.list-view .product-card {
    display: flex;
    align-items: center;
}

.products-grid.list-view .product-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    margin-right: 20px;
}

.products-grid.list-view .product-info {
    flex: 1;
    padding: 0;
}

.products-grid.list-view .product-name {
    font-size: 18px;
    margin-bottom: 8px;
}

.products-grid.list-view .product-rating {
    margin-bottom: 8px;
}

.products-grid.list-view .product-price {
    margin-bottom: 12px;
}

.products-grid.list-view .add-to-cart-btn {
    width: auto;
    padding: 10px 20px;
}

/* 移动端列表视图 */
@media (max-width: 767px) {
    .products-grid.list-view .product-card {
        flex-direction: column;
        text-align: center;
    }
    
    .products-grid.list-view .product-image {
        width: 100%;
        height: 200px;
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .products-grid.list-view .add-to-cart-btn {
        width: 100%;
    }
}

/* 折叠样式 - 平板和移动端 */
@media (max-width: 1024px) {
    .sidebar-toggle {
        display: block;
    }
    
    .sidebar-content {
        max-height: 0;
        opacity: 0;
        margin-bottom: 0;
    }
    
    .category-sidebar.collapsed .sidebar-content {
        max-height: 0;
        opacity: 0;
    }
    
    .category-sidebar.expanded .sidebar-content {
        max-height: 1000px;
        opacity: 1;
    }
    
    .category-sidebar.collapsed .toggle-icon {
        transform: rotate(-90deg);
    }
    
    .category-sidebar.expanded .toggle-icon {
        transform: rotate(0deg);
    }
    
    .category-sidebar.collapsed .sidebar-header {
        margin-bottom: 0;
    }
}
