@media (max-width: 768px) {
    .search-page-title {
        font-size: 20px !important;
    }
}

:root {
    --lps-primary: #2f6fed;
    --lps-primary-light: #f0f5ff;
    --lps-text-main: #1f2937;
    --lps-text-muted: #6b7280;
    --lps-bg-gray: #f8fafc;
    --lps-radius-lg: 20px;
    --lps-radius-md: 12px;
    --lps-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --lps-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* کانتینر اصلی دسکتاپ */
.menu-live-search {
    width: 560px;
    margin: 20px auto;
    position: relative;
}

.lps {
    position: relative;
    width: 100%;
    z-index: 1000;
}

/* فرم جستجو با استایل کپسولی مدرن */
.lps-form {
    display: flex;
    align-items: center;
    background: var(--lps-bg-gray);
    border: 1.5px solid #e2e8f0;
    border-radius: var(--lps-radius-lg);
    padding: 6px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lps-form:focus-within {
    background: #ffffff;
    border-color: var(--lps-primary);
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.15);
    transform: translateY(-1px);
}

.lps-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 12px 20px;
    font-size: 16px;
    color: var(--lps-text-main);
    outline: none !important;
    box-shadow: none !important;
}

.lps-input::placeholder {
    color: #94a3b8;
}

/* دکمه جستجو - مینیمال و شیک */
.lps-btn {
    background: #64748b;
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.28s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 18px rgba(100, 116, 139, 0.16);
}

.lps-btn:hover {
    background: #74849a;
    box-shadow: 0 12px 24px rgba(100, 116, 139, 0.22);
    transform: translateY(-1px);
}

/* باکس نتایج (Glassmorphism اصلاح شده و بهینه) */
.lps-results {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%); /* همیشه وسط می‌مونه */
    width: 100%; /* عرض دینامیک */
    max-width: 600px; /* حداکثر عرض */
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8); /* حاشیه نیمه‌شفاف */
    border-radius: 22px; /* گوشه‌های گردتر */
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08); /* سایه ملایم و مدرن */
    z-index: 99999;
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent; /* رنگ اسکرول‌بار */
    animation: lpsFadeIn 0.25s ease-out;
    will-change: opacity, transform; /* بهینه‌سازی انیمیشن */
}

@keyframes lpsFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* لیست نتایج - دو ستونه */
.live-search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* دو ستون */
    gap: 12px; /* فاصله بین کارت‌ها */
}

/* هر آیتم در لیست */
.live-search-item {
    margin: 0;
}

/* اضافه کردن خط دور کارت محصول */
.live-search-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px; /* کمی پدینگ رو تنظیم کردیم که خط دورش شیک بشه */
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.25s ease;
    
    /* این دو خط خط دور رو اضافه می‌کنه */
    border: 1px solid #f1f5f9; 
    background: #ffffff; /* پس‌زمینه سفید برای تفکیک بهتر */
    
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* افکت هاور برای وقتی که خط دور داره */
.live-search-item a:hover {
    background: #f8fafc; /* تغییر ملایم رنگ پس‌زمینه در هاور */
    border-color: #cbd5e1; /* تیره شدن خط دور در هاور */
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    transform: translateY(-2px);
}

/* تصویر محصول */
.ls-image {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: 14px; /* گوشه‌های گرد برای عکس */
    background: #fff;
    border: 1px solid #f1f5f9;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* انیمیشن نرم برای چرخش */
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05); /* سایه ظریف برای عکس */
}

.live-search-item a:hover .ls-image {
    transform: rotate(-4deg) scale(1.05); /* چرخش و کمی بزرگ شدن */
}

/* اطلاعات محصول */
.live-search-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: right;
    flex: 1;
    min-width: 0; /* جلوگیری از بیرون زدن متن */
}

.ls-title {
    font-size: 14px;
    line-height: 1.6;
    font-weight: 600;
    color: #1f2937; /* رنگ اصلی متن */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ls-price {
    font-size: 15px;
    color: #475569; /* رنگ قیمت اصلی */
    font-weight: 800;
    line-height: 1.5;
}

.ls-price del { /* قیمت قدیمی */
    font-size: 12px;
    color: #9ca3af; /* رنگ خاکستری برای قیمت قدیمی */
    margin-left: 6px;
    font-weight: 500;
}

/* دکمه "مشاهده همه نتایج" */
.live-search-view-all {
    grid-column: span 2; /* تمام عرض */
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
}

.live-search-view-all a {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 13px 14px;
    background: #f8fafc; /* رنگ پس‌زمینه مینیمال */
    color: #475569; /* رنگ متن */
    border-radius: 16px; /* گوشه‌های گرد */
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.25s ease;
    border: 1px solid #e2e8f0; /* حاشیه ظریف */
}

.live-search-view-all a:hover {
    background: #eef2f7;
    color: #334155;
    border-color: #cbd5e1;
}

/* حالت لودینگ هوشمند */
.live-search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 20px;
    color: #6b7280;
    font-size: 14px;
    text-align: center;
}

.live-search-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0; /* رنگ حاشیه اسپینر */
    border-top: 3px solid #64748b; /* رنگ چرخان اسپینر */
    border-radius: 50%;
    animation: lps-spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes lps-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* ===============================
   Mobile Live Search (FINAL)
================================ */

/* دسکتاپ */
.menu-live-search{
display:block;
}

/* موبایل */
.mobile-live-wrapper{
display:none;
}

