/* =========================================
   CSQ Product Search - ظاهر هماهنگ با انتخاب شهر
   ========================================= */

.csq-search-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    direction: rtl;
    font-family: inherit;
}

/* باکس اصلی */
.csq-product-trigger-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 10px 14px;
    border: 1px solid #e3e3e3;
    border-radius: 12px;
    background: #fff;
    cursor: text;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.csq-product-trigger-box:hover,
.csq-product-trigger-box:focus-within {
    border-color: #d6d6d6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

/* بخش ورودی متن - سمت راست */
.csq-product-box-text {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

#csqProductInput {
    width: 100%;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: #444;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

#csqProductInput::placeholder {
    color: #777;
    opacity: 1;
}

/* بخش آیکون‌ها - سمت چپ */
.csq-product-icons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-right: 12px;
    flex-shrink: 0;

    /*
      ترتیب ثابت:
      از چپ به راست: آیکون تصویر، سپس میکروفون
      مانند تصویر مرجع شما
    */
    direction: ltr;
}

/* هر دو آیکون */
.csq-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #c62828;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.csq-icon-btn svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* فعلاً آیکون تصویر فقط ظاهری است */
.csq-image-btn:hover,
.csq-voice-btn:hover {
    color: #a61f1f;
    transform: scale(1.08);
}

.csq-icon-btn:focus-visible {
    outline: 2px solid rgba(198, 40, 40, 0.28);
    outline-offset: 3px;
    border-radius: 5px;
}

/* واکنش‌گرا برای موبایل */
@media (max-width: 480px) {
    .csq-search-container {
        max-width: 100%;
    }

    .csq-product-trigger-box {
        min-height: 50px;
        padding: 10px 12px;
    }

    .csq-product-icons {
        margin-right: 10px;
        gap: 9px;
    }
}

.csq-search-container {
    width: calc(100% - 8px) !important;
    max-width: 420px !important;
    margin-right: 4px !important;
    margin-left: 4px !important;
    margin-top: 2px !important;
    box-sizing: border-box !important;
}

.csq-product-trigger-box {
    height: 52px !important;
    min-height: 52px !important;
    padding: 0 14px !important;
    box-sizing: border-box !important;
}

#csqProductInput,
#csqProductInput::placeholder {
    color: #444 !important;
    opacity: 1 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}


@media (max-width: 480px) {
    .csq-product-box-text {
        right: 12px;
        left: 82px;
    }

    .csq-product-icons {
        left: 12px;
    }
}



.csq-product-trigger-box {
    position: relative;
    display: block !important;
    height: 52px !important;
    min-height: 52px !important;
    padding: 0 !important;
}

.csq-product-box-text {
    position: absolute;
    top: 0;
    right: 14px;
    left: 86px;
    height: 100%;
    display: flex;
    align-items: center;
}

#csqProductInput {
    height: 100%;
    text-align: right !important;
    color: #444 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

.csq-product-icons {
    position: absolute;
    top: 50%;
    left: 14px;
    margin: 0 !important;
    transform: translateY(-50%);
}





.csq-product-trigger-box {
    position: relative !important;
    padding: 0 !important;
}

.csq-product-box-text {
    position: absolute !important;
    top: 0;
    right: 14px !important;
    left: 86px !important;
    height: 52px;
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
}

#csqProductInput {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: right !important;
    direction: rtl !important;
}


/* =========================================
   نتایج جستجوی AJAX
   ========================================= */

.csq-product-results {
    position: absolute;
    z-index: 9999;
    top: calc(100% + 7px);
    right: 4px;
    left: 4px;
    display: none;
    max-height: 390px;
    overflow-y: auto;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.13);
    direction: rtl;
}

.csq-product-results.is-visible {
    display: block;
}

.csq-search-loading,
.csq-no-results {
    padding: 18px 15px;
    color: #666;
    font-size: 14px;
    text-align: right;
}

.csq-search-loading {
    color: #c62828;
}

.csq-results-list {
    padding: 5px 0;
}

.csq-product-result-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f1f1;
    color: inherit;
    text-decoration: none !important;
    transition: background 0.18s ease;
}

.csq-product-result-item:last-child {
    border-bottom: 0;
}

.csq-product-result-item:hover {
    background: #fafafa;
}

.csq-result-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    overflow: hidden;
    flex: 0 0 48px;
    border-radius: 9px;
    background: #f3f3f3;
}

.csq-result-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.csq-result-no-image {
    display: inline-flex;
    color: #aaa;
}

.csq-result-no-image svg {
    width: 22px;
    height: 22px;
}

.csq-result-content {
    min-width: 0;
    flex: 1;
}

.csq-result-title {
    overflow: hidden;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.7;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.csq-result-city {
    margin-top: 3px;
    overflow: hidden;
    color: #888;
    font-size: 12px;
    line-height: 1.6;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* حالت فعال بودن میکروفون */
#csqProductVoiceBtn.is-recording {
    color: #ff0000;
    animation: csqProductVoicePulse 1.2s infinite;
}

@keyframes csqProductVoicePulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.22);
        opacity: 0.65;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

