/* ===========================================================
                        SEARCH PAGE
=========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

/* =======================
        Variables
======================= */

:root {

    --primary: #0D6EFD;
    --primary-dark: #0A58CA;
    --primary-light: #EAF3FF;

    --background: #F5F9FF;
    --surface: #FFFFFF;

    --text: #202124;
    --text-light: #6B7280;

    --border: #E6ECF5;

    --radius: 22px;
    --radius-small: 16px;

    --shadow:
        0 8px 30px rgba(13, 110, 253, .08);

}

/* =======================
        Reset
======================= */

* {

    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;

}

body {

    background: var(--background);
    color: var(--text);

}

img {

    display: block;
    width: 100%;

}

button {

    border: none;
    background: none;
    cursor: pointer;

}

a {

    text-decoration: none;
    color: inherit;

}

/*==================================================
PAGE
==================================================*/


.search-page {

    width: 100%;

    max-width: 700px;

    margin: auto;

    padding-bottom: 50px;

}

/* =======================
        Header
======================= */

header {

    position: sticky;

    top: 0;

    z-index: 1000;

    height: 62px;

    background: rgba(255, 255, 255, .78);

    backdrop-filter: blur(20px);

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 18px;

    border-bottom: 1px solid rgba(230, 236, 245, .8);

}

header h1 {

    font-size: 18px;
    font-weight: 700;

}

header button {

    width: 46px;
    height: 46px;

    border-radius: 50%;

    background: #fff;

    box-shadow: var(--shadow);

}

header i {

    font-size: 22px;
    color: var(--primary);

}

/* =======================
        Main
======================= */

main {

    padding-left: 18px;
    padding-right: 18px;
    padding-bottom: 100px;

}

/* =======================
        Search
======================= */

.search-box {

    margin: 14px 0 8px;

}

.search-box div {

    display: flex;

    align-items: center;

    gap: 14px;

    background: #fff;

    border-radius: 20px;

    height: 52px;

    padding: 0 18px;

    box-shadow: var(--shadow);

}

.search-box div:focus-within {

    border: 2px solid var(--primary);

}

.search-box i {

    font-size: 22px;

    color: var(--primary);

}

.search-box input {

    flex: 1;

    border: none;

    outline: none;

    background: none;

    font-size: 15px;

}

/* =======================
        Filter Chips
======================= */

.selected-filters {

    display: flex;

    gap: 10px;

    overflow: auto;

    scrollbar-width: none;

}

.selected-filters::-webkit-scrollbar {

    display: none;

}

.filter-chip {

    flex: none;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    height: 36px;
    padding: 0 16px;

    background: var(--primary-light);
    color: var(--primary);

    border: none;
    border-radius: 999px;

    font-size: 13px;
    font-weight: 600;
    line-height: 1;

    white-space: nowrap;
    cursor: pointer;

}

.filter-chip i {

    font-size: 15px;
    line-height: 1;

}

/* =======================
        Result
======================= */

.result-header {

    margin-bottom: 18px;

}

.result-header h2 {

    font-size: 15px;

    color: var(--text-light);

}

/* =======================
        Grid
======================= */

.products-grid {

    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 16px;

}

/* =======================
        Product Card
======================= */
.product-card {

    width: 100%;

    max-width: 170px;

    justify-self: stretch;

    flex: none;

    background: #fff;

    border-radius: 16px;

    overflow: hidden;

    border: 1px solid #e7eef8;

    box-shadow: 0 3px 10px rgba(15, 23, 42, .05);

    transition: .3s;

}

.product-card:hover {

    transform: translateY(-3px);

}

.product-image {

    position: relative;

    height: 120px;

    overflow: hidden;

}

.product-image img {

    width: 100%;

    height: 100%;

    object-fit: cover;

    background: #f4f8fd;

    transition: .35s;

}

.product-card:hover img {

    transform: scale(1.05);

}

.discount {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #EF4444;
    color: #fff;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    display: none;
}

.product-body {
    padding: 15px;
}

.product-body h3 {

    font-size: 15px;
    line-height: 28px;
    height: 56px;
    overflow: hidden;


}

.store {

    display: block;

    font-size: 11px;

    color: var(--text-light);

}

.price {
    margin-top: 4px;
    display: flex;
    flex-direction: column-reverse;
}

