/* ==========================================================================
   TeslaCommerce Smart Search - header dropdown (smart-search.js)
   --------------------------------------------------------------------------
   Drawn inside Ryan's own search result container (.vp-search-box-result .vp-search-result), which
   keeps its position, width, open/close and the mobile over-page. This sheet styles the content only:
   ranked suggestions (queries, product types, categories, brands, products - each marked by its type),
   a rule, product previews (a row of cards) and "view all".
   ========================================================================== */

.tc-ss {
    --tc-ss-ink: #0C0C0C;
    --tc-ss-text: #3F4064;
    --tc-ss-muted: #81858B;
    --tc-ss-rule: #EDEDED;
    --tc-ss-hover: #F5F6F7;
    --tc-ss-card: #F5F5F5;
    --tc-ss-accent: var(--ryan-primary, #007AD0);
    padding: 6px 0 4px;
    font-family: yekanbakh, tahoma, sans-serif;
    color: var(--tc-ss-ink);
    direction: rtl;
    text-align: right;
}

.tc-ss ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tc-ss a {
    color: inherit;
    text-decoration: none;
}

.tc-ss svg {
    display: block;
}

/* ---- suggestions -------------------------------------------------------- */

.tc-ss__intent-row {
    position: relative;
    display: flex;
    align-items: center;
}

.tc-ss__intent {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 44px;
    padding: 0 16px 0 52px;
    font-size: 14px;
    line-height: 22px;
    color: var(--tc-ss-text);
    transition: background-color 0.12s ease;
}

.tc-ss__intent:hover,
.tc-ss__intent.is-active {
    background: var(--tc-ss-hover);
}

.tc-ss__intent-icon,
.tc-ss__all-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--tc-ss-muted);
}

.tc-ss__intent-icon svg,
.tc-ss__all-icon svg {
    width: 18px;
    height: 18px;
}

.tc-ss__intent-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.tc-ss__intent-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* where an entity sits ("در برندها", a category's parents) or a product's price */
.tc-ss__intent-context {
    overflow: hidden;
    font-size: 12px;
    line-height: 18px;
    color: var(--tc-ss-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-ss__intent-context .tc-ss__now {
    font-size: 12px;
    line-height: 18px;
}

/* a derived product type: the tag in the accent colour, otherwise a search row */
.tc-ss__intent--productType .tc-ss__intent-icon {
    color: var(--tc-ss-accent);
}

/* a category, brand or product: a page of its own - a round mark (or picture) and a second line */
.tc-ss__intent--entity {
    min-height: 56px;
}

.tc-ss__intent--entity .tc-ss__intent-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--tc-ss-card);
    color: var(--tc-ss-text);
}

.tc-ss__intent-media {
    display: block;
    flex: 0 0 auto;
    overflow: hidden;
    width: 36px;
    height: 36px;
    border: 1px solid var(--tc-ss-rule);
    border-radius: 8px;
    background: #FFFFFF;
}

.tc-ss__intent-media--logo {
    box-sizing: border-box;
    /* 6px: a square logo's corners stay inside the 36px circle */
    padding: 6px;
    border-radius: 50%;
}

.tc-ss__intent-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* a product row has no "put in the field" arrow */
.tc-ss__intent--product {
    padding-left: 16px;
}

/* «همه نتایج برای «...»»: the category row's phrase as a search - a lighter line under the category, its icon
   centred under the category's round mark, so it reads as the broader results and not as another entity */
.tc-ss__intent--search {
    min-height: 36px;
    padding: 0 25px 0 16px;
    font-size: 13px;
    color: var(--tc-ss-muted);
}

.tc-ss__intent--search .tc-ss__intent-icon,
.tc-ss__intent--search .tc-ss__intent-icon svg {
    width: 16px;
    height: 16px;
}

/* a curated expansion: a related intent - the accent mark and the "related to" line set it apart */
.tc-ss__intent--expansion {
    min-height: 56px;
}

.tc-ss__intent--expansion .tc-ss__intent-icon {
    color: var(--tc-ss-accent);
}

.tc-ss__intent--expansion .tc-ss__intent-text {
    font-weight: 700;
    color: var(--tc-ss-ink);
}

/* the completion - what was not typed - reads bold */
.tc-ss__intent-text b {
    font-weight: 700;
    color: var(--tc-ss-ink);
}

/* puts the suggestion in the field to refine it */
.tc-ss__fill {
    position: absolute;
    top: 50%;
    left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--tc-ss-muted);
    transform: translateY(-50%);
    cursor: pointer;
}

.tc-ss__fill:hover {
    background: #EAEBED;
    color: var(--tc-ss-ink);
}

.tc-ss__fill svg {
    width: 16px;
    height: 16px;
}

