/* =============================================================================
   «دنبال چه محصولی هستید؟» — جست‌وجوگر صفحه اصلی (پیشوند fdr-)
   ============================================================================= */

.fdr,
.fdr.hm-reveal,
.fdr.hm-reveal.is-visible {
    position: relative;
    isolation: isolate;
    padding: 30px clamp(18px, 4vw, 40px) 26px;
    border-radius: 26px;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(56, 189, 248, .28), transparent 46%),
        linear-gradient(135deg, #0a2358 0%, #0B4F9F 48%, #1454d6 100%);
    background-color: #0B4F9F;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow:
        0 18px 44px -20px rgba(10, 35, 88, .7);
    overflow: visible;
    color: #fff;
    transition: transform .28s ease, box-shadow .28s ease, filter .28s ease;
}
.fdr:hover,
.fdr.hm-reveal.is-visible:hover {
    transform: translateY(-6px);
    box-shadow: 0 28px 56px -18px rgba(10, 35, 88, .8);
    filter: saturate(1.08);
}

/* هاله نرم پشت کادر */
.fdr__glow {
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: inherit;
    background: conic-gradient(from 210deg, #4f46e5, #0ea5e9, #22c55e, #f59e0b, #4f46e5);
    opacity: 0;
    filter: blur(16px);
    transition: opacity .45s ease;
}
.fdr.is-open .fdr__glow,
.fdr:focus-within .fdr__glow { opacity: .28; }

.fdr__head { text-align: center; margin-bottom: 18px; }

.fdr__title {
    margin: 0;
    font-size: clamp(19px, 2.6vw, 26px);
    font-weight: 800;
    line-height: 1.6;
    color: #fff;
}

.fdr__sub {
    margin: 6px 0 0;
    font-size: clamp(12px, 1.6vw, 14px);
    color: rgba(255, 255, 255, .84);
    line-height: 2;
}

/* ------------------------------- فرم ------------------------------- */
.fdr__form {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px;
    border-radius: 999px;
    background: #fff;
    border: 1.5px solid rgba(15, 23, 42, .1);
    box-shadow: 0 10px 26px -20px rgba(15, 23, 42, .5);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.fdr__form:focus-within {
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .13), 0 14px 30px -20px rgba(79, 70, 229, .6);
}

.fdr__icon {
    display: grid;
    place-items: center;
    width: 34px;
    flex: 0 0 34px;
    font-size: 17px;
    color: #94a3b8;
}

.fdr__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 15px;
    color: #0f172a;
}
.fdr__input::placeholder { color: #94a3b8; }

.fdr__clear {
    flex: 0 0 auto;
    width: 30px; height: 30px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}
.fdr__clear:hover { background: #e2e8f0; }

.fdr__btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 44px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
    box-shadow: 0 10px 22px -12px rgba(79, 70, 229, .95);
}
.fdr__btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.fdr__btn:active { transform: translateY(0); }

/* نوار بارگذاری نازک بالای فرم */
.fdr.is-busy .fdr__form::after {
    content: '';
    position: absolute;
    inset-block-start: -1.5px;
    inset-inline-start: 12%;
    width: 30%;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, #4f46e5, transparent);
    animation: fdr-scan 1s linear infinite;
}
@keyframes fdr-scan {
    0%   { transform: translateX(0);    opacity: 0; }
    30%  { opacity: 1; }
    100% { transform: translateX(160%); opacity: 0; }
}

/* ------------------------------ پنل نتیجه ------------------------------ */
.fdr__panel {
    position: absolute;
    inset-block-start: calc(100% + 10px);
    inset-inline: 0;
    z-index: 60;
    max-height: min(62vh, 480px);
    overflow: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    box-shadow: 0 24px 60px -28px rgba(15, 23, 42, .6);
    -webkit-overflow-scrolling: touch;
}

.fdr__group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 4px;
}
.fdr__group-t { font-size: 11px; font-weight: 800; color: #94a3b8; letter-spacing: .02em; }
.fdr__wipe {
    margin-inline-start: auto;
    border: 0;
    background: none;
    color: #6366f1;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.fdr__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    color: #0f172a;
    text-decoration: none;
}
.fdr__row:hover,
.fdr__row.is-active { background: #eef2ff; }
.fdr__row--plain { gap: 9px; font-size: 13px; color: #334155; }
.fdr__row--plain i { color: #94a3b8; font-size: 14px; }

.fdr__thumb {
    display: grid;
    place-items: center;
    width: 42px; height: 42px;
    flex: 0 0 42px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    color: #94a3b8;
}
.fdr__thumb img { width: 100%; height: 100%; object-fit: contain; }

.fdr__txt { min-width: 0; flex: 1 1 auto; }
.fdr__txt b {
    display: block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fdr__txt em { font-style: normal; font-size: 11px; color: #94a3b8; }
.fdr__row mark { background: #fef08a; color: inherit; padding: 0 1px; border-radius: 3px; }

.fdr__price {
    flex: 0 0 auto;
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}
.fdr__price.is-out { color: #ef4444; font-weight: 600; }

.fdr__tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 10px 8px; }
.fdr__tag {
    padding: 5px 12px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12.5px;
    text-decoration: none;
}
.fdr__tag:hover, .fdr__tag.is-active { background: #4f46e5; color: #fff; }
.fdr__tag mark { background: transparent; color: inherit; font-weight: 800; }

.fdr__all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 4px;
    padding: 11px;
    border-radius: 12px;
    background: #f8fafc;
    color: #4f46e5;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.fdr__all:hover, .fdr__all.is-active { background: #eef2ff; }

.fdr__none {
    display: grid;
    justify-items: center;
    gap: 5px;
    padding: 28px 16px;
    text-align: center;
}
.fdr__none i { font-size: 26px; color: #cbd5e1; }
.fdr__none b { font-size: 13.5px; }
.fdr__none span { font-size: 12px; color: #94a3b8; }

/* ------------------------------ چیپ‌ها ------------------------------ */
.fdr__chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
    justify-content: center;
}
.fdr__chips-label { font-size: 12px; color: rgba(255,255,255,.72); }
.fdr__chip {
    padding: 5px 13px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 12.5px;
    text-decoration: none;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.fdr__chip:hover { background: #fff; color: #0B4F9F; transform: translateY(-1px); }

/* --------------------------- میان‌بر دسته‌ها --------------------------- */
.fdr__quick {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 16px;
}
.fdr__cat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .16);
    color: #fff;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.fdr__cat:hover {
    transform: translateY(-2px);
    background: #fff;
    color: #0B4F9F;
    border-color: #fff;
}
.fdr__cat b {
    font-size: 12.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fdr__cat em {
    font-style: normal;
    font-size: 11px;
    color: inherit;
    background: rgba(255,255,255,.16);
    border-radius: 999px;
    padding: 2px 8px;
    flex: 0 0 auto;
}

/* ------------------------------ نکته‌ها ------------------------------ */
.fdr__facts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 22px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed rgba(255,255,255,.22);
    font-size: 12px;
    color: rgba(255,255,255,.82);
}
.fdr__facts i { color: #fff; margin-inline-end: 4px; }
.fdr__facts b { color: #fff; }

/* ------------------------------ موبایل ------------------------------ */
@media (max-width: 640px) {
    .fdr { padding: 22px 16px 20px; border-radius: 22px; }
    .fdr__form { flex-wrap: wrap; border-radius: 20px; padding: 8px; }
    .fdr__icon { display: none; }
    .fdr__input { flex: 1 1 100%; order: 1; padding-inline: 12px; }
    .fdr__clear { order: 2; }
    .fdr__btn { order: 3; flex: 1 1 100%; justify-content: center; border-radius: 14px; }
    .fdr__panel { border-radius: 16px; }
    .fdr__facts { gap: 6px 14px; }
}

/* ------------------------------ حالت تاریک ------------------------------ */
@media (prefers-color-scheme: dark) {
    html[data-theme="dark"] .fdr,
    html:not([data-theme="light"]) .fdr {
        background:
            linear-gradient(180deg, rgba(30, 41, 59, .96), rgba(15, 23, 42, .92)),
            radial-gradient(120% 140% at 85% -20%, rgba(99, 102, 241, .25), transparent 60%);
        background-color: #0f172a;
        border-color: rgba(148, 163, 184, .18);
    }
    html:not([data-theme="light"]) .fdr__title { color: #f1f5f9; }
    html:not([data-theme="light"]) .fdr__form {/* background: #1e293b; *//* border-color: rgba(148, 163, 184, .22); */}
    html:not([data-theme="light"]) .fdr__input { color: #e2e8f0; }
    html:not([data-theme="light"]) .fdr__panel { background: #1e293b; border-color: rgba(148, 163, 184, .18); }
    html:not([data-theme="light"]) .fdr__row { color: #e2e8f0; }
    html:not([data-theme="light"]) .fdr__row:hover,
    html:not([data-theme="light"]) .fdr__row.is-active { background: rgba(99, 102, 241, .18); }
    html:not([data-theme="light"]) .fdr__cat {/* background: rgba(30, 41, 59, .7); */border-color: rgba(148, 163, 184, .18);color: #e2e8f0;}
}

@media (prefers-reduced-motion: reduce) {
    .fdr__glow, .fdr__btn, .fdr__cat { transition: none; }
    .fdr.is-busy .fdr__form::after { animation: none; }
}
