/**
 * 다양한 선식 제품 섹션 전용 CSS
 * 세컨하우스 스타일 기반
 */

/* 섹션 컨테이너 */
.products.diverse-products {
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #faf8f5 0%, #f5f1eb 50%, #efebe3 100%);
}

.products.diverse-products > div:first-child {
    text-align: center;
    margin-bottom: 3rem;
}

.products.diverse-products .glowing-title {
    font-size: 2.2rem;
    color: #6b4a2e;
    margin-bottom: 1rem;
    font-weight: 700;
}

.products.diverse-products > div:first-child p {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
}

.products-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 그리드 레이아웃 */
.diverse-products-grid,
.products-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
    gap: 24px !important;
    margin-bottom: 40px;
    max-width: 100%;
    box-sizing: border-box;
}

/* PC 버전: 4열 그리드 */
@media (min-width: 1200px) {
    .diverse-products-grid,
    .products-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
        max-width: 1400px !important;
    }
}

/* 상품 카드 - 모든 페이지에서 적용되도록 강제 */
.diverse-product-card,
.products-grid .diverse-product-card,
.categories .diverse-product-card {
    background: #fff !important;
    border-radius: 12px !important;
    border: 1px solid #e8dcc8 !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    box-shadow: 0 2px 8px rgba(212, 165, 116, 0.08) !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.diverse-product-card:hover {
    box-shadow: 0 8px 24px rgba(212, 165, 116, 0.2);
    transform: translateY(-4px);
    border-color: #c49a6a;
}

.diverse-product-link,
.products-grid .diverse-product-link,
.categories .diverse-product-link {
    display: flex !important;
    flex-direction: column !important;
    text-decoration: none !important;
    color: inherit !important;
    height: 100% !important;
    min-height: 0 !important;
    width: 100% !important;
}

/* 상품 이미지 */
.diverse-product-image,
.products-grid .diverse-product-image,
.categories .diverse-product-image,
.products.diverse-products .diverse-product-image {
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 1 !important;
    max-height: 250px !important;
    height: auto !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, #f8f5f0 0%, #f2ede4 100%) !important;
    flex-shrink: 0 !important;
}

.diverse-product-image img,
.products-grid .diverse-product-image img,
.categories .diverse-product-image img,
.products.diverse-products .diverse-product-image img {
    width: 100% !important;
    height: 100% !important;
    max-height: 250px !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
    display: block !important;
}

.diverse-product-card:hover .diverse-product-image img,
.products-grid .diverse-product-card:hover .diverse-product-image img,
.categories .diverse-product-card:hover .diverse-product-image img {
    transform: scale(1.05) !important;
}

