/* Ensure the mobile layout is correctly styled */
@media (max-width: 768px) {
    /* Navbar styles (from a previous fix) */
    .navbar {
        z-index: 1050;
    }
    .navbar-collapse {
        z-index: 1040;
    }

    /* Stack the content vertically and fix the order */
    .category-container {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        position: relative;
        z-index: 1;
    }
    
    @media (max-width: 768px) {
    /* ... other rules ... */
    
    .category-container > .sidebar {
        width: 100%;
        order: 1; /* This moves the filters to the top */
        padding: 1rem;
    }
    
    .category-container > .products-grid {
        width: 100%;
        order: 2; /* This moves the products below the filters */
        padding: 1rem;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.8rem;
    }
}
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.category-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.category-container {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding: 2rem;
    max-width: 100%;
}

.sidebar {
    flex-shrink: 0;
    width: 25%;
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.products-grid {
    flex-grow: 1;
    width: 72%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.filters h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.filter-section h4 {
    color: #34495e;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.filter-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
}

.filter-item input[type="checkbox"] {
    margin-right: 0.8rem;
    width: 16px;
    height: 16px;
    accent-color: #3498db;
}

.filter-item label {
    cursor: pointer;
    color: #555;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.filter-item label:hover {
    color: #3498db;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #666;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-container p {
    font-size: 1rem;
    color: #666;
}

.product-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.product-card a {
    text-decoration: none;
    color: inherit;
    display: block;
    padding: 1rem;
}

.product-image {
    width: 100%;
    height: 200px;
    margin-bottom: 1rem;
    border-radius: 4px;
    overflow: hidden;
}

.placeholder-image {
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.9rem;
}

.placeholder-image::before {
    content: "Product Image";
}

.product-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.product-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-details .price {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.product-details .size {
    font-size: 0.8rem;
    color: #999;
    font-weight: 600;
}

.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #666;
}

.error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #e74c3c;
}

.products-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
    padding-bottom: 2rem;
}
@media (max-width: 480px) {
    .category-container {
        padding: 0.5rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }
}