/* Universal Box Sizing and Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    margin: 0;
    padding: 0;
}

header {
    text-align: center;
    background-color: #fff;
    padding: 20px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 30px;
}

main {
    display: flex;
    gap: 30px;
    padding: 0 30px;
    max-width: 1400px;
    margin: 0 auto;
}

#filter-controls {
    width: 250px;
    flex-shrink: 0;
    background-color: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    height: fit-content;
}

.filter-group {
    margin-bottom: 25px;
}
.filter-group h3, .filter-group label {
    margin-bottom: 10px;
}
.filter-group label {
    display: block;
    font-weight: normal;
}

select, input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#product-list {
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.product-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #eee;
}

.product-info {
    padding: 15px;
}

.product-info h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.product-info .category {
    font-size: 0.9em;
    color: #777;
    margin-bottom: 10px;
}

.product-info .price {
    font-size: 1.2em;
    font-weight: bold;
    color: #0056b3;
}

/* Class to hide products */
.hidden {
    display: none;
}
/* =================================================================
   Responsive Design for Mobile and Tablets
   ================================================================= */

/* This rule applies to any screen with a width of 768px or less */
@media (max-width: 768px) {
    body {
        /* Reduce the base font size slightly on mobile for better readability */
        font-size: 15px; 
    }

    header {
        /* Reduce padding on the header to save vertical space */
        padding: 15px;
    }
    
    header h1 {
        /* Make the main heading a bit smaller */
        font-size: 1.8em;
    }

    main {
        /* Change the layout from a row to a stacked column */
        flex-direction: column;
        /* Adjust side padding */
        padding: 0 15px;
    }

    #filter-controls {
        /* Allow the filter section to take up the full width */
        width: 100%;
        margin-bottom: 25px; /* Add a little more space between filters and products */
    }

    #product-list {
        width: 100%;
    }
}

/* This is an extra rule for very small screens (phones) */
@media (max-width: 480px) {
    #product-list {
        /* Force a single column of products for better readability */
        grid-template-columns: 1fr;
    }
    
    .product-info {
        /* Reduce padding inside the product cards on small screens */
        padding: 10px;
    }
}
