.subcategory-grid-container {
    margin-bottom: 20px; /* Add some space below the grid */
}
.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 columns */
    gap: 15px; /* Space between items */
    margin-bottom: 15px;
}

.subcategory-item {
    /* Ensure items align nicely if names wrap */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.subcategory-item a {
    display: block; /* Make the whole area clickable */
    text-decoration: none;
    color: #333; /* Or your theme's default link color */
}
.subcategory-item a:hover {
    color: #222; /* Darker on hover */
    text-decoration: none;
}


.subcategory-item img {
    margin-bottom: 8px;
    max-width: 100%; /* Ensure image fits */
    height: auto; /* Maintain aspect ratio */
    border: 1px solid #ddd; /* Optional border */
    padding: 2px;
    /* Ensure image size is constrained if needed, matching resize */
    width: 200px;
    height: 200px;
    object-fit: contain; /* Or 'cover', depending on desired look */
}

.subcategory-item p {
    margin-bottom: 0;
    font-size: 13px;
    font-weight: bold;
    line-height: 1.3; /* Adjust for readability */
}

/* Responsive adjustments */
@media (max-width: 1200px) { /* Adjust breakpoint if needed */
    .subcategory-grid {
        grid-template-columns: repeat(4, 1fr); /* 4 columns */
    }
}

@media (max-width: 992px) { /* Medium devices (tablets, less than 992px) */
    .subcategory-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 columns */
    }
     .subcategory-item img {
        width: 150px; /* Adjust image size for smaller screens */
        height: 150px;
    }
}

@media (max-width: 768px) { /* Small devices (landscape phones, less than 768px) */
    .subcategory-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 columns */
        gap: 10px;
    }
     .subcategory-item img {
        width: 120px;
        height: 120px;
    }
     .subcategory-item p {
       font-size: 12px;
    }
}

@media (max-width: 576px) { /* Extra small devices (portrait phones, less than 576px) */
    .subcategory-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns */
        gap: 10px;
    }
     .subcategory-item img {
        width: 100px;
        height: 100px;
    }
}
