/* ============================================================
   ROUZHINA Live Search — استایل فرانت‌اند (الهام‌گرفته از خانومی)
   ============================================================ */

/* برای استفاده از فونت محلی، فایل‌ها را در assets/fonts قرار دهید
   و دو @font-face زیر را از کامنت خارج کنید:

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
*/

.rls-wrap {
  position: relative;
  direction: rtl;
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  color: #0e0e16;
  z-index: 999;
  /* متغیرهای پیش‌فرض — همه از داشبورد قابل تغییرند (inline روی عنصر) */
  --rls-accent: #5A5998;
  --rls-border: #E4E3E1;
  --rls-border-focus: #5A5998;
  --rls-panel-bg: #FFFFFF;
  --rls-panel-hover: #FEFEFB;
  --rls-icon-bg: #EEEEF7;
  --rls-icon-color: #5A5998;
  --rls-submit-bg: #EEEEF7;
  --rls-submit-hover: #5A5998;
  --rls-submit-color: #5A5998;
  --rls-width: 100%;
  width: var(--rls-width);
  max-width: 100%;
}

/* وقتی فرم با سلکتور CSS جایگزین نوار جستجوی قالب شده باشد؛
   در ظرف‌های flex کش می‌آید تا عرض تعیین‌شدهٔ کاربر (--rls-width) اعمال شود. */
.rls-injected { width: 100%; }
.rls-injected .rls-wrap { flex: 1 1 auto; min-width: 0; }

/* در موبایل همیشه تمام‌عرض — صرف‌نظر از عرض دسکتاپ تعیین‌شده */
@media (max-width: 767px) {
  .rls-wrap { width: 100% !important; }
}

.rls-wrap *,
.rls-wrap *::before,
.rls-wrap *::after { box-sizing: border-box; }

/* ---------- فرم ---------- */

.rls-form {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--rls-panel-bg);
  border: 1.5px solid var(--rls-border);
  border-radius: 14px;
  padding: 10px 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.rls-form:focus-within {
  border-color: #5a5998;
  box-shadow: 0 0 0 4px rgba(90, 89, 152, 0.12);
}

.rls-form-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #7f6c72;
  transition: background 0.18s ease, color 0.18s ease;
}
.rls-form-icon svg { width: 18px; height: 18px; }
.rls-form-icon img { width: 18px; height: 18px; }

.rls-form:focus-within .rls-form-icon { color: #5a5998; }

.rls-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font: inherit;
  font-size: 14.5px;
  color: #0e0e16;
  padding: 2px 0;
}

