/* ============================================================
   موتور جستجوی پیشرفته - استایل فرانت‌اند
   RTL-first، سبک و بدون وابستگی خارجی
   ============================================================ */

.ase-search-wrapper {
    position: relative;
    max-width: 560px;
    width: 100%;
    font-family: inherit;
    direction: rtl;
}

.ase-search-form {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1.5px solid #d9dde3;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.ase-search-form:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.ase-search-input {
    flex: 1;
    border: 0;
    outline: 0;
    padding: 12px 16px;
    font-size: 15px;
    background: transparent;
    color: #1f2733;
}

.ase-search-input::placeholder { color: #9aa3b0; }

.ase-search-submit {
    border: 0;
    background: #2563eb;
    color: #fff;
    padding: 0 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}
.ase-search-submit:hover { background: #1d4ed8; }

/* ---------- پنل نتایج ---------- */
.ase-results-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e8ee;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .14);
    z-index: 9999;
    max-height: 70vh;
    overflow-y: auto;
    padding: 8px;
    animation: ase-fade .12s ease;
}

@keyframes ase-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ase-loading,
.ase-empty {
    padding: 22px 16px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.ase-loading::before {
    content: "";
    display: inline-block;
    width: 15px; height: 15px;
    margin-inline-end: 8px;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    vertical-align: -2px;
    animation: ase-spin .7s linear infinite;
}
@keyframes ase-spin { to { transform: rotate(360deg); } }

/* پیشنهاد تصحیح */
.ase-suggestion {
    padding: 10px 12px;
    margin-bottom: 4px;
    font-size: 13.5px;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
}
.ase-suggest-link {
    background: none;
    border: 0;
    color: #b45309;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
    padding: 0;
}

.ase-group-title {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    padding: 10px 12px 4px;
    letter-spacing: .02em;
}

.ase-group { display: flex; flex-direction: column; }

.ase-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: #1f2733;
    transition: background .1s ease;
}
.ase-item:hover,
.ase-item.active { background: #f1f5f9; }

.ase-item-thumb {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    object-fit: cover;
    background: #f1f5f9;
    flex-shrink: 0;
}
.ase-item-thumb--empty {
    background: linear-gradient(135deg, #eef2f7, #e2e8f0);
}

.ase-item-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}
.ase-item-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ase-item-title mark {
    background: #fef08a;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}
.ase-item-meta { display: flex; gap: 8px; align-items: center; }
.ase-item-price { font-size: 13px; font-weight: 700; color: #059669; }
.ase-item-stock {
    font-size: 11px;
    color: #b91c1c;
    background: #fee2e2;
    padding: 1px 6px;
    border-radius: 6px;
}

.ase-view-all {
    display: block;
    text-align: center;
    padding: 11px;
    margin-top: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    border-top: 1px solid #eef2f7;
}
.ase-view-all:hover { background: #f8fafc; }

/* اسکرول‌بار ظریف */
.ase-results-panel::-webkit-scrollbar { width: 8px; }
.ase-results-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1; border-radius: 8px;
}

/* حالت تیره (اختیاری، اگر قالب کلاس dark داشته باشد) */
@media (prefers-color-scheme: dark) {
    .ase-search-form { background: #1e293b; border-color: #334155; }
    .ase-search-input { color: #e2e8f0; }
    .ase-results-panel { background: #1e293b; border-color: #334155; }
    .ase-item { color: #e2e8f0; }
    .ase-item:hover, .ase-item.active { background: #273449; }
}
