/* =========================================================
   1. Category Page Main Layout
   ========================================================= */

.main-content {
    width: 90%;
    max-width: 1400px; /* Max width for large desktops */
    margin: 40px auto;
    padding: 0 15px;
}

.category-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.category-header h1 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 10px;
}


/* =========================================================
   2. Product Grid (Desktop First)
   ========================================================= */

.product-grid {
    display: grid;
    /* Desktop: 4 columns */
    grid-template-columns: repeat(4, 1fr);
    gap: 30px; /* Space between cards */
    margin-top: 30px;
}

/* =========================================================
   3. Product Card Styling (Shared)
   ========================================================= */

.product-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.product-card h4 {
    font-size: 1.1em;
    color: #000;
    margin: 10px 0 5px;
    height: 3.5em; /* Ensure uniform height for product titles */
    overflow: hidden;
}

.product-card p {
    font-size: 1.3em;
    color: #c0392b; /* Highlight price */
    font-weight: bold;
    margin-top: 5px;
}

.product-image-wrapper {
    width: 100%;
    /* Maintain a 1:1 aspect ratio for images */
    padding-top: 100%; 
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

.product-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures image covers the area without distortion */
    transition: opacity 0.3s;
}

/* Price & Discount Group */
.price-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.strikethrough-price {
    color: #999;
    text-decoration: line-through;
    font-size: 0.9em;
    font-weight: normal;
}

.product-price {
    color: #c0392b;
    font-size: 1.2em;
    font-weight: bold;
}

/* Action Buttons */
.product-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.add-to-cart-btn, .buy-now-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s;
}

.add-to-cart-btn {
    background-color: #3498db; /* Blue for Add to Cart */
    color: white;
}

.add-to-cart-btn:hover {
    background-color: #2980b9;
}

.buy-now-btn {
    background-color: #2ecc71; /* Green for Buy Now */
    color: white;
}

.buy-now-btn:hover {
    background-color: #27ae60;
}

/* =========================================================
   4. Responsive Adjustments (Mobile/Tablet)
   ========================================================= */

/* Tablet (3 columns) */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* Large Mobile (2 columns) */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .category-header h1 {
        font-size: 2em;
    }
}

/* Small Mobile (1 column) */
@media (max-width: 480px) {
    .main-content {
        width: 100%;
        margin: 20px auto;
        padding: 0 10px;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}