/**
 * استایل‌های فرانت‌اند جستجوی زنده گروهی المنتور (نسخه ۲.۰.۰ — بازشونده زیر سرچ‌بار)
 * Elementor Grouped Live Search Frontend Styles
 */

/* ==========================================================================
   ۱. کانتینر اصلی و رفع مشکل مخفی‌شدن دراپ‌داون در هدر المنتور
   ========================================================================== */
.elementor-widget-search,
.elementor-search-form,
.egls-search-container {
    position: relative !important;
    z-index: 9999 !important;
    overflow: visible !important;
}

.elementor-widget-search .e-search,
.elementor-widget-search .e-search-form,
.elementor-widget-search .e-search-input-wrapper {
    position: relative !important;
    overflow: visible !important;
}

/* ==========================================================================
   ۲. دراپ‌داون نتایج و پیشنهادات (دقیقاً زیر خود سرچ‌بار)
   ========================================================================== */
.egls-dropdown,
#egls-live-search-dropdown {
    position: absolute !important;
    min-width: 460px;
    max-width: min(620px, 94vw);
    max-height: var(--egls-max-height, 540px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--egls-dropdown-padding, 16px);
    direction: rtl;
    text-align: right;
    background: var(--egls-dropdown-bg, #ffffff);
    border: var(--egls-dropdown-border-width, 1px) solid var(--egls-dropdown-border, #e8eaf1);
    border-radius: var(--egls-radius, 16px);
    box-shadow: var(--egls-dropdown-shadow, 0 18px 50px rgba(25, 30, 65, 0.14), 0 4px 14px rgba(25, 30, 65, 0.05));
    color: var(--egls-title-color, #202235);
    font-family: inherit;
    box-sizing: border-box;
    z-index: 99999999 !important;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    visibility: hidden;
}

.egls-dropdown.is-active,
#egls-live-search-dropdown.is-active {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

.egls-dropdown[hidden],
#egls-live-search-dropdown[hidden] {
    display: none !important;
}

@media (max-width: 580px) {
    .egls-dropdown {
        min-width: 0 !important;
        width: 100% !important;
        max-width: calc(100vw - 24px) !important;
        right: 0 !important;
    }
}

/* اسکرول‌بار سفارشی */
.egls-dropdown::-webkit-scrollbar {
    width: 6px;
}
.egls-dropdown::-webkit-scrollbar-track {
    background: #f7f8fc;
    border-radius: 4px;
}
.egls-dropdown::-webkit-scrollbar-thumb {
    background: #d8dbe5;
    border-radius: 4px;
}
.egls-dropdown::-webkit-scrollbar-thumb:hover {
    background: #b5b9ca;
}

/* ==========================================================================
   ۳. امکانات هوشمند و پیشنهادات درون دراپ‌داون (ترندها، تاریخچه و بنر)
   ========================================================================== */
.egls-suggestions-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.egls-suggest-section {
    display: flex;
    flex-direction: column;
}

.egls-suggest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.egls-suggest-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #202235;
}

/* آیکون آتش ترندها */
.egls-icon-fire {
    width: 17px;
    height: 17px;
    fill: #ef4056;
    stroke: #ef4056;
    flex-shrink: 0;
}

/* آیکون ساعت تاریخچه */
.egls-icon-clock {
    width: 16px;
    height: 16px;
    stroke: #7e8299;
    flex-shrink: 0;
}

/* دکمه پاک کردن تاریخچه */
.egls-suggest-clear {
    background: transparent;
    border: none;
    color: #ef4056;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 6px;
    transition: background 0.15s;
    font-family: inherit;
}
.egls-suggest-clear:hover {
    background: rgba(239, 64, 86, 0.08);
}

/* کانتینر چیپ‌ها */
.egls-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* چیپ‌های ترند دیجی‌کالا با فلش ↗ */
.egls-chip-trend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border: 1px solid #e0e0e2;
    border-radius: 9999px;
    background: #ffffff;
    color: #3f4064;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none;
    user-select: none;
    box-sizing: border-box;
}

