/* 카테고리 페이지 전체 레이아웃 */
.category-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 40px;
}

/* 카테고리 타이틀 */
.category-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 40px;
    color: #000;
}

/* 카테고리 탭 버튼들 */
.category-tabs {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 1px solid #E0E0E0;
}

.category-tab {
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #999;
    transition: color 0.3s ease;
    font-weight: 400;
    position: relative;
    text-decoration: none;
}

.category-tab:hover {
    color: #000;
}

.category-tab.active {
    color: #000;
    font-weight: 700;
}

.category-tab.active::after {
    content: '';
    position: absolute;
    bottom: -31px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #000;
}

/* 정렬 옵션 바 - 상단 breadcrumb */
.sort-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    font-size: 12px;
    color: #999;
}

.sort-bar .sort-option {
    cursor: pointer;
    transition: color 0.3s;
    text-decoration: none;
    color: #999;
}

.sort-bar .sort-option:hover {
    color: #333;
}

.sort-bar .sort-option.active {
    color: #333;
    font-weight: 500;
}

.sort-bar .divider {
    color: #ddd;
    cursor: default;
}

/* 메인 컨텐츠 래퍼 */
.content-wrapper {
    display: flex;
    gap: 40px;
}

/* ========== 왼쪽 필터 사이드바 ========== */
.filter-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.filter-container {
    background-color: #fff;
    border: 1px solid #E5E5E5;
    border-radius: 20px;
    padding: 30px 25px;
}

.filter-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #E5E5E5;
}

.filter-title {
    font-size: 18px;
    font-weight: 700;
    color: #000;
    margin: 0;
}

.filter-toggle-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-toggle-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.filter-group {
    margin-bottom: 0;
    border-bottom: none;
}

.filter-group:last-of-type {
    border-bottom: 1px solid #E5E5E5;
    padding-bottom: 0;
}

.filter-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    font-size: 15px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    user-select: none;
}

.filter-header:hover {
    color: #000;
}

.filter-arrow-icon {
    width: 8px;
    height: 14px;
    opacity: 0.5;
    transition: transform 0.3s;
}

.filter-group.open .filter-arrow-icon {
    transform: rotate(90deg);
}

/* 필터 내용 */
.filter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 5px;
}

.filter-group.open .filter-content {
    padding-bottom: 15px;
}

/* 필터 체크박스 */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
    color: #555;
}

.filter-checkbox:hover {
    color: #000;
}

.filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: rgba(100, 136, 118, 1);
    cursor: pointer;
}

.filter-checkbox span {
    flex: 1;
}

/* 필터 버튼 그룹 */
.filter-buttons {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

/* 필터 초기화 버튼 */
.filter-reset-btn {
    flex: 1;
    padding: 14px 0;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #666;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-reset-btn:hover {
    border-color: #333;
    color: #333;
}

/* 필터 적용 버튼 */
.filter-apply-btn {
    flex: 1;
    padding: 14px 0;
    border: none;
    background-color: rgba(0, 0, 0, 1);
    color: #fff;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

/* ========== 오른쪽 제품 섹션 ========== */
.product-section {
    flex: 1;
}

/* 제품 그리드 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px 30px;
    margin-bottom: 50px;
}

/* 제품 카드 링크 */
.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
}

/* 제품 카드 */
.product-card {
    background: white;
    cursor: pointer;
    transition: transform 0.3s;
    width: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
}

/* 제품 이미지 */
.product-img {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 1:1 비율 유지 */
    background-color: #f5f5f5;
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 12px;
}

.product-img img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

.placeholder-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #E0E0E0;
}

/* 상품 뱃지 */
.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background-color: #ff6b6b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* 제품 정보 */
.product-info {
    padding: 0;
}

