/* ══════════════════════════════════════
   BADGES — OKIRU
   Mobile-first, adaptado para bottom sheet
══════════════════════════════════════ */

/* ─────────────────────────────────
   OVERRIDE DO MODAL
   No desktop: permite a badge vazar
   para esquerda (overflow-x: visible).
   No mobile: o modal é bottom sheet
   full-width — a badge vai dentro.
───────────────────────────────── */
.modal-detalhe {
  overflow-x: visible !important;
}

/* ══════════════════════════════════════
   BADGE LATERAL — DESKTOP
   Container em coluna, posicionado
   para fora do card pela esquerda
══════════════════════════════════════ */

/* Wrapper: coluna de badges, ancorada no topo esquerdo do modal */
.badge-lateral-wrap {
  position: absolute;
  top: 12px;
  left: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
}

/* Item individual de cada badge */
.badge-lateral-item {
  position: relative;
  cursor: pointer;
  opacity: 0;
  animation:
    badgeSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
    badgeFloat 3s ease-in-out infinite;
  animation-delay: var(--badge-delay, 0s), calc(var(--badge-delay, 0s) + 0.6s);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

@keyframes badgeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.7);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes badgeFloat {
  0%, 100% { transform: translateY(0px);    }
  50%       { transform: translateY(-6px);  }
}

/* ── Imagem da badge ── */
.badge-lateral-img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: cover;
  border: 3px solid rgba(167, 139, 250, 0.75);
  box-shadow:
    0 0 0 5px rgba(108, 122, 224, 0.18),
    0 8px 28px rgba(108, 122, 224, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: badgeGlowPulse 2.8s ease-in-out infinite;
}

/* Formato arredondado (ex: Clássico) */
.badge-lateral-img.badge--redondo,
.badge-lateral-emoji.badge--redondo,
.badge-popup-img.badge--redondo,
.badge-popup-emoji.badge--redondo,
.story-badge-img.badge--redondo {
  border-radius: 50%;
}

/* Formato livre — mantém o shape natural da imagem PNG */
.badge-lateral-img.badge--livre,
.badge-lateral-emoji.badge--livre,
.badge-popup-img.badge--livre,
.badge-popup-emoji.badge--livre,
.story-badge-img.badge--livre {
  border-radius: 0;
  border: none;
  box-shadow: none;
  animation: none;
  background: transparent;
}

/* Esconde o glow decorativo no popup quando a badge é de formato livre */
.badge-popup:has(.badge-popup-img.badge--livre) .badge-popup-glow,
.badge-popup:has(.badge-popup-emoji.badge--livre) .badge-popup-glow {
  display: none;
}

.badge-lateral-item:hover .badge-lateral-img {
  transform: scale(1.13);
  animation: none;
  box-shadow:
    0 0 0 6px rgba(167, 139, 250, 0.35),
    0 12px 36px rgba(108, 122, 224, 0.65);
}

/* Badge de formato livre: sem borda/glow no hover */
.badge-lateral-item:hover .badge-lateral-img.badge--livre,
.badge-lateral-item:active .badge-lateral-img.badge--livre {
  box-shadow: none;
  border: none;
}