.price strong {
    color: var(--primary);
    font-size: 17px;
    font-weight: 700;
}

.price del {
    margin-top: 5px;
    min-height: 18px;
    color: #9CA3AF;
    font-size: 13px;
}

/* =======================
        Skeleton
======================= */

.loading-grid {

    display: none;

    grid-template-columns: repeat(2, 1fr);

    gap: 16px;

}

.product-skeleton {

    height: 285px;

    border-radius: 22px;

    background: #E9EEF7;

    position: relative;

    overflow: hidden;

}

.product-skeleton::after {

    content: "";

    position: absolute;

    inset: 0;

    transform: translateX(-100%);

    background:

        linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, .7),
            transparent);

    animation: skeleton 1.2s infinite;

}

@keyframes skeleton {

    to {

        transform: translateX(100%);

    }

}

/* =======================
        Empty
======================= */

.empty-box {

    display: none;

    text-align: center;

    padding: 60px 20px;

}

.empty-box i {

    font-size: 60px;

    color: #CBD5E1;

}

.empty-box h3 {

    margin-top: 16px;

}

.empty-box p {

    margin-top: 8px;

    color: var(--text-light);

}

/* =======================
        Pagination
======================= */

.pagination {

    margin-top: 30px;

    display: flex;

    justify-content: center;

    align-items: center;

    gap: 18px;

}

.pagination button {

    background: var(--primary);

    color: #fff;

    width: 95px;

    height: 44px;

    border-radius: 14px;

}

.pagination button:disabled {

    opacity: .4;

    cursor: not-allowed;

}

#pageInfo {

    font-weight: 700;

}

/* =======================
        Bottom Sheet
======================= */

.sheet {

    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, .35);

    backdrop-filter: blur(5px);

    display: flex;

    align-items: flex-end;

    opacity: 0;

    visibility: hidden;

    transition: .3s;

    z-index: 5000;

}

.sheet.show {

    opacity: 1;

    visibility: visible;

}

.sheet-content {

    width: 100%;

    background: #fff;

    border-radius: 30px 30px 0 0;

    max-height: 85vh;

    overflow: auto;

    animation: sheetUp .35s ease;

}

@keyframes sheetUp {

    from {

        transform: translateY(100%);

    }

    to {

        transform: translateY(0);

    }

}

.sheet-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 22px;

    border-bottom: 1px solid var(--border);

}

.sheet-header h2 {

    font-size: 18px;

}

.sheet-header button {

    width: 42px;
    height: 42px;

    border-radius: 50%;

    background: #EEF5FF;

}

.sheet-body {

    padding: 22px;

}

.sheet-body label {

    display: block;

    margin-top: 20px;
    margin-bottom: 10px;

    font-weight: 600;

}

.sheet-body select,
.sheet-body input {

    width: 100%;

    height: 52px;

    border: 1px solid var(--border);

    border-radius: 16px;

    padding: 0 15px;

    outline: none;

    background: #fff;

}

.sheet-body select:focus,
.sheet-body input:focus {

    border-color: var(--primary);

}

.filter-actions {

    display: flex;

    gap: 12px;

    margin-top: 28px;

}

.filter-actions button {

    flex: 1;

    height: 54px;

    border: none;

    border-radius: 16px;

    font-weight: 700;

    color: #fff;

    cursor: pointer;

    transition: .25s;

}

#applyFilter {

    background: linear-gradient(135deg,
            var(--primary),
            #4B8DFF);

}

#resetFilter {

    background: linear-gradient(135deg,
            #EF4444,
            #DC2626);

}

.filter-actions button:hover {

    transform: translateY(-2px);

    opacity: .95;

}

/* =======================
        Responsive
======================= */

@media(min-width:768px) {

    main {

        max-width: 950px;
        margin: auto;

    }

    .products-grid {

        grid-template-columns: repeat(3, 1fr);

    }

}

@media(min-width:1200px) {

    main {

        max-width: 1350px;

    }

    .products-grid {

        grid-template-columns: repeat(4, 1fr);

    }

}

/* ==========================================
                STORES
========================================== */

.stores-section {

    margin-top: 16px;

    margin-bottom: 32px;

}

.section-title {

    margin-bottom: 16px;

}

