/* ========================================================================
   LWG TV — Global Search Overlay (Premium Cinematic UX)
   ========================================================================== */

/* Overlay backdrop */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(5, 8, 14, 0.85);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.search-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.search-overlay-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(160,30,30,0.08) 0%, transparent 60%);
  pointer-events: none;
}

/* Search panel */
.search-panel {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin-top: 8vh;
  padding: 0 20px;
  z-index: 1;
}

/* Search input container */
.search-input-box {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(18, 24, 38, 0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input-box:focus-within {
  border-color: rgba(180, 40, 40, 0.6);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(180, 40, 40, 0.3);
}
.search-input-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-right: 14px;
  opacity: 0.5;
}
.search-input-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.search-overlay-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white, #F3F7FC);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
  caret-color: #c83030;
}
.search-overlay-input::placeholder {
  color: rgba(255,255,255,0.3);
}
.search-close-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 18px;
  transition: background 0.15s, color 0.15s;
}
.search-close-btn:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
}
.search-hint {
  text-align: center;
  color: rgba(255,255,255,0.25);
  font-size: 12px;
  margin-top: 10px;
  letter-spacing: 0.02em;
}

/* Results panel */
.search-results-panel {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin-top: 12px;
  max-height: calc(82vh - 80px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.search-results-panel::-webkit-scrollbar {
  width: 6px;
}
.search-results-panel::-webkit-scrollbar-track {
  background: transparent;
}
.search-results-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
}

/* Section headers */
.search-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
}
.search-section-header .clear-btn {
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}
.search-section-header .clear-btn:hover {
  color: rgba(255,255,255,0.7);
}

/* Recent search pills */
.search-recents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 8px;
}
.search-recent-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.search-recent-pill:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
}
.search-recent-pill .pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  transition: background 0.15s;
}
.search-recent-pill .pill-remove:hover {
  background: rgba(200, 48, 48, 0.4);
}

/* Trending / Results rows */
.search-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 4px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  outline: none;
}
.search-row:hover,
.search-row.focused {
  background: rgba(255,255,255,0.07);
}
.search-row.focused {
  box-shadow: inset 0 0 0 1px rgba(200,48,48,0.3);
}
.search-row-poster {
  flex-shrink: 0;
  width: 44px;
  height: 66px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
}
.search-row-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.search-row-info {
  flex: 1;
  min-width: 0;
}
.search-row-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--white, #F3F7FC);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}
.search-row-meta .rating {
  color: rgba(255,200,50,0.8);
}
.search-row-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.search-row-type.movie {
  background: rgba(200, 48, 48, 0.15);
  color: rgba(220, 80, 80, 0.9);
}
.search-row-type.series {
  background: rgba(60, 140, 220, 0.15);
  color: rgba(100, 170, 240, 0.9);
}
.search-row-type.anime {
  background: rgba(180, 80, 200, 0.15);
  color: rgba(200, 120, 220, 0.9);
}

/* Loading shimmer */
.search-loading {
  padding: 20px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.search-shimmer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
}
.search-shimmer-poster {
  width: 44px;
  height: 66px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.search-shimmer-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.search-shimmer-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.search-shimmer-line:first-child { width: 65%; }
.search-shimmer-line:last-child { width: 40%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty state */
.search-empty {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255,255,255,0.3);
}
.search-empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.4;
}
.search-empty h3 {
  font-size: 15px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  margin: 0 0 6px;
}
.search-empty p {
  font-size: 13px;
  margin: 0;
}

/* Error state */
.search-error {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255,255,255,0.3);
}
.search-error h3 {
  font-size: 15px;
  font-weight: 500;
  color: rgba(220, 80, 80, 0.8);
  margin: 0 0 6px;
}

/* Full results view */
.search-full-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
}
.search-full-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--white, #F3F7FC);
}
.search-filter-chips {
  display: flex;
  gap: 6px;
}
.search-chip {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.45);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.search-chip.active {
  background: rgba(200, 48, 48, 0.15);
  border-color: rgba(200, 48, 48, 0.3);
  color: rgba(220, 80, 80, 0.9);
}
.search-chip:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
}

/* See all link */
.search-see-all {
  text-align: center;
  padding: 10px 0 4px;
}
.search-see-all-btn {
  font-size: 13px;
  font-weight: 500;
  color: rgba(200, 48, 48, 0.8);
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px 16px;
  border-radius: 8px;
  transition: background 0.15s;
}
.search-see-all-btn:hover {
  background: rgba(200, 48, 48, 0.1);
}

/* TV / 10-foot adjustments */
@media (max-width: 960px) {
  .search-panel { margin-top: 5vh; }
  .search-overlay-input { font-size: 20px; }
  .search-row { padding: 12px 6px; }
  .search-row-poster { width: 50px; height: 75px; }
  .search-row-title { font-size: 16px; }
}
