/* ============================================================
   LA FORGE COSPLAY — Emoji & GIF Picker
   ============================================================ */

/* ── Conteneur principal ─────────────────────────────────── */
.gifpicker-popup {
  position: fixed;
  z-index: 9999;
  width: 340px;
  max-height: calc(100vh - 24px);
  background: var(--forge-surface, #1a1a2e);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: gpFadeIn .15s ease;
}
@keyframes gpFadeIn {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Onglets ─────────────────────────────────────────────── */
.gifpicker-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.2);
}
.gifpicker-tab {
  flex: 1;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .4px;
  background: none;
  border: none;
  color: var(--forge-text-muted, #888);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.gifpicker-tab:hover { background: rgba(255,255,255,.05); }
.gifpicker-tab.active {
  color: var(--forge-copper, #b87333);
  border-bottom: 2px solid var(--forge-copper, #b87333);
}

/* ── Barre de recherche (GIF) ────────────────────────────── */
.gifpicker-search {
  padding: 8px 10px 6px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.gifpicker-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.gifpicker-search input::placeholder { color: rgba(255,255,255,.35); }
.gifpicker-search input:focus { border-color: var(--forge-copper, #b87333); }

/* ── Scroll body ─────────────────────────────────────────── */
.gifpicker-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: 300px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.gifpicker-body::-webkit-scrollbar { width: 4px; }
.gifpicker-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* ── Panel Emoji ─────────────────────────────────────────── */
.emoji-panel { padding: 6px 8px 8px; }
.emoji-cat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  color: var(--forge-text-muted, #888);
  text-transform: uppercase;
  padding: 6px 2px 4px;
}
.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.emoji-btn {
  width: 32px;
  height: 32px;
  font-size: 18px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s;
  line-height: 1;
}
.emoji-btn:hover { background: rgba(255,255,255,.1); }

/* ── Panel GIF ───────────────────────────────────────────── */
.gif-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 6px;
}
.gif-item {
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255,255,255,.04);
  aspect-ratio: 16/9;
  transition: transform .12s, box-shadow .12s;
}
.gif-item:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(184,115,51,.4);
}
.gif-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gif-item-broken {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  color: var(--forge-parchment);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  border: 1px dashed rgba(255,255,255,.14);
}

/* ── États ───────────────────────────────────────────────── */
.gifpicker-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--forge-text-muted, #888);
  font-size: 13px;
}
.gifpicker-loading {
  text-align: center;
  padding: 28px 16px;
  color: var(--forge-text-muted, #888);
  font-size: 13px;
}

/* ── Footer powered by GIPHY ─────────────────────────────── */
.gifpicker-footer {
  padding: 5px 10px;
  text-align: right;
  font-size: 10px;
  color: rgba(255,255,255,.25);
  border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.15);
}
.gifpicker-footer a { color: rgba(255,255,255,.35); text-decoration: none; }
.gifpicker-footer a:hover { color: rgba(255,255,255,.6); }

/* ── Rendu GIF dans les posts/commentaires ───────────────── */
.post-gif, .comment-gif {
  max-width: 320px;
  max-height: 240px;
  border-radius: 10px;
  display: block;
  margin: 6px 0;
  cursor: pointer;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .gifpicker-popup { width: calc(100vw - 24px); }
}
