﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f5f5f0;
    color: #333;
}

.products-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    position: relative;
}

.product-card-link {
    text-decoration: none;
    color: inherit;
    display: contents;
}

.sidebar {
    display: none;
    position: absolute;
    left: -100%;
    top: 50px;
    width: auto;
    z-index: 1000;
    transition: left 0.3s ease;
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.25rem;
    height: fit-content;
}

    .sidebar.open {
        left: 0;
        display: block;
    }

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.125rem;
    position: relative;
}

    .sidebar-header span {
        font-size: 14px;
        font-weight: 600;
    }

.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
}

/*.category-item {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    transition: all 0.3s;
    gap: 0.5rem;
    background-color: #f5f5f0;
    font-weight: 600;
    font-size: 14px;
}*/

.category-item {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    gap: 0.5rem;
    background-color: #f5f5f0;
    font-weight: 600;
    font-size: 14px;
}

    .category-item:hover {
        background-color: #e5e5d8;
    }

    .category-item.active {
        background-color: #5ba15d;
        color: white;
    }


.category-count {
    font-size: 0.75rem;
    font-weight: 700;
    background-color: #e8f5e9;
    color: #5ba15d;
    min-width: 24px;
    height: 24px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}
.category-item.active .category-count {
    background-color: white;
    color: #5ba15d;
}

.main-content {
    flex: 1;
}

.products-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap:1rem 2rem;
}

.products-count span {
    font-weight: 600;
}

.view-controls {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    background-color: #f4f2ed;
    padding: 8px;
    border-radius: 10px;
}

.product-search {
    flex: 1;
    position: relative;
    order: 3;
}

    .product-search input {
        width: 100%;
        padding: 10px 16px 10px 44px;
        border: 1px solid #e5e5d8;
        border-radius: 10px;
        font-size: 14px;
        font-family: inherit;
        background-color: white;
        transition: border-color 0.3s, box-shadow 0.3s;
    }

        .product-search input:focus {
            outline: none;
            border-color: #5ba15d;
            box-shadow: 0 0 0 3px rgba(91, 161, 93, 0.1);
        }

        .product-search input::placeholder {
            color: #999;
        }

.product-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #999;
}

@media (max-width: 767px) {
    .product-search {
        order: 3;
        flex: 0 0 100%;
      
    }

    .products-header {
        flex-wrap: wrap;
    }
}

.view-btn img {
    width: 20px;
}

.view-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background-color: transparent;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

    .view-btn:hover {
        background-color: #fff;
    }

    .view-btn.active {
        background-color: #fff;
    }

.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.product-card {
    background-color: white;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

    .product-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    }

.product-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    max-height: 200px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #235c3b;
    color: white;
}

.product-info {
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.product-category {
    font-size: 11px;
    color: #888888;
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.product-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1rem;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.product-price {
    font-size: 1rem;
    font-weight: bold;
    color: #f5a623;
}

.view-btn-product {
    background-color: #5fa967;
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: auto;
    margin-right: 0;
}

    .view-btn-product:hover {
        background-color: #4a8552;
    }

.product-description {
    display: none;
    color: #888888;
    font-size: 11px;
    margin-bottom: 1rem;
}

/* Grid view - mobile: single column */
.products-grid.grid-view {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

    .products-grid.grid-view .product-card {
        display: flex;
        flex-direction: column;
    }

    .products-grid.grid-view .product-info {
        flex: 1;
    }

    .products-grid.grid-view .product-footer {
        margin-top: auto;
    }


/* List View - mobile: adjusted for small screens */
.products-grid.list-view .product-card {
    display: grid;
    grid-template-columns: 120px 1fr;
    height: max-content;
}

.products-grid.list-view .product-image-wrapper {
    aspect-ratio: unset;
    height: 100%;
    max-height: 200px;
}

    .products-grid.list-view .product-image-wrapper .organic-badge span {
        display: none;
    }

.products-grid.list-view .product-info {
    display: flex;
    flex-direction: column;

}

.products-grid.products-grid.list-view .product-footer {
    margin-top: auto;
}

.products-grid.list-view .product-description {

    display: -webkit-box;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f4f2ed;
    color: black;
    padding: 10px;
    border: 1px solid black;
    border-radius: 0.5rem;
    cursor: pointer;
    width: fit-content;
}

.arrow-icon {
    transition: transform 0.3s;
}

.filter-btn.open .arrow-icon {
    transform: rotate(180deg);
}

.close-btn {
    display: block;
    position: absolute;
    top: -10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
}


@media (min-width: 768px) {

    .product-search {
        order: 0;
        flex: 1;
        max-width: unset;
    }

    .products-layout {
        grid-template-columns: auto 1fr;
    }

    .sidebar {
        display: block;
        position: static;
        width: auto;
        z-index: auto;
        transition: none;
    }

    .filter-btn {
        display: none;
    }

  /*  .products-header {
        justify-content: start;
    }*/
    .products-header {
        display: flex;
        align-items: center;
        margin-bottom: 2rem;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .close-btn {
        display: none;
    }

    .products-grid.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    .products-grid.list-view .product-card {
        grid-template-columns: 200px 1fr;
    }

    .product-info {
        padding: 1rem;
    }
    .products-grid.list-view .product-description {
        /*    display: block;*/
        display: -webkit-box;
        -webkit-line-clamp: 3; /* number of lines */
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
}

@media (min-width: 1024px) {
    .products-grid.grid-view {
        grid-template-columns: repeat(3, 1fr);
    }
}
