/* =====================================================================
   [27] Correções jul/26 — v11
   1) Moldura de avatar (desktop + mobile) alinhada com o círculo interno
      do SVG (67% do box).
   2) Chip de categoria no card do bazar: ícone pequeno, sem fundo preto.
   3) Postagem encaminhada no chat: preenche a bolha sem espaço vazio.
   ===================================================================== */

/* ---------- 1. Molduras de avatar ---------------------------------- */
/* O interior "limpo" dos SVGs em /assets/img/frames/*.svg tem raio ~67
   do canvas 200x200. Então o avatar deve ocupar 67% do box da moldura. */
.wz-frame-box{
  --wz-avatar-size: calc(var(--wz-frame-size) * 0.67) !important;
}
.wz-frame-avatar{
  width: var(--wz-avatar-size) !important;
  height: var(--wz-avatar-size) !important;
}
.wz-frame-avatar > img,
.wz-frame-avatar > .wz-ava-img{
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

/* Tamanhos coerentes por contexto (usa !important para vencer
   o inline style que o PHP ainda emite). */
.profile-avatar-wrap-lg .wz-frame-box,
.profile-avatar-wrap .wz-frame-box{
  --wz-frame-size: 150px !important;
}
.edit-profile-head .wz-frame-box{ --wz-frame-size: 150px !important; }
.post-header .wz-frame-box       { --wz-frame-size: 56px  !important; }
.conversation-item .wz-frame-box { --wz-frame-size: 60px  !important; }
.chat-header-user .wz-frame-box  { --wz-frame-size: 48px  !important; }

/* Mobile: reduz e destrava larguras fixas do wrap antigo. */
@media (max-width: 640px){
  .profile-avatar-wrap-lg .wz-frame-box,
  .profile-avatar-wrap .wz-frame-box{
    --wz-frame-size: 108px !important;
  }
}

/* Se o wrap antigo tem largura/altura fixa via !important, libera
   quando ele contiver a moldura, senão o SVG "some" ou fica cortado. */
.profile-avatar-wrap-lg:has(.wz-frame-box),
.profile-avatar-wrap:has(.wz-frame-box){
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  aspect-ratio: auto !important;
  overflow: visible !important;
  background: transparent !important;
}
.profile-v3 .profile-hero-inner:has(.wz-frame-box){
  grid-template-columns: 150px minmax(0,1fr) !important;
}
@media (max-width: 640px){
  .profile-v3 .profile-hero-inner:has(.wz-frame-box){
    grid-template-columns: 108px minmax(0,1fr) !important;
  }
  .profile-v3 .profile-avatar-wrap-lg:has(.wz-frame-box),
  .profile-v3 .profile-avatar-wrap-lg:has(.wz-frame-box) .profile-avatar{
    width: auto !important;
    height: auto !important;
  }
}

/* Reposiciona o mood-badge sobre a moldura */
.profile-avatar-wrap-lg:has(.wz-frame-box) .mood-badge{
  position: absolute;
  right: 6px; bottom: 6px;
  z-index: 3;
}
.profile-avatar-wrap-lg:has(.wz-frame-box) .avatar-orbit{
  display: none !important;
}


/* ---------- 2. Chip de categoria do bazar --------------------------- */
/* Antes: chip com fundo preto (rgba(0,0,0,.65)) + ícone 22px → gigante.
   Agora: sem fundo, ícone 16px com sombrinha pra legibilidade. */
.bazar-card-cat,
.bazar-card-cat--bottom{
  background: transparent !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  padding: 4px 6px !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.95), 0 0 6px rgba(0,0,0,.65);
  border-radius: 999px;
}
.bazar-card-cat .cat-icon-img,
.bazar-card-cat--bottom .cat-icon-img{
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  background: transparent !important;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.9));
}
.bazar-card-cat .cat-icon-emoji,
.bazar-card-cat--bottom .cat-icon-emoji{
  font-size: 12px;
}



/* ---------- 3. Postagem encaminhada no chat (v3 compacta) ---------- */
/* Remove o espaço gigante causado por white-space: pre-wrap + HTML indentado. */
.chat-bubble.has-shared-post,
.chat-bubble:has(.chat-shared-post){
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  padding: 4px !important;
  padding-right: 4px !important;
  padding-bottom: 4px !important;
  width: fit-content !important;
  min-width: 0 !important;
  max-width: min(214px, 74vw) !important;
  white-space: normal !important;
  overflow: visible !important;
}
.chat-bubble.has-shared-post .wz-msg-body,
.chat-bubble:has(.chat-shared-post) .wz-msg-body,
.wz-msg:has(.chat-shared-post) .wz-msg-body{
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  width: 100% !important;
  white-space: normal !important;
  line-height: 1.2 !important;
}
.chat-bubble.has-shared-post .chat-shared-post,
.chat-bubble .chat-shared-post{
  display: block !important;
  width: 190px !important;
  max-width: 100% !important;
  border: 0 !important;
  background: rgba(0,0,0,.16) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  white-space: normal !important;
}
.chat-bubble.has-shared-post .chat-shared-post-tag,
.chat-bubble .chat-shared-post-tag{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  padding: 4px 6px 2px !important;
  margin: 0 !important;
  min-height: 18px !important;
  font-size: 10.5px !important;
  line-height: 1.15 !important;
  opacity: .9 !important;
  white-space: normal !important;
}
.chat-bubble.has-shared-post .chat-shared-post-media,
.chat-bubble .chat-shared-post-media{
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  max-height: none !important;
  min-height: 0 !important;
  height: auto !important;
  background: transparent !important;
  overflow: hidden !important;
  display: block !important;
  border-radius: 0 !important;
}
.chat-bubble.has-shared-post .chat-shared-post-media img,
.chat-bubble.has-shared-post .chat-shared-post-media video,
.chat-bubble .chat-shared-post-media img,
.chat-bubble .chat-shared-post-media video{
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: cover !important;
  background: transparent !important;
  display: block !important;
}
.chat-bubble.has-shared-post .chat-shared-post-caption,
.chat-bubble .chat-shared-post-caption{
  padding: 5px 7px 7px !important;
  font-size: 12px !important;
  line-height: 1.25 !important;
  white-space: normal !important;
}
.chat-bubble.has-shared-post .wz-msg-status,
.chat-bubble:has(.chat-shared-post) .wz-msg-status{
  position: absolute !important;
  right: 8px !important;
  bottom: 7px !important;
  margin: 0 !important;
}
@media (max-width: 480px){
  .chat-bubble.has-shared-post,
  .chat-bubble:has(.chat-shared-post){ max-width: min(204px, 72vw) !important; }
  .chat-bubble.has-shared-post .chat-shared-post,
  .chat-bubble .chat-shared-post{ width: 180px !important; }
}


