/* =====================================================================
   39-glass-controls.css
   Redesenho premium dos botões flutuantes do feed (som) e do story
   (adicionar, pausar/play, fechar, opções). Estilo glassmorphism escuro
   com brilho sutil, ícones nítidos e transições suaves.
   ===================================================================== */

/* Reset local para todos os controles cobertos por este arquivo */
.post-video-wrap .video-sound-btn,
.story-add-btn,
.story-pause-toggle,
.story-close,
.story-options-toggle {
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  outline: none;
  font: inherit;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}

/* ---------- Base compartilhada (glass premium) ---------- */
.post-video-wrap .video-sound-btn,
.story-add-btn,
.story-pause-toggle,
.story-close,
.story-options-toggle {
  /* position é definido individualmente abaixo — pause/close/options ficam
     no flex do .story-header, só add-btn e video-sound-btn são absolute */
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: #fff !important;

  /* Vidro escuro com leve tom azulado */
  background:
    linear-gradient(140deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 55%),
    radial-gradient(120% 120% at 20% 10%, rgba(96,165,250,.28) 0%, rgba(15,20,38,0) 60%),
    rgba(12, 16, 30, .55) !important;
  border: 1px solid rgba(255,255,255,.22) !important;
  box-shadow:
    0 8px 22px -8px rgba(0,0,0,.55),
    0 0 0 1px rgba(148,163,255,.08) inset,
    0 1px 0 rgba(255,255,255,.14) inset !important;

  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);

  transition:
    transform .18s cubic-bezier(.2,.7,.3,1.2),
    background .2s ease,
    border-color .2s ease,
    box-shadow .2s ease,
    filter .2s ease;
}

/* Brilho superior sutil (efeito "cristal") */
.post-video-wrap .video-sound-btn::after,
.story-add-btn::after,
.story-pause-toggle::after,
.story-close::after,
.story-options-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 38%);
  mix-blend-mode: overlay;
  opacity: .8;
}

/* Hover / active comuns */
.post-video-wrap .video-sound-btn:hover,
.story-add-btn:hover,
.story-pause-toggle:hover,
.story-close:hover,
.story-options-toggle:hover {
  border-color: rgba(186, 220, 255, .55) !important;
  box-shadow:
    0 12px 28px -8px rgba(0,0,0,.6),
    0 0 0 3px rgba(96,165,250,.18),
    0 1px 0 rgba(255,255,255,.18) inset !important;
  transform: scale(1.06);
}

.post-video-wrap .video-sound-btn:active,
.story-add-btn:active,
.story-pause-toggle:active,
.story-close:active,
.story-options-toggle:active {
  transform: scale(.92);
  filter: brightness(.95);
}

/* ---------- Botão de SOM do feed ---------- */
.post-video-wrap .video-sound-btn {
  right: 12px;
  bottom: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  z-index: 4;
  padding: 0;
}
.post-video-wrap .video-sound-btn svg {
  width: 18px !important;
  height: 18px !important;
  stroke: #fff;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
  position: relative;
  z-index: 1;
}
/* Respeita o atributo hidden do HTML: só 1 ícone visível por vez */
.post-video-wrap .video-sound-btn svg[hidden],
.story-pause-toggle svg[hidden],
.role-mute-icon svg[hidden] {
  display: none !important;
}
.post-video-wrap .video-sound-btn svg:not([hidden]),
.story-pause-toggle svg:not([hidden]),
.role-mute-icon svg:not([hidden]) {
  display: block;
}
/* Estado com áudio ativo: leve tom ciano */
.post-video-wrap .video-sound-btn:not(.muted) {
  background:
    linear-gradient(140deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 55%),
    radial-gradient(120% 120% at 20% 10%, rgba(56,189,248,.4) 0%, rgba(15,20,38,0) 60%),
    rgba(12, 16, 30, .6) !important;
  border-color: rgba(125,211,252,.55) !important;
}

/* ---------- Botão de ADICIONAR story (+) ---------- */
.story-add-btn {
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  z-index: 30;
  /* Levemente mais vibrante para chamar atenção */
  background:
    linear-gradient(140deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 55%),
    radial-gradient(120% 120% at 20% 10%, rgba(129,140,248,.45) 0%, rgba(15,20,38,0) 60%),
    rgba(14, 18, 34, .6) !important;
  border-color: rgba(165,180,252,.55) !important;
}
.story-add-btn svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
  stroke-width: 2.4;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
  position: relative;
  z-index: 1;
}

