/**
 * =================================================================
 *  WooCommerce Live Search – CSS (Optimized)
 * =================================================================
 *
 * @version 2.0.1 (Optimized by Manus AI)
 *
 * الهدف: تنسيق نتائج البحث اللحظي بشكل احترافي ومتوافق مع الجوال.
 */

/* -----------------------------------------------------------------
   1. Results Box Container (صندوق النتائج)
   ----------------------------------------------------------------- */
.talb-live-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;

    /* Styling */
    background: var(--base-2, #ffffff);
    border: 1px solid var(--contrast-3, #dddddd);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    z-index: 9999;

    /* Scroll */
    max-height: 420px;
    overflow-y: auto;
}

/* -----------------------------------------------------------------
   2. Individual Result Item (عنصر النتيجة)
   ----------------------------------------------------------------- */
.talb-live-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    text-decoration: none !important;
    background: transparent;
    transition: background 0.2s ease;
}

.talb-live-search-item:hover {
    background: rgba(0,0,0,0.04);
}

/* -----------------------------------------------------------------
   3. Product Image (صورة المنتج)
   ----------------------------------------------------------------- */
.talb-live-search-item img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    background: rgba(0,0,0,0.03);
    border-radius: 4px;
    flex-shrink: 0;
}

/* -----------------------------------------------------------------
   4. Text Information (النصوص)
   ----------------------------------------------------------------- */
.talb-live-search-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0; /* Allows text to truncate */
}

/* Product Title (اسم المنتج) */
.talb-live-search-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--contrast, #111111);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* SKU / Product Code (رمز المنتج) */
.talb-live-search-sku {
    font-size: 12px;
    color: var(--contrast-2, #666666);
}

/* Price (السعر) */
.talb-live-search-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent, #b12704);
}

/* -----------------------------------------------------------------
   5. Search Term Highlight (إبراز كلمة البحث)
   ----------------------------------------------------------------- */
.talb-live-search-title mark {
    background: rgba(255,230,150,0.85);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* -----------------------------------------------------------------
   6. Loading / Empty States (حالات التحميل / لا نتائج)
   ----------------------------------------------------------------- */
.talb-live-search-loading,
.talb-live-search-empty {
    padding: 14px;
    text-align: center;
    font-size: 14px;
    color: var(--contrast-2, #666);
}

/* -----------------------------------------------------------------
   7. "View All Results" Button (زر "عرض كل النتائج")
   ----------------------------------------------------------------- */
.talb-live-search-all {
    display: block;
    padding: 14px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--contrast, #000) !important;
    background: var(--base, #f7f7f7);
    border-top: 1px solid var(--contrast-3, #ddd);
    text-decoration: none !important;
    transition: background 0.2s ease;
}

.talb-live-search-all:hover {
    background: var(--base-2, #eeeeee);
}

/* -----------------------------------------------------------------
   8. Scrollbar Styling (تنسيق شريط التمرير)
   ----------------------------------------------------------------- */
.talb-live-search-results::-webkit-scrollbar {
    width: 6px;
}

.talb-live-search-results::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.25);
    border-radius: 3px;
}

/* -----------------------------------------------------------------
   9. Mobile Adjustments (تعديلات الجوال)
   ----------------------------------------------------------------- */
@media (max-width: 768px) {
    /* Ensure the results box is still a dropdown on mobile */
    .talb-live-search-results {
        position: absolute;
        max-height: 65vh;
        border-radius: 6px;
    }
}
