/* FilmyBazaar — animated search bar & results panel */

.search-wrapper {
  position: relative;
}

/* Dropdown panel */
.search-results,
.search-suggestions {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  right: 0;
  z-index: 2100;
  display: none;
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  pointer-events: none;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(165deg, rgba(28, 26, 44, 0.98), rgba(14, 12, 24, 0.99));
  border: 1px solid rgba(255, 107, 107, 0.35);
  box-shadow:
    0 24px 56px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 40px rgba(255, 61, 61, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  max-height: min(420px, 58vh);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ff6b6b rgba(0, 0, 0, 0.2);
}

.search-results.show,
.search-suggestions.show {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: fbSearchPanelIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes fbSearchPanelIn {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Search bar pulse while loading */
.search-container.is-searching {
  border-color: rgba(255, 61, 61, 0.55) !important;
  animation: fbSearchBarPulse 1.2s ease-in-out infinite;
}

.search-container.is-searching .search-icon i {
  animation: fbSearchIconSpin 0.9s linear infinite;
}

@keyframes fbSearchBarPulse {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(255, 61, 61, 0.35),
      0 10px 26px rgba(0, 0, 0, 0.32);
  }
  50% {
    box-shadow:
      0 0 0 6px rgba(255, 61, 61, 0),
      0 0 32px rgba(255, 61, 61, 0.28);
  }
}

@keyframes fbSearchIconSpin {
  to { transform: rotate(360deg); }
}

/* Panel header */
.fb-sr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(90deg, rgba(255, 61, 61, 0.12), transparent);
}

.fb-sr-header-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffb6b6;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.fb-sr-header-title i {
  color: #ff6b6b;
  animation: fbSearchSparkle 2s ease-in-out infinite;
}

@keyframes fbSearchSparkle {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

.fb-sr-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(189, 195, 199, 0.85);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 61, 61, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.25);
}

/* Loading */
.fb-sr-loading {
  padding: 1.75rem 1rem;
  text-align: center;
}

.fb-sr-loading-bar {
  width: 56%;
  height: 4px;
  margin: 0 auto 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

.fb-sr-loading-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, #ff6b6b, #ffd700, transparent);
  animation: fbSearchLoadBar 1s ease-in-out infinite;
}

@keyframes fbSearchLoadBar {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.fb-sr-loading p {
  margin: 0;
  font-size: 0.88rem;
  color: #bdc3c7;
}

/* Highlight matched query text */
.fb-sr-hl {
  background: rgba(255, 61, 61, 0.35);
  color: #fff;
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 800;
}

/* Result row — desktop suggestions + searchResults */
.suggestion-item.fb-sr-item,
.search-result-item.fb-sr-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.75rem 1rem;
  margin: 0;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  opacity: 0;
  animation: fbSearchItemIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: background 0.22s ease, transform 0.22s ease;
}

.suggestion-item.fb-sr-item:last-child,
.search-result-item.fb-sr-item:last-child {
  border-bottom: none;
}

@keyframes fbSearchItemIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.suggestion-item.fb-sr-item:hover,
.suggestion-item.fb-sr-item:focus-visible,
.search-result-item.fb-sr-item:hover,
.search-result-item.fb-sr-item:focus-visible {
  background: linear-gradient(90deg, rgba(255, 61, 61, 0.18), rgba(255, 61, 61, 0.04));
  transform: translateX(4px);
  outline: none;
}

.fb-sr-poster-wrap {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.fb-sr-poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.suggestion-item.fb-sr-item:hover .fb-sr-poster-wrap img,
.search-result-item.fb-sr-item:hover .fb-sr-poster-wrap img {
  transform: scale(1.08);
}

.fb-sr-poster-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, 0.2) 50%, transparent 60%);
  transform: translateX(-100%);
  animation: fbPosterShine 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes fbPosterShine {
  0%, 70% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.fb-sr-body {
  flex: 1;
  min-width: 0;
}

.fb-sr-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.fb-sr-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #a8a8b8;
  margin-bottom: 0.2rem;
}

.fb-sr-type {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #c8c8d8;
}

.fb-sr-type i {
  color: #ff8e8e;
  font-size: 0.72rem;
}

.fb-sr-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ff6b6b;
}

.fb-sr-rating i {
  color: #ffd700;
  font-size: 0.72rem;
}

.fb-sr-play {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff3d3d, #ff6b6b);
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 6px 18px rgba(255, 61, 61, 0.45);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.suggestion-item.fb-sr-item:hover .fb-sr-play,
.search-result-item.fb-sr-item:hover .fb-sr-play {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(255, 61, 61, 0.55);
}

.fb-sr-play i {
  margin-left: 2px;
}

/* Empty / error */
.fb-sr-empty {
  padding: 2rem 1.25rem;
  text-align: center;
  color: #bdc3c7;
}

.fb-sr-empty i {
  font-size: 2rem;
  color: rgba(255, 107, 107, 0.45);
  margin-bottom: 0.65rem;
  display: block;
}

/* Mobile search results — match desktop polish */
.fb-msearch-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font-family: 'Poppins', sans-serif;
  opacity: 0;
  animation: fbSearchItemIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: background 0.2s ease;
}

.fb-msearch-result:hover {
  background: rgba(255, 61, 61, 0.12);
}

.fb-msearch-result .fb-sr-poster-wrap {
  width: 52px;
  height: 78px;
}

.fb-msearch-loading {
  padding: 2rem 1rem;
  text-align: center;
  color: #bdc3c7;
}

.fb-msearch-loading .fb-sr-loading-bar {
  margin-bottom: 1rem;
}

/* Mobile full-screen search bar glow */
.fb-msearch-input-wrap.fb-msearch-active {
  border-color: rgba(255, 61, 61, 0.5);
  box-shadow: 0 0 28px rgba(255, 61, 61, 0.25);
  animation: fbSearchBarPulse 1.4s ease-in-out infinite;
}

.fb-msearch-results .suggestion-item.fb-sr-item {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .search-results.show,
  .suggestion-item.fb-sr-item,
  .search-result-item.fb-sr-item,
  .fb-msearch-result,
  .search-container.is-searching,
  .search-container.is-searching .search-icon i,
  .fb-sr-header-title i,
  .fb-sr-poster-shine {
    animation: none !important;
  }
  .suggestion-item.fb-sr-item,
  .search-result-item.fb-sr-item,
  .fb-msearch-result {
    opacity: 1;
    transform: none;
  }
}
