/* Switch Rádio <-> On-Demand — minimal, sem gradientes, sem focus-ring.
   O botão da faixa é o MESMO componente (.pedido-button); só o texto muda. */
.mode-switch {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: auto; cursor: pointer; user-select: none;
  font-size: 0.72rem; font-weight: 600; color: var(--muted, #6b6b78);
}
.mode-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.mode-switch__track {
  position: relative; width: 40px; height: 22px; border-radius: 999px;
  background: #b9b9cc; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
  transition: background 0.2s ease; flex: none;
}
.mode-switch__thumb {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform 0.2s ease;
}
.mode-switch input:checked + .mode-switch__track { background: var(--brand, #0d6efd); }
.mode-switch input:checked + .mode-switch__track .mode-switch__thumb { transform: translateX(18px); }

/* anterior/próxima — só aparecem no modo On-Demand (reusam .control-button do player) */
.od-nav { display: none; }
body[data-mode="ondemand"] .od-nav { display: inline-flex; }

/* =========================================================
 *  Header do player (status + switch) — mobile.
 *  Em telas estreitas, "Tocando Agora" empurrava o switch pra outra linha.
 *  Mantém status + switch SEMPRE na mesma linha, alinhados, sem quebra:
 *  - header nowrap; status trunca (min-width:0 + ellipsis) e cede espaço;
 *  - o switch encolhe escondendo os rótulos "Radio"/"On-Demand"
 *    (o estado fica claro pelo toggle + pelo badge "Live now"/"Sob demanda").
 *  Não afeta o desktop.
 * ========================================================= */
@media (max-width: 600px) {
  .now-playing-header {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .now-playing-header .status-indicator {
    min-width: 0;
    flex: 1 1 auto;
  }
  .now-playing-header .status-indicator #statusText {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  /* Mantém os rótulos no mobile, porém menores — só o toggle não deixa claro o modo. */
  .now-playing-header .mode-switch {
    flex: none;
    gap: 4px;
    font-size: 0.56rem;
  }
  .now-playing-header .mode-switch .mode-switch__opt {
    display: inline;
    white-space: nowrap;
  }
}

/* =========================================================
 *  Controle de volume — ícone + slider em popover.
 *  Disponível nos DOIS modos. Sem gradiente, sem focus-ring.
 * ========================================================= */
.volume-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
}
.volume-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) scale(0.96);
  transform-origin: bottom center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  background: #fff;
  border: 1px solid var(--line, #e7e7ef);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 30;
}
.volume-control.is-open .volume-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}
/* Pequena seta do popover */
.volume-popover::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
}
/* Slider VERTICAL dentro do popover (abordagem moderna: writing-mode) */
.volume-popover .volume-slider {
  display: block;
  width: 6px;
  height: 90px;
  margin: 0;
  writing-mode: vertical-lr;
  direction: rtl; /* topo = volume alto */
  background: #9ab1de;
  border-radius: 3px;
  cursor: pointer;
}

/* =========================================================
 *  Barra de progresso — aparece nos DOIS modos.
 *  Rádio: read-only (sem thumb, cursor default).
 *  On-Demand: seek (thumb + cursor pointer).
 * ========================================================= */
.od-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.od-progress[aria-hidden="true"] { display: none; }

.od-progress__time {
  font-size: 0.68rem;
  color: var(--muted, #6b6b78);
  font-variant-numeric: tabular-nums;
  flex: none;
  min-width: 30px;
  text-align: center;
}
/* Trilha: contém o preenchimento (read-only) + o input de range sobreposto. */
.od-progress__track {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 14px;
  display: flex;
  align-items: center;
}
/* Preenchimento sólido (sem gradiente) usado no modo Rádio (read-only). */
.od-progress__fill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  width: 0;
  border-radius: 2px;
  background: var(--brand, #0d6efd);
  pointer-events: none;
  display: none;
}
.od-progress[data-progress-mode="radio"] .od-progress__fill {
  display: block;
}
.od-progress__bar {
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #9ab1de;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}
/* No Rádio a trilha base fica transparente para o preenchimento sólido aparecer. */
.od-progress[data-progress-mode="radio"] .od-progress__bar {
  background: rgba(154, 177, 222, 0.45);
}

/* On-Demand: barra interativa (seek) com thumb */
.od-progress[data-progress-mode="ondemand"] .od-progress__bar {
  cursor: pointer;
}
.od-progress[data-progress-mode="ondemand"] .od-progress__bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand, #0d6efd);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.45);
}
.od-progress[data-progress-mode="ondemand"] .od-progress__bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand, #0d6efd);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.45);
}

