/* ============================================================
   Product list - left Filter sidebar + 2-column layout
   (frontend-only enhancement; data comes from existing
    /product/getDataProduct endpoint)
   ============================================================ */

.krc-list-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-top: 30px;
    padding: 0 10px 90px;   /* 하단 90px: 필터/제품 영역과 푸터 사이 여백 */
}

.krc-filter-sidebar {
    flex: 0 0 260px;
    width: 260px;
}

.krc-product-main {
    flex: 1 1 auto;
    min-width: 0;
}

/* ---- 모바일 필터 드로어 크롬: 데스크톱에서는 모두 숨김(현행 유지) ---- */
.krc-filter-toggle,
.krc-filter-backdrop,
.krc-filter-drawer-head,
.krc-filter-drawer-actions {
    display: none;
}

/* ---- Filter sidebar ---- */
.krc-filter-title {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.01em;
    padding-bottom: 18px;
    border-bottom: 1px solid #ededed;
}

.krc-filter-group {
    border-bottom: 1px solid #ededed;
    padding: 20px 0;
}

.krc-filter-group-head {
    width: 100%;
    background: none;
    border: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 17px;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    letter-spacing: -0.01em;
}

.krc-filter-group-head svg {
    transition: transform 0.2s ease;
    flex: 0 0 auto;
    color: #555;
}

.krc-filter-group.is-collapsed .krc-filter-group-head svg {
    transform: rotate(180deg);
}

.krc-filter-options {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.krc-filter-group.is-collapsed .krc-filter-options {
    display: none;
}

.krc-filter-option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    margin: 0;
    padding: 11px 12px;
    border-radius: 8px;
    user-select: none;
    transition: background 0.15s ease;
}

.krc-filter-option:hover:not(.is-checked) {
    background: #f5f7fa;
}

/* 체크된 옵션 행 활성 배경 */
.krc-filter-option.is-checked {
    background: #e9f1fc;
}

.krc-filter-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.krc-checkbox {
    width: 20px;
    height: 20px;
    border: 1.5px solid #cfcfcf;
    border-radius: 4px;
    flex: 0 0 20px;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.krc-filter-option:hover .krc-checkbox {
    border-color: #0d2845;
}

.krc-filter-option input:checked + .krc-checkbox {
    background: #0d2845;
    border-color: #0d2845;
}

.krc-filter-option input:checked + .krc-checkbox::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.krc-filter-option input:focus + .krc-checkbox {
    box-shadow: 0 0 0 3px rgba(13, 40, 69, 0.15);
}

.krc-filter-option-label {
    line-height: 1.3;
}

.krc-filter-empty {
    font-size: 14px;
    color: #999;
    padding: 16px 0;
}

/* ---- Toolbar (result count) ---- */
.krc-toolbar {
    position: relative;
    min-height: 28px;
    margin-bottom: 18px;
}

/* keep the existing search-count layout readable in the new column */
.krc-toolbar .popup-second-category-container-son {
    display: flex;
    align-items: center;
}

/* ---- Product grid (3-column minimal cards) ---- */
#list-product {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px 24px;
    margin-top: 18px !important;
}

.krc-pcard {
    width: 100%;
}

.krc-pcard__link {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e5e7eb;        /* 기본: 회색 테두리 */
    border-radius: 14px;
    padding: 18px;
    background: #fff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.krc-pcard__link:hover {
    border-color: #0c2546;            /* 호버: 진한 네이비 테두리 */
    box-shadow: 0 6px 18px rgba(12, 37, 70, 0.15);
}

.krc-pcard__image {
    background: #fff;
    border-radius: 10px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
    box-sizing: border-box;
}

.krc-pcard__link:hover .krc-pcard__image {
    background: #fff;
}

.krc-pcard__image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.krc-pcard__body {
    padding: 18px 4px 0;
}

.krc-pcard__name {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px;
    line-height: 1.35;
    letter-spacing: -0.01em;
    word-break: break-word;
}

.krc-pcard__meta {
    font-size: 13.5px;
    color: #9b9ba2;
    margin: 0;
    line-height: 1.4;
}

/* ---- Slim pagination (덮어쓰기) ---- */
#paging.pagination {
    margin-top: 36px;
    gap: 4px;
}

