/* ============================================================
   NEO • MULTIMÍDIA — ÁUDIOS MOBILE
   ------------------------------------------------------------
   Camada visual mobile do módulo de Áudios.
   Desktop permanece controlado por style.audios.css.
   ============================================================ */

@media (max-width: 768px), (pointer: coarse) and (max-width: 932px) {

  body.neo-audios-mobile-active {
    overflow-x: hidden;
  }

  /* O módulo deixa de trabalhar como duas colunas simultâneas. */
  body.neo-audios-mobile-active #view {
    min-height: 0;
  }

  body.neo-audios-mobile-active .audios-wrap {
    display: block !important;
    position: relative;
    width: 100% !important;
    height: calc(100dvh - 120px);
    min-height: 0;
    overflow: hidden !important;
  }

  body.neo-audios-mobile-active .audios-left,
  body.neo-audios-mobile-active .audios-right {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    flex: none !important;
    margin: 0 !important;
    box-sizing: border-box;
  }

  /* Tela de Cards/Listas */
  body.neo-audios-mobile-view-list .audios-left {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 20 !important;
    transform: translateX(0) !important;
  }

  body.neo-audios-mobile-view-list .audios-right {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: 1 !important;
  }

  /* Tela de Player */
  body.neo-audios-mobile-view-player .audios-left {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: 1 !important;
  }

  body.neo-audios-mobile-view-player .audios-right {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 20 !important;
    transform: translateX(0) !important;
  }

  /* O slot do player precisa ocupar o painel inteiro no mobile. */
  body.neo-audios-mobile-view-player #audios-player-slot {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  /*
    IMPORTANTE:
    O player real vive dentro do #neo-global-player-host.
    Como esse host já tem z-index alto no app.audios.js, aqui reforçamos
    para ele ficar acima do painel .audios-right, mas abaixo dos botões mobile.
  */
  body.neo-audios-mobile-active #neo-global-player-host.neo-docked {
    z-index: 85000 !important;
    pointer-events: auto !important;
  }

  body.neo-audios-mobile-active #neo-global-player-host.neo-docked .player-container {
    z-index: 85001 !important;
  }

  /* Botão voltar da tela do player */
  .neo-audios-mobile-back {
    position: fixed !important;
    top: max(12px, env(safe-area-inset-top)) !important;
    left: max(12px, env(safe-area-inset-left)) !important;

    width: 46px;
    height: 46px;
    border-radius: 999px;

    display: none;
    align-items: center;
    justify-content: center;

    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(10,10,10,0.82);
    color: #fff;

    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    padding-bottom: 4px; /* sobe visualmente a seta */

    box-shadow:
      0 0 16px rgba(0,0,0,0.7),
      0 8px 22px rgba(0,0,0,0.55);

    backdrop-filter: blur(8px);

    z-index: 100500 !important;
    pointer-events: auto !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .neo-audios-mobile-back.is-visible {
    display: flex !important;
  }

  .neo-audios-mobile-back:active {
    transform: scale(0.94);
    filter: brightness(0.9);
  }

  /* Botão flutuante para voltar ao player */
  .neo-audios-mobile-float-player {
    position: fixed !important;
    right: max(16px, env(safe-area-inset-right)) !important;
    bottom: max(18px, env(safe-area-inset-bottom)) !important;

    width: 58px;
    height: 58px;
    border-radius: 999px;

    display: none;
    align-items: center;
    justify-content: center;

    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255, 0, 48, 0.92);
    color: #fff;

    font-size: 24px;
    line-height: 1;

    box-shadow:
      0 0 20px rgba(255,0,60,0.58),
      0 12px 30px rgba(0,0,0,0.58);

    z-index: 100400 !important;
    pointer-events: auto !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .neo-audios-mobile-float-player.is-visible {
    display: flex !important;
  }

  .neo-audios-mobile-float-player:active {
    transform: scale(0.94);
    filter: brightness(0.9);
  }

  /*
    Se o botão global desktop existir, no mobile ele não deve competir
    visualmente com o botão mobile. Mantemos o nosso botão como principal.
  */
  body.neo-audios-mobile-capable #neo-player-jump-btn {
    z-index: 100300 !important;
  }
}

/* ============================================================
   ETAPA 3 — BOTÃO ÚNICO DE AÇÕES NO MOBILE
   ------------------------------------------------------------
   O JS mobile move a .toolbar-left original para dentro deste painel.
   Assim os listeners e as regras do app.audios.js continuam intactos.
   ============================================================ */

