.main-content {
    padding: 40px 20px;
    min-height: 60vh;
    background-color: #f4f7f6;
}

.section-title {
    text-align: center;
    margin: 20px 0 40px;
    color: #2c3e50;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 35px;
    max-width: 1200px;
    margin: 0 auto;
}

.product-card {
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.02);
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.product-card:nth-child(1) {
    animation-delay: 0.1s;
}

.product-card:nth-child(2) {
    animation-delay: 0.2s;
}

.product-card:nth-child(3) {
    animation-delay: 0.3s;
}

.product-card:nth-child(4) {
    animation-delay: 0.4s;
}

.product-card:nth-child(5) {
    animation-delay: 0.5s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.product-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background-color: #f8f9fa;
}

.product-info {
    padding: 25px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-info h3 {
    color: #2c3e50;
    font-size: 20px;
    margin-bottom: 8px;
    font-weight: 700;
    line-height: 1.3;
}

.product-info .specs {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 4px;
}

.product-info .price {
    color: #e74c3c;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 20px;
    margin-top: auto;
    padding-top: 15px;
}

.add-to-cart {
    background: linear-gradient(135deg, #3b665b, #2c4d44);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(59, 102, 91, 0.3);
}

.add-to-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 102, 91, 0.4);
    background: linear-gradient(135deg, #2c4d44, #1e362f);
}

.add-to-cart:active {
    transform: translateY(0);
}

.image-slider {
    position: relative;
    width: calc(100% - 24px);
    margin: 12px auto 0;
    aspect-ratio: 5 / 4;
    height: auto;
    background-color: #f4f7f6;
    /* Soft gray to highlight the curved edges */
    border-radius: 16px;
    /* គេមរូបភាពកោង (Curved edges on all sides) */
    overflow: hidden;
}

.slide {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Ensures product is never cropped on any device */
    padding: 10px;
    /* Breathing room */
    box-sizing: border-box;
    mix-blend-mode: multiply;
    /* Magically makes white backgrounds invisible */
    display: none;
    animation: fadeEffect 0.5s ease-in-out;
}

.slide.active {
    display: block;
}

@keyframes fadeEffect {
    from {
        opacity: 0.4;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    color: #333;
    border: none;
    cursor: pointer;
    width: 35px;
    height: 35px;
    font-size: 16px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 0.7;
}

.image-slider:hover .slider-btn {
    opacity: 1;
}

.slider-btn:hover {
    background-color: #ffffff;
    color: #3b665b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.slider-btn.prev {
    left: 10px;
}

.slider-btn.next {
    right: 10px;
}

.color-selection {
    margin: 15px 0 20px 0;
    text-align: center;
}

.color-options {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.color-options input[type="radio"] {
    display: none;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.color-options input[type="radio"]:checked+.color-swatch {
    border-color: #3b665b;
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(59, 102, 91, 0.4);
}

.color-options input[type="radio"]:checked+.color-swatch::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid #3b665b;
    border-radius: 50%;
}

/* ========================================= */
/* Filter UI Styles                          */
/* ========================================= */
.product-filter {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin: -30px auto -20px auto;
    width: fit-content;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
}

.product-filter::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.filter-btn {
    flex-shrink: 0;
    background-color: #fff;
    border: 2px solid #3b665b;
    color: #3b665b;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.filter-btn:hover {
    background-color: #f0f5f3;
}

.filter-btn.active {
    background-color: #3b665b;
    color: #fff;
    box-shadow: 0 4px 10px rgba(59, 102, 91, 0.3);
}

/* ========================================= */
/* Mobile Responsive Layout for iOS/Android  */
/* ========================================= */
@media (max-width: 768px) {
    .main-content {
        padding: 20px 15px;
    }

    .section-title {
        font-size: 24px;
        margin-bottom: 25px;
    }

    .product-filter {
        gap: 5px;
        margin-bottom: 10px;
        margin-top: -10px;
    }

    .filter-btn {
        padding: 8px 10px;
        font-size: 13px;
    }

    .product-grid {
        grid-template-columns: 1fr;
        /* 1 column layout on mobile to prevent overflow */
        gap: 25px;
    }

    .product-img,
    .image-slider {
        height: 220px;
        /* Slightly shorter on mobile for better fit */
    }

    .product-info {
        padding: 20px 15px;
    }
}