/* ================================
   1. Reset & base
================================ */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Times New Roman', Times, serif; }
body { background-color: #c8e6ff; padding: 20px 0; color: #333; }
.container { max-width: 1200px; margin: 0 auto; background-color: #ffffff; box-shadow: 0 4px 10px rgba(0,0,0,0.05); border-radius: 8px; overflow: hidden; }

/* ================================
   2. Header & nav
================================ */
header { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; border-bottom: 1px solid #eee; background: #fff; }
.logo { display: flex; align-items: center; }
.logo-img { height: 48px; width: auto; display: block; }
nav { display: flex; gap: 30px; }
nav a { text-decoration: none; color: #333; font-weight: 500; font-size: 15px; transition: color 0.3s; }
nav a:hover, nav a.active { color: #d32f2f; }

/* ================================
   3. Hero banner (16:9)
================================ */
.hero-banner { width: 100%; aspect-ratio: 16 / 9; background-color: #e0e0e0; overflow: hidden; }
.hero-banner img { width: 100%; height: 100%; object-fit: cover; }

/* ================================
   4. Shop layout (sidebar + main)
================================ */
.shop-layout { display: flex; padding: 30px 40px; gap: 30px; }

/* ================================
   5. Sidebar & categories
================================ */
.sidebar { width: 220px; flex-shrink: 0; }
.sidebar-box { border: 1px solid #eee; background: #fff; padding: 15px 0; border-radius: 4px; }
.sidebar-title { font-size: 18px; font-weight: bold; padding: 0 20px 15px 20px; border-bottom: 1px solid #eee; margin-bottom: 10px; }
.category-list { list-style: none; }
.category-list li { padding: 10px 20px; cursor: pointer; color: #555; transition: all 0.2s; font-size: 16px; }
.category-list li:hover { color: #0088cc; }
.category-list li.active { background-color: #e6f7ff; color: #0077b3; border-left: 3px solid #0077b3; font-weight: bold; }

/* ================================
   6. Search bar
================================ */
.main-content { flex-grow: 1; }
.search-bar { display: flex; margin-bottom: 20px; border: 1px solid #ccc; border-radius: 4px; overflow: hidden; }
.search-bar input { flex-grow: 1; padding: 12px 15px; border: none; outline: none; font-size: 14px; }
.search-bar button { padding: 0 25px; background-color: #fca311; border: none; font-weight: bold; cursor: pointer; transition: background 0.3s; color: #fff; }
.search-bar button:hover { background-color: #e59400; }

/* ================================
   7. Product grid & cards
================================ */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }

.product-card {
    border: 1px solid #eee;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
    border-top: 3px solid transparent;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.12);
    border-top-color: #d32f2f;
}

/* Image area — edge to edge, grey bg so products pop */
.product-img-wrap {
    background-color: #f7f7f7;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1 / 1;
}
.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    cursor: zoom-in;
    display: block;
}
.product-card:hover .product-img { transform: scale(1.05); }

/* Card text area */
.product-info { padding: 14px 18px 18px 18px; display: flex; flex-direction: column; flex-grow: 1; gap: 6px; border-top: 1px solid #f0f0f0; }

/* Coloured category tags */
.product-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 4px;
    display: inline-block;
    align-self: flex-start;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.product-tag.tag-rice  { background: #e8f5e9; color: #2e7d32; }
.product-tag.tag-oil   { background: #fff8e1; color: #f57f17; }
.product-tag.tag-sugar { background: #fce4ec; color: #c62828; }
.product-tag.tag-salt  { background: #e3f2fd; color: #1565c0; }
.product-tag.tag-other { background: #f0f0f0; color: #888; }

.product-title { font-size: 15px; font-weight: 700; color: #222; text-align: left; line-height: 1.4; padding: 6px 0 2px; }
.product-desc  { font-size: 12px; color: #777; text-align: left; flex-grow: 1; line-height: 1.6; padding: 2px 0 6px; }

.no-results { grid-column: 1 / -1; text-align: center; padding: 50px; color: #888; }

/* ================================
   9. Lightbox
================================ */
.hero-banner img { cursor: default; }
.product-img { cursor: zoom-in; }

#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
#lightbox.active { display: flex; }

#lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    object-fit: contain;
}

#lightbox-close {
    position: fixed;
    top: 20px;
    right: 28px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
    z-index: 1001;
    transition: opacity 0.2s;
}
#lightbox-close:hover { opacity: 0.7; }
@media (max-width: 768px) {

    /* Header: stack logo above nav */
    header { flex-direction: column; gap: 14px; padding: 16px 20px; text-align: center; }
    nav { gap: 16px; flex-wrap: wrap; justify-content: center; }
    nav a { font-size: 14px; }

    /* Shop layout: stack vertically, tighter padding */
    .shop-layout { flex-direction: column; padding: 16px; gap: 16px; }

    /* Sidebar: full width, 2-column grid of buttons */
    .sidebar { width: 100%; }
    .sidebar-box { padding: 0; border: none; background: transparent; }
    .sidebar-title { display: none; }
    .category-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        overflow-x: unset;
        padding-bottom: 0;
    }
    .category-list li {
        padding: 10px 8px;
        white-space: nowrap;
        border-radius: 8px;
        border: 1px solid #ddd;
        background: #fff;
        font-size: 13px;
        text-align: center;
        flex-shrink: unset;
    }
    .category-list li.active {
        background-color: #0077b3;
        color: #fff;
        border-color: #0077b3;
        border-left: 1px solid #0077b3;
        font-weight: bold;
    }

    /* Product grid: exactly 2 columns on mobile */
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

    /* Slightly smaller cards on mobile */
    .product-info { padding: 10px 12px 12px; }
    .product-title { font-size: 13px; }
    .product-desc { font-size: 11px; }
}
