/* Sélecteur d'emojis et de GIF (composant « Picker ») — js/picker.js
   .st-picker--float   ordinateur : fenêtre flottante au-dessus du bouton
   .st-picker--docked  mobile : panneau sous la zone de saisie, à la place du clavier
   .st-picker--sheet   mobile sans zone de saisie (réaction) : panneau en bas de l'écran */

.st-picker {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  text-align: left;
}

.st-picker[hidden] {
  display: none;
}

.st-picker:focus {
  outline: none;
}

/* Remise à zéro des boutons (annule le button { width: 100% } de l'ancien style.css) */
.st-picker :where(button:not(.st-chip):not(.st-segmented__option)) {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font: inherit;
  letter-spacing: 0;
  color: inherit;
  cursor: pointer;
  filter: none;
  transform: none;
}

.st-picker :where(button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.st-picker--float {
  position: fixed;
  left: var(--pop-x, 12px);
  top: var(--pop-y, 12px);
  z-index: 1200;
  width: min(360px, calc(100vw - 24px));
  height: min(440px, calc(100dvh - 24px));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-menu);
}

.st-picker--docked {
  flex-shrink: 0;
  height: min(46dvh, 340px);
  border-top: 1px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom);
}

.st-picker--sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  height: min(52dvh, 400px);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  box-shadow: var(--shadow-menu);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Mobile : panneau ouvert = clavier ouvert, la barre de navigation flottante s'efface */
body.st-picker-open .st-nav {
  display: none;
}

/* ── En-tête : onglets et recherche ── */

.st-picker__top {
  flex-shrink: 0;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.st-picker--react .st-picker__tabs {
  display: none;
}

.st-picker__searchrow {
  display: flex;
  gap: 8px;
}

.st-picker__search {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.st-picker__search:focus-within {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.st-picker .st-picker__input {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  font: inherit;
  font-size: var(--text-md);
  color: var(--text);
}

.st-picker .st-picker__input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.st-picker .st-picker__skin {
  width: 44px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  background: var(--surface-2);
}

/* ✋ dans la ligne de recherche sur mobile, dans le pied sur ordinateur */
.st-picker--float .st-picker__skin--top,
.st-picker[data-tab="gif"] .st-picker__skin--top {
  display: none;
}

/* ── Emojis ── */

.st-picker__panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.st-picker__panel[hidden] {
  display: none;
}

.st-picker__cats {
  flex-shrink: 0;
  padding: 0 6px 4px;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--hairline);
}

.st-picker .st-picker__cat {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.st-picker .st-picker__cat[hidden] {
  display: none;
}

/* Zone tactile portée à 44 px sans changer le dessin */
.st-picker__cat::after {
  content: "";
  position: absolute;
  inset: -5px -2px;
}

.st-picker .st-picker__cat:hover {
  color: var(--text);
}

.st-picker .st-picker__cat[aria-current="true"] {
  background: var(--selected);
  color: var(--accent-text);
}

.st-picker__tones {
  flex-shrink: 0;
  padding: 6px 8px;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  border-bottom: 1px solid var(--hairline);
}

.st-picker__tones[hidden] {
  display: none;
}

.st-picker .st-picker__tone {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  font-size: 22px;
  line-height: 1;
}

.st-picker .st-picker__tone[aria-pressed="true"] {
  background: var(--selected);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.st-picker__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 8px 8px;
}

.st-picker__label {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 10px 4px 6px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-regular);
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}

.st-picker__grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.st-picker .st-picker__emoji {
  height: 44px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--font-sans);
  font-size: 24px;
  line-height: 1;
}

.st-picker .st-picker__emoji:hover,
.st-picker .st-picker__emoji:focus-visible {
  background: var(--selected);
}

.st-picker__empty {
  margin: 0;
  padding: var(--space-6) var(--space-2);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.st-picker__empty[hidden] {
  display: none;
}

.st-picker__foot {
  flex-shrink: 0;
  height: 52px;
  padding: 0 10px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--hairline);
}

.st-picker:not(.st-picker--float) .st-picker__foot {
  display: none;
}

.st-picker__big {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--font-sans);
  font-size: 26px;
  line-height: 1;
}

.st-picker__code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── GIF ── */

.st-picker__chips {
  flex-shrink: 0;
  padding: 4px 10px 8px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.st-picker__chips::-webkit-scrollbar {
  display: none;
}

.st-picker .st-picker__chip {
  min-height: 32px;
  padding: 0 11px;
  flex-shrink: 0;
  font-size: var(--text-xs);
}

.st-picker__masonry {
  columns: 3;
  column-gap: 6px;
}

.st-picker:not(.st-picker--float) .st-picker__masonry {
  columns: 2;
}

.st-picker__tile {
  position: relative;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  break-inside: avoid;
  background: var(--surface-2);
}

.st-picker .st-picker__gif {
  display: block;
  width: 100%;
}

.st-picker__gif img {
  display: block;
  width: 100%;
  height: auto;
}

.st-picker .st-picker__fav,
.st-picker .st-picker__play {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--media-scrim);
  color: var(--on-media);
}

.st-picker .st-picker__fav {
  top: 6px;
  right: 6px;
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
}

.st-picker .st-picker__play {
  left: 6px;
  bottom: 6px;
}

.st-picker__fav::after,
.st-picker__play::after {
  content: "";
  position: absolute;
  inset: -6px;
}

.st-picker__tile:hover .st-picker__fav,
.st-picker__tile:focus-within .st-picker__fav,
.st-picker .st-picker__fav[aria-pressed="true"] {
  opacity: 1;
}

.st-picker .st-picker__fav[aria-pressed="true"] {
  color: var(--media-fav);
}

.st-picker__giphy {
  flex-shrink: 0;
  height: 30px;
  margin: 0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .st-picker .st-picker__fav {
    transition: none;
  }
}
