/* Favorites Container Styles */
.favorites-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Favorite Item Styles - matching history bar */
.favorite-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 1rem;
  font-size: 0.75rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  /* Prevent width expansion on hover - like history bar */
  box-sizing: border-box;
}

.favorite-item:hover {
  background: var(--bs-primary-bg-subtle);
}

.favorite-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  white-space: nowrap;
  /* Ensure text doesn't expand the container */
  max-width: 100%;
  /* Ensure text is always visible - with stronger rules */
  color: inherit !important;
  visibility: visible !important;
  opacity: 1 !important;
  /* Force text rendering */
  font-size: inherit !important;
  line-height: inherit !important;
  font-family: inherit !important;
  font-weight: inherit !important;
  /* Ensure proper text display */
  text-decoration: none !important;
  text-transform: none !important;
  text-align: left !important;
  /* Prevent any interference */
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  /* Allow hover effects to work */
  transition: max-width 0.2s ease, all 0.2s ease;
}

/* Hover effect: shorten text to show delete button */
.favorite-item:hover .favorite-item-title {
  max-width: calc(100% - 2rem) !important; /* Reserve space for delete button */
  text-overflow: ellipsis !important;
  /* Ensure smooth transition */
  transition: max-width 0.2s ease !important;
  /* Ensure text remains visible during hover */
  color: inherit !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure text is always visible in all states */
.favorite-item .favorite-item-title {
  color: inherit !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Force text visibility after layout changes */
.favorite-item .favorite-item-title,
.favorite-item-title {
  /* Force text to be visible */
  color: inherit !important;
  visibility: visible !important;
  opacity: 1 !important;
  /* Ensure proper text rendering */
  display: flex !important;
  align-items: center !important;
  /* Prevent any CSS interference */
  text-shadow: none !important;
  filter: none !important;
  transform: none !important;
  /* Force repaint */
  will-change: auto !important;
}

/* Additional rules to ensure text visibility in all contexts */
.favorite-item .favorite-item-title,
.favorite-item-title,
.favorites-container .favorite-item-title,
.favorite-item .favorite-item-title {
  /* Ensure text is always visible regardless of parent context */
  color: inherit !important;
  visibility: visible !important;
  opacity: 1 !important;
  /* Force proper text rendering */
  display: flex !important;
  align-items: center !important;
  /* Prevent any interference */
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
  transform: none !important;
  /* Ensure proper font rendering */
  font-size: inherit !important;
  line-height: inherit !important;
  font-family: inherit !important;
  font-weight: inherit !important;
  /* Force repaint */
  will-change: auto !important;
  /* Ensure text is not clipped - but allow hover effects */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}

.favorite-item-icon {
  color: var(--bs-warning);
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.favorite-item-delete {
  display: none;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--bs-secondary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
}

.favorite-item:hover .favorite-item-delete {
  opacity: 1;
  display: flex;
}

.favorite-item-delete:hover {
  background: var(--bs-danger-bg-subtle);
  color: var(--bs-danger);
}

/* Responsive adjustments - matching history bar */
@media (max-width: 768px) {
  .favorite-item {
    padding: 0.125rem 0.375rem;
    font-size: 0.7rem;
  }

  .favorite-item-delete {
    opacity: 1;
  }
}
