/* ========================================
   김치광장 - 상품 목록 페이지 전용 CSS (product_list.css)
   ======================================== */


/* ========================================
   상품 목록 레이아웃
   ======================================== */

/* 전체 컨테이너: 사이드바 + 메인 콘텐츠 */
.list-layout {
    display: flex;
    gap: 40px;
    padding: 40px 0 60px;
    align-items: flex-start;
}

/* ========================================
   좌측 사이드바 (카테고리 필터)
   ======================================== */

.list-sidebar {
    width: 220px;
    flex-shrink: 0;
}

/* 카테고리 타이틀 */
.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: #292829;
    padding-bottom: 12px;
    border-bottom: 2px solid #292829;
    margin-bottom: 16px;
}

/* 메인 카테고리 */
.sidebar-cat-main {
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 0;
}

.sidebar-cat-main > li {
    border-top: 1px solid #e0e0e0;
}

/* 메인 카테고리 링크 */
.sidebar-cat-main > li > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 500;
    color: #292829;
}

.sidebar-cat-main > li > a:hover {
    color: #6b1210;
}

/* 현재 선택된 카테고리 강조 */
.sidebar-cat-main > li > a.is-active {
    color: #6b1210;
    font-weight: 700;
}

/* 서브 카테고리 */
.sidebar-cat-sub {
    display: none;
    padding: 4px 0 12px;
}

.sidebar-cat-sub.is-open {
    display: block;
}

.sidebar-cat-sub li a {
    display: block;
    padding: 7px 12px;
    font-size: 14px;
    color: #555555;
}

.sidebar-cat-sub li a:hover {
    color: #6b1210;
}

.sidebar-cat-sub li a.is-active {
    color: #6b1210;
    font-weight: 500;
}


/* ========================================
   우측 상품 목록 메인 영역
   ======================================== */

.list-main {
    flex: 1;
    min-width: 0; /* flex 자식 overflow 방지 */
}

/* 목록 상단 정렬/필터 바 */
.list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}

/* 총 상품 수 표시 */
.list-count {
    font-size: 14px;
    color: #555555;
}

.list-count strong {
    color: #6b1210;
    font-weight: 700;
}

/* 정렬 선택 */
.list-sort {
    display: flex;
    gap: 8px;
    align-items: center;
}

.list-sort select {
    padding: 7px 10px;
    font-size: 13px;
    border: 1px solid #cccccc;
    color: #292829;
    outline: none;
    cursor: pointer;
    background: white;
    font-family: inherit;
}

.list-sort select:focus {
    border-color: #6b1210;
}

/* 열 수 전환 버튼 */
.list-view-toggle {
    display: flex;
    gap: 4px;
}

.btn-grid-view {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    color: #888888;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
}

.btn-grid-view.is-active,
.btn-grid-view:hover {
    background: #292829;
    color: white;
    border-color: #292829;
}

/* 상품 목록 그리드 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

/* 상품 없음 메시지 */
.no-product {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 0;
    color: #888888;
    font-size: 15px;
}


/* ========================================
   카테고리 상단 배너
   ======================================== */

.cat-banner {
    margin-bottom: 30px;
    background: #f8f8f8;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.cat-banner .cat-banner-icon {
    font-size: 48px;
    color: #6b1210;
}

.cat-banner .cat-banner-title {
    font-size: 22px;
    font-weight: 700;
    color: #292829;
    margin-bottom: 6px;
    display: block;
}

.cat-banner .cat-banner-desc {
    font-size: 14px;
    color: #555555;
}


/* ========================================
   반응형
   ======================================== */

/* 태블릿 (1024px 이하) */
@media (max-width: 1024px) {
    .list-layout {
        gap: 24px;
    }

    .list-sidebar {
        width: 180px;
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

/* 모바일 (768px 이하) */
@media (max-width: 768px) {
    .list-layout {
        flex-direction: column;
        padding: 20px 0 40px;
    }

    /* 사이드바를 상단 가로 스크롤 카테고리로 변경 */
    .list-sidebar {
        width: 100%;
    }

    .sidebar-title {
        font-size: 16px;
    }

    /* 서브 카테고리를 가로 스크롤 형태로 */
    .sidebar-cat-sub {
        display: flex !important; /* 모바일에서 항상 표시 */
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 8px 0;
        gap: 8px;
        scrollbar-width: none;
    }

    .sidebar-cat-sub::-webkit-scrollbar {
        display: none;
    }

    .sidebar-cat-sub li {
        flex-shrink: 0;
    }

    .sidebar-cat-sub li a {
        padding: 6px 14px;
        border: 1px solid #e0e0e0;
        display: inline-block;
        white-space: nowrap;
        font-size: 13px;
    }

    .sidebar-cat-sub li a.is-active {
        background: #292829;
        color: white;
        border-color: #292829;
    }

    /* 메인 카테고리 항목들도 가로 스크롤 */
    .sidebar-cat-main {
        display: flex;
        overflow-x: auto;
        border: none;
        gap: 4px;
        scrollbar-width: none;
    }

    .sidebar-cat-main::-webkit-scrollbar {
        display: none;
    }

    .sidebar-cat-main > li {
        flex-shrink: 0;
        border: none;
    }

    .sidebar-cat-main > li > a {
        padding: 8px 16px;
        border: 1px solid #e0e0e0;
        font-size: 14px;
        white-space: nowrap;
    }

    .sidebar-cat-main > li > a.is-active {
        background: #6b1210;
        color: white;
        border-color: #6b1210;
    }

    /* 상품 그리드 2열 */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .list-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .list-view-toggle {
        display: none; /* 모바일에서 숨김 */
    }
}
