/* 1. RESET & BASE */
*, *::before, *::after { 
    box-sizing: border-box; 
}

body { 
    background-color: #fff; 
    font-family: system-ui, -apple-system, sans-serif; 
    color: #333; 
    line-height: 1.3; 
    margin: 0;
}

/* 2. GRID SYSTEM & CONTAINERS */
#product-container { 
    display: grid !important; /* Use !important to override Bootstrap flex */
    grid-template-columns: repeat(2, minmax(0, 1fr)); 
    gap: 10px;
    margin: 0;
    width: 100%;
}

#product-container.product-grid { 
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)); 
    gap: 10px;
    margin-top: 20px;
}

/* Tablet: 3 per row */
@media (min-width: 768px) {
    #product-container.product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* Desktop: 5 per row */
@media (min-width: 992px) {
    #product-container.product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 15px; 
    }
}

/* Ensure the product wrapper doesn't force full width */
.col-product {
    width: auto !important;
    height: 100%;
}

/* 3. HEADER & NAVIGATION */
.header { display:flex; align-items:center; justify-content:space-between; padding: 4px 12px; }

.header-slogan { display: flex; flex-direction: column; justify-content: center; margin-left: 10px; text-align: right; line-height: 1.1; }
.header-slogan span:first-child { font-size: 0.75rem; font-weight: 700; color: #333; }

.category-icons { 
    display: flex; 
    justify-content: space-around; 
    margin-bottom: 20px; 
    padding: 12px 0; 
    border-bottom: 1px solid #eee; 
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.category-icons a { 
    text-decoration: none; 
    color: #444; 
    text-align: center; 
    flex: 1; 
    font-size: 0.6rem; 
    font-weight: 700; 
    display: flex; 
    flex-direction: column; 
    align-items: center;
    min-width: 60px;
}

.category-icons svg { 
    width: 24px; 
    height: 24px; 
    fill: #444; 
    margin-bottom: 5px; 
}

h1.collection-header { 
    display: block;
    font-size: 0.85rem;      /* Small but legible */
    font-weight: 700;        /* Bold for hierarchy */
    text-transform: uppercase; 
    color: #777;             /* Muted color to keep focus on products */
    margin: 10px 0 5px 5px;  /* Minimal space around the text */
    padding: 0;              /* Remove padding to save vertical height */
    letter-spacing: 0.05em;
    border: none;            /* Remove borders to reduce visual "weight" */
    background: transparent; /* Blends into the page background */
}

/* 5. PRODUCT CARDS */
.card { 
    border: 1px solid #eee; 
    border-radius: 4px; 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    background: #fff;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card img { 
    width: 100%; 
    height: auto; 
    aspect-ratio: 330 / 206; 
    object-fit: cover; 
    display: block;
    background: #fdfdfd; 
}

.card-body { 
    padding: 8px; 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; 
}

.brand-price-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    gap: 8px; 
    margin-top: auto; 
}

.brand-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.72rem;
}

.price-text { 
    font-size: 0.9rem; 
    font-weight: 800; 
    color: #b02a37; 
    white-space: nowrap; 
}

/* ==========================================================================
   Framework-Free 390px Mobile Optimization 
   ========================================================================== */

@media (max-width: 390px) {
    /* 1. Reclaim horizontal screen space by dropping side padding */
    .header {
        padding-left: 4px !important;
        padding-right: 4px !important;
        gap: 4px !important; /* Keep logo and text close */
    }

    /* 2. Scale down the text stack elements dynamically to prevent dropping down */
    .header-slogan {
        margin-left: 4px !important; /* Bring text closer to the logo */
    }

    .header-slogan span:first-child {
        font-size: 8.5px !important; /* "Largest Furniture Store Since 1943" */
        white-space: nowrap !important;
        letter-spacing: -0.1px !important;
    }

    /* Target your red 5% guarantee box on mobile if you kept the markup */
    .header-guarantee {
        font-size: 9.5px !important;
        white-space: nowrap !important;
        letter-spacing: -0.1px !important;
    }
}