.product-name {
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.product-rating {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.stars {
    display: inline-flex;
    margin-right: 6px;
}

.star-icon {
    color: #FFD700;
    font-size: 14px;
    line-height: 1;
}

.star-icon.filled {
    color: #FFD700;
}

.star-icon.half {
    position: relative;
    color: #E0E0E0;
}

.star-icon.half::before {
    content: '★';
    position: absolute;
    left: 0;
    color: #FFD700;
    width: 50%;
    overflow: hidden;
}

.rating-score {
    font-size: 13px;
    color: #666;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: #000;
}

/* 가격 섹션 */
.product-price-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.current-price {
    font-size: 15px;
    font-weight: 400;
    color: #000;
}

.original-price {
    font-size: 14px;
    font-weight: 400;
    color: #999;
    text-decoration: line-through;
}

.discount-rate {
    font-size: 14px;
    font-weight: 500;
    color: #FF0000;
    background-color: #FFE5E5;
    padding: 4px 12px;
    border-radius: 20px;
}

/* 상품 리뷰 별점 */
.product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.product-rating .stars {
    display: flex;
    gap: 1px;
}

.product-rating .star {
    font-size: 12px;
    color: #ddd;
}

.product-rating .star.filled {
    color: #FFD700;
}

.product-rating .review-count {
    font-size: 11px;
    color: #999;
}

.product-rating .rating-score {
    font-size: 11px;
    color: #999;
}

/* ========== 페이지네이션 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 50px;
    padding-top: 30px;
}

.page-arrow,
.page-number,
.page-dots {
    padding: 8px 12px;
    font-size: 14px;
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.page-arrow:hover,
.page-number:hover {
    color: #000;
}

.page-number.active {
    color: #000;
    font-weight: 700;
}

.page-dots {
    cursor: default;
}

.page-arrow.disabled {
    color: #ccc;
    cursor: default;
    pointer-events: none;
}

/* ========== 모바일 카테고리 헤더 (기본 숨김) ========== */
.mobile-category-header {
    display: none;
}

/* ========== 반응형 디자인 ========== */
@media (max-width: 1024px) {
    .content-wrapper {
        flex-direction: column;
    }

    /* 1024px 이하에서 필터 숨기기 (모바일 필터 버튼으로 대체) */
    .filter-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        z-index: 1000;
        padding: 60px 20px 20px;
        overflow-y: auto;
        width: 100%;
        margin-bottom: 0;
    }

    .filter-sidebar.mobile-open {
        display: block;
    }

    .mobile-filter-close {
        display: none;
        position: fixed;
        top: 16px;
        right: 16px;
        background: #fff;
        border: none;
        font-size: 32px;
        cursor: pointer;
        color: #333;
        z-index: 1001;
        width: 40px;
        height: 40px;
        line-height: 1;
    }

    .filter-sidebar.mobile-open .mobile-filter-close {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 모바일 카테고리 헤더 표시 */
    .mobile-category-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 0;
        border-bottom: 1px solid #e5e5e5;
        margin-bottom: 16px;
    }

    .mobile-category-title {
        display: flex;
        align-items: baseline;
        gap: 8px;
    }

    .mobile-category-label {
        font-size: 20px;
        font-weight: 700;
        color: #000;
    }

    .mobile-category-name {
        font-size: 14px;
        font-weight: 400;
        color: #666;
    }

    .mobile-filter-btn {
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
    }

    .mobile-filter-btn img {
        width: 20px;
        height: 20px;
    }

    /* PC용 타이틀 숨김 */
    .category-title {
        display: none;
    }

    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .category-tabs {
        gap: 40px;
    }
}

@media (max-width: 900px) {
    /* 카테고리 페이지 하단 네비게이션 공간 확보 */
    .category-page {
        padding: 30px 16px 100px;
    }

    /* 카테고리 타이틀 모바일 스타일 */
    .category-title {
        font-size: 22px;
        margin-bottom: 30px;
    }

    /* 카테고리 탭 모바일 스타일 */
    .category-tabs {
        gap: 24px;
        margin-bottom: 30px;
        padding-bottom: 20px;
        overflow-x: auto;
        justify-content: flex-start;
        padding-left: 4px;
    }

    .category-tab {
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .category-tab.active::after {
        bottom: -21px;
    }

    /* 필터 사이드바 숨기기 */
    .filter-sidebar {
        display: none;
    }

    /* 정렬 옵션 바 숨기기 */
    .sort-bar {
        display: none;
    }

    /* 별점 숨기기 */
    .product-rating {
        display: none;
    }

    /* 상품 그리드 2열 */
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 30px 16px;
    }

    /* 가격 섹션 모바일 조정 */
    .current-price {
        font-size: 15px;
    }

    .original-price {
        font-size: 13px;
    }

    .discount-rate {
        font-size: 13px;
        padding: 3px 10px;
    }

    /* 상품 이름 */
    .product-name {
        font-size: 14px;
        font-weight: 700;
    }

    .current-price {
        font-size: 14px;
        font-weight: 400;
    }
}

@media (max-width: 900px) {
    .category-page {
        padding: 20px 16px 100px;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px 12px;
    }

    .category-title {
        font-size: 20px;
    }

    .category-tabs {
        gap: 20px;
    }

    .category-tab {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .category-page {
        padding: 16px 12px 100px;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 10px;
    }

    .category-tabs {
        gap: 16px;
    }

    .category-tab {
        font-size: 12px;
    }

    .content-wrapper {
        gap: 20px;
    }

    .pagination {
        gap: 5px;
    }

    .page-arrow,
    .page-number {
        padding: 6px 10px;
        font-size: 13px;
    }
}

@media (max-width: 900px) {
    /* 모바일 카테고리 탭 스타일 */
    .category-tabs {
        display: flex;
        justify-content: flex-start;
        gap: 20px;
        margin-bottom: 20px;
        padding: 12px 0;
        border-bottom: 1px solid #e5e5e5;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* 스크롤바 숨기기 */
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .category-tabs::-webkit-scrollbar {
        display: none;
    }

    .category-tab {
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
        padding: 8px 0;
    }

    .category-tab.active::after {
        bottom: -13px;
    }

    /* 모바일에서 필터 컨테이너 */
    .filter-sidebar.mobile-open .filter-container {
        width: 100%;
    }

    .filter-sidebar.mobile-open .filter-title-wrapper {
        margin-bottom: 20px;
    }

    /* 상품 섹션 전체 너비 */
    .product-section {
        width: 100%;
    }

    .category-page {
        padding: 20px 16px;
    }
}
