/* 分类页面样式 - 基于原始设计稿，使用 cat- 前缀避免冲突 */

/* 页面布局优化 - 确保最小高度 */
.categories-page {
    min-height: calc(100vh - 700px);
    display: flex;
    flex-direction: column;
}

.categories-page .d-flex {
    flex: 1;
    min-height: 400px;
}


/* 分类列表卡片基础样式 */
.cat-list-card {
    background: white;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    margin-bottom: 1rem;
}

.cat-list-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.cat-list-card:hover .cat-list-info {
    background-color: white;
}

.cat-list-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.cat-list-card:hover::before {
    opacity: 1;
}

/* 图片和信息区域 */
.cat-list-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: white;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.cat-list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cat-list-info {
    padding: 0.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    z-index: 2;
}

/* 文本样式 - 统一处理 */
.cat-list-brand, .cat-list-colors {
    font-size: clamp(0.6rem, 2vw, 0.8rem);
    color: #a6a6a6;
    font-weight: 500;
    line-height: 1.2;
    overflow: hidden;
    white-space: nowrap;
}

.cat-list-title {
    font-size: clamp(0.7rem, 2.2vw, 0.9rem);
    color: #333;
    margin-bottom: 0.3rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.cat-list-price {
    font-size: clamp(0.8rem, 2.5vw, 1.1rem);
    font-weight: 700;
    color: #000;
    margin-top: auto;
    line-height: 1.2;
    overflow: hidden;
    white-space: nowrap;
}

.cat-list-brand {
    margin-bottom: 0.2rem;
}

.cat-list-colors {
    margin-top: 0.5rem;
}

#cat-list-grid {
    display: grid !important;
    grid-template-columns: repeat(var(--desktop-cols, 5), 1fr);
    gap: 1rem;
}

/* 响应式断点 */
@media (max-width: 1200px) {
    #cat-list-grid { grid-template-columns: repeat(var(--tablet-cols, 4), 1fr); }
}

@media (max-width: 768px) {
    #cat-list-grid { grid-template-columns: repeat(var(--mobile-cols, 2), 1fr); }
    .cat-list-info { padding: 0.4rem; }
}

@media (max-width: 576px) {
    #cat-list-grid { grid-template-columns: repeat(var(--xs-cols, 2), 1fr); }
}

@media (max-width: 480px) {
    .cat-list-info { padding: 0.3rem; }
}

/* 热门分类标题响应式样式 */
@media (max-width: 768px) {
    .cat-list-title-section h1 {
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    .cat-list-title-section h1 {
        font-size: 1.4rem;
    }
}

/* 筛选侧边栏样式 */
.cat-filter-sidebar {
    background: #fff;
    margin-bottom: 2rem;
    width: 240px;
    flex-shrink: 0;
    padding-right: 30px;
    position: sticky; /* 粘性定位 */
    top: 20px;  /* 距离顶部20px */
    z-index: 100;  /* 确保在其他元素之上 */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 300;
}

/* 移动端布局调整 - 使用更具体的选择器避免冲突 */
@media (max-width: 991.98px) {
    .categories-page .d-flex {
        flex-direction: column;
    }
    
    .categories-page .flex-grow-1 {
        width: 100%;
    }
    
    .cat-filter-sidebar {
        position: static;  /* 移动端取消固定定位 */
        top: auto;
    }
    
    /* 为移动端底部按钮预留空间 */
    body {
        padding-bottom: 80px;
    }
}

/* 移动端底部筛选按钮 */
.cat-mobile-filter-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    z-index: 1000;
}

.cat-mobile-filter-btn {
    width: 100%;
    background: #2a292f;
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 500;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    opacity: 1;
}

.cat-mobile-filter-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

.cat-mobile-filter-btn:hover {
    background: rgba(42, 41, 47, 0.8);
    color: white;
}

.cat-mobile-filter-btn:focus {
    background: rgba(42, 41, 47, 0.8);
    color: white;
    box-shadow: none;
}

/* 移动端 Offcanvas 样式 */
.cat-offcanvas-start {
    width: 280px;
}

.cat-offcanvas-header {
    background: #000;
    color: white;
    border-bottom: 1px solid #333;
}

.cat-offcanvas-title {
    font-weight: 300;
    font-size: 18px;
}

.cat-btn-close {
    filter: invert(1);
}