.tc-ss__sep {
    height: 1px;
    margin: 8px 16px;
    background: var(--tc-ss-rule);
}

/* ---- product previews -------------------------------------------------- */

.tc-ss__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px 10px;
}

.tc-ss__title {
    font-size: 14px;
    font-weight: 700;
    line-height: 22px;
}

.tc-ss__more {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    line-height: 20px;
    color: var(--tc-ss-muted) !important;
    white-space: nowrap;
}

.tc-ss__more:hover {
    color: var(--tc-ss-accent) !important;
}

.tc-ss__more svg {
    width: 14px;
    height: 14px;
}

.tc-ss__count {
    font-weight: 700;
}

.tc-ss__products {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 0 16px 6px !important;
}

.tc-ss__product {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--tc-ss-card);
    transition: border-color 0.12s ease;
}

.tc-ss__product:hover,
.tc-ss__product.is-active {
    border-color: rgba(var(--ryan-primary-rgb, 0, 122, 208), 0.35);
}

.tc-ss__thumb {
    display: block;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    background: #FFFFFF;
}

.tc-ss__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tc-ss__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
}

.tc-ss__name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    color: var(--tc-ss-ink);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.tc-ss__price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    text-align: left;
}

.tc-ss__now {
    font-size: 13px;
    font-weight: 700;
    line-height: 20px;
    color: var(--tc-ss-ink);
    white-space: nowrap;
}

.tc-ss__now small {
    font-size: 10px;
    font-weight: 400;
    color: var(--tc-ss-muted);
}

.tc-ss__old {
    font-size: 11px;
    line-height: 16px;
    color: var(--tc-ss-muted);
}

.tc-ss__stock {
    font-size: 12px;
    line-height: 20px;
    color: var(--tc-ss-muted);
}

/* out of stock: listed after the in-stock products (server order), its picture and name quieter */
.tc-ss__product--out .tc-ss__thumb img,
.tc-ss__intent--out .tc-ss__intent-media img {
    opacity: 0.55;
}

.tc-ss__product--out .tc-ss__name,
.tc-ss__intent--out .tc-ss__intent-text {
    color: var(--tc-ss-muted);
}

/* ---- view all / messages ------------------------------------------------ */

.tc-ss__all {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin-top: 6px;
    padding: 0 16px;
    border-top: 1px solid var(--tc-ss-rule);
    font-size: 13px;
    line-height: 22px;
    color: var(--tc-ss-accent) !important;
}

.tc-ss__all:hover,
.tc-ss__all.is-active {
    background: var(--tc-ss-hover);
}

.tc-ss__all-icon {
    color: var(--tc-ss-accent);
}

.tc-ss__message {
    padding: 14px 16px;
    font-size: 13px;
    line-height: 22px;
    color: var(--tc-ss-muted);
}

/* ---- loading skeleton (cfg.loading): the rows' and cards' own boxes, filled with placeholders ---- */

.tc-ss--loading {
    pointer-events: none;
}

.tc-ss__sk {
    display: block;
    border-radius: 6px;
    background: linear-gradient(90deg, #E9EBEE 25%, #F4F5F7 50%, #E9EBEE 75%) 0 0 / 200% 100%;
    animation: tc-ss-shimmer 1.3s linear infinite;
}

.tc-ss__sk-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.tc-ss__sk-line {
    flex: 0 0 auto;
    height: 12px;
}

.tc-ss__sk-line--short {
    width: 55%;
}

.tc-ss__sk-title {
    width: 104px;
    height: 14px;
}

/* the highlight runs right to left, the way the page reads */
@keyframes tc-ss-shimmer {
    to {
        background-position: 100% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tc-ss__sk {
        animation: none;
    }
}

/* phones: the over-page is the full screen; product previews become a swipeable row */
@media (max-width: 991.98px) {
    /* the storefront's surfaces are white; the over-page behind the result was grey */
    .vp-search-box .vp-search-box-result:has(.vp-search-result .tc-ss),
    .vp-search-box .vp-search-box-result .vp-search-result:has(.tc-ss) {
        background: #FFFFFF;
    }

    /* the panel has no frame of its own here (mobile-search-header.css): the first row starts under the field */
    .tc-ss {
        padding-top: 4px;
    }

    .tc-ss__intent {
        min-height: 48px;
    }

    .tc-ss__intent--entity,
    .tc-ss__intent--expansion {
        min-height: 56px;
    }

    .tc-ss__intent--search {
        min-height: 40px;
    }

    .tc-ss__products {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .tc-ss__products::-webkit-scrollbar {
        display: none;
    }

    .tc-ss__products > li {
        flex: 0 0 136px;
        scroll-snap-align: start;
    }
}