.egls-chip-trend svg.egls-trend-arrow {
    width: 13px;
    height: 13px;
    stroke: #81858b;
    stroke-width: 2.2;
    transition: transform 0.18s ease, stroke 0.18s ease;
    flex-shrink: 0;
}

.egls-chip-trend:hover {
    background: #f8f8fa;
    border-color: #bcc0cb;
    color: #1e202c;
    transform: translateY(-1px);
}

.egls-chip-trend:hover svg.egls-trend-arrow {
    stroke: #ef4056;
    transform: translate(-2px, -2px);
}

/* چیپ‌های تاریخچه اخیر */
.egls-chip-recent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid #e8eaf1;
    border-radius: 9999px;
    background: #f8f9fd;
    color: #3b3e54;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.egls-chip-recent .egls-chip-text {
    cursor: pointer;
}

.egls-chip-recent .egls-chip-del {
    color: #999dae;
    font-size: 14px;
    line-height: 1;
    padding: 0 3px;
    border-radius: 50%;
    transition: color 0.15s;
}
.egls-chip-recent .egls-chip-del:hover {
    color: #ef4056;
}

/* ==========================================================================
   ۴. بنر تبلیغاتی یا معرفی دوره ویژه در انتهای دراپ‌داون
   ========================================================================== */
.egls-promo-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 10px;
    padding: 16px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1c1d29 0%, #2a2e45 100%);
    color: #ffffff;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(28, 29, 41, 0.15);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    box-sizing: border-box;
}

.egls-promo-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(239, 64, 86, 0.22) 0%, transparent 70%);
    pointer-events: none;
}

.egls-promo-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(28, 29, 41, 0.25);
    color: #ffffff;
}

.egls-banner-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    z-index: 2;
}

.egls-banner-badge {
    display: inline-block;
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 20px;
    background: #ef4056;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
}

.egls-banner-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
    line-height: 1.4;
}

.egls-banner-desc {
    font-size: 11px;
    color: #c4c7d4;
    margin: 0;
    line-height: 1.5;
}

.egls-banner-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    align-self: flex-start;
    margin-top: 4px;
    padding: 5px 14px;
    border-radius: 20px;
    background: #ffffff;
    color: #1c1d29;
    font-size: 11px;
    font-weight: 700;
    transition: background 0.18s;
}

.egls-promo-banner:hover .egls-banner-btn {
    background: #ef4056;
    color: #ffffff;
}

.egls-banner-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

/* ==========================================================================
   ۵. تب‌های فیلتر سریع (In-Dropdown Filter Tabs)
   ========================================================================== */
.egls-filter-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--egls-divider-color, #e8eaf1);
    overflow-x: auto;
}

.egls-filter-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 9999px;
    background: #f4f5fa;
    border: 1px solid transparent;
    color: #5d6175;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
    font-family: inherit;
}

.egls-filter-tab-btn:hover {
    background: #ebeef5;
    color: #2b2e46;
}

.egls-filter-tab-btn.is-active {
    background: #635bff;
    color: #ffffff;
}

.egls-filter-tab-btn .egls-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 5px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.08);
    font-size: 10px;
    font-weight: 700;
}

.egls-filter-tab-btn.is-active .egls-tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* ==========================================================================
   ۶. وضعیت و لودینگ
   ========================================================================== */
.egls-status {
    padding: 12px 8px;
    text-align: center;
    font-size: 12.5px;
    color: #7e8299;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.egls-status:empty {
    display: none;
}

.egls-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e8eaf1;
    border-top-color: #635bff;
    border-radius: 50%;
    animation: egls-spin 0.75s linear infinite;
    display: inline-block;
}

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

/* ==========================================================================
   ۷. ساختار بخش‌های نتایج (محصولات، دوره‌ها و مقالات)
   ========================================================================== */
.egls-section {
    margin-bottom: 6px;
}

.egls-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 0 8px;
    padding: 0 4px;
    font-size: var(--egls-heading-font-size, 13px);
    font-weight: 700;
    color: var(--egls-heading-color, #3b3e54);
}

