/* جستجوی زنده هدر */
form[data-site-search] { position: relative; }

.header-search-result {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    z-index: 1050;
    max-height: 70vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    text-align: right;
    direction: rtl;
}

.header-search-result[hidden] { display: none !important; }

.header-search-result.is-up {
    top: auto;
    bottom: calc(100% + 6px);
    max-height: 60vh;
}

.header-search-result .ss-section + .ss-section { border-top: 1px solid #f0f0f0; }

.header-search-result .ss-title {
    padding: 10px 14px 4px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #999;
}

.header-search-result .ss-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    color: #333;
    text-decoration: none;
}

.header-search-result .ss-item:hover,
.header-search-result .ss-item.is-active,
.header-search-result .ss-more:hover,
.header-search-result .ss-more.is-active {
    background: #f3f8fd;
    color: #0864be;
}

.header-search-result .ss-media {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f7f7;
    border-radius: 6px;
    overflow: hidden;
    color: #aaa;
    font-size: 1.8rem;
}

.header-search-result .ss-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-search-result .ss-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header-search-result .ss-name {
    font-size: 1.4rem;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-search-result .ss-sub {
    font-size: 1.2rem;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-search-result .ss-more {
    display: block;
    padding: 10px 14px;
    border-top: 1px solid #f0f0f0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #0864be;
    text-align: center;
}

.header-search-result .ss-empty {
    padding: 16px 14px;
    font-size: 1.3rem;
    color: #777;
}

form[data-site-search].ss-loading .btn-search i { opacity: .4; }

/* جستجوی پایین صفحه موبایل: هم‌عرض صفحه، و visibility بدون تأخیر تا input همان لحظه فوکوس بگیرد */
.sticky-footer .hs-toggle .input-wrapper { width: calc(100vw - 2rem); }
.sticky-footer .hs-toggle.show .input-wrapper { transition: transform .3s, opacity .3s; }

/* نوار جستجوی همیشه‌دیدنی هدر در موبایل و تبلت (در دسکتاپ فرم خود هدر نمایش داده می‌شود) */
.header-mobile-search { display: none; background: #fff; padding: 1rem 1.5rem; border-bottom: 1px solid #eee; }
@media (max-width: 767.98px) {
    .header-mobile-search { display: block; }
}
.mobile-search-form { display: flex; align-items: stretch; position: relative; direction: rtl; }
.mobile-search-form input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    height: 4.2rem;
    padding: 0 1.4rem;
    font-size: 16px; /* جلوگیری از زوم خودکار iOS هنگام فوکوس */
    border: 1px solid #ddd;
    border-left: 0;
    border-radius: 0 2.1rem 2.1rem 0;
    background: #f4f4f4;
    outline: none;
}
.mobile-search-form button {
    flex: 0 0 4.8rem;
    height: 4.2rem;
    border: 1px solid #ddd;
    border-right: 0;
    border-radius: 2.1rem 0 0 2.1rem;
    background: #f4f4f4;
    font-size: 1.8rem;
    color: #222;
}

/* صفحه نتایج */
.site-search-page .search-essay {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}

.site-search-page .search-essay img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    flex: 0 0 120px;
}

.site-search-page .search-essay h3 { font-size: 1.6rem; margin-bottom: .5rem; }
.site-search-page .search-essay p { font-size: 1.3rem; color: #777; margin: 0; }
.site-search-page .product-media img { width: 100%; height: auto; aspect-ratio: 260 / 291; object-fit: contain; }