@media (max-width:1024px){

.menu-live-search{
display:none;
}

/* جلوگیری از فشرده شدن توسط قالب آسترا */
.mobile-live-wrapper {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    min-width: 44px !important; /* فضای کافی برای آیکن */
}

}

/* پنل جستجو */
.mobile-search-panel {
    display: none;
    /* تغییر به fixed برای اینکه نسبت به کل صفحه وسط‌چین شود */
    position: fixed !important; 
    
    /* تنظیم فاصله از بالا */
    top: 70px !important; 
    
    /* جادوی وسط‌چین کردن */
    left: 4vw !important; /* نیم‌فاصله از چپ */
    right: 4vw !important; /* نیم‌فاصله از راست */
    width: 92vw !important; /* کل عرض منهای فواصل */
    
    /* حذف محدودیت‌های قبلی */
    max-width: 92vw !important;
    
    background: #ffffff !important;
    padding: 15px !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2) !important;
    z-index: 1000000 !important;
    box-sizing: border-box !important;
}

/* حالت باز */
.mobile-search-panel.open {
    display: block !important;
}

/* فرم */
.mobile-search-panel .lps{
width:100%;
}

.mobile-search-panel .lps-form {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    margin: 0 !important;
}

.mobile-search-panel .lps-input {
    flex: 1 !important;
    height: 48px !important;
    font-size: 14px !important;
    border: 1px solid #eee !important;
    border-radius: 10px !important;
}

.mobile-search-panel .lps-btn {
    flex: 0 0 auto !important;
    height: 45px !important;
    padding: 0 20px !important;
    background: #222 !important;
    color: #fff !important;
    border-radius: 8px !important;
    border: none !important;
}

/* رفع مشکل اسکرول افقی */
html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* نتایج */
.mobile-search-panel .lps-results{
    position:relative !important;
    top:auto !important;
    left:auto !important;
    transform:none !important;
    width:100% !important;
    max-width:100% !important;
    margin-top:10px;
}

/* جلوگیری از overflow در هدر Astra */

.ast-site-header,
.ast-primary-header-bar{
overflow:visible !important;
}

/* فقط برای ادمین لاگین شده */
body.admin-bar .mobile-search-panel {
    top: 119px !important;
}

/* === ثابت کردن رنگ آیکن ضربدر === */
.kz-close-icon{
color:#1e73be !important;
font-size:20px;
font-weight:700;
line-height:1;
display:inline-block;
}

.kz-search-icon{
color:#333 !important;
font-size:18px;
line-height:1;
display:inline-block;
}

/* حذف کامل فوکوس مرورگر از آیکن جستجوی موبایل */
.mobile-search-icon,
.mobile-search-icon:focus,
.mobile-search-icon:active,
.mobile-search-icon:focus-visible,
.mobile-search-icon:hover {
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* جلوگیری از هایلایت هنگام لمس در موبایل */
.mobile-search-icon{
    -webkit-tap-highlight-color: transparent;
}


/* =========================
   Mobile Result UI Improve
=========================*/

@media (max-width:768px) {

    /* آیکن جستجو */
    .mobile-search-icon{
        background:transparent;
        border:0;
        box-shadow:none;
        
        display:flex;
        align-items:center;
        justify-content:center;
        
        cursor:pointer;
        padding:0;
        margin:0;
        }
        
    /* پنل کمی نرم‌تر */
    .mobile-search-panel{
        border-radius:18px !important;
        padding:14px !important;
    }

    /* نتایج */
    .mobile-search-panel .lps-results{
        max-height:60vh;
        padding:8px;
    }
    
    /* موبایل تک ستونه */
    .mobile-search-panel .live-search-results-list{
        grid-template-columns:1fr !important;
        gap:10px;
    }
    
    /* کارت محصول */
    .mobile-search-panel .live-search-item a{
        padding:12px;
        border-radius:14px;
        display:flex;
        align-items:center;
        gap:12px;
        
        border:1px solid #eef2f7;
        background:#fff;
        
        box-shadow:0 2px 8px rgba(0,0,0,0.04);
    }
        
    /* حذف حرکت زیاد در موبایل */
    .mobile-search-panel .live-search-item a:hover{
        transform:none;
        box-shadow:0 3px 10px rgba(0,0,0,0.06);
    }
    
    /* تصویر */
    .mobile-search-panel .ls-image{
        width:56px;
        height:56px;
        border-radius:12px;
        border:1px solid #f1f5f9;
        box-shadow:none;
    }
    
    /* متن */
    .mobile-search-panel .ls-title{
        font-size:13px;
        line-height:1.5;
    }
    
    /* قیمت */
    .mobile-search-panel .ls-price{
        font-size:14px;
        font-weight:700;
    }
    
    /* دکمه مشاهده همه */
    .mobile-search-panel .live-search-view-all{
        grid-column:span 1 !important;
    }
    
    .mobile-search-panel .live-search-view-all a{
        height:44px;
        font-size:13px;
        border-radius:12px;
        background:#f1f5f9;
    }
    
    /* اسکرول تمیزتر */
    .mobile-search-panel .lps-results::-webkit-scrollbar{
        width:4px;
    }
    
    .mobile-search-panel .lps-results::-webkit-scrollbar-thumb{
        background:#d1d5db;
        border-radius:10px;
    }
}

/* تنظیم اندازه آیکون سرچ موبایل (ایموجی) */
.mobile-search-icon {
    font-size: 20px !important; /* اندازه آیکون رو اینجا زیاد کن */
}