/* Express Fast Title Search */

.wfts-topbar {
  position: relative;
  z-index: 100;
  width: min(calc(100% - 24px), 560px);
  max-width: 560px;
  margin: 14px auto 12px;
  padding: 0 12px;
  box-sizing: border-box;
}

.wfts-topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow:
    0 14px 40px rgba(15, 23, 42, 0.14),
    0 2px 8px rgba(15, 23, 42, 0.06);
}

.wfts-topbar-label {
  flex-shrink: 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.wfts-root--topbar {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.wfts-root--topbar .wfts-panel {
  width: 100%;
  max-width: 100%;
}

.wfts-root--topbar .wfts-mobile-hint {
  display: none !important;
}

.wfts-root--topbar .wfts-searchbox {
  width: 100%;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.wfts-root--topbar .wfts-searchbox:focus-within,
.wfts-root--topbar.is-open .wfts-searchbox {
  border: 0;
  box-shadow: none;
}

.wfts-root--topbar .wfts-results {
  z-index: 100000;
}

@media (max-width: 768px) {
  .wfts-topbar {
    width: calc(100% - 16px);
    margin: 10px auto 12px;
    padding: 0 8px;
  }

  .wfts-topbar-inner {
    padding: 8px 10px;
    gap: 8px;
  }

  .wfts-topbar-label {
    display: none;
  }
}

.wfts-root {
  position: relative;
  z-index: 100;
  font-family: inherit;
}

.wfts-mobile-hint {
  display: none;
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #475569;
}

.wfts-panel {
  width: min(100%, 420px);
}

.wfts-panel-inner {
  position: relative;
}

.wfts-searchbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.wfts-root.is-open .wfts-searchbox,
.wfts-searchbox:focus-within {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.wfts-search-icon {
  display: inline-flex;
  color: #64748b;
  flex-shrink: 0;
}

.wfts-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 0.98rem;
  line-height: 1.5;
  color: #0f172a;
  outline: none;
}

.wfts-input::placeholder {
  color: #94a3b8;
}

.wfts-close {
  display: none;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.wfts-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(70vh, 420px);
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  z-index: 20;
}

.wfts-results[hidden] {
  display: none !important;
}

.wfts-item,
.wfts-msg,
.wfts-see-all {
  display: block;
}

.wfts-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.wfts-item:last-child {
  border-bottom: 0;
}

.wfts-item:hover,
.wfts-item.is-active {
  background: #eff6ff;
}

.wfts-item-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f1f5f9;
}

.wfts-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wfts-item-body {
  min-width: 0;
  flex: 1;
}

.wfts-item-title {
  display: block;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wfts-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.82rem;
  color: #64748b;
}

.wfts-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.75rem;
}

.wfts-msg {
  padding: 14px 12px;
  color: #64748b;
  font-size: 0.92rem;
}

.wfts-see-all {
  padding: 12px;
  text-align: center;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  border-top: 1px solid #f1f5f9;
}

.wfts-see-all:hover {
  background: #f8fafc;
  color: #1d4ed8;
}

.wfts-backdrop {
  display: none;
}

/* Results page */
.wfts-results-page {
  padding: 32px 16px 48px;
}

.wfts-results-page-inner {
  max-width: 860px;
  margin: 0 auto;
}

.wfts-results-header h1 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.wfts-results-query {
  color: #64748b;
  margin: 0 0 24px;
}

.wfts-results-empty {
  color: #64748b;
}

.wfts-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.wfts-results-item {
  margin: 0;
}

.wfts-results-link {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.wfts-results-link:hover {
  border-color: #bfdbfe;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.1);
}

.wfts-results-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f1f5f9;
}

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

.wfts-results-title {
  display: block;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.wfts-results-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.88rem;
  color: #64748b;
}

.wfts-results-type {
  color: #4338ca;
  font-weight: 600;
}

/* Mobile: باکس جستجو همیشه visible (نه آیکون مخفی) */
@media (max-width: 768px) {
  .wfts-root {
    width: 100%;
    max-width: 100%;
  }

  .wfts-mobile-hint {
    display: block;
  }

  .wfts-panel {
    display: block !important;
    position: relative;
    width: 100%;
    max-width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .wfts-searchbox {
    width: 100%;
    padding: 12px 14px;
    min-height: 48px;
    border-radius: 14px;
  }

  .wfts-input {
    font-size: 1rem;
  }

  .wfts-close {
    display: none !important;
  }

  .wfts-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(65vh, 360px);
    margin-top: 0;
    z-index: 30;
  }

  .wfts-root.is-results-open .wfts-results {
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  }

  .wfts-backdrop {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .wfts-panel {
    display: block !important;
  }
}