.rls-input::placeholder { color: #7f6c72; }

.rls-spinner svg {
  width: 18px;
  height: 18px;
  display: block;
  color: #5a5998;
  animation: rls-spin 0.8s linear infinite;
}

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

.rls-submit {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: #eeeef7;
  color: #5a5998;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.rls-submit:hover { background: #5a5998; color: #fff; transform: scale(1.05); }
.rls-submit svg { width: 17px; height: 17px; }

/* ---------- پنل نتایج ---------- */

.rls-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: 0;
  background: var(--rls-panel-bg);
  border: 1px solid var(--rls-border);
  border-radius: 16px;
  box-shadow: 0 24px 48px -18px rgba(14, 14, 22, 0.22), 0 2px 6px rgba(14, 14, 22, 0.05);
  max-height: min(480px, 70vh);
  overflow-y: auto;
  padding: 8px;
  z-index: 1000;
  animation: rls-panel-in 0.2s cubic-bezier(0.2, 0.8, 0.3, 1) both;
  scrollbar-width: thin;
  scrollbar-color: #d8d6d2 transparent;
}

@keyframes rls-panel-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rls-panel::-webkit-scrollbar { width: 6px; }
.rls-panel::-webkit-scrollbar-thumb { background: #d8d6d2; border-radius: 99px; }
.rls-panel::-webkit-scrollbar-thumb:hover { background: #5a5998; }

/* ---------- سرگروه‌ها ---------- */

.rls-group-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #7f6c72;
  padding: 10px 12px 6px;
  letter-spacing: 0.2px;
}

/* ---------- آیتم‌ها ---------- */

.rls-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  color: #0e0e16;
  text-decoration: none !important;
  transition: background 0.14s ease;
}

.rls-item:hover,
.rls-item.rls-active { background: #fefefb; outline: 1px solid #eeeef7; }

.rls-item-title {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.7;
  min-width: 0;
}

.rls-mark {
  color: #5a5998;
  background: rgba(90, 89, 152, 0.1);
  border-radius: 4px;
  padding: 0 1px;
  font-weight: 700;
}

.rls-count {
  flex: none;
  font-size: 11.5px;
  color: #7f6c72;
  background: #f6f5f3;
  border-radius: 99px;
  padding: 3px 10px;
}

/* دسته‌بندی */
.rls-cat-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #eeeef7;
  color: #5a5998;
}

.rls-cat-icon svg { width: 20px; height: 20px; }

.rls-item:hover .rls-cat-icon,
.rls-item.rls-active .rls-cat-icon { background: #5a5998; color: #fff; }

/* برند */
.rls-brand-logo,
.rls-brand-letter {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid #e4e3e1;
  background: #fff;
}

.rls-brand-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }

.rls-brand-letter { font-size: 16px; font-weight: 800; border: none; }

/* محصول */
.rls-thumb {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  background: #f6f5f3;
  border: 1px solid #eeedeb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rls-thumb img { width: 100%; height: 100%; object-fit: cover; }

.rls-product-body { flex: 1; min-width: 0; display: block; }

.rls-price {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #0e0e16;
  margin-top: 2px;
}

.rls-price del,
.rls-price .woocommerce-Price-amount del { color: #7f6c72; font-weight: 400; margin-inline-start: 6px; }
.rls-price ins { text-decoration: none; color: #5a5998; }

.rls-badge {
  display: inline-block;
  margin-inline-start: 8px;
  vertical-align: middle;
  font-size: 10.5px;
  font-weight: 700;
  color: #9a6b1f;
  background: #fbf0e3;
  border-radius: 99px;
  padding: 2px 9px;
}

/* ---------- حالت خالی ---------- */

.rls-empty { text-align: center; padding: 34px 18px 28px; }
.rls-empty svg { width: 42px; height: 42px; color: #c9c6c1; margin-bottom: 10px; }
.rls-empty-title { font-size: 15px; font-weight: 800; margin: 0 0 4px; }
.rls-empty-hint { font-size: 12.5px; color: #7f6c72; margin: 0; }

/* ---------- لینک پایین پنل ---------- */

.rls-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding: 12px 14px;
  border-top: 1px solid #e4e3e1;
  border-radius: 0 0 12px 12px;
  color: #5a5998 !important;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
  transition: background 0.14s ease;
}

.rls-footer:hover,
.rls-footer.rls-active { background: #eeeef7; }
.rls-footer svg { width: 18px; height: 18px; flex: none; }

/* ---------- متغیرهای قابل تنظیم از داشبورد ----------
   همهٔ متغیرها روی .rls-wrap به‌صورت inline از تنظیمات ست می‌شوند؛
   این بلوک عناصر را به آن‌ها متصل می‌کند. */

.rls-form:focus-within { border-color: var(--rls-border-focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rls-border-focus) 12%, transparent); }
.rls-form:focus-within .rls-form-icon { color: var(--rls-icon-color); }
.rls-form-icon { background: var(--rls-icon-bg); color: var(--rls-icon-color); }
.rls-spinner svg { color: var(--rls-accent); }
.rls-submit { background: var(--rls-submit-bg); color: var(--rls-submit-color); }
.rls-submit:hover { background: var(--rls-submit-hover); color: #fff; }
.rls-panel { background: var(--rls-panel-bg); }
.rls-item:hover, .rls-item.rls-active { background: var(--rls-panel-hover); }
.rls-panel::-webkit-scrollbar-thumb:hover { background: var(--rls-accent); }
.rls-mark { color: var(--rls-accent); background: color-mix(in srgb, var(--rls-accent) 10%, transparent); }
.rls-item:hover .rls-cat-icon, .rls-item.rls-active .rls-cat-icon { background: var(--rls-accent); color: #fff; }
.rls-cat-icon { background: color-mix(in srgb, var(--rls-accent) 12%, #fff); color: var(--rls-accent); }
.rls-price ins { color: var(--rls-accent); }
.rls-footer { color: var(--rls-accent) !important; }
.rls-footer:hover, .rls-footer.rls-active { background: color-mix(in srgb, var(--rls-accent) 10%, #fff); }

/* حذف سایه از داشبورد */
.rls-no-shadow .rls-form, .rls-no-shadow .rls-panel { box-shadow: none !important; }

/* ---------- دکمهٔ قیف فیلتر ---------- */

.rls-filter-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: var(--rls-icon-bg);
  color: var(--rls-icon-color);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.rls-filter-btn:hover { background: var(--rls-accent); color: #fff; transform: scale(1.05); }
.rls-filter-btn svg { width: 17px; height: 17px; }

/* آیکن سفارشی آپلودشده (تصویر به‌جای SVG) */
.rls-custom-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

/* ---------- حالت ناموجود (بدون قیمت) ---------- */

.rls-item.rls-oos .rls-thumb img { filter: grayscale(0.6); opacity: 0.75; }
.rls-item.rls-oos .rls-item-title { color: #7f6c72; }

/* لوگوی برند کمی بزرگ‌تر تا بندانگشتی خوانا باشد */
.rls-brand-logo, .rls-brand-letter { width: 40px; height: 40px; }
.rls-brand-logo img { padding: 4px; }

/* ---------- ریسپانسیو ---------- */

@media (max-width: 640px) {
  .rls-panel {
    position: fixed;
    top: auto;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: 62vh;
  }
  .rls-item-title { font-size: 13px; }
  .rls-form { padding: 9px 12px; }
}
