/* Salient 테마 호환성 추가 CSS */

/* 전체 너비 강제 */
body .ceramic-product-filter {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding-left: 60px !important;
    padding-right: 60px !important;
}

/* 세라믹 제품 단일 페이지에서 대표 이미지 숨기기 */
.single-ceramic_product .post-thumbnail,
.single-ceramic_product .featured-image,
.single-ceramic_product .entry-thumbnail,
.single-ceramic_product img.wp-post-image,
.single-ceramic_product .nectar-post-grid-item-featured-img,
.single-ceramic_product article .img-wrap {
    display: none !important;
}

/* 최우선 우선순위로 Grid 강제 적용 */
body.kblog .ceramic-product-filter .products-grid,
body .ceramic-product-filter .products-grid,
.ceramic-product-filter .products-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important; /* 정확히 4칸 */
    gap: 40px !important;
    float: none !important;
    width: 100% !important;
    margin: 0 0 40px 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* 제품 아이템 강제 설정 */
body.kblog .ceramic-product-filter .product-item-link,
body .ceramic-product-filter .product-item-link,
.ceramic-product-filter .product-item-link {
    text-decoration: none !important;
    color: inherit !important;
    display: block !important;
}

body.kblog .ceramic-product-filter .product-item,
body .ceramic-product-filter .product-item,
.ceramic-product-filter .product-item {
    float: none !important;
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    list-style: none !important;
}

/* Salient의 column 클래스 간섭 방지 */
body .ceramic-product-filter .filter-content-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
}

body .ceramic-product-filter .filter-sidebar,
body .ceramic-product-filter .products-container {
    float: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    clear: none !important;
}

/* Salient의 기본 너비 제한 해제 */
.ceramic-product-filter .wpb_column,
.ceramic-product-filter .vc_column_container,
.ceramic-product-filter .vc_column-inner {
    width: 100% !important;
    padding: 0 !important;
}

/* Salient의 row 스타일 덮어쓰기 */
.ceramic-product-filter .wpb_row,
.ceramic-product-filter .vc_row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Salient의 img 스타일 초기화 */
.ceramic-product-filter .product-image {
    width: 100% !important;
    padding-top: 66.67% !important; /* 3:2 비율 */
    position: relative !important;
    background: #f5f5f5 !important;
    overflow: hidden !important;
    margin: 0 !important;
}

.ceramic-product-filter .product-image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    max-width: 100% !important;
    display: block !important;
}

/* Salient 기본 링크 스타일 방지 */
.ceramic-product-filter a {
    text-decoration: none !important;
}

.ceramic-product-filter .product-item a {
    color: inherit !important;
}

/* Salient 버튼 스타일 충돌 방지 */
.ceramic-product-filter button,
.ceramic-product-filter .pagination-button {
    font-family: inherit !important;
    line-height: normal !important;
}

/* Clearfix */
.ceramic-product-filter::after,
.filter-content-wrapper::after,
.products-grid::after {
    content: "";
    display: table;
    clear: both;
}

/* Salient의 before/after 제거 */
.ceramic-product-filter .products-grid::before {
    display: none !important;
}

/* 반응형 Grid 강제 */
@media (max-width: 1400px) {
    body .ceramic-product-filter .products-grid {
        gap: 35px !important;
    }
}

@media (max-width: 1200px) {
    body .ceramic-product-filter {
        padding-left: 40px !important;
        padding-right: 40px !important;
    }
    
    body .ceramic-product-filter .products-grid {
        grid-template-columns: repeat(3, 1fr) !important; /* 3칸으로 */
        gap: 30px !important;
    }
}

@media (max-width: 900px) {
    body .ceramic-product-filter {
        padding-left: 30px !important;
        padding-right: 30px !important;
    }
    
    body .ceramic-product-filter .products-grid {
        grid-template-columns: repeat(2, 1fr) !important; /* 2칸으로 */
        gap: 25px !important;
    }
}

@media (max-width: 768px) {
    body .ceramic-product-filter {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
    
    body .ceramic-product-filter .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
}

@media (max-width: 480px) {
    body .ceramic-product-filter {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    body .ceramic-product-filter .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
}

/* --- SEARCH RESULTS PAGE OVERRIDES --- */
body.search-results #search-results {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 40px !important;
    height: auto !important;
    position: static !important;
    margin: 40px 0 !important;
}

body.search-results #search-results .result {
    position: static !important;
    width: 100% !important;
    left: auto !important;
    top: auto !important;
    margin: 0 !important;
    background: #fff !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

body.search-results #search-results .result:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

body.search-results #search-results .result .inner-wrap {
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* Thumbnail wrapper link */
body.search-results #search-results .result .inner-wrap > a {
    display: block !important;
    width: 100% !important;
    position: relative !important;
    padding-top: 56.25% !important; /* 16:9 Aspect Ratio */
    overflow: hidden !important;
    background: #f5f5f5 !important;
    order: 1 !important; /* Image first */
}

body.search-results #search-results .result .inner-wrap > a img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
}

body.search-results #search-results .result:hover .inner-wrap > a img {
    transform: scale(1.05) !important;
}

/* Title wrapper */
body.search-results #search-results .result .inner-wrap h2.title {
    padding: 20px !important;
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    order: 2 !important; /* Title second */
}

body.search-results #search-results .result .inner-wrap h2.title a {
    color: #333 !important;
    text-decoration: none !important;
    transition: color 0.3s ease !important;
}

body.search-results #search-results .result .inner-wrap h2.title a:hover {
    color: #000 !important;
}

/* Fallback if no thumbnail is present */
body.search-results #search-results .result[data-post-thumb=""] .inner-wrap,
body.search-results #search-results .result:not([data-post-thumb="1"]) .inner-wrap {
    justify-content: center !important;
    align-items: center !important;
    min-height: 150px !important;
    background: #fafafa !important;
}

body.search-results #search-results .result[data-post-thumb=""] .inner-wrap h2.title,
body.search-results #search-results .result:not([data-post-thumb="1"]) .inner-wrap h2.title {
    text-align: center !important;
}

/* Responsive grid layouts */
@media only screen and (max-width: 1200px) {
    body.search-results #search-results {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 30px !important;
    }
}

@media only screen and (max-width: 900px) {
    body.search-results #search-results {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
}

@media only screen and (max-width: 600px) {
    body.search-results #search-results {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* 검색결과 페이지 헤더 배경색 흰색으로 변경 */
body.search-results #page-header-bg,
body.search-results #page-header-bg[data-height="250"] {
    background-color: #ffffff !important;
    background-image: none !important;
    border-bottom: 1px solid #eeeeee !important;
}

body.search-results #page-header-bg h1 {
    color: #000000 !important;
}

body.search-results #page-header-bg h1 span {
    color: #000000 !important;
}

body.search-results #page-header-bg .result-num {
    color: #666666 !important;
}

