/**
 * Custom search styling
 * Ensures consistent search results positioning across all pages
 */

/* Search results container */
#searchResults {
  position: absolute !important;
  top: 45px !important; /* Reduced from previous value to be closer to search button */
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 300px !important;
  background-color: #141414 !important;
  color: white !important;
  border-radius: 5px !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5) !important;
  z-index: 1001 !important; /* Increased z-index to ensure it's on top */
  max-height: 80vh !important;
  overflow-y: auto !important;
  border: 1px solid #8d16c9 !important;
  margin-top: 0 !important; /* Removed margin to position exactly */
}

/* Search results items */
.movie-list {
  padding: 10px;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  background-color: #1a1a1a;
  cursor: pointer;
  position: relative;
}

.movie-list:hover {
  background-color: #2a2a2a;
}

/* Custom styles for search result items */
.search-item-thumbnail {
  flex: 0 0 60px;
  margin-right: 10px;
}

.search-item-thumbnail img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  object-fit: cover;
}

.search-item-info {
  flex: 1;
  overflow: hidden;
}

.search-item-info h3 {
  font-size: 14px;
  margin: 0 0 5px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-info p {
  font-size: 12px;
  margin: 0;
  color: #aaa;
}

.watchListBtn {
  background: linear-gradient(135deg, #a710e0 0%, #8a14ca 100%);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 10px;
  white-space: nowrap;
  min-width: 100px;
}

.watchListBtn:hover {
  background: linear-gradient(135deg, #8a14ca 0%, #a710e0 100%);
}

#searchResults p {
  color: #fff;
  text-align: center;
  margin: 10px 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #searchResults {
    width: 80% !important; /* Wider on mobile */
    max-width: 300px !important;
    top: 40px !important; /* Even closer on mobile */
  }
}

/* Mobile optimizations for search results */
@media (max-width: 480px) {
  #searchResults {
    width: 85% !important;
    max-width: 280px !important;
    top: 45px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    position: fixed !important; /* Change to fixed positioning */
    z-index: 1050 !important; /* Higher z-index to appear above everything */
    max-height: 70vh !important; /* Limit height to prevent overflow */
  }

  .movie-list {
    padding: 12px 10px;
    align-items: flex-start;
  }

  .search-item-thumbnail {
    flex: 0 0 50px;
    margin-right: 8px;
  }

  .search-item-info h3 {
    font-size: 13px;
    max-width: 120px;
  }

  .search-item-info p {
    font-size: 11px;
  }

  .watchListBtn {
    padding: 4px 8px;
    font-size: 11px;
    min-width: 40px;
    margin-left: 5px;
  }

  .movie-list img {
    max-width: 60px;
    height: auto;
    margin-right: 10px;
  }
}
