/* Search (home) styles */

#home-search {
  position: relative;
}

#home-search-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-top: 6px;
  padding: 12px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Zapewnij czytelny kolor tekstu w panelu autouzupełniania (light mode) */
#home-search-panel,
#home-search-panel * {
  color: var(--text-primary);
}

#home-search-panel .filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#home-search-panel .field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.difficulty-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.difficulty-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}

/* Okrągłe checkboxy w chipach trudności */
.difficulty-chip input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  background: var(--main-bg-color);
  display: inline-block;
  position: relative;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.difficulty-chip input[type="checkbox"]:hover {
  border-color: var(--primary-color);
}
.difficulty-chip input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.15);
}
.difficulty-chip input[type="checkbox"]:checked {
  background: var(--primary-color);
  border-color: var(--primary-color);
}
.difficulty-chip:hover {
  border-color: var(--primary-color);
}

/* "Dowolny" używa dokładnie tych samych styli co .difficulty-chip (etykieta ma obie klasy) */

#home-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  border: 1px solid var(--border-color);
  background: var(--main-bg-color);
  padding: 6px;
  border-radius: 8px;
}

#home-tags:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.08);
}

#home-tags-input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 120px;
  background: transparent;
}

#home-tags-suggest {
  display: none;
  position: absolute;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-top: 6px;
  padding: 6px;
  z-index: 60;
  max-height: 220px;
  overflow: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Elementy sugestii tagów */
#home-tags-suggest .tag-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
#home-tags-suggest .tag-suggest-item:hover,
#home-tags-suggest .tag-suggest-item.active {
  background: var(--background-color);
}

#home-search-suggest {
  display: none;
  margin-top: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

/* Podpowiedzi wyszukiwania (linki) */
#home-search-suggest a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
#home-search-suggest a:hover,
#home-search-suggest a.active {
  background: var(--background-color);
  color: var(--text-primary);
}

/* Chipy tagów (JS dodaje .tag-chip) */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 999px;
  transition: border-color .2s ease, background .2s ease;
}
.tag-chip:hover {
  border-color: var(--primary-color);
}
.tag-chip button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.tag-chip button:hover {
  color: var(--text-primary);
}

/* Dark mode dopasowania */
[data-theme="dark"] #home-search-suggest a:hover,
[data-theme="dark"] #home-search-suggest a.active,
[data-theme="dark"] #home-tags-suggest .tag-suggest-item:hover,
[data-theme="dark"] #home-tags-suggest .tag-suggest-item.active {
  background: var(--background-color);
}


