/* Modern Compact Product Grid - 4 Columns Default */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.product-card {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure consistent height */
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgb(0 0 0 / 0.15);
    border-color: var(--primary);
}

.product-card-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.product-card .product-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.product-card .product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1.25rem;
    transition: opacity 0.3s ease;
}

.product-card .product-img-second {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1.25rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .product-img {
    opacity: 0;
}

.product-card:hover .product-img-second {
    opacity: 1;
}

/* If no second image exists, don't hide the first one on hover */
.product-card .product-img:only-child {
    opacity: 1 !important;
}

.product-card .product-info {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    /* Clean layout */
    text-align: center;
    /* Centered */
}

.product-card .product-name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* Reduced to 2 lines for cleaner look */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: auto;
    margin-bottom: 0.5rem;
}

.product-card .product-price {
    font-size: 1.35rem;
    /* Larger price */
    font-weight: 800;
    color: var(--primary);
    margin-top: auto;
    /* Push to bottom */
}


/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e2e8f0 !important;
}

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

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .product-card .product-info {
        padding: 0.875rem 1rem;
    }

    .product-card .product-name {
        font-size: 0.875rem;
    }

    .product-card .product-price {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}