/**
 * CherryTree Product Card Component Styles
 * 재사용 가능한 상품 카드 스타일 컴포넌트
 */

/* ===================================
   Variables (CherryTree Brand Colors)
   =================================== */
:root {
    --ct-primary: #f06272;
    --ct-primary-hover: #d94a5a;
    --ct-primary-light: #fff0f2;
    --ct-secondary: #6c757d;
    --ct-dark: #2c3e50;
    --ct-light: #f8f9fa;
    --ct-star: #ffc107;
    --ct-star-empty: #e0e0e0;
    --ct-shadow: rgba(0, 0, 0, 0.08);
    --ct-shadow-hover: rgba(0, 0, 0, 0.15);
    --ct-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ct-radius: 16px;
    --ct-radius-sm: 12px;
}

/* ===================================
   Product Card Container
   =================================== */
.ct-product-card {
    position: relative;
    background: #fff;
    border-radius: var(--ct-radius);
    overflow: hidden;
    box-shadow: 0 4px 20px var(--ct-shadow);
    transition: var(--ct-transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ct-product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px var(--ct-shadow-hover);
}

/* ===================================
   Product Image Section
   =================================== */
/* ===================================
   Product Image Section
   =================================== */
/* ===================================
   Product Image Section
   =================================== */
.ct-product-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* 1:1 Aspect Ratio (Robust) */
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    border-bottom: 1px solid #f0f0f0;
}

.ct-product-image-wrapper a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.ct-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensure image fills container */
    transition: var(--ct-transition);
}

.ct-product-card:hover .ct-product-image {
    transform: scale(1.05);
}

/* Bookmark Button */
.ct-bookmark-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--ct-transition);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ct-bookmark-btn:hover {
    transform: scale(1.1);
    background: #fff;
}

.ct-bookmark-btn .bookmark-icon {
    /* SVG size handled in HTML, or enforce here */
    width: 22px; 
    height: 22px;
    transition: var(--ct-transition);
}

.ct-bookmark-btn.active .bookmark-icon {
    animation: heartPop 0.3s ease-out;
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ===================================
   Product Content Section
   =================================== */
/* ===================================
   Product Content Section
   =================================== */
.ct-product-content {
    padding: 20px; /* Increased padding */
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Product Name */
.ct-product-name {
    font-size: 16px; /* Slightly larger */
    font-weight: 700;
    color: var(--ct-dark);
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 46px; /* Fixed height for 2 lines (16px * 1.4 * 2 approx 44.8) */
}

.ct-product-name a {
    color: inherit;
    text-decoration: none;
    transition: var(--ct-transition);
}

.ct-product-name a:hover {
    color: var(--ct-primary);
}

/* Rating Section */
.ct-product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.ct-rating-stars {
    display: flex;
    gap: 2px;
}

.ct-star {
    font-size: 14px;
    color: var(--ct-star-empty);
}

.ct-star.filled {
    color: var(--ct-star);
}

.ct-star.half {
    position: relative;
}

.ct-star.half::before {
    content: '\f005';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 0;
    width: 50%;
    overflow: hidden;
    color: var(--ct-star);
}

.ct-rating-count {
    font-size: 13px;
    color: #999;
    font-weight: 500;
}

/* Price Section */
.ct-product-price {
    margin-bottom: 12px;
    margin-top: auto;
}

.ct-price-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--ct-primary);
    letter-spacing: -0.5px;
}

.ct-price-suffix {
    font-size: 14px;
    font-weight: 400;
    color: #666;
}

/* ===================================
   Seller Section
   =================================== */
.ct-product-seller {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.ct-seller-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ct-seller-name {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ct-seller-name a {
    color: inherit;
    text-decoration: none;
    transition: var(--ct-transition);
}

.ct-seller-name a:hover {
    color: var(--ct-primary);
}

/* ===================================
   Product Card Grid
   =================================== */
.ct-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    padding: 16px 0;
}

@media (min-width: 576px) {
    .ct-product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .ct-product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .ct-product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1200px) {
    .ct-product-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ===================================
   Product Card Slider (Swiper)
   =================================== */
.ct-product-slider {
    position: relative;
    overflow-x: clip; /* Only hide horizontal overflow, allow vertical for shadows */
    overflow-y: visible;
    padding: 8px 0 20px 0; /* Top and bottom padding for card shadows and hover effects */
}

.ct-product-slider .swiper-slide {
    width: 220px;
    height: auto;
}

.ct-product-slider .swiper-button-prev,
.ct-product-slider .swiper-button-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transition: var(--ct-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ct-product-slider .swiper-button-prev {
    left: 0;
}

.ct-product-slider .swiper-button-next {
    right: 0;
}

/* Adjust for small screens to prevent overflow overlap */
@media (max-width: 768px) {
    .ct-product-slider .swiper-button-prev {
        left: 0;
    }
    .ct-product-slider .swiper-button-next {
        right: 0;
    }
}

.ct-product-slider .swiper-button-prev:hover,
.ct-product-slider .swiper-button-next:hover {
    background: var(--ct-primary);
}

.ct-product-slider .swiper-button-prev::after,
.ct-product-slider .swiper-button-next::after {
    display: none; /* Hide default swiper arrows if any */
}

.ct-product-slider .swiper-button-prev .nav-icon,
.ct-product-slider .swiper-button-next .nav-icon {
    font-size: 16px;
    color: var(--ct-dark);
    transition: var(--ct-transition);
}

.ct-product-slider .swiper-button-prev:hover .nav-icon,
.ct-product-slider .swiper-button-next:hover .nav-icon {
    color: #fff;
}

/* Pagination - Premium Glassmorphism Style */
.ct-product-slider .swiper-pagination {
    position: static;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.ct-product-slider .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: rgba(0, 0, 0, 0.12);
    opacity: 1;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50px;
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
}

.ct-product-slider .swiper-pagination-bullet::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: linear-gradient(135deg, var(--ct-primary), var(--ct-primary-hover));
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ct-product-slider .swiper-pagination-bullet:hover {
    background: rgba(240, 98, 114, 0.25);
    transform: scale(1.15);
}

.ct-product-slider .swiper-pagination-bullet-active {
    width: 28px;
    background: linear-gradient(135deg, var(--ct-primary), var(--ct-primary-hover));
    box-shadow: 0 3px 12px rgba(240, 98, 114, 0.45);
}

.ct-product-slider .swiper-pagination-bullet-active::before {
    width: 100%;
    height: 100%;
}

/* ===================================
   Skeleton Loading State
   =================================== */
.ct-product-card.skeleton {
    pointer-events: none;
}

.ct-product-card.skeleton .ct-product-image-wrapper,
.ct-product-card.skeleton .ct-product-name,
.ct-product-card.skeleton .ct-product-rating,
.ct-product-card.skeleton .ct-product-price,
.ct-product-card.skeleton .ct-seller-avatar,
.ct-product-card.skeleton .ct-seller-name {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.ct-product-card.skeleton .ct-product-name {
    height: 42px;
    width: 100%;
}

.ct-product-card.skeleton .ct-product-rating {
    height: 20px;
    width: 120px;
}

.ct-product-card.skeleton .ct-product-price {
    height: 24px;
    width: 100px;
}

.ct-product-card.skeleton .ct-seller-avatar {
    width: 32px;
    height: 32px;
}

.ct-product-card.skeleton .ct-seller-name {
    height: 16px;
    width: 80px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
