/*
 * Product Grid Layout CSS
 * Responsive grid untuk 4 produk desktop, 2 produk mobile
 */

/* IMPORTANT: Memastikan Bootstrap grid tidak di-override */
.shop .product {
    position: relative;
}

/* Bootstrap Grid Enforcement - Pastikan 4 kolom di desktop */
@media (min-width: 992px) {
    .shop .product.col-lg-3 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .shop .product.col-md-4 {
        flex: 0 0 33.333333% !important;
        max-width: 33.333333% !important;
    }
}

@media (max-width: 767.98px) {
    .shop .product.col-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
}

/* Product Card Styling - TIDAK override Bootstrap grid */
.product {
    margin-bottom: 2rem;
}

.product .grid-inner {
    display: flex;
    flex-direction: column;
    height: 100%; /* Membuat semua card sama tinggi */
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.product .grid-inner:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

/* Image Container - Consistent Aspect Ratio */
.product-image {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
    background: #f8f9fa;
}

.product-image .fslider,
.product-image .flexslider,
.product-image .slider-wrap,
.product-image .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-image:hover img {
    transform: scale(1.03);
}

/* Product Description - Flex untuk consistent height */
.product-desc {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    text-align: center;
}

.product-title {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    min-height: 2.5rem;
}

.product-title h3 {
    font-size: 0.95rem;
    line-height: 1.3;
    margin: 0;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.product-title h3 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-title h3 a:hover {
    color: #007bff;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e74c3c;
    margin-bottom: 0.5rem;
}

.product-rating {
    font-size: 0.85rem;
    color: #f39c12;
    margin-top: auto;
}

/* Custom Spacing untuk Grid Container */
.shop.row {
    margin-left: -15px;
    margin-right: -15px;
}

.shop .product {
    padding-left: 15px;
    padding-right: 15px;
}

/* Responsive Adjustments - HANYA untuk spacing dan typography */

/* Mobile */
@media (max-width: 575.98px) {
    .product {
        margin-bottom: 1.5rem;
    }
    
    .product-title h3 {
        font-size: 0.85rem;
    }
    
    .product-desc {
        padding: 0.75rem;
    }
    
    .product-price {
        font-size: 1rem;
    }
    
    /* Spacing lebih rapat di mobile */
    .shop.row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .shop .product {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Small Tablet */
@media (min-width: 576px) and (max-width: 767.98px) {
    .product {
        margin-bottom: 1.75rem;
    }
    
    .product-title h3 {
        font-size: 0.9rem;
    }
}

/* Medium Tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
    .product {
        margin-bottom: 1.75rem;
    }
    
    .product-title h3 {
        font-size: 0.9rem;
    }
}

/* Desktop - 4 produk per baris via Bootstrap col-lg-3 */
@media (min-width: 992px) {
    .product {
        margin-bottom: 2rem;
    }
    
    .product-title h3 {
        font-size: 0.95rem;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .product-title h3 {
        font-size: 1rem;
    }
    
    .product-price {
        font-size: 1.2rem;
    }
}

/* Loading State untuk Consistent Layout */
.product-image.loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .product .grid-inner {
        background: #2c2c2c;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    
    .product .grid-inner:hover {
        box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    }
    
    .product-title h3,
    .product-title h3 a {
        color: #e0e0e0;
    }
    
    .product-title h3 a:hover {
        color: #4dabf7;
    }
    
    .product-desc {
        color: #e0e0e0;
    }
}

/* 
 * Product Grid Layout CSS - Version 3.1
 * Responsive Grid with Full Box Coverage
 */

/* Bootstrap Grid Overrides for Consistent Heights */
.shop.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.625rem; /* 10px gutter */
}

.shop .product {
    padding: 0 0.625rem 1.25rem; /* 10px horizontal, 20px bottom */
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    height: auto; /* Let content determine height */
    min-height: 420px; /* Minimum height for consistency */
}

/* Force consistent column widths with enforced layout */
.shop .product.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.shop .product.col-sm-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

@media (min-width: 768px) {
    .shop .product.col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

@media (min-width: 992px) {
    .shop .product.col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

/* Product Grid Inner Container */
.shop .product .grid-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 400px; /* Consistent minimum height */
}

/* Product Image Section - Takes most space */
.shop .product .product-image {
    flex: 1 1 auto; /* Grow to fill available space */
    min-height: 280px;
    max-height: 320px; /* Prevent too tall images */
}

/* Product Description - Fixed height */
.shop .product .product-desc {
    flex: 0 0 auto; /* Don't grow */
    height: 120px; /* Fixed height for consistency */
    min-height: 120px;
    max-height: 120px;
    overflow: hidden;
}

/* Responsive Adjustments */
@media (max-width: 575.98px) {
    /* Mobile: 2 products per row */
    .shop .product {
        min-height: 380px;
        padding-bottom: 1rem;
    }
    
    .shop .product .product-image {
        min-height: 220px;
        max-height: 260px;
    }
    
    .shop .product .product-desc {
        height: 100px;
        min-height: 100px;
        max-height: 100px;
    }
    
    .shop.row {
        margin: 0 -0.5rem;
    }
    
    .shop .product {
        padding: 0 0.5rem 1rem;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    /* Small tablets: 2 products per row */
    .shop .product {
        min-height: 400px;
    }
    
    .shop .product .product-image {
        min-height: 250px;
        max-height: 290px;
    }
    
    .shop .product .product-desc {
        height: 110px;
        min-height: 110px;
        max-height: 110px;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    /* Medium tablets: 3 products per row */
    .shop .product {
        min-height: 420px;
    }
    
    .shop .product .product-image {
        min-height: 260px;
        max-height: 300px;
    }
    
    .shop .product .product-desc {
        height: 120px;
        min-height: 120px;
        max-height: 120px;
    }
}

@media (min-width: 992px) {
    /* Desktop: 4 products per row */
    .shop .product {
        min-height: 440px;
    }
    
    .shop .product .product-image {
        min-height: 280px;
        max-height: 320px;
    }
    
    .shop .product .product-desc {
        height: 120px;
        min-height: 120px;
        max-height: 120px;
    }
}

/* Ensure Equal Heights with Flexbox */
.shop {
    display: flex;
    flex-wrap: wrap;
}

.shop .product {
    display: flex;
    flex-direction: column;
}

.shop .product .grid-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Product Title Consistency */
.shop .product .product-title {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 2.5rem;
    max-height: 4rem;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.shop .product .product-title h3 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin: 0;
    width: 100%;
}

/* Price and Rating Section */
.shop .product .product-price {
    margin-bottom: 0.25rem;
    font-weight: 600;
    font-size: 1rem;
}

.shop .product .product-rating {
    margin-bottom: 0;
    font-size: 0.85rem;
}

/* Hover Effects */
.shop .product:hover .grid-inner {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Loading State */
.shop.loading .product {
    opacity: 0.7;
    pointer-events: none;
}

/* Filter Animation */
.shop .product {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.shop .product.isotope-hidden {
    opacity: 0;
    transform: scale(0.9);
}

/* Grid Container Spacing */
.content-wrap .container {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 1200px) {
    .content-wrap .container {
        max-width: 1140px;
        margin: 0 auto;
    }
}

/* Debug Grid (remove in production) */
/* 
.shop .product {
    outline: 1px solid rgba(255,0,0,0.2);
}

.shop .product .grid-inner {
    outline: 1px solid rgba(0,255,0,0.2);
}

.shop .product .product-image {
    outline: 1px solid rgba(0,0,255,0.2);
}
*/

/* Version 3.1 - Full Box Coverage Grid */ 