/* ── Sticker Picker Panel ─────────────────────────────────────────── */

.sticker-picker {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

/* Smooth open/close via grid row trick (allows height: auto transitions) */
.sticker-picker-inner {
  display: flex;
  flex-direction: column;
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--muted2) transparent;
}
.sticker-picker-inner::-webkit-scrollbar { width: 4px }
.sticker-picker-inner::-webkit-scrollbar-track { background: transparent }
.sticker-picker-inner::-webkit-scrollbar-thumb { background: var(--muted2); border-radius: 2px }

/* Slide animation via display interpolation */
.sticker-picker.sp-entering .sticker-picker-inner {
  animation: spSlideIn 0.25s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.sticker-picker.sp-leaving .sticker-picker-inner {
  animation: spSlideOut 0.2s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
}

@keyframes spSlideIn {
  from { max-height: 0; opacity: 0; }
  to   { max-height: 260px; opacity: 1; }
}
@keyframes spSlideOut {
  from { max-height: 260px; opacity: 1; }
  to   { max-height: 0; opacity: 0; }
}

/* ── Companion Tabs ──────────────────────────────────────────────── */

.sticker-picker-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  scrollbar-width: none;
}
.sticker-picker-tabs::-webkit-scrollbar { display: none; }

.sticker-picker-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--ff-body);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sticker-picker-tab:hover {
  background: var(--surface-3);
  color: var(--cream);
}

.sticker-picker-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-10);
}

.sticker-picker-tab-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.sticker-picker-tab-name {
  font-weight: 500;
}

/* ── Sticker Grid ────────────────────────────────────────────────── */

.sticker-picker-grid-wrap {
  position: relative;
  min-height: 80px;
}

.sticker-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px 10px 0;
  animation: spGridFadeIn 0.2s ease-out;
}

@keyframes spGridFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sticker-picker-item {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.sticker-picker-item:hover {
  background: var(--surface-3);
  border-color: var(--accent);
  transform: scale(1.06);
}

.sticker-picker-item:active {
  transform: scale(0.95);
}

.sticker-picker-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-width: 56px;
  max-height: 56px;
}

.sticker-picker-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 6px;
  padding: 6px 10px 8px;
  border-top: 1px solid var(--border);
}

.sticker-stage-badge {
  color: var(--accent);
  font-weight: 600;
  text-transform: capitalize;
}

.sticker-picker-loading,
.sticker-picker-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px 0;
}

/* ── Sticker in chat messages ──────────────────────────────────── */

.msg-sticker {
  padding: 4px;
  position: relative;
}

.msg-sticker .sticker-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  display: block;
  transition: transform 0.15s ease;
}

/* ── Sticker Chat Animations ──────────────────────────────────── */

.sticker-enter .sticker-img {
  animation: stickerBounceIn 0.4s ease-out both;
}

@keyframes stickerBounceIn {
  0%   { transform: scale(0); }
  50%  { transform: scale(1.15); }
  75%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}

.msg-sticker:not(.sticker-enter) .sticker-img:hover {
  transform: scale(1.08) rotate(-3deg);
  cursor: pointer;
}

.sticker-particle {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  margin-left: -3.5px;
  margin-top: -3.5px;
  pointer-events: none;
  animation: stickerParticle 0.6s ease-out forwards;
}

@keyframes stickerParticle {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* Active state for input action buttons */
.input-action.active {
  color: var(--accent);
  background: var(--accent-10);
}