/* 찜하기 버튼 */
.diverse-wishlist-btn,
.products-grid .diverse-wishlist-btn,
.categories .diverse-wishlist-btn {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: 36px !important;
    height: 36px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid #e8dcc8 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.diverse-wishlist-btn:hover,
.products-grid .diverse-wishlist-btn:hover,
.categories .diverse-wishlist-btn:hover {
    background: #fff !important;
    border-color: #c49a6a !important;
    transform: scale(1.1) !important;
}

.diverse-wishlist-btn.active,
.products-grid .diverse-wishlist-btn.active,
.categories .diverse-wishlist-btn.active {
    background: #ff6b6b !important;
    border-color: #ff6b6b !important;
    color: #fff !important;
}

.diverse-wishlist-btn i,
.products-grid .diverse-wishlist-btn i,
.categories .diverse-wishlist-btn i {
    font-size: 16px !important;
    color: #6b4a2e !important;
}

.diverse-wishlist-btn.active i,
.products-grid .diverse-wishlist-btn.active i,
.categories .diverse-wishlist-btn.active i {
    color: #fff !important;
}

/* 상품 정보 */
.diverse-product-info,
.products-grid .diverse-product-info,
.categories .diverse-product-info {
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    flex: 1 !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

/* 상품명 */
.diverse-product-name,
.products-grid .diverse-product-name,
.categories .diverse-product-name {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #6b4a2e !important;
    line-height: 1.4 !important;
    margin-bottom: 4px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

/* 상품 요약 */
.diverse-product-summary,
.products-grid .diverse-product-summary,
.categories .diverse-product-summary {
    font-size: 13px !important;
    color: #7a5a3a !important;
    line-height: 1.5 !important;
    margin-bottom: 8px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

/* 가격 */
.diverse-product-price,
.products-grid .diverse-product-price,
.categories .diverse-product-price {
    margin-top: auto !important;
    padding-top: 12px !important;
    border-top: 1px solid #f0f0f0 !important;
    flex-shrink: 0 !important;
}

.diverse-price-original,
.products-grid .diverse-price-original,
.categories .diverse-price-original {
    display: block !important;
    font-size: 13px !important;
    color: #999 !important;
    text-decoration: line-through !important;
    margin-bottom: 4px !important;
}

.diverse-price-sale,
.products-grid .diverse-price-sale,
.categories .diverse-price-sale {
    display: block !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #6b4a2e !important;
}

/* 통계 영역 */
.diverse-product-stats,
.products-grid .diverse-product-stats,
.categories .diverse-product-stats {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    margin-top: auto !important;
    padding-top: 12px !important;
    border-top: 1px solid #f0f0f0 !important;
    flex-shrink: 0 !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
    white-space: nowrap !important;
}

.diverse-stat-item,
.products-grid .diverse-stat-item,
.categories .diverse-stat-item {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 12px !important;
    color: #7a5a3a !important;
}

.diverse-stat-item i,
.products-grid .diverse-stat-item i,
.categories .diverse-stat-item i {
    font-size: 14px !important;
    color: #c49a6a !important;
}

.diverse-stat-item span:not(:first-child),
.products-grid .diverse-stat-item span:not(:first-child),
.categories .diverse-stat-item span:not(:first-child) {
    font-weight: 600 !important;
}

/* 숫자 강조 스타일 */
.diverse-stat-number,
.products-grid .diverse-stat-number,
.categories .diverse-stat-number {
    font-weight: 700 !important;
    color: #6b4a2e !important;
    font-size: 13px !important;
}

.diverse-stat-sales .diverse-stat-number,
.products-grid .diverse-stat-sales .diverse-stat-number,
.categories .diverse-stat-sales .diverse-stat-number {
    color: #c49a6a !important;
}

.diverse-stat-review .diverse-stat-number,
.products-grid .diverse-stat-review .diverse-stat-number,
.categories .diverse-stat-review .diverse-stat-number {
    color: #ffa500 !important;
}

.diverse-stat-wishlist .diverse-stat-number,
.products-grid .diverse-stat-wishlist .diverse-stat-number,
.categories .diverse-stat-wishlist .diverse-stat-number {
    color: #ff6b6b !important;
}

.diverse-stat-view .diverse-stat-number,
.products-grid .diverse-stat-view .diverse-stat-number,
.categories .diverse-stat-view .diverse-stat-number {
    color: #4a90e2 !important;
}

.diverse-stat-sales,
.products-grid .diverse-stat-sales,
.categories .diverse-stat-sales {
    margin-left: 0 !important;
}

.diverse-stat-sales i,
.products-grid .diverse-stat-sales i,
.categories .diverse-stat-sales i {
    color: #6b4a2e !important;
}

/* PC/모바일 버전 표시 제어 */
.pc-only,
.products-grid .pc-only,
.categories .pc-only {
    display: none !important;
}

.mobile-only,
.products-grid .mobile-only,
.categories .mobile-only {
    display: flex !important;
}

/* PC 버전: 통계 순서 및 형식 */
@media (min-width: 1200px) {
    .pc-only,
    .products-grid .pc-only,
    .categories .pc-only {
        display: flex !important;
    }
    
    .mobile-only,
    .products-grid .mobile-only,
    .categories .mobile-only {
        display: none !important;
    }
    
    .diverse-product-stats,
    .products-grid .diverse-product-stats,
    .categories .diverse-product-stats {
        display: flex !important;
        flex-direction: row !important;
        gap: 20px !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
        white-space: nowrap !important;
    }
    
    /* PC 버전 누적판매 스타일 */
    .diverse-stat-sales.pc-only,
    .products-grid .diverse-stat-sales.pc-only,
    .categories .diverse-stat-sales.pc-only {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        order: 1 !important;
    }
    
    .diverse-stat-sales.pc-only .diverse-stat-label,
    .products-grid .diverse-stat-sales.pc-only .diverse-stat-label,
    .categories .diverse-stat-sales.pc-only .diverse-stat-label {
        font-size: 12px !important;
        color: #7a5a3a !important;
        font-weight: 600 !important;
    }
    
    .diverse-stat-sales.pc-only .diverse-stat-number,
    .products-grid .diverse-stat-sales.pc-only .diverse-stat-number,
    .categories .diverse-stat-sales.pc-only .diverse-stat-number {
        font-weight: 700 !important;
        color: #c49a6a !important;
    }
    
    /* PC 버전 리뷰 스타일 */
    .diverse-stat-review.pc-only,
    .products-grid .diverse-stat-review.pc-only,
    .categories .diverse-stat-review.pc-only {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        order: 2 !important;
    }
    
    .diverse-stat-review.pc-only .diverse-stat-label,
    .products-grid .diverse-stat-review.pc-only .diverse-stat-label,
    .categories .diverse-stat-review.pc-only .diverse-stat-label {
        font-size: 12px !important;
        color: #7a5a3a !important;
        font-weight: 600 !important;
    }
    
    .diverse-stat-review.pc-only .diverse-stat-number,
    .products-grid .diverse-stat-review.pc-only .diverse-stat-number,
    .categories .diverse-stat-review.pc-only .diverse-stat-number {
        font-weight: 700 !important;
        color: #ffa500 !important;
    }
    
    /* PC 버전 관심 스타일 */
    .diverse-stat-wishlist.pc-only,
    .products-grid .diverse-stat-wishlist.pc-only,
    .categories .diverse-stat-wishlist.pc-only {
        order: 3 !important;
    }
    
    .diverse-stat-wishlist.pc-only .diverse-stat-number,
    .products-grid .diverse-stat-wishlist.pc-only .diverse-stat-number,
    .categories .diverse-stat-wishlist.pc-only .diverse-stat-number {
        font-weight: 700 !important;
        color: #ff6b6b !important;
    }
    
    /* PC 버전 조회수 스타일 */
    .diverse-stat-view.pc-only,
    .products-grid .diverse-stat-view.pc-only,
    .categories .diverse-stat-view.pc-only {
        order: 4 !important;
    }
    
    .diverse-stat-view.pc-only .diverse-stat-number,
    .products-grid .diverse-stat-view.pc-only .diverse-stat-number,
    .categories .diverse-stat-view.pc-only .diverse-stat-number {
        font-weight: 700 !important;
        color: #4a90e2 !important;
    }
}

/* 빈 상품 메시지 */
.empty-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
}

.empty-products i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ddd;
}

.empty-products h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #666;
}

.empty-products p {
    font-size: 1rem;
    color: #999;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .products.diverse-products {
        padding: 2rem 0;
    }
    
    /* 모바일에서 타이틀과 상품카드 세로 배치 */
    .products.diverse-products.mobile-only > div:first-child {
        display: block !important;
        width: 100% !important;
        text-align: center;
        margin-bottom: 2rem;
    }
    
    .products.diverse-products.mobile-only .products-container {
        display: block !important;
        width: 100% !important;
    }
    
    /* 인덱스 페이지 다양한선식섹션 컨테이너만 양옆 패딩 제거 */
    .products.diverse-products .products-container {
        padding-left: 0;
        padding-right: 0;
    }
    
    .products.diverse-products .glowing-title {
        font-size: 1.8rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .products.diverse-products > div:first-child p {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .diverse-products-grid,
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* mobile-best-products-grid는 독립 클래스이므로 영향받지 않도록 */
    .mobile-best-products-grid {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
    }
    
    .diverse-product-info,
    .products-grid .diverse-product-info,
    .categories .diverse-product-info {
        padding: 12px !important;
    }
    
    .diverse-product-name,
    .products-grid .diverse-product-name,
    .categories .diverse-product-name {
        font-size: 14px !important;
    }
    
    .diverse-product-summary,
    .products-grid .diverse-product-summary,
    .categories .diverse-product-summary {
        font-size: 12px !important;
    }
    
    .diverse-price-sale,
    .products-grid .diverse-price-sale,
    .categories .diverse-price-sale {
        font-size: 16px !important;
    }
    
    .diverse-stat-item,
    .products-grid .diverse-stat-item,
    .categories .diverse-stat-item {
        font-size: 11px !important;
    }
    
    /* 모바일 버전 표시 제어 */
    .pc-only,
    .products-grid .pc-only,
    .categories .pc-only {
        display: none !important;
    }
    
    .mobile-only,
    .products-grid .mobile-only,
    .categories .mobile-only {
        display: flex !important;
    }
    
    /* 모바일 버전 통계 순서: 누적판매 → 리뷰 → 관심 (조회수 제외) */
    .diverse-product-stats,
    .products-grid .diverse-product-stats,
    .categories .diverse-product-stats {
        display: flex !important;
        flex-direction: row !important;
        gap: 12px !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
        white-space: nowrap !important;
    }
    
    .diverse-stat-sales.mobile-only,
    .products-grid .diverse-stat-sales.mobile-only,
    .categories .diverse-stat-sales.mobile-only {
        order: 1 !important;
        flex-shrink: 0 !important;
    }
    
    .diverse-stat-review.mobile-only,
    .products-grid .diverse-stat-review.mobile-only,
    .categories .diverse-stat-review.mobile-only {
        order: 2 !important;
        flex-shrink: 0 !important;
    }
    
    .diverse-stat-wishlist.mobile-only,
    .products-grid .diverse-stat-wishlist.mobile-only,
    .categories .diverse-stat-wishlist.mobile-only {
        order: 3 !important;
        flex-shrink: 0 !important;
    }
    
    /* 모바일에서 조회수 숨김 */
    .diverse-stat-view.mobile-only,
    .products-grid .diverse-stat-view.mobile-only,
    .categories .diverse-stat-view.mobile-only {
        display: none !important;
    }
}

/* 태블릿 반응형 */
@media (min-width: 769px) and (max-width: 1199px) {
    .diverse-products-grid,
    .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 20px !important;
    }
}

/* 베스트 상품 캐러셀 (모바일용) - 세로 2칸 그리드 */
.best-products-carousel {
    overflow: visible;
    position: relative;
    width: 100%;
}

.best-products-carousel .carousel-track {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    transition: none !important;
    transform: none !important;
    position: relative !important;
    height: auto !important;
}

.best-products-carousel .carousel-card,
.best-products-carousel .diverse-product-card {
    width: 100%;
    min-width: 0;
    position: relative !important;
    opacity: 1 !important;
    transform: none !important;
    display: block !important;
    height: auto !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.best-products-carousel .carousel-card.active,
.best-products-carousel .diverse-product-card.active {
    transform: none !important;
    z-index: auto;
    opacity: 1 !important;
}

.best-products-carousel .carousel-card.prev,
.best-products-carousel .carousel-card.next,
.best-products-carousel .diverse-product-card.prev,
.best-products-carousel .diverse-product-card.next {
    opacity: 1 !important;
    transform: none !important;
}

.best-products-carousel .carousel-card.far,
.best-products-carousel .diverse-product-card.far {
    opacity: 1 !important;
    transform: none !important;
}

/* 모바일 캐러셀 - 세로 2칸 그리드 강제 적용 */
@media (max-width: 768px) {
    /* main.css의 캐러셀 스타일 완전 오버라이드 */
    .products.diverse-products.mobile-only .best-products-carousel {
        padding: 0 1rem !important;
        height: auto !important;
        background: transparent !important;
        border-radius: 0 !important;
        overflow: visible !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    .products.diverse-products.mobile-only .best-products-carousel .carousel-track {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: auto !important;
        gap: 16px !important;
        transform: none !important;
        transition: none !important;
        position: relative !important;
        height: auto !important;
        width: 100% !important;
        overflow: visible !important;
        will-change: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        /* main.css의 block 스타일 오버라이드 */
        display: grid !important;
    }
    
    /* main.css의 .carousel-card 스타일 완전 오버라이드 */
    .products.diverse-products.mobile-only .best-products-carousel .carousel-card,
    .products.diverse-products.mobile-only .best-products-carousel .diverse-product-card {
        width: 100% !important;
        flex: none !important;
        min-width: 0 !important;
        max-width: none !important;
        position: relative !important;
        opacity: 1 !important;
        transform: none !important;
        display: block !important;
        height: auto !important;
        margin: 0 !important;
        background: #fff !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 8px rgba(212, 165, 116, 0.08) !important;
        border: 1px solid #e8dcc8 !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        scale: 1 !important;
        z-index: auto !important;
        /* main.css의 absolute, translateX 오버라이드 */
        position: relative !important;
        transform: none !important;
        transition: none !important;
    }
    
    .products.diverse-products.mobile-only .best-products-carousel .carousel-card.active,
    .products.diverse-products.mobile-only .best-products-carousel .diverse-product-card.active,
    .products.diverse-products.mobile-only .best-products-carousel .carousel-card.prev,
    .products.diverse-products.mobile-only .best-products-carousel .carousel-card.next,
    .products.diverse-products.mobile-only .best-products-carousel .carousel-card.far,
    .products.diverse-products.mobile-only .best-products-carousel .diverse-product-card.prev,
    .products.diverse-products.mobile-only .best-products-carousel .diverse-product-card.next,
    .products.diverse-products.mobile-only .best-products-carousel .diverse-product-card.far {
        transform: none !important;
        opacity: 1 !important;
        z-index: auto !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
    }
}