/* ---------- Botão PAUSAR / PLAY do story ---------- */
.story-pause-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  z-index: 25;
}
.story-pause-toggle svg {
  width: 16px;
  height: 16px;
  fill: #fff !important;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
  position: relative;
  z-index: 1;
}

/* ---------- Botão FECHAR (✕) do story ---------- */
.story-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: #fff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  z-index: 25;
}
.story-close:hover {
  background:
    linear-gradient(140deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 55%),
    radial-gradient(120% 120% at 20% 10%, rgba(248,113,113,.35) 0%, rgba(15,20,38,0) 60%),
    rgba(12, 16, 30, .6) !important;
  border-color: rgba(252,165,165,.55) !important;
}

/* ---------- Botão OPÇÕES (⋯) do story ---------- */
.story-options-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  z-index: 25;
}
.story-options-toggle svg {
  width: 18px;
  height: 18px;
  fill: #fff !important;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
  position: relative;
  z-index: 1;
}

/* ---------- Ícone de mute nos Rolês (feed vertical) ---------- */
.role-slide .role-mute-icon {
  position: absolute;
  right: 14px;
  bottom: 90px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  color: #fff;
  background:
    linear-gradient(140deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 55%),
    radial-gradient(120% 120% at 20% 10%, rgba(96,165,250,.28) 0%, rgba(15,20,38,0) 60%),
    rgba(12, 16, 30, .55);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow:
    0 8px 22px -8px rgba(0,0,0,.55),
    0 1px 0 rgba(255,255,255,.14) inset;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  transition: transform .18s ease, border-color .2s ease, box-shadow .2s ease;
}
.role-slide .role-mute-icon:hover {
  transform: scale(1.06);
  border-color: rgba(186,220,255,.55);
}
.role-slide .role-mute-icon svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
}

/* Foco por teclado acessível em todos */
.post-video-wrap .video-sound-btn:focus-visible,
.story-add-btn:focus-visible,
.story-pause-toggle:focus-visible,
.story-close:focus-visible,
.story-options-toggle:focus-visible,
.role-slide .role-mute-icon:focus-visible {
  outline: 2px solid rgba(147, 197, 253, .8);
  outline-offset: 2px;
}

/* ---------- Barra de VISUALIZAÇÕES do story (dono) ---------- */
/* Especificidade dobrada com #storyViewersBtn pra vencer qualquer override */
#storyViewersBtn.story-viewers-bar,
.story-viewers-bar {
  position: absolute;
  left: 12px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 6;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: #fff !important;
  cursor: pointer;

  background:
    linear-gradient(140deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 55%),
    radial-gradient(120% 120% at 20% 10%, rgba(96,165,250,.28) 0%, rgba(15,20,38,0) 60%),
    rgba(12, 16, 30, .55) !important;
  border: 1px solid rgba(255,255,255,.22) !important;
  box-shadow:
    0 8px 22px -8px rgba(0,0,0,.55),
    0 0 0 1px rgba(148,163,255,.08) inset,
    0 1px 0 rgba(255,255,255,.14) inset !important;

  backdrop-filter: blur(16px) saturate(180%);
  transition:
    transform .18s cubic-bezier(.2,.7,.3,1.2),
    border-color .2s ease,
    box-shadow .2s ease,
    filter .2s ease;
  position: absolute;
  overflow: hidden;
}
.story-viewers-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 40%);
  mix-blend-mode: overlay;
  opacity: .8;
}
.story-viewers-bar:hover {
  border-color: rgba(186, 220, 255, .55) !important;
  box-shadow:
    0 12px 28px -8px rgba(0,0,0,.6),
    0 0 0 3px rgba(96,165,250,.18),
    0 1px 0 rgba(255,255,255,.18) inset !important;
  transform: translateY(-1px);
}
.story-viewers-bar:active {
  transform: translateY(0) scale(.97);
  filter: brightness(.95);
}
.story-viewers-bar svg {
  width: 15px;
  height: 15px;
  stroke: #fff;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.story-viewers-bar > span,
.story-viewers-label {
  position: relative;
  z-index: 1;
}
.story-viewers-label {
  color: rgba(255,255,255,.75) !important;
}
.story-viewers-bar > span:first-of-type {
  font-weight: 700;
}
.story-viewers-bar:focus-visible {
  outline: 2px solid rgba(147, 197, 253, .8);
  outline-offset: 2px;
}
