/* ============ نوار جستجوی هوشمند - آبنر ============ */

.ab-search-bar {
  width: 100%;
  max-width: 620px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 30px;
  position: relative;
  direction: rtl;
  min-height: 54px;
  box-sizing: border-box;
  z-index: 500;
}

.ab-search-input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 4px 10px;
  min-width: 0;
}
.ab-search-input::placeholder { color: rgba(255, 255, 255, 0.5); }

/* انتخابگر موتور جستجو */
.ab-engine-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.ab-engine-btn:hover { background: rgba(255, 255, 255, 0.15); }

.ab-engine-logo {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ab-engine-logo svg { width: 100%; height: 100%; }

.ab-engine-chevron {
  opacity: 0.7;
  flex-shrink: 0;
}

/* آیکون‌های ابزار */
.ab-search-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.ab-tool-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
.ab-tool-btn:hover { background: rgba(255, 255, 255, 0.15); }
.ab-tool-btn:active { transform: scale(0.94); }
.ab-tool-submit {
  background: #2563eb !important;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}
.ab-tool-submit:hover { background: #1d4ed8 !important; }

/* ============ دراپ‌دان موتورها (شیشه‌ای) ============ */

.ab-engine-dropdown {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: 8px !important;
  min-width: 260px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, var(--glass-opacity, 0.12)) !important;
  backdrop-filter: blur(var(--dash-blur-px, 24px)) saturate(180%) !important;
  -webkit-backdrop-filter: blur(var(--dash-blur-px, 24px)) saturate(180%) !important;
  border: 1px solid var(--dash-glass-border, rgba(255, 255, 255, 0.25)) !important;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45) !important;
  z-index: 99999 !important;
  direction: rtl;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: engineDropIn 0.2s ease;
}
.ab-engine-dropdown.hidden { display: none !important; }

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

.ab-engine-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  text-align: right;
  width: 100%;
  box-sizing: border-box;
}
.ab-engine-item:hover { background: rgba(255, 255, 255, 0.15); }
.ab-engine-item.active {
  background: rgba(59, 110, 245, 0.28);
  box-shadow: inset 0 0 0 1px rgba(59, 110, 245, 0.4);
}

.ab-engine-item-logo {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ab-engine-item-logo svg { width: 100%; height: 100%; }

.ab-engine-item-name {
  flex: 1;
  text-align: right;
}

.ab-engine-item .check {
  flex-shrink: 0;
}

/* ============ رفع مشکل z-index ============ */

/* در ستون وسط، سرچ‌بار باید بالاتر از بوکمارک‌ها باشه */
.center-module {
  position: relative;
  z-index: 100;
}

#abnerBookmarksContainer {
  position: relative;
  z-index: 1;
}

/* در موبایل هم درست کار کنه */
@media (max-width: 1024px) {
  .ab-search-bar {
    padding: 6px 10px;
    min-height: 48px;
  }
  .ab-engine-text { display: none; }
  .ab-engine-btn { padding: 6px 8px; }
  .ab-tool-btn { width: 34px; height: 34px; }
  .ab-search-input { font-size: 14px; }
  .ab-engine-dropdown {
    right: 4px !important;
    left: 4px !important;
    min-width: auto !important;
    max-width: none !important;
  }
}
/* ============ رپر نوار جستجو (بدون backdrop برای عدم تداخل) ============ */

.ab-search-wrap {
  position: relative;
  width: 100%;
  max-width: 620px;
  z-index: 500;
}
/* ============ آیکون‌های موتورهای ایرانی ============ */

.ab-engine-item-logo svg,
.ab-engine-logo svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* اطمینان از رندر صحیح آیکون‌های SVG با gradient */
.ab-engine-item-logo svg defs,
.ab-engine-logo svg defs {
  pointer-events: none;
}
/* ============ آیکون‌های موتورها ============ */

.ab-engine-item-logo svg,
.ab-engine-logo svg {
  display: block;
  width: 100%;
  height: 100%;
}