/* mobile side menu (drawer) */

header.main-header .side-menu {
    right: -100vw;
    width: min(400px, 90vw);
    padding-bottom: 24px;
    border-radius: 20px 0 0 20px;
    background-color: #fff;
    box-shadow: -8px 0 32px rgba(31, 45, 61, 0.16);
    direction: rtl;
    text-align: right;
}

header.main-header .side-menu.open {
    right: 0;
}

/* head: search + close */

.side-menu__head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid #f0f0f1;
    background: #fff;
}

.side-menu__search {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.side-menu__search-icon {
    position: absolute;
    top: 50%;
    right: 14px;
    color: #a1a3a8;
    font-size: 20px;
    line-height: 1;
    pointer-events: none;
    transform: translateY(-50%);
    transition: color 0.2s ease;
}

.side-menu__search-spinner {
    position: absolute;
    top: 50%;
    right: 15px;
    display: none;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border: 2px solid color-mix(in srgb, var(--primary-color) 20%, transparent);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: side-search-spin 0.7s linear infinite;
}

.side-menu__search.is-loading .side-menu__search-icon {
    display: none;
}

.side-menu__search.is-loading .side-menu__search-spinner {
    display: block;
}

@keyframes side-search-spin {
    to {
        transform: rotate(360deg);
    }
}

.side-menu__search-clear {
    position: absolute;
    top: 50%;
    left: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #81858b;
    font-size: 18px;
    cursor: pointer;
}

.side-menu__search.has-value .side-menu__search-clear {
    display: flex;
}

.side-menu__search input {
    display: block;
    width: 100%;
    height: 46px;
    padding: 0 44px 0 40px;
    border: 1px solid transparent;
    border-radius: 14px;
    outline: none;
    background: #f2f3f5;
    color: #0c0c0c;
    font-size: 13.5px;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.side-menu__search input::placeholder {
    color: #a1a3a8;
}

.side-menu__search input:focus {
    border-color: color-mix(in srgb, var(--primary-color) 45%, transparent);
    background: #fff;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 12%, transparent);
}

.side-menu__search:focus-within .side-menu__search-icon {
    color: var(--primary-color);
}

.side-menu__close {
    display: flex;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #3f4064;
    font-size: 24px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.side-menu__close:hover,
.side-menu__close:focus {
    background: #f2f3f5;
    outline: none;
}

/* items */

header.main-header .side-menu > ul {
    padding: 6px 0 0;
}

header.main-header .side-menu a {
    background-color: transparent;
}

header.main-header .side-menu > ul > li > a {
    position: relative;
    padding: 14px 20px 14px 52px;
    border-bottom: 1px solid #f3f3f4;
    background: transparent;
    color: #0c0c0c;
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.7;
}

header.main-header .side-menu ul > li.sub-menu > a::after {
    content: '\F140';
    top: 50%;
    left: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-top: -13px;
    border-radius: 8px;
    background: #f5f6f8;
    color: #81858b;
    font-size: 18px;
    line-height: 1;
}

header.main-header .side-menu ul > li.sub-menu.open > a {
    color: var(--primary-color);
}

header.main-header .side-menu ul > li.sub-menu.open > a::after {
    background: color-mix(in srgb, var(--primary-color) 12%, transparent);
    color: var(--primary-color);
}

/* nested lists */

header.main-header .side-menu ul ul {
    padding: 4px 0;
    border-bottom: 1px solid #f3f3f4;
    background-color: #fafafb;
    box-shadow: none;
    direction: rtl;
}

header.main-header .side-menu ul ul ul {
    padding-right: 14px;
    border-bottom: 0;
    background-color: transparent;
}

header.main-header .side-menu ul > li > ul > li > a,
header.main-header .side-menu ul ul li a {
    position: relative;
    padding: 0 32px 0 52px;
    color: #3f4064;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 44px;
}

header.main-header .side-menu ul ul li.sub-menu > a::after {
    left: 16px;
    width: 22px;
    height: 22px;
    margin-top: -11px;
    font-size: 16px;
    background: transparent;
}

header.main-header .side-menu ul ul li a:hover,
header.main-header .side-menu ul > li > ul > li > a:hover {
    color: var(--primary-color);
}

header.main-header .side-menu ul ul li a.text-nowrap {
    color: var(--primary-color);
    font-weight: 500;
}

header.main-header .side-menu ul ul li a.text-nowrap i {
    margin-left: 4px;
    font-size: 16px;
    vertical-align: middle;
}

/* category thumbnails (first level) */

header.main-header .side-menu ul ul > li > a:has(.side-menu__thumb),
header.main-header .side-menu > ul > li > a:has(.side-menu__thumb) {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 8px;
    padding-bottom: 8px;
    line-height: 1.7;
}

.side-menu__thumb {
    display: flex;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    overflow: hidden;
    border: 1px solid #ececec;
    border-radius: 12px;
    background: #fff;
}

.side-menu__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

header.main-header .side-menu li.sub-menu.open > a .side-menu__thumb {
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
}

/* live search results */

.side-search-results {
    padding-bottom: 8px;
}

.side-search-results[hidden],
header.main-header .side-menu > ul[hidden] {
    display: none !important;
}

.side-search-section {
    padding: 16px 0 14px;
    border-bottom: 1px solid #f0f0f1;
}

.side-search-section__title {
    margin: 0 16px 12px;
    color: #0c0c0c;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.7;
}

.side-search-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 16px 2px;
    scrollbar-width: none;
}

.side-search-chips::-webkit-scrollbar,
.side-search-track::-webkit-scrollbar {
    display: none;
}

header.main-header .side-menu .side-search-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid #e0e0e2;
    border-radius: 999px;
    background: #fff;
    color: #3f4064;
    font-size: 12.5px;
    line-height: 1.6;
    white-space: nowrap;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.side-search-chip i {
    color: #a1a3a8;
    font-size: 16px;
}

.side-search-chip__parent {
    color: #a1a3a8;
    font-size: 11px;
}

.side-search-chip__parent::before {
    content: "در ";
}

header.main-header .side-menu .side-search-chip:hover {
    border-color: color-mix(in srgb, var(--primary-color) 45%, transparent);
    color: var(--primary-color);
}

.side-search-carousel {
    position: relative;
}

.side-search-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 0 16px 4px;
    scroll-padding-inline: 16px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

header.main-header .side-menu .side-search-card {
    display: flex;
    flex: 0 0 152px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #ececec;
    border-radius: 14px;
    background: #fff;
    color: #0c0c0c;
    scroll-snap-align: start;
}

.side-search-card__media {
    display: block;
    aspect-ratio: 1;
    background: #f5f6f8;
}

.side-search-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.side-search-card__title {
    display: -webkit-box;
    min-height: calc(1.9em * 2);
    margin: 10px 10px 6px;
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.9;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.side-search-card__foot {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: auto;
    padding: 0 10px 10px;
}

.side-search-card__price {
    color: #0c0c0c;
    font-size: 14px;
    font-weight: 700;
}

.side-search-card__currency {
    color: #81858b;
    font-size: 10.5px;
}

.side-search-card__unavailable {
    color: #a1a3a8;
    font-size: 12px;
    font-weight: 500;
}

.side-search-carousel__next {
    position: absolute;
    top: 64px;
    left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #ececec;
    border-radius: 50%;
    background: #fff;
    color: #0c0c0c;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(31, 45, 61, 0.12);
    cursor: pointer;
}

header.main-header .side-menu .side-search-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    color: var(--primary-color);
    font-size: 13.5px;
    font-weight: 700;
}

.side-search-all i {
    font-size: 18px;
}

.side-search-empty {
    margin: 0;
    padding: 40px 20px;
    color: #81858b;
    font-size: 13px;
    text-align: center;
}