.section-title h2 {

    font-size: 18px;
    font-weight: 700;

}

.stores-grid {

    display: grid;

    grid-template-columns: 1fr;

    gap: 16px;

}

.store-card {

    background: #fff;

    border-radius: 22px;

    overflow: hidden;

    box-shadow: 0 8px 25px rgba(0, 0, 0, .06);

    cursor: pointer;

    transition: .25s;

}

.store-card:hover {

    transform: translateY(-4px);

}

.store-cover {

    height: 140px;

    overflow: hidden;

    background: #f5f5f5;

}

.store-cover img {

    width: 100%;

    height: 100%;

    object-fit: cover;

    display: block;

}

.store-info {

    padding: 16px;

}

.store-info h3 {

    font-size: 16px;

    font-weight: 700;

    line-height: 28px;

}

.picker-btn {

    width: 100%;
    height: 54px;

    border: 1px solid var(--border);

    border-radius: 16px;

    background: #fff;

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 0 18px;

    font-size: 15px;

}

.category-tree {

    padding: 10px 0 30px;

}

.category-tree {
    padding: 12px 0;
    max-height: 65vh;
    overflow: auto;
}

.tree-item {
    margin-bottom: 12px;
}

.tree-parent {

    display: flex;
    align-items: center;
    gap: 14px;

    height: 58px;

    padding: 0 18px;

    background: #fff;

    border-radius: 18px;

    border: 1px solid #edf2f7;

    cursor: pointer;

    transition: .25s;

}

.tree-parent:hover {

    border-color: #0D6EFD;

    transform: translateY(-2px);

}

.icon {

    width: 40px;
    height: 40px;

    border-radius: 14px;

    background: #eef5ff;

    display: flex;
    justify-content: center;
    align-items: center;

    color: #0D6EFD;

}

.tree-title {

    flex: 1;

    font-weight: 600;

}

.tree-arrow {

    transition: .25s;

}

.tree-arrow.open {

    transform: rotate(-90deg);

}

.tree-children {

    display: none;

    margin-top: 8px;

    border-right: 2px solid #dbeafe;

    margin-right: 20px;

    padding-right: 18px;

}

.tree-children.open {

    display: block;

}

.tree-child {

    height: 46px;

    display: flex;

    align-items: center;

    border-radius: 12px;

    padding: 0 14px;

    cursor: pointer;

    transition: .2s;

}

.tree-child:hover {

    background: #EAF3FF;

    color: #0D6EFD;

}

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.sort-chip {
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    height: 36px;
    padding: 0 16px;

    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;

    box-shadow: 0 4px 12px rgba(0, 0, 0, .05);

    font-size: 14px;
    font-weight: 600;
    color: #444;

    cursor: pointer;
    transition: .25s;

    margin: 0;
}

.sort-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.sort-chip i:first-child {
    color: var(--primary);
}

.selected-filters {
    flex: 1;

    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;

    min-height: 42px;

    overflow-x: auto;
    overflow-y: hidden;

    scrollbar-width: none;
}

.selected-filters::-webkit-scrollbar {
    display: none;
}

.sort-sheet {

    max-height: 430px;

}

.sort-list {

    padding: 10px 0;

}

.sort-item {

    width: 100%;

    height: 58px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 24px;

    background: #fff;

    border: none;

    border-bottom: 1px solid #edf2f7;

    font-size: 15px;

    transition: .2s;

}

.sort-item:last-child {

    border-bottom: none;

}

.sort-item:hover {

    background: #F7FAFF;

}

.sort-item i {

    opacity: 0;

    color: var(--primary);

    font-size: 20px;

}

.sort-item.active {

    color: var(--primary);

    font-weight: 700;

}

.sort-item.active i {

    opacity: 1;

}

.load-more-box {

    width: 100%;

    display: flex;

    justify-content: center;

    align-items: center;

    clear: both;

    margin: 32px auto;

}

.load-more-btn {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 8px;

    padding: 14px 26px;

    min-width: 240px;

    border: 1px solid #ddd;

    border-radius: 16px;

    background: #fff;

    font-family: inherit;

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;

    transition: .25s;

}

.load-more-btn:hover {

    background: #f7f7f7;

}

.load-more-btn i {

    transition: .25s;

}