.cat-btn-close-custom {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.cat-btn-close-custom:hover {
    opacity: 0.7;
}

.cat-btn-close-custom:focus {
    outline: none;
    box-shadow: none;
}

.cat-offcanvas-body {
    background: #000;
    color: white;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 300;
}

/* 移动端筛选内容样式 */
.cat-offcanvas-body .cat-filter-section {
    border-bottom: 1px solid #444;
    margin-bottom: 20px;
    padding-bottom: 15px;
}

.cat-offcanvas-body .cat-filter-header {
    background: transparent;
    border: none;
    color: white;
    padding: 0;
    font-weight: 300;
    font-size: 16px;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cat-offcanvas-body .cat-filter-header:focus {
    color: white;
    box-shadow: none;
}

.cat-offcanvas-body .cat-filter-header span:after {
    border-color: white;
}

.cat-offcanvas-body .cat-filter-content {
    margin-top: 15px;
}

.cat-offcanvas-body .form-check {
    margin-bottom: 12px;
}

.cat-offcanvas-body .form-check-input {
    background-color: transparent;
    border: 1px solid #666;
}

.cat-offcanvas-body .form-check-input:checked {
    background-color: white;
    border-color: white;
}

.cat-offcanvas-body .form-check-input:focus {
    border-color: #7292a9;
    box-shadow: 0 0 0 0.2rem rgba(114, 146, 169, 0.25);
}

.cat-offcanvas-body .form-check-label {
    color: #b1b1b1 !important;
    font-size: 14px;
    font-weight: 300;
    margin-left: 8px;
}

.cat-offcanvas-body .form-check-input:checked + .form-check-label {
    color: white !important;
}

.cat-offcanvas-body .cat-filter-search-btn {
    background: white;
    border: none;
    color: black;
    padding: 12px 20px;
    border-radius: 0;
    font-weight: 300;
    font-size: 16px;
    width: 100%;
}

.cat-offcanvas-body .cat-filter-search-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    color: black;
}

.cat-offcanvas-body .cat-filter-search-btn .badge {
    background: #2a292f;
    color: white;
    font-weight: normal;
}

/* 筛选区块 */
.cat-filter-section {
    border-bottom: 1px solid #f1f3f4;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.cat-filter-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* 筛选标题按钮 */
.cat-filter-header {
    width: 100%;
    background: none;
    border: none;
    padding: 0.75rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 300;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    transition: color 0.2s ease;
    position: relative;
}

.cat-filter-header:hover {
    color: #333;
}

.cat-filter-header:focus {
    color: #333;
    outline: none;
    box-shadow: none;
}

.cat-filter-header:active {
    color: #333;
}

.cat-filter-header span:after {
    content: "";
    display: block;
    border-top: 1px solid #2b2b2b;
    border-right: 1px solid #2b2b2b;
    width: 13px;
    height: 13px;
    position: absolute;
    top: 6px;
    bottom: 0;
    right: 8px;
    margin: auto 0;
    transform: rotate(135deg);
    transition: transform 0.3s ease;
    transform-origin: 75% 25%;
}

.cat-filter-header[aria-expanded="true"] span:after {
    transform: rotate(315deg);
}

/* 筛选内容区域 */
.cat-filter-content {
    padding-top: 0.5rem;
    font-weight: 300;
}

/* 表单复选框和单选框样式 */
.cat-filter-content .form-check {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}

.cat-filter-content .form-check:last-child {
    margin-bottom: 0;
}

.cat-filter-content .form-check-input {
    margin-top: 0.125rem;
}

.cat-filter-content .form-check-label {
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    line-height: 1.4;
    font-weight: 300;
}

.cat-filter-content .form-check-input:checked + .form-check-label {
    color: #2a292f;
    font-weight: 400;
}

/* 检索按钮样式 */
.cat-filter-search-btn {
    background: #2a292f;
    border: none;
    color: white;
    font-weight: 300;
    padding: 0.75rem 1rem;
    border-radius: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cat-filter-search-btn:hover {
    background: rgba(42, 41, 47, 0.8);
}

.cat-filter-search-btn:focus {
    outline: none;
    box-shadow: none;
}

.cat-filter-search-btn .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    background-color: #7292a9;
    color: white;
    font-weight: normal;
}

/* 移动端隐藏筛选菜单 */
@media (max-width: 991.98px) {
    .cat-filter-sidebar {
        display: none !important;
    }
}

/* 响应式调整 */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .cat-filter-content .form-check-label {
        font-size: 0.85rem;
    }
    
    .cat-filter-header {
        font-size: 0.95rem;
        padding: 0.6rem 0;
    }
}

/* 选中状态的视觉反馈 */
.cat-filter-content .form-check-input:checked {
    background-color: #2a292f;
    border-color: #2a292f;
}

.cat-filter-content .form-check-input:focus {
    border-color: #2a292f;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(42, 41, 47, 0.25);
}

.cat-filter-content .form-check-input:hover {
    background-color: rgba(42, 41, 47, 0.8);
}

/* 加载更多按钮样式 */
.load-more-btn {
    background-color: #ffffff !important;
    border: 1px solid #000000 !important;
    border-radius: 0 !important;
    color: #000000 !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    min-width: 120px !important;
}

.load-more-btn:hover {
    background-color: #ffffff !important;
    border-color: #666666 !important;
    color: #000000 !important;
}

.load-more-btn:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1) !important;
}

.load-more-btn:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.load-more-btn .btn-loading {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.load-more-btn .spinner-border-sm {
    width: 1rem !important;
    height: 1rem !important;
}


/* 移动端按钮样式调整 */
@media (max-width: 768px) {
    .load-more-btn {
        padding: 10px 20px !important;
        font-size: 13px !important;
        min-width: 100px !important;
    }
}