/* ══════════════════════════════════════════════════════════════
   DESKTOP PICKER — GIFs / Medios / Pegatinas / Emojis
   Widget unificado SOLO para escritorio. Oculto por defecto (mobile
   sigue usando #emojiPicker tal cual, sin cambios).
   ══════════════════════════════════════════════════════════════ */

#dpOverlay, #dpPicker { display: none; }

@media (min-width: 769px) {

  #dpOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: transparent;
  }
  #dpOverlay.open { display: block; }

  #dpPicker {
    display: none;
    position: fixed;
    z-index: 1201;
    width: 440px;
    height: 620px;
    max-height: calc(100vh - 100px);
    background: #1e1f22;
    border: 1px solid var(--border, #26292F);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    flex-direction: column;
    overflow: hidden;
  }
  #dpPicker.open { display: flex; }

  /* ── Tabs superiores ─────────────────────────── */
  .dp-tabs {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 20px 10px;
    flex-shrink: 0;
  }
  .dp-tab {
    background: none;
    border: none;
    color: var(--text-muted, #949ba4);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 0;
  }
  .dp-tab.active {
    color: var(--text-header, #f2f3f5);
  }
  .dp-tab:hover:not(.active) { color: #dbdee1; }

  /* ── Barra de búsqueda ───────────────────────── */
  .dp-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 16px 10px;
    padding: 8px 10px;
    background: #111214;
    border-radius: 4px;
    flex-shrink: 0;
  }
  .dp-search-icon { flex-shrink: 0; color: #949ba4; }
  #dpSearch {
    flex: 1;
    background: none;
    border: none;
    color: var(--text, #dbdee1);
    font-size: 14px;
  }
  #dpSearch::placeholder { color: var(--text-muted, #949ba4); }

  /* ── Cuerpo: rail + contenido ───────────────── */
  .dp-body {
    display: flex;
    flex: 1;
    min-height: 0;
  }

  .dp-rail {
    width: 52px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 0 8px;
    overflow-y: auto;
    scrollbar-width: none;
  }
  .dp-rail-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted, #949ba4);
    flex-shrink: 0;
  }
  .dp-rail-btn { transition: background 0.15s, color 0.15s, transform 0.12s ease; }
  .dp-rail-btn svg { width: 20px; height: 20px; display: block; }
  .dp-rail-btn:active { transform: scale(0.88); }
  .dp-rail-btn:hover { background: #26292F; }
  .dp-rail-btn.active { background: #313338; color: var(--text-header, #f2f3f5); }

  .dp-content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 4px 12px 12px;
  }

  /* ── Panel de emojis ─────────────────────────── */
  .dp-panel-emojis .dp-cat-label {
    color: var(--text-muted, #949ba4);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    margin: 14px 4px 6px;
  }
  .dp-panel-emojis .dp-cat-label:first-child { margin-top: 6px; }

  .dp-emoji-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
  }
  .dp-emoji-grid .ep-emoji {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
  }
  .dp-emoji-grid .ep-emoji:hover { background: #26292F; transform: scale(1.15); }
  .dp-emoji-grid .ep-emoji:active { transform: scale(0.95); }
  .dp-emoji-grid .ep-emoji img { width: 24px; height: 24px; }
  .dp-emoji-grid .ep-emoji .ep-emoji-fallback { font-size: 24px; line-height: 1; }

  .dp-empty-msg {
    color: var(--text-muted, #949ba4);
    font-size: 14px;
    text-align: center;
    margin-top: 40px;
  }

  /* ── Panel de GIFs ───────────────────────────── */
  .dp-gif-favs-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #2b2d31;
    border: none;
    border-radius: 4px;
    color: var(--text-muted, #949ba4);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    margin-bottom: 8px;
    cursor: pointer;
  }
  .dp-gif-favs-btn:hover { background: #35373c; color: var(--text, #dbdee1); }
  .dp-gif-favs-btn.active { background: #413CDD; color: #fff; }
  .dp-gif-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .dp-gif-card {
    position: relative;
    width: 100%;
    padding-top: 66%;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #111214;
    border: 2px solid transparent;
    transition: border-color 0.12s, transform 0.12s;
  }
  .dp-gif-card:hover { border-color: var(--accent, #5865f2); transform: scale(1.02); }
  .dp-gif-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #111214;
  }
  .dp-gif-star-btn {
    position: absolute;
    top: 4px; right: 4px;
    background: rgba(0,0,0,0.65);
    border: none; border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    color: #fff;
  }
  .dp-gif-card:hover .dp-gif-star-btn { opacity: 1; }
  .dp-gif-star-btn.on { opacity: 1; color: #f0b232; }
  .dp-gif-status {
    color: var(--text-muted, #949ba4);
    font-size: 13px;
    text-align: center;
    padding: 14px 0;
  }
  .dp-powered {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-muted, #949ba4);
    font-size: 11px;
    text-align: center;
    padding: 10px 0 4px;
  }
  .dp-powered .powered-klipy-logo { height: 15px; width: auto; display: block; opacity: .95; }

  /* ── Grid de pegatinas personalizadas ──────────── */
  .dp-sticker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    overflow-y: auto;
    height: 100%;
    align-content: start;
  }
  /* ── Placeholder Medios / Pegatinas ──────────── */
  .dp-panel-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
  }
  .dp-placeholder {
    color: var(--text-muted, #949ba4);
    font-size: 15px;
    font-weight: 600;
  }
}