#paging .page-item .page-link {
    border: 1px solid #ececef !important;
    background: #fff;
    color: #1a1a1a;
    border-radius: 6px !important;
    width: auto !important;
    min-width: 36px;
    height: 36px;
    line-height: 22px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#paging .page-item .page-link.curentPage {
    background: #fff !important;
    border-color: #cfd3da !important;
    color: #1a1a1a !important;
    font-weight: 700;
}

#paging .page-item .page-link:hover {
    background: #f7f7f9;
}

/* ---- Responsive ---- */
@media screen and (max-width: 1200px) {
    #list-product { grid-template-columns: repeat(3, 1fr); gap: 22px 18px; }
    .krc-pcard__image { padding: 22px; }
}

@media screen and (max-width: 900px) {
    .krc-list-layout {
        flex-direction: column;
        gap: 0;
        padding: 0 16px 90px;   /* 좌우 대칭 여백 */
    }
    /* 우측 여백이 남지 않도록 제품 영역과 그리드를 가로 꽉 채움 */
    .krc-product-main { width: 100%; }
    #list-product {
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
        justify-content: stretch;
        margin-top: 6px !important;   /* 결과 표시줄과 그리드 사이 여백 축소 */
    }
    /* 'N products found' 표시줄과 제품 그리드 사이 빈 여백 제거 */
    .krc-toolbar { margin-bottom: 0; min-height: 0; }

    /* ===== 필터: 하단 드로어(bottom sheet) ===== */
    /* 필터 열기 버튼 (제품 위에 표시) */
    .krc-filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin: 4px 0 18px;
        padding: 11px 18px;
        border: 1px solid #d7dbe3;
        border-radius: 10px;
        background: #fff;
        color: #1a1a1a;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
    }
    .krc-filter-toggle .krc-filter-count { color: #0d5cab; font-weight: 700; }

    /* 반투명 배경 */
    .krc-filter-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(10, 15, 25, .5);
        z-index: 2900;
        opacity: 0;
        pointer-events: none;
        transition: opacity .3s ease;
    }
    body.krc-filter-open .krc-filter-backdrop { opacity: 1; pointer-events: auto; }
    body.krc-filter-open { overflow: hidden; }

    /* 사이드바 → 하단에서 올라오는 드로어 */
    .krc-filter-sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        flex: none;
        max-height: 85vh;
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, .2);
        z-index: 3000;
        transform: translateY(100%);
        transition: transform .3s ease;
    }
    body.krc-filter-open .krc-filter-sidebar { transform: translateY(0); }

    .krc-filter-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 12px 10px;
        border-bottom: 1px solid #ededed;
        flex: 0 0 auto;
    }
    .krc-filter-drawer-title { font-size: 18px; font-weight: 700; color: #1a1a1a; }
    .krc-filter-drawer-close {
        width: 34px;
        height: 34px;
        border: 0;
        background: #f3f4f6;
        border-radius: 50%;
        font-size: 22px;
        line-height: 1;
        color: #333;
        cursor: pointer;
    }

    /* 필터 목록: 스크롤 영역 */
    .krc-filter-scroll {
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 4px 12px 6px;
    }
    /* 드로어 헤더와 중복되는 'Filter' 제목 숨김 */
    .krc-filter-scroll .krc-filter-title { display: none; }

    /* 하단 액션 바 */
    .krc-filter-drawer-actions {
        display: flex;
        gap: 10px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid #ededed;
        flex: 0 0 auto;
    }
    .krc-filter-reset {
        flex: 0 0 auto;
        padding: 13px 22px;
        border: 1px solid #d7dbe3;
        border-radius: 10px;
        background: #fff;
        color: #333;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
    }
    .krc-filter-done {
        flex: 1 1 auto;
        padding: 13px 22px;
        border: 0;
        border-radius: 10px;
        background: #0d2845;
        color: #fff;
        font-size: 15px;
        font-weight: 700;
        cursor: pointer;
    }
}

@media screen and (max-width: 560px) {
    #list-product { grid-template-columns: repeat(2, 1fr); gap: 18px 12px; }
    .krc-pcard__link { padding: 12px; }
    .krc-pcard__image { padding: 6px; }
    .krc-pcard__body { padding: 12px 2px 0; }
    .krc-pcard__name { font-size: 14px; }
    .krc-pcard__meta { font-size: 12px; }
}