@media (max-width: 768px), (pointer: coarse) and (max-width: 932px) {

  body.neo-audios-mobile-active.neo-audios-mobile-view-list .audios-toolbar {
    min-height: 48px;
    padding: 4px 6px;
    margin-bottom: 8px;
    gap: 8px;
  }

  body.neo-audios-mobile-active.neo-audios-mobile-view-list .audios-toolbar .toolbar-right {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    overflow: hidden;
  }

  body.neo-audios-mobile-active.neo-audios-mobile-view-list .audios-path {
    display: block;
    max-width: 62vw;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.72);
  }

  .neo-audios-mobile-actions-btn {
    position: fixed !important;
    top: max(52px, calc(env(safe-area-inset-top) + 50px)) !important;
    left: max(8px, calc(env(safe-area-inset-left) + 28px)) !important;

    min-width: 104px;
    height: 42px;
    padding: 0 14px;
    border-radius: 999px;

    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;

    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(22,22,22,0.88);
    color: #fff;

    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;

    box-shadow:
      0 0 14px rgba(0,0,0,0.62),
      0 8px 24px rgba(0,0,0,0.50);

    backdrop-filter: blur(10px);
    z-index: 100350 !important;
    pointer-events: auto !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  body.neo-audios-mobile-active.neo-audios-mobile-view-list
  .neo-audios-mobile-actions-btn.is-visible {
    display: inline-flex !important;
  }
  
  body.neo-audios-mobile-active.neo-audios-mobile-view-player
  .neo-audios-mobile-actions-btn {
    display: none !important;
    pointer-events: none !important;
  }

  .neo-audios-mobile-actions-btn:active {
    transform: scale(0.96);
    filter: brightness(0.92);
  }

  .neo-audios-mobile-actions-btn .neo-actions-icon {
    font-size: 1.08rem;
    line-height: 1;
  }

  .neo-audios-mobile-actions-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    z-index: 100550 !important;
    pointer-events: auto;
  }

  body.neo-audios-mobile-actions-open .neo-audios-mobile-actions-backdrop {
    display: block;
  }

  .neo-audios-mobile-actions-sheet {
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));

    max-height: min(72dvh, 560px);
    overflow: hidden;

    display: none;
    flex-direction: column;

    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(24,24,24,0.97);
    color: #fff;

    box-shadow:
      0 0 28px rgba(0,0,0,0.72),
      0 -10px 34px rgba(0,0,0,0.46);

    z-index: 100600 !important;
    pointer-events: auto !important;
  }

  body.neo-audios-mobile-actions-open .neo-audios-mobile-actions-sheet {
    display: flex;
  }

  .neo-audios-mobile-actions-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .neo-audios-mobile-actions-head strong {
    font-size: 1rem;
    letter-spacing: 0.02em;
  }

  .neo-audios-mobile-actions-close {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .neo-audios-mobile-actions-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px 16px;
  }

  .neo-audios-mobile-actions-sheet .toolbar-left {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .neo-audios-mobile-actions-sheet .toolbar-left > button,
  .neo-audios-mobile-actions-sheet .playlist-actions > button,
  .neo-audios-mobile-actions-sheet .btn-yt {
    width: 100% !important;
    min-height: 46px !important;
    padding: 11px 14px !important;
    border-radius: 14px !important;
    text-align: left !important;
    justify-content: flex-start !important;
    font-size: 0.95rem !important;
    background: rgba(255,255,255,0.07) !important;
    color: #eee !important;
    border: 1px solid rgba(255,255,255,0.10) !important;
  }

  .neo-audios-mobile-actions-sheet .toolbar-left > button:disabled,
  .neo-audios-mobile-actions-sheet .playlist-actions > button:disabled,
  .neo-audios-mobile-actions-sheet .btn-yt:disabled {
    opacity: 0.42 !important;
    filter: grayscale(0.35);
    cursor: not-allowed !important;
  }

  .neo-audios-mobile-actions-sheet .toolbar-left > button:active:not(:disabled),
  .neo-audios-mobile-actions-sheet .playlist-actions > button:active:not(:disabled),
  .neo-audios-mobile-actions-sheet .btn-yt:active:not(:disabled) {
    transform: scale(0.985) !important;
    filter: brightness(0.92) !important;
  }

  .neo-audios-mobile-actions-sheet .playlist-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .neo-audios-mobile-actions-sheet .input-hidden,
  .neo-audios-mobile-actions-sheet input[type="file"] {
    display: none !important;
  }
}

@media (max-width: 768px), (pointer: coarse) and (max-width: 932px) {

  .player-container.media-video-audio-only #video-container {
    display: none !important;
  }

  .player-container.media-video-audio-only .vinil {
    display: flex !important;
  }

  .player-container.media-video-audio-only .player-nowplaying::before {
    content: "Modo áudio do vídeo";
    display: block;
    margin-bottom: 6px;
    font-size: 0.78rem;
    opacity: 0.75;
  }

}