.egls-section-heading-count {
    font-size: 11px;
    font-weight: 500;
    color: #9295ab;
    background: #f1f2f8;
    padding: 2px 7px;
    border-radius: 10px;
}

.egls-items-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* هر آیتم نتیجه */
.egls-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: var(--egls-item-padding, 8px);
    border-radius: var(--egls-item-radius, 12px);
    text-decoration: none;
    color: inherit;
    background: var(--egls-item-bg, #ffffff);
    transition: background 0.15s ease, transform 0.15s ease;
    position: relative;
    box-sizing: border-box;
}

.egls-item:hover,
.egls-item:focus {
    background: var(--egls-item-hover-bg, #f7f7fc);
    outline: none;
}

/* تصویر بندانگشتی */
.egls-thumb-wrap {
    width: var(--egls-thumb-width, 60px);
    height: var(--egls-thumb-height, 56px);
    border-radius: var(--egls-thumb-radius, 9px);
    overflow: hidden;
    flex-shrink: 0;
    background: #f0f2f8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.egls-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.egls-item:hover .egls-thumb-wrap img {
    transform: scale(var(--egls-thumb-zoom, 1.06));
}

.egls-no-image {
    color: #b0b4c7;
    display: flex;
    align-items: center;
    justify-content: center;
}
.egls-no-image svg {
    width: 22px;
    height: 22px;
}

/* اطلاعات متنی */
.egls-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.egls-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.egls-title {
    font-size: var(--egls-title-font-size, 13px);
    font-weight: 600;
    color: var(--egls-title-color, #202235);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s ease;
    line-height: 1.4;
}

.egls-item:hover .egls-title {
    color: var(--egls-title-hover-color, #635bff);
}

.egls-title mark {
    background: rgba(99, 91, 255, 0.14);
    color: inherit;
    padding: 0 2px;
    border-radius: 3px;
}

/* بج حراج یا محصول */
.egls-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
    background: #edf0f8;
    color: #555b75;
}
.egls-badge-sale {
    background: #e53e3e;
    color: #ffffff;
}

/* قیمت و برچسب رایگان */
.egls-price {
    font-size: 12px;
    font-weight: 700;
    color: var(--egls-price-color, #635bff);
}

.egls-price-free {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    color: var(--egls-free-color, #00a389);
    background: var(--egls-free-bg, rgba(0, 163, 137, 0.1));
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.2px;
}

/* خلاصه متن مقالات */
.egls-excerpt {
    font-size: var(--egls-excerpt-font-size, 11px);
    color: var(--egls-excerpt-color, #7e8299);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.egls-date {
    font-size: 10.5px;
    color: #a1a5b7;
    margin-top: 2px;
}

/* دکمه خرید سریع */
.egls-quick-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid #e8eaf1;
    background: #ffffff;
    color: #635bff;
    cursor: pointer;
    transition: all 0.18s ease;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    font-family: inherit;
}

.egls-quick-cart-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
}

.egls-quick-cart-btn:hover {
    background: #635bff;
    border-color: #635bff;
    color: #ffffff;
}

.egls-quick-cart-btn.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.egls-quick-cart-btn.is-added {
    background: #00a389;
    border-color: #00a389;
    color: #ffffff;
}

/* خط جداکننده */
.egls-divider {
    height: 1px;
    background: var(--egls-divider-color, #e8eaf1);
    margin: 12px 0;
}

/* دکمه مشاهده همه نتایج */
.egls-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px;
    margin-top: 10px;
    border-radius: 12px;
    background: var(--egls-view-all-bg, #f8f9fd);
    color: var(--egls-view-all-color, #635bff);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    box-sizing: border-box;
}

.egls-view-all:hover {
    background: var(--egls-view-all-hover-bg, rgba(99, 91, 255, 0.08));
    color: var(--egls-view-all-color, #635bff);
}

.egls-view-all svg {
    width: 15px;
    height: 15px;
    transform: rotate(180deg);
}