/* ---------- Trim de música estilo Instagram (janela de 30s) --------- */
.music-trim{
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 4px 2px;
  margin-top: 6px;
  border-top: 1px dashed rgba(255,255,255,.08);
  width: 100%;
}
.music-trim-label{
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  font-size: 12.5px; color: rgba(255,255,255,.82);
}
.music-trim-label strong{
  color: #22d3ee; font-weight: 800; font-variant-numeric: tabular-nums;
}
.music-trim-hint{ color: rgba(255,255,255,.52); font-size: 11.5px; }
.music-trim-track{
  position: relative;
  height: 54px;
  width: 100%;
  border-radius: 8px;
  background: rgba(0,0,0,.28);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.music-trim-track:active{ cursor: grabbing; }
.music-waveform{
  position: absolute;
  inset: 7px 0;
  opacity: .9;
  background:
    repeating-linear-gradient(90deg,
      rgba(56,189,248,.95) 0 2px,
      transparent 2px 5px,
      rgba(56,189,248,.45) 5px 7px,
      transparent 7px 11px),
    linear-gradient(180deg, transparent 0 18%, rgba(56,189,248,.9) 18% 82%, transparent 82%);
  mask-image: radial-gradient(ellipse at center, #000 35%, transparent 70%);
}
.music-trim-window{
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  border: 2px solid #facc15;
  border-radius: 7px;
  background: rgba(250,204,21,.08);
  display: flex;
  justify-content: space-between;
  padding: 0;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 0 0 999px rgba(0,0,0,.38);
}
.music-trim-window:active{ cursor: grabbing; }
.music-trim-window.is-locked{ cursor: default; }
.music-trim-handle{
  width: 7px;
  min-height: 100%;
  background: #facc15;
  display: block;
}
.music-trim-window-fill{ flex: 1; }
.music-trim input[type=range]{
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.music-preview-segment{
  align-self: flex-start;
  border: 1px solid rgba(34,211,238,.36);
  background: rgba(34,211,238,.12);
  color: #dffbff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}


/* =====================================================================
   [27b] Reforço mobile — foto de perfil dentro da moldura
   O 12-final-user-fixes.css força .profile-v3 .profile-avatar-wrap-lg
   .profile-avatar a 88x88 no mobile. Precisamos vencer isso quando há
   moldura, senão a foto vaza do círculo interno (72px).
   ===================================================================== */

/* Container do avatar dentro da moldura respeita o --wz-avatar-size,
   em qualquer contexto (inclusive .profile-v3 mobile). */
.profile-v3 .profile-avatar-wrap-lg .wz-frame-avatar,
.profile-hero-inner .profile-avatar-wrap-lg .wz-frame-avatar,
.profile-avatar-wrap .wz-frame-avatar,
.profile-avatar-wrap-lg .wz-frame-avatar{
  width: var(--wz-avatar-size) !important;
  height: var(--wz-avatar-size) !important;
  aspect-ratio: 1 / 1 !important;
}

/* Imagem preenche o container 100% — vence rules de 88x88 mobile. */
.profile-v3 .profile-avatar-wrap-lg .wz-frame-avatar > img,
.profile-v3 .profile-avatar-wrap-lg .wz-frame-avatar > img.profile-avatar,
.profile-hero-inner .profile-avatar-wrap-lg .wz-frame-avatar > img,
.profile-hero-inner .profile-avatar-wrap-lg .wz-frame-avatar > img.profile-avatar,
.profile-avatar-wrap-lg .wz-frame-avatar > img.profile-avatar,
.profile-avatar-wrap .wz-frame-avatar > img.profile-avatar{
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  display: block !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  position: static !important;
}

/* Reforço: em telas ainda menores, mantém proporção certa. */
@media (max-width: 640px){
  .profile-v3 .profile-avatar-wrap-lg .wz-frame-box,
  .profile-hero-inner .profile-avatar-wrap-lg .wz-frame-box,
  .profile-avatar-wrap-lg .wz-frame-box,
  .profile-avatar-wrap .wz-frame-box{
    --wz-frame-size: 108px !important;
  }
  .profile-v3 .profile-avatar-wrap-lg .wz-frame-avatar,
  .profile-hero-inner .profile-avatar-wrap-lg .wz-frame-avatar{
    width: calc(var(--wz-frame-size) * 0.67) !important;
    height: calc(var(--wz-frame-size) * 0.67) !important;
  }
}
