/*
 * Entry mini-toolbar (UX-3) — quick-action bar that appears after scrolling
 * past the entry header on long entry-detail pages. Pinned to the bottom on
 * narrow viewports, and to the right edge on desktop so it doesn't fight the
 * existing on-page nav (which sticks to the top).
 *
 * Filter offcanvas bottom-sheet polish (UX-11) is at the bottom of this file.
 */

.entry-mini-toolbar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translate(-50%, 1rem);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.6rem;
  background-color: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  z-index: 1030;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.entry-mini-toolbar.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.entry-mini-toolbar__word {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0 0.5rem 0 0.25rem;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-right: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
  color: var(--text-primary, #212529);
}

.entry-mini-toolbar__btn {
  background: transparent;
  border: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary, #6c757d);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.entry-mini-toolbar__btn:hover,
.entry-mini-toolbar__btn:focus-visible {
  background-color: var(--hover-bg, rgba(0, 0, 0, 0.05));
  color: var(--text-primary, #212529);
  outline: none;
}

.entry-mini-toolbar__btn:focus-visible {
  box-shadow: 0 0 0 2px var(--bs-primary, #0d6efd);
}

/* On very narrow screens, drop the headword chip so the toolbar stays compact. */
@media (max-width: 420px) {
  .entry-mini-toolbar__word {
    display: none;
  }
  .entry-mini-toolbar {
    bottom: 0.75rem;
    padding: 0.3rem 0.45rem;
  }
}

/* Don't compete with the back-to-top button on screens that have one. */
@media (min-width: 992px) {
  .entry-mini-toolbar {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
    transform: translate(0, 1rem);
  }
  .entry-mini-toolbar.is-visible {
    transform: translate(0, 0);
  }
}

/* -------------------------------------------------------------------------
 * UX-11 — Filters as a proper bottom sheet on mobile.
 * The search page already uses Bootstrap's offcanvas-lg + offcanvas-bottom on
 * #advancedFiltersPanel; this adds the visual affordances (drag handle, top
 * radii, elevated shadow) that make it read as a bottom sheet, plus a touch
 * of polish for the existing "Apply Filters" sticky footer.
 * ------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
  #advancedFiltersPanel.offcanvas-bottom {
    border-top-left-radius: 1.25rem;
    border-top-right-radius: 1.25rem;
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.18);
  }

  /* Drag-handle pill at the top of the sheet. Pure visual affordance — the
   * offcanvas itself still closes via the existing close button / backdrop. */
  #advancedFiltersPanel.offcanvas-bottom::before {
    content: "";
    display: block;
    width: 2.5rem;
    height: 0.25rem;
    border-radius: 999px;
    background-color: rgba(0, 0, 0, 0.18);
    margin: 0.5rem auto 0;
  }
}
