
/* ==============================================
   JPARTS Top-Down Category Navigation
   ============================================== */

.jp-category-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;

    width: 100%;
    max-width: 100%;
    min-width: 0;

    margin: 0 0 20px;
    padding: 12px 16px;

    background: #ffffff;
    border: 1px solid #d9e2e8;
    border-radius: 6px;

    box-sizing: border-box;
}

/* 카테고리 제목 */

.jp-category-nav__heading {
    flex: 0 0 auto;

    color: #172b3a;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

/* 드롭다운 영역 */

.jp-category-nav__controls {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 10px;

    min-width: 0;
}

/* 1차 / 2차 카테고리 공통 */

.jp-category-nav__controls select {
    flex: 1 1 180px;

    width: auto;
    min-width: 130px;
    max-width: 320px;
    height: 40px;

    padding: 0 34px 0 12px;

    background-color: #ffffff;
    color: #172b3a;

    border: 1px solid #cbd5e1;
    border-radius: 5px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 500;

    box-sizing: border-box;
    cursor: pointer;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

/* 마우스를 올렸을 때 */

.jp-category-nav__controls select:hover:not(:disabled) {
    border-color: #28627a;
    background-color: #f5fafc;
}

/* 선택창 활성화 */

.jp-category-nav__controls select:focus {
    outline: none;
    border-color: #28627a;
    box-shadow: 0 0 0 3px rgba(40, 98, 122, 0.12);
}

/* 비활성 카테고리 */

.jp-category-nav__controls select:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* 카테고리 사이 화살표 */

.jp-category-nav__arrow {
    flex: 0 0 auto;
    color: #94a3b8;
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

/* 내부 데이터용 선택창은 화면에 표시하지 않음 */

.jp-category-nav #jp-category-source {
    display: none !important;
}

/* 기존 이동 버튼이 남아 있을 경우 숨김 */

.jp-category-nav #jp-category-go {
    display: none;
}

/* ==============================================
   Product Detail
   ============================================== */

.product-detail-page > .breadcrumb-bar {
    margin-bottom: 12px;
}

.product-detail-page > .jp-category-nav {
    margin-bottom: 24px;
}

/* ==============================================
   Tablet
   ============================================== */

@media (max-width: 900px) {
    .jp-category-nav {
        gap: 10px;
        padding: 12px;
    }

    .jp-category-nav__heading {
        width: 100%;
    }

    .jp-category-nav__controls select {
        flex: 1 1 160px;
        max-width: none;
    }
}

/* ==============================================
   Mobile
   ============================================== */

@media (max-width: 600px) {
    .jp-category-nav {
        padding: 10px;
        margin-bottom: 16px;
    }

    .jp-category-nav__controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }

    .jp-category-nav__controls select {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        max-width: none;
        height: 42px;
    }

    .jp-category-nav__arrow {
        display: none;
    }
}

/* Mobile-only overrides; formerly in base.html */
/* 모바일 계층형 카테고리 전체 영역 */
        .mobile-category-shortcut {
            width: 100%;
            margin: 0 0 10px;
        }

        .mobile-shortcut-collapse {
            width: 100%;
            min-width: 0;
        }

        /* 접기 / 펼치기 제목 */
        .mobile-shortcut-collapse > summary {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 8px 4px 10px;
            cursor: pointer;
            list-style: none;
            color: #102b46;
            font-size: 15px;
            font-weight: 700;
        }

        .mobile-shortcut-collapse > summary::-webkit-details-marker {
            display: none;
        }

        .mobile-shortcut-collapse > summary::marker {
            content: "";
        }

        .mobile-shortcut-collapse .fold-hint {
            color: #2d647c;
            font-size: 12px;
            font-weight: 600;
            white-space: nowrap;
        }

        .mobile-shortcut-collapse[open] .fold-closed,
        .mobile-shortcut-collapse:not([open]) .fold-open {
            display: none;
        }

        /* 기존 PC 카테고리 UI 재사용 */
        .mobile-shortcut-collapse > .jp-category-nav {
            width: 100%;
            min-width: 0;
            margin: 0;
            padding: 10px;
            border: 1px solid #dbe3ef;
            border-radius: 11px;
            background: #ffffff;
            box-sizing: border-box;
        }

        /* 제목은 summary에서 한 번만 표시 */
        .mobile-shortcut-collapse .jp-category-nav__heading {
            display: none;
        }

        .mobile-shortcut-collapse .jp-category-nav__controls {
            min-width: 0;
        }

        .mobile-shortcut-collapse .jp-category-nav__controls select {
            min-width: 0;
        }

        .mobile-shortcut-collapse > summary:focus-visible {
            outline: 2px solid #28627a;
            outline-offset: 3px;
            border-radius: 6px;
        }

        /* 스마트폰: 카테고리 두 개를 가로 한 줄에 표시 */
        @media (max-width: 600px) {
            .mobile-category-shortcut {
                margin-bottom: 8px;
            }

            .mobile-shortcut-collapse > summary {
                padding: 6px 4px 8px;
                font-size: 14px;
            }

            .mobile-shortcut-collapse > .jp-category-nav {
                padding: 8px;
                border-radius: 10px;
            }

            .mobile-shortcut-collapse .jp-category-nav__controls {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 6px;
                width: 100%;
                align-items: center;
            }

            .mobile-shortcut-collapse .jp-category-nav__controls select {
                flex: none;
                width: 100%;
                min-width: 0;
                max-width: 100%;
                height: 38px;
                padding: 0 22px 0 8px;
                font-size: 12px;
                border-radius: 6px;
            }

            /* 모바일에서는 단계 구분 화살표 숨김 */
            .mobile-shortcut-collapse .jp-category-nav__arrow {
                display: none;
            }
        }

        /* JPARTS 모바일 공식 로고 */
        .site-header .brand {
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 0;
        }

        .site-header .mobile-brand-logo {
            display: block;
            width: auto;
            height: 32px;
            max-width: 150px;
            object-fit: contain;
        }
