/**
 * جستجوی هوشمند آسمان - استایل جستجوی زنده و تصویری
 * Version: 1.1.0
 */

.ass-search-wrap {
    position: relative !important;
    display: inline-block;
    width: 100%;
}

/* نتایج */
.ass-live-results {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 99999;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
    max-height: 430px;
    overflow-y: auto;
    direction: rtl;
    text-align: right;
}

.ass-results-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ass-result-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none !important;
    color: #222;
    border-bottom: 1px solid #f0f0f0;
}

.ass-result-item:last-child a { border-bottom: none; }
.ass-result-item a:hover { background: #f5f9ff; }

.ass-result-img {
    width: 52px;
    height: 52px;
    52px;
    object-fit: contain;
    border-radius: 8px;
 0;
    background: #fafafa;
}

.ass-result-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ass-result-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.7;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ass-result-price {
    display: block;
    font-size: 13px;
    color: #0a8f3c;
    font-weight: 600;
}

.ass-result-similarity {
    display: block;
    font-size: 11px;
    color: #2271b1;
}

.ass-no-results {
    padding: 16px;
    margin: 0;
    color: #666;
    text-align: center;
    font-size: 13px;
}

.ass-matis-suggestion {
    padding: 12px 14px;
    background: #f2f8ff;
    border-top: 1px solid #dceaff;
    font-size: 13px;
    line-height: 1.9;
}

/* دکمه دوربین (جستجوی تصویری) */
.ass-search-wrap .ass-camera-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 10px; /* LTR: سمت چپ */
    background: transparent;
    border: none;
    padding: 4px;
    line-height: 0;
    color: #8a8a8a;
    cursor: pointer;
    z-index: 5;
    opacity: 0.75;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.ass-search-wrap .ass-camera-btn:hover {
    opacity: 1;
    color: #2271b1;
}

.ass-search-wrap .ass-camera-btn svg {
    display: block;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* RTL: دوربین سمت چپ باقی می‌ماند چون آیکون جستجوی اکثر قالب‌ها سمت چپ/راست مخالف است.
   اگر قالب RTL است و آیکون ذره‌بین سمت چپ است، این قانون آن را جابه‌جا می‌کند: */
body.rtl .ass-search-wrap .ass-camera-btn,
[dir="rtl"] .ass-search-wrap .ass-camera-btn,
html[dir="rtl"] .ass-search-wrap .ass-camera-btn {
    left: 10px;
    right: auto;
}

/* جلوگیری از همپوشانی با آیکون جستجو در سمت راستِ فرم‌های RTL */
.woocommerce-product-search .ass-camera-btn,
.search-form .ass-camera-btn {
    pointer-events: auto;
}

/* اسپینر بارگذاری */
.ass-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    color: #666;
    font-size: 13px;
}

.ass-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: ass-spin 0.8s linear infinite;
}

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

/* نمایش نتایج جستجوی تصویری به‌صورت گرید (اختیاری، در صفحه نتایج) */
.ass-image-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

@media (max-width: 600px) {
    .ass-live-results { max-height: 320px; }
    .ass-result-img { width: 44px; height: 44px; }
}
