/* #285 — Bouton flottant « Signaler un bug » + pop-over.
   Présent sur toutes les pages nitrates, ancré en bas à droite. Discret au
   repos, s'ouvre en pop-over vers le haut. Style sobre DSFR. */

.nitrates-bug {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1900; /* sous le popup feedback (#284, z 2000) et sous la modale carte */
  font-size: 0.875rem;
}

/* ── Bouton déclencheur ─────────────────────────────────────────────────── */
.nitrates-bug__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border-default-grey, #ddd);
  border-radius: 999px;
  background: var(--background-default-grey, #fff);
  color: var(--text-action-high-blue-france, #000091);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgb(0 0 0 / 12%);
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease,
    background 0.15s ease;
}

.nitrates-bug__toggle:hover {
  background: var(--background-alt-blue-france, #f5f5fe);
  box-shadow: 0 4px 14px rgb(0 0 0 / 18%);
  transform: translateY(-1px);
}

.nitrates-bug__toggle:focus-visible {
  outline: 2px solid var(--text-action-high-blue-france, #000091);
  outline-offset: 2px;
}

.nitrates-bug__toggle svg {
  flex: 0 0 auto;
}

/* Sur petits écrans, le bouton se réduit à l'icône pour rester discret. */
@media (width <= 576px) {
  .nitrates-bug__toggle-label {
    display: none;
  }

  .nitrates-bug__toggle {
    padding: 0.6rem;
  }
}

/* ── Pop-over ───────────────────────────────────────────────────────────── */
.nitrates-bug__popover[hidden] {
  display: none;
}

.nitrates-bug [hidden] {
  display: none !important;
}

.nitrates-bug__popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.6rem);
  width: min(360px, calc(100vw - 2rem));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 1.1rem 1.1rem 1.25rem;
  background: var(--background-default-grey, #fff);
  border: 1px solid var(--border-default-grey, #ddd);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgb(0 0 0 / 22%);
  animation: nitrates-bug-pop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes nitrates-bug-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.nitrates-bug__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.nitrates-bug__titre {
  margin: 0;
}

.nitrates-bug__close {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-mention-grey, #666);
  cursor: pointer;
}

.nitrates-bug__close:hover {
  background: var(--background-alt-grey, #eee);
}

.nitrates-bug__type {
  margin: 0 0 0.75rem;
}

.nitrates-bug__popover .fr-fieldset__legend {
  padding-bottom: 0.25rem;
}

.nitrates-bug__popover textarea.fr-input {
  resize: vertical;
}

.nitrates-bug__rgpd {
  margin: 0.6rem 0 0;
  color: var(--text-mention-grey, #666);
}

.nitrates-bug__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.nitrates-bug__erreur {
  margin-top: 0.5rem;
}