/* Rádio (ao vivo): read-only — SEM thumb de arraste, cursor default,
   trilha preenchida pela cor da marca para indicar o progresso. */
.od-progress[data-progress-mode="radio"] .od-progress__bar {
  cursor: default;
}
.od-progress[data-progress-mode="radio"] .od-progress__bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: 0;
  opacity: 0;
}
.od-progress[data-progress-mode="radio"] .od-progress__bar::-moz-range-thumb {
  width: 0;
  height: 0;
  border: none;
  opacity: 0;
}
/* Trilha preenchida (Firefox) no modo Rádio */
.od-progress[data-progress-mode="radio"] .od-progress__bar::-moz-range-progress {
  background: var(--brand, #0d6efd);
  height: 4px;
  border-radius: 2px;
}

@media (max-width: 480px) {
  /* Oculta o controle de volume no mobile (a maioria dos navegadores móveis
     ignora o volume programático; o volume físico fica no aparelho).
     Fica aqui (ondemand.css = última folha) para vencer a cascata. */
  .volume-control {
    display: none;
  }

  /* No mobile o play-button fica posicionado de forma absoluta (canto inferior
     direito). Para a barra de progresso ficar utilizável, ela ocupa uma LINHA
     própria, com folga à direita para não passar por baixo do botão play. */
  .player-controls {
    flex-wrap: wrap;
  }
  .od-progress {
    order: 10; /* sempre por último na linha */
    flex-basis: 100%;
    width: 100%;
    margin-top: 8px;
    gap: 6px;
    padding-right: 44px; /* folga p/ o play-button absoluto à direita */
    box-sizing: border-box;
  }
  .od-progress__time {
    min-width: 28px;
    font-size: 0.62rem;
  }
  .od-progress__bar { height: 3px; }
}

/* =========================================================
 *  Botão compartilhar por faixa (discreto, na identidade)
 *  Desktop: aparece só no hover do card. Touch: sempre acessível.
 * ========================================================= */
.pedido-share {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-right: 2px;
  padding: 0;
  border: 1px solid var(--line, #e7e7ef);
  border-radius: 50%;
  background: #fff;
  color: var(--muted, #6b6b78);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
}
.pedido-share:hover {
  color: var(--brand, #0d6efd);
  border-color: rgba(13, 110, 253, 0.3);
  background: #f0f4ff;
}
.pedido-share.is-copied {
  color: #28a745;
  border-color: rgba(40, 167, 69, 0.35);
  background: #eaf7ee;
}
.pedido-share svg { display: block; }

/* Desktop com hover real: o botão fica oculto e só aparece ao passar o mouse no card. */
@media (hover: hover) and (pointer: fine) {
  .pedido-share {
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.15s ease, transform 0.15s ease, color 0.2s ease,
      background-color 0.2s ease, border-color 0.2s ease;
  }
  .pedido-item:hover .pedido-share,
  .pedido-share:focus-visible {
    opacity: 1;
    transform: scale(1);
  }
}

/* =========================================================
 *  Estados da fila no bloco de histórico (modo On-Demand)
 *  Reaproveita .history-item; só adiciona marcação sutil (sem focus-ring).
 * ========================================================= */
.history-item.od-played { opacity: 0.55; }
.history-item.od-current {
  background: #f0f4ff;
  border-radius: 6px;
}
.history-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
  background: var(--brand, #0d6efd);
  color: #fff;
}

@media (max-width: 520px) {
  .pedido-share {
    width: 26px;
    height: 26px;
  }
  .pedido-share svg { width: 14px; height: 14px; }
}
