/* Products Page Styles */

/* General Layout */
body {
    background-color: #f8f9fa;
    /* Light grey background */
    margin: 0;
    font-family: 'Poppins', sans-serif;
}

/* Top Bar */
.top-bar {
    background: #6a00f4;
    /* Brand Primary */
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-back-home {
    color: #fff;
    font-size: 20px;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.btn-back-home:hover {
    opacity: 1;
}

/* Header & Search */
.products-header {
    background: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.search-bar {
    flex-grow: 1;
    position: relative;
    max-width: 600px;
}

.search-bar input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border-radius: 30px;
    border: 1px solid #e1e1e1;
    background: #f8f9fa;
    outline: none;
    transition: all 0.3s;
}

.search-bar input:focus {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #9d4edd;
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.filter-toggle-btn {
    background: #fff;
    border: 1px solid #e1e1e1;
    color: #333;
    padding: 10px 18px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.filter-toggle-btn:hover,
.filter-toggle-btn.active {
    background: #f0f0f0;
    border-color: #ccc;
}

/* Category Strip (Squares) */
.category-strip {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 20px;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE */
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.category-strip::-webkit-scrollbar {
    display: none;
}

.category-square {
    flex: 0 0 auto;
    width: 100px;
    /* Reduced specific size logic to match "square" with text below if needed, or just pill buttons logic requested? Design said "Squares" */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.category-square:hover {
    transform: translateY(-2px);
}

.category-img-box {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    /* Rounded Edges Square */
    background: #f0f0f0;
    overflow: hidden;
    position: relative;
    border: 2px solid transparent;
    /* Selection borders */
    transition: all 0.3s;
}

.category-square.active .category-img-box {
    border-color: #9d4edd;
    box-shadow: 0 4px 12px rgba(157, 78, 221, 0.3);
}

.category-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-name {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.category-square.active .category-name {
    color: #9d4edd;
    font-weight: 700;
}

/* Subcategory Strip (Pills) */
.subcategory-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 15px 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: #fff;
    /* Or light grey? Keeps sticky feel */
}

.subcategory-strip::-webkit-scrollbar {
    display: none;
}

.subcategory-pill {
    flex: 0 0 auto;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 25px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.subcategory-pill:hover {
    background: #f8f9fa;
    border-color: #ddd;
}

.subcategory-pill.active {
    background: #9d4edd;
    color: #fff;
    border-color: #9d4edd;
    box-shadow: 0 4px 10px rgba(157, 78, 221, 0.3);
}

/* Main Layout: Sidebar + Grid */
.products-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Filter Sidebar */
.filter-sidebar {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 90px;
}

.filter-group {
    margin-bottom: 25px;
}

.filter-title {
    font-weight: 600;
    margin-bottom: 15px;
    display: block;
    color: #333;
}

.filter-option {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
}

.filter-option input {
    margin-right: 10px;
    accent-color: #9d4edd;
}

.price-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.price-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.apply-btn {
    width: 100%;
    background: #9d4edd;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

.clear-btn {
    width: 100%;
    background: none;
    border: 1px solid #ddd;
    color: #666;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Product Card */
.product-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    border: 1px solid #f0f0f0;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.product-img-wrapper {
    position: relative;
    height: 180px;
    width: 100%;
    background: #f9f9f9;
}

.product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    border: none;
    transition: all 0.2s;
}

.fav-btn:hover,
.fav-btn.active {
    color: #ff4081;
    transform: scale(1.1);
}

.badge-new {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #4cc9f0;
    /* Or Green for 'Available' in reference? */
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-discount {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff4081;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
}

.product-info {
    padding: 15px;
}

.product-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-vendor {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    display: block;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: #6a00f4;
    /* Reference Purple */
    margin-bottom: 12px;
}

.btn-details {
    width: 100%;
    background: #9d4edd;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 20px;
    /* Highly rounded as in reference */
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-details:hover {
    background: #7b2cbf;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .products-container {
        display: block;
        /* Stack on mobile */
        padding: 10px;
    }

    .filter-sidebar {
        display: none;
        /* Hidden by default, toggleable */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 2000;
        overflow-y: auto;
        border-radius: 0;
    }

    .filter-sidebar.open {
        display: block;
    }

    .search-bar {
        max-width: none;
        /* Full width on mobile */
    }

    .products-header {
        flex-wrap: wrap;
    }

    .search-bar {
        order: 2;
        width: 100%;
        margin-top: 10px;
    }

    .filter-toggle-btn {
        order: 1;
    }

    /* Make grid 2 columns on mobile instead of auto-fill small */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-img-wrapper {
        height: 140px;
    }

    .product-info {
        padding: 10px;
    }
}

/* --- New Category Styles (Ported from Home Page) --- */

.categories-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 20px;
    padding: 20px 0;
    /* Reduced side padding so items are flush with edge or handled by margin */
    width: 100%;
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
    -ms-overflow-style: none;
    /* Hide scrollbar IE */
}

.categories-grid::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    width: 110px;
    flex-shrink: 0;
    /* Prevent shrinking */
    transition: transform 0.2s;
}

.category-item:hover {
    transform: translateY(-5px);
}

.cat-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 4px solid #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.cat-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-item.active .cat-circle {
    border-color: #9d4edd;
    box-shadow: 0 0 0 4px rgba(157, 78, 221, 0.3);
}

.cat-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: center;
    line-height: 1.3;
}

.category-item.active .cat-name {
    color: #9d4edd;
    font-weight: 700;
}

/* Gradients */
.cat-bg-1 {
    background: linear-gradient(135deg, #67e8f9, #22d3ee);
}

.cat-bg-2 {
    background: linear-gradient(135deg, #f9a8d4, #f472b6);
}

.cat-bg-3 {
    background: linear-gradient(135deg, #bef264, #84cc16);
}

.cat-bg-4 {
    background: linear-gradient(135deg, #fcd34d, #f59e0b);
}

/* Override/Hide old strip styles if necessary */
.category-strip {
    /* Converting strip to a grid container */
    overflow: visible;
    justify-content: center;
    background: transparent;
    border: none;
    flex-wrap: wrap;
    gap: 20px;
    height: auto;
    padding-bottom: 30px;
}