/* Search-box affordances added on top of nav.css: spinner, clear button,
   highlighted matches, the "Mohli jste myslet" group, and the floating
   back-to-top button.

   Kept in a separate file so nav.css stays the minified bundle it has been;
   loaded after nav.css in base.html so the cascade overrides where it has
   to (e.g. search-box positioning). */

/* The clear ("×") button and spinner share the right-hand slot inside
   .search-box; only one is visible at a time.
   (Don't re-declare .search-box{position:relative} here — nav.css already
   does that, and re-declaring it overrides the mobile breakpoint's
   `position:absolute`, breaking the "tap-the-magnifier-to-drop-search-
   below-navbar" affordance on phones.) */

.search-box__clear,
.search-box__spinner {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Our display:inline-flex above wins over the UA's [hidden]{display:none},
   so the hidden attribute alone would leave the spinner visible AND spinning
   in the background. Force it off when hidden. */
.search-box__clear[hidden],
.search-box__spinner[hidden] {
  display: none !important;
}

.search-box__clear {
  background: transparent;
  border: 0;
  color: var(--text-dim, #aaa);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}
.search-box__clear:hover,
.search-box__clear:focus-visible {
  color: var(--gold-light, #f0d27a);
  background: rgba(201, 162, 39, 0.12);
  outline: none;
}

.search-box__spinner {
  pointer-events: none;
}
.search-box__spinner::before {
  content: "";
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 2px solid rgba(201, 162, 39, 0.25);
  border-top-color: var(--gold, #c9a227);
  animation: hoe-search-spin 0.8s linear infinite;
}
@keyframes hoe-search-spin {
  to { transform: rotate(360deg); }
}

/* Leave room on the right so the clear button does not overlap the input
   text. type=search browsers add a native ✕ — hide it so our own button
   stays the single source of truth. */
.search-input { padding-right: 2.1rem; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-input::-webkit-search-decoration { display: none; }

/* Keyboard-navigation highlight on result items. */
.search-result-item.is-active {
  background: rgba(201, 162, 39, 0.18);
  outline: 1px solid rgba(201, 162, 39, 0.45);
}

/* Highlighted query matches inside snippets and titles. */
.search-result-item mark,
.lore-entity-card mark {
  background: rgba(201, 162, 39, 0.32);
  color: inherit;
  padding: 0 0.1em;
  border-radius: 2px;
}

/* "Did you mean…" block inside the dropdown. */
.search-results__suggest-header {
  padding: 0.45rem 0.85rem 0.2rem;
  font-size: 0.72rem;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim, #aaa);
  border-top: 1px solid rgba(107, 84, 0, 0.3);
  background: rgba(201, 162, 39, 0.04);
}
.search-results__suggest-group {
  border-bottom: 1px solid rgba(107, 84, 0, 0.2);
}
.search-results__suggest-group:last-child { border-bottom: none; }
.search-results__suggest-term {
  display: block;
  padding: 0.4rem 0.85rem 0.1rem;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  color: var(--gold, #c9a227);
  text-decoration: none;
}
.search-results__suggest-term:hover,
.search-results__suggest-term:focus-visible {
  text-decoration: underline;
}

/* Recently-searched / recently-viewed chips shown when input is empty. */
.search-results__recent-header {
  padding: 0.45rem 0.85rem 0.2rem;
  font-size: 0.72rem;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim, #aaa);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.search-results__recent-clear {
  background: transparent;
  border: 0;
  color: var(--text-dim, #aaa);
  font-size: 0.7rem;
  cursor: pointer;
  text-transform: none;
  font-family: inherit;
  letter-spacing: normal;
}
.search-results__recent-clear:hover { color: var(--gold-light, #f0d27a); }
.search-results__recent-chips {
  padding: 0.1rem 0.6rem 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.search-results__recent-chip {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(201, 162, 39, 0.1);
  border: 1px solid rgba(201, 162, 39, 0.2);
  color: var(--gold-light, #f0d27a);
  font-size: 0.78rem;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  transition: background 0.15s, border-color 0.15s;
}
.search-results__recent-chip:hover,
.search-results__recent-chip:focus-visible {
  background: rgba(201, 162, 39, 0.2);
  border-color: rgba(201, 162, 39, 0.45);
  outline: none;
}

/* Floating "back to top" button. Hidden until scrolled past ~600px. */
.back-to-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: rgba(20, 14, 6, 0.85);
  color: var(--gold-light, #f0d27a);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  z-index: 70;
  pointer-events: none;
}
.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover,
.back-to-top:focus-visible {
  background: rgba(40, 28, 8, 0.95);
  outline: none;
}

/* Avoid overlapping the bottom-left support / bug widgets on small screens. */
@media (max-width: 720px) {
  .back-to-top { bottom: 5.5rem; }
}
