.tn-search-tradeinn {
    --tn-primary: #652D90;
    --tn-border: #e2e2e2;
    --tn-text: #222;
    --tn-muted: #777;
    width: 100%;
    direction: rtl;
    position: relative;
    z-index: 99999;
    font-family: inherit;
}

.tn-search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 58px;
    background: #fff;
    border: 1px solid #cfcfcf;
    border-radius: 4px;
    transition: .2s ease;
    box-sizing: border-box;
}

.tn-search-open .tn-search-box,
.tn-search-box:focus-within {
    border-color: var(--tn-primary);
    box-shadow: 0 3px 14px rgba(0,0,0,.08);
}

.tn-search-input-field {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 56px;
    padding: 0 14px;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--tn-text);
    font-size: 15px;
    line-height: 56px;
    text-align: right;
}

.tn-search-input-field::placeholder { color: #8a8a8a; opacity: 1; }

.tn-search-icon,
.tn-search-clear {
    flex: 0 0 52px;
    width: 52px;
    height: 56px;
    padding: 0;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.tn-search-icon { order: 3; }
.tn-search-input-field { order: 2; }
.tn-search-clear { order: 1; }

.tn-search-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: var(--tn-primary);
    stroke-width: 1.8;
    stroke-linecap: round;
}

.tn-search-clear svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #888;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.tn-search-icon:hover svg { transform: scale(1.08); }
.tn-search-clear:hover svg { stroke: #222; }

.tn-search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 4px;
    box-shadow: 0 12px 35px rgba(0,0,0,.12);
    overflow: hidden;
    z-index: 100000;
}

.tn-suggestion-item {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 78px;
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    text-decoration: none !important;
    color: inherit !important;
    background: #fff;
    transition: background .15s ease;
}

.tn-suggestion-item:last-child { border-bottom: 0; }
.tn-suggestion-item:hover { background: #f7f7f7; }

.tn-suggestion-image {
    flex: 0 0 62px;
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    background: #fafafa;
    border: 1px solid #eee;
}

.tn-suggestion-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tn-suggestion-content {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tn-suggestion-title {
    color: #222;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tn-suggestion-price {
    color: var(--tn-primary);
    font-size: 13px;
    font-weight: 700;
}

.tn-search-results {
    width: 100%;
    margin-top: 18px;
}

.tn-search-results > .elementor { width: 100%; }

.tn-search-loading,
.tn-search-empty {
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--tn-muted);
    font-size: 14px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
}

.tn-search-loading em { font-style: normal; margin-right: 8px; }
.tn-search-loading span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--tn-primary);
    animation: tn-search-dot 1s infinite ease-in-out;
}
.tn-search-loading span:nth-child(2) { animation-delay: .12s; }
.tn-search-loading span:nth-child(3) { animation-delay: .24s; }

@keyframes tn-search-dot {
    0%, 80%, 100% { transform: translateY(0); opacity: .35; }
    40% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 600px) {
    .tn-search-box { min-height: 52px; }
    .tn-search-input-field { height: 50px; line-height: 50px; font-size: 14px; }
    .tn-search-icon, .tn-search-clear { height: 50px; flex-basis: 46px; width: 46px; }
    .tn-suggestion-item { min-height: 70px; padding: 8px 10px; }
    .tn-suggestion-image { width: 54px; height: 54px; flex-basis: 54px; }
}


/* ==========================================================
   TN LOAD MORE
   ========================================================== */

.tn-load-more-products {
    display: block;
    width: auto;
    min-width: 170px;
    margin: 30px auto 50px;
    padding: 12px 30px;
    border: 0;
    border-radius: 8px;
    background: #652D90;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    transition: .2s ease;
}

.tn-load-more-products:hover {
    opacity: .88;
    transform: translateY(-1px);
}

.tn-load-more-products.loading,
.tn-load-more-products:disabled {
    opacity: .65;
    cursor: wait;
}


/* Mobile: the theme's native search is hidden by JS and the original TN search
   is mounted here. Keep one compact, touch-friendly search instance. */
@media (max-width: 1024px) {
    .xts-header-search-form-mobile .tn-search-tradeinn.tn-search-mobile-active {
        display: block !important;
        width: 100%;
        margin: 0;
        padding: 0;
        position: relative;
        z-index: 100000;
    }

    .xts-header-search-form-mobile .tn-search-mobile-active .tn-search-box {
        min-height: 48px;
        height: 48px;
        border-radius: 8px;
    }

    .xts-header-search-form-mobile .tn-search-mobile-active .tn-search-input-field {
        height: 46px;
        line-height: 46px;
        font-size: 14px;
        padding: 0 12px;
    }

    .xts-header-search-form-mobile .tn-search-mobile-active .tn-search-icon,
    .xts-header-search-form-mobile .tn-search-mobile-active .tn-search-clear {
        width: 42px;
        min-width: 42px;
        height: 46px;
    }

    .xts-header-search-form-mobile .tn-search-mobile-active .tn-search-suggestions,
    .xts-header-search-form-mobile .tn-search-mobile-active .tn-search-results {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}