/* ── Emoji fallback ── */
.badge-lateral-emoji {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(167, 139, 250, 0.75);
  background: linear-gradient(135deg, #1e2035 0%, #2d2f5a 100%);
  box-shadow:
    0 0 0 5px rgba(108, 122, 224, 0.18),
    0 8px 28px rgba(108, 122, 224, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  animation: badgeGlowPulse 2.8s ease-in-out infinite;
  transition: transform 0.25s ease;
}

.badge-lateral-item:hover .badge-lateral-emoji {
  transform: scale(1.13);
  animation: none;
}

@keyframes badgeGlowPulse {
  0%, 100% {
    box-shadow:
      0 0 0 5px rgba(108, 122, 224, 0.18),
      0 8px 28px rgba(108, 122, 224, 0.45);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(167, 139, 250, 0.28),
      0 8px 36px rgba(108, 122, 224, 0.65);
  }
}

/* Active state tátil */
.badge-lateral-item:active .badge-lateral-img,
.badge-lateral-item:active .badge-lateral-emoji {
  transform: scale(0.92);
  animation: none;
}

/* ── Tooltip hover (só desktop) ── */
.badge-lateral-tooltip {
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(-8px);
  background: rgba(255, 255, 255, 0.97);
  border-radius: 14px;
  padding: 10px 15px 11px;
  min-width: 110px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(108, 122, 224, 0.12);
}

.badge-lateral-tooltip::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-right-color: rgba(255, 255, 255, 0.97);
}

.badge-lateral-item:hover .badge-lateral-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.badge-tooltip-label {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #6c7ae0;
  margin-bottom: 3px;
}

.badge-tooltip-name {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #2d2f4a;
}

body.dark .badge-lateral-tooltip {
  background: rgba(22, 24, 42, 0.98);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(108, 122, 224, 0.22);
}
body.dark .badge-lateral-tooltip::before {
  border-right-color: rgba(22, 24, 42, 0.98);
}
body.dark .badge-tooltip-label { color: #a78bfa; }
body.dark .badge-tooltip-name  { color: #e0e0f0; }


/* ══════════════════════════════════════
   BADGE LATERAL — MOBILE (≤ 768px)
   Fica na linha divisória entre o hero
   (240px) e o corpo branco do modal,
   ancorada à esquerda — como um selo.
══════════════════════════════════════ */
@media (max-width: 768px) {

  /* Sem overflow lateral no mobile, mas permite vazar verticalmente */
  .modal-detalhe {
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  /* Badges na borda inferior direita do hero, lado a lado */
  .badge-lateral-wrap {
    top: auto;
    bottom: 0;
    left: auto;
    right: 12px;
    transform: translateY(50%);
    flex-direction: row;
    gap: 6px;
  }

  /* Cada item entra de cima */
  .badge-lateral-item {
    opacity: 0;
    animation:
      badgeSlideInMobile 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
      badgeFloat 3s ease-in-out infinite;
    animation-delay: var(--badge-delay, 0s), calc(var(--badge-delay, 0s) + 0.55s);
  }

  @keyframes badgeSlideInMobile {
    from {
      opacity: 0;
      transform: translateY(-16px) scale(0.75);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  .badge-lateral-img,
  .badge-lateral-emoji {
    width: 36px;
    height: 36px;
  }

  .badge-lateral-emoji { font-size: 24px; }

  /* Tooltip desabilitado no mobile */
  .badge-lateral-tooltip {
    display: none !important;
  }

  /* Área de toque generosa por item */
  .badge-lateral-item::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
  }
}

@media (max-width: 420px) {
  .badge-lateral-wrap {
    top: 240px;
    left: 14px;
  }

  .badge-lateral-img,
  .badge-lateral-emoji {
    width: 32px;
    height: 32px;
  }
}


/* ══════════════════════════════════════
   BADGE NO STORY / XPOST CARD
   Sobreposta no canto inferior esquerdo
   da imagem de capa
══════════════════════════════════════ */
.story-capa-wrap {
  position: relative;
}

.story-badge-wrap {
  position: absolute;
  bottom: 36px;
  left: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

@media (max-width: 768px) {
  .story-badge-wrap {
    bottom: 64px;
  }
}

/* Item individual: badge + tag lado a lado */
.story-badge-item {
  display: flex;
  align-items: center;
  opacity: 0;
  animation: storyBadgeIn 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

@keyframes storyBadgeIn {
  from { opacity: 0; transform: translateX(-10px) scale(0.85); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

.story-badge-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}

.story-badge-img.badge--redondo {
  border: 2px solid rgba(167, 139, 250, 0.85);
  box-shadow:
    0 0 0 3px rgba(108, 122, 224, 0.25),
    0 4px 12px rgba(108, 122, 224, 0.55);
}

.story-badge-tag {
  margin-left: 6px;
  padding: 4px 10px 4px 10px;
  background: rgba(10, 10, 30, 0.72);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.2px;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}


/* ══════════════════════════════════════
   POPUP DE DETALHE DA BADGE
   Abre ao clicar/tocar na badge
══════════════════════════════════════ */
.badge-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.28s ease;
  padding: 20px;
  /* Impede scroll do body durante o popup */
  touch-action: none;
}
.badge-popup-overlay.visible {
  opacity: 1;
}

.badge-popup {
  position: relative;
  background: #fff;
  border-radius: 28px;
  padding: 40px 32px 32px;
  width: min(320px, 88vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.35), 0 0 0 1px rgba(108,122,224,0.1);
  transform: scale(0.85) translateY(16px);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  /* Evita que o popup fique muito alto em telas pequenas */
  max-height: 90dvh;
  overflow-y: auto;
}

.badge-popup-overlay.visible .badge-popup {
  transform: scale(1) translateY(0);
}

body.dark .badge-popup {
  background: #16182a;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(108,122,224,0.2);
}

/* Glow roxo de fundo */
.badge-popup-glow {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(167,139,250,0.35) 0%, transparent 70%);
  pointer-events: none;
  flex-shrink: 0;
}

/* Botão fechar — maior no mobile para toque */
.badge-popup-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(108,122,224,0.1);
  color: #6c7ae0;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  z-index: 2;
  /* Área de toque maior */
  -webkit-tap-highlight-color: transparent;
}
.badge-popup-close:hover  { background: rgba(108,122,224,0.2); transform: scale(1.1); }
.badge-popup-close:active { background: rgba(108,122,224,0.25); transform: scale(0.95); }

body.dark .badge-popup-close {
  background: rgba(108,122,224,0.15);
  color: #a78bfa;
}

/* Imagem grande da badge */
.badge-popup-img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border: 4px solid rgba(167,139,250,0.8);
  box-shadow:
    0 0 0 8px rgba(108,122,224,0.12),
    0 16px 40px rgba(108,122,224,0.45);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  animation: badgePopupPulse 3s ease-in-out infinite;
}

.badge-popup-emoji {
  width: 110px;
  height: 110px;
  border: 4px solid rgba(167,139,250,0.8);
  background: linear-gradient(135deg, #1e2035, #2d2f5a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  box-shadow: 0 0 0 8px rgba(108,122,224,0.12), 0 16px 40px rgba(108,122,224,0.45);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

@keyframes badgePopupPulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(108,122,224,0.12), 0 16px 40px rgba(108,122,224,0.45); }
  50%       { box-shadow: 0 0 0 12px rgba(167,139,250,0.18), 0 16px 48px rgba(108,122,224,0.65); }
}

.badge-popup-label {
  font-family: 'Nunito', sans-serif;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #6c7ae0;
  margin-top: 4px;
}
body.dark .badge-popup-label { color: #a78bfa; }

.badge-popup-nome {
  font-family: 'Nunito', sans-serif;
  font-size: 22px;
  font-weight: 900;
  color: #2d2f4a;
  text-align: center;
}
body.dark .badge-popup-nome { color: #e0e0f0; }

.badge-popup-desc {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
  line-height: 1.6;
  max-width: 240px;
}
body.dark .badge-popup-desc { color: #9095b8; }

/* Ajustes mobile do popup */
@media (max-width: 768px) {
  .badge-popup {
    /* No mobile sobe como sheet do centro,
       não precisa mudar pois já é centered */
    padding: 36px 24px 28px;
    border-radius: 24px;
    gap: 8px;
  }

  .badge-popup-img,
  .badge-popup-emoji {
    width: 96px;
    height: 96px;
  }

  .badge-popup-emoji { font-size: 44px; }

  .badge-popup-nome {
    font-size: 20px;
  }

  .badge-popup-desc {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .badge-popup {
    padding: 32px 20px 24px;
    border-radius: 22px;
  }

  .badge-popup-img,
  .badge-popup-emoji {
    width: 84px;
    height: 84px;
  }

  .badge-popup-emoji { font-size: 38px; }
}


/* ══════════════════════════════════════
   ANTI-HIGHLIGHT no tap (mobile)
   Remove o flash azul ao tocar
══════════════════════════════════════ */
.badge-lateral-item,
.badge-popup-close {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
