/*
 * SPDX-License-Identifier: LicenseRef-FluxTuner-Web-NC
 */

/* Persistent player layout, controls, states, themes and responsive behavior. */

.player-bar {
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)), var(--panel);
  box-shadow: 0 1.5rem 4rem var(--shadow);
}

.player-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.player-bar {
  position: fixed;
  right: var(--page-inline);
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: var(--page-inline);
  z-index: 28;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1rem;
}

.player-bar::before {
  display: block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: var(--muted);
  content: "";
}

.player-info {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.12rem 0.75rem;
  align-items: center;
}

.player-info .eyebrow {
  grid-row: span 3;
  margin: 0;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.player-info h2,
.player-info p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-info p {
  color: var(--muted);
}

.player-actions {
  align-items: center;
  justify-content: end;
}

.player-actions [data-player-toggle]:not(:disabled) {
  color: #04111f;
  border-color: var(--action-fill);
  background: var(--action-fill);
}

.player-actions [data-player-toggle]:not(:disabled):hover {
  color: #ffffff;
  border-color: var(--action-fill-hover);
  background: var(--action-fill-hover);
}

.player-bar[data-state="loading"]::before {
  background: var(--warning);
  box-shadow: 0 0 1rem rgba(250, 204, 21, 0.65);
}

.player-bar[data-state="playing"]::before {
  background: var(--accent);
  box-shadow: 0 0 1rem rgba(110, 231, 216, 0.65);
}

.player-bar[data-state="paused"]::before {
  background: var(--muted);
}

.player-bar[data-state="error"]::before {
  background: var(--danger);
  box-shadow: 0 0 1rem rgba(252, 165, 165, 0.65);
}

.player-bar[data-state="loading"] [data-player-status] { color: var(--warning); }

.player-bar[data-state="playing"] [data-player-status] { color: var(--accent); }

.player-bar[data-state="error"] [data-player-status] { color: var(--danger); }

@media (max-width: 58rem) {.player-bar {
    grid-template-columns: 1fr;
  }

.player-bar::before {
    position: absolute;
    top: 1rem;
    right: 1rem;
  }

.player-actions {
    justify-content: start;
  }}

@media (max-width: 42rem) {.player-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

.player-actions button,
.player-actions a {
    width: 100%;
  }}

.player-bar {
  position: fixed !important;
  right: auto !important;
  bottom: max(1rem, env(safe-area-inset-bottom)) !important;
  left: 50% !important;
  z-index: 60 !important;
  width: min(50rem, calc(100% - 2rem)) !important;
  transform: translateX(-50%) !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 0.75rem !important;
  align-items: center !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0.75rem 0.9rem !important;
  border: 1px solid rgba(110, 231, 216, 0.34) !important;
  border-radius: 1.1rem !important;
  background:
    radial-gradient(circle at 0% 0%, rgba(110, 231, 216, 0.12), transparent 12rem),
    linear-gradient(180deg, rgba(18, 39, 64, 0.98), rgba(7, 18, 34, 0.98)) !important;
  box-shadow:
    0 1rem 3rem rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.035) inset !important;
}

.player-bar::before {
  display: none !important;
  content: none !important;
}

.player-bar .eyebrow {
  display: none !important;
}

.player-bar > div:first-child {
  min-width: 0 !important;
}

.player-bar h2 {
  overflow: hidden !important;
  margin: 0 !important;
  font-size: 1rem !important;
  line-height: 1.15 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.player-bar p {
  margin: 0.22rem 0 0 !important;
  color: var(--muted) !important;
  font-size: 0.82rem !important;
}

.player-actions {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 0.45rem !important;
  align-items: center !important;
  justify-content: end !important;
}

.player-actions button,
.player-actions a {
  min-height: 2.1rem !important;
  padding: 0 0.72rem !important;
  font-size: 0.82rem !important;
}

@media (max-width: 42rem) {.player-bar {
    width: calc(100% - 1rem) !important;
    bottom: 0.5rem !important;
    grid-template-columns: 1fr !important;
    padding: 0.7rem !important;
  }

.player-actions {
    justify-content: start !important;
  }}

html[data-theme="light"] .player-bar {
  background:
    radial-gradient(circle at 0% 0%, rgba(2, 132, 199, 0.12), transparent 13rem),
    rgba(255, 255, 255, 0.90) !important;
  box-shadow:
    0 1rem 3rem rgba(15, 23, 42, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.70) inset !important;
}

.player-bar[hidden] {
  display: none !important;
}

.player-bar {
  border-color: rgba(110, 231, 216, 0.56) !important;
  border-radius: 1.25rem !important;
  background:
    radial-gradient(circle at 0% 0%, rgba(110, 231, 216, 0.22), transparent 14rem),
    linear-gradient(180deg, rgba(14, 35, 60, 0.99), rgba(4, 11, 23, 0.99)) !important;
  box-shadow:
    0 1.35rem 4rem rgba(0, 0, 0, 0.72),
    0 0 2rem rgba(110, 231, 216, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset !important;
  backdrop-filter: blur(1rem) !important;
}

.player-bar h2 {
  font-size: 1.06rem !important;
}

.player-bar p {
  font-weight: 750 !important;
}

.player-actions a {
  display: inline-flex !important;
  min-height: 2.1rem !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(110, 231, 216, 0.28) !important;
  border-radius: 999px !important;
  padding: 0 0.72rem !important;
  color: var(--text) !important;
  background: rgba(15, 35, 59, 0.72) !important;
  font: inherit !important;
  font-size: 0.82rem !important;
  font-weight: 850 !important;
  text-decoration: none !important;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease !important;
}

.player-actions a:hover {
  border-color: rgba(110, 231, 216, 0.72) !important;
  color: var(--accent) !important;
  transform: translateY(-1px) !important;
}

.player-bar[data-state="playing"] {
  border-color: rgba(110, 231, 216, 0.78) !important;
  box-shadow:
    0 1.35rem 4rem rgba(0, 0, 0, 0.72),
    0 0 2.2rem rgba(110, 231, 216, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset !important;
}

.player-bar[data-state="loading"] {
  border-color: rgba(250, 204, 21, 0.58) !important;
}

.player-bar[data-state="error"] {
  border-color: rgba(252, 165, 165, 0.62) !important;
}

html[data-theme="light"] .player-actions a {
  border-color: rgba(14, 116, 144, 0.22) !important;
  color: var(--text) !important;
  background: rgba(255, 255, 255, 0.72) !important;
}

html[data-theme="light"] .player-actions a:hover {
  border-color: rgba(14, 116, 144, 0.52) !important;
  color: var(--accent) !important;
}

.player-station {
  color: var(--text) !important;
  font-size: 0.82rem;
  font-weight: 700 !important;
  opacity: 0.86;
}

.player-station[hidden] {
  display: none !important;
}

/* Compact Now Playing hierarchy and icon controls. */
.player-info {
  display: flex !important;
  min-width: 0;
  flex-direction: column !important;
  gap: 0.12rem !important;
}

.player-info .player-station {
  order: -1;
  color: var(--accent) !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: none;
  opacity: 0.92;
}

.player-info h2 {
  font-size: 1rem !important;
  line-height: 1.2 !important;
}

.player-info .player-message {
  color: var(--muted) !important;
  font-size: 0.78rem !important;
  font-weight: 650 !important;
  line-height: 1.25;
}

.player-actions {
  flex-wrap: nowrap !important;
  gap: 0.5rem !important;
}

.player-actions .player-control {
  display: inline-flex !important;
  width: 2.75rem !important;
  min-width: 2.75rem !important;
  height: 2.75rem !important;
  min-height: 2.75rem !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 999px !important;
  padding: 0 !important;
}

.player-control-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

.player-control[data-player-mode="pause"] .player-control-icon {
  font-size: 0.82rem;
  letter-spacing: -0.16em;
  transform: translateX(-0.06em);
}

.player-control[data-player-mode="loading"] .player-control-icon {
  animation: player-control-pulse 900ms ease-in-out infinite alternate;
}

@keyframes player-control-pulse {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

@media (max-width: 42rem) {
  .player-bar {
    position: fixed !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.45rem !important;
    padding: 0.72rem !important;
  }

  .player-info {
    display: flex !important;
    min-width: 0 !important;
    flex-direction: column !important;
    gap: 0.12rem !important;
  }

  .player-actions {
    width: 100% !important;
    align-self: auto !important;
    justify-content: center !important;
  }

  .player-info h2,
  .player-info .player-station,
  .player-info .player-message {
    max-width: 100%;
  }
}

@media (max-width: 24rem) {
  .player-actions {
    gap: 0.35rem !important;
  }

  .player-actions .player-control {
    width: 2.75rem !important;
    min-width: 2.75rem !important;
    height: 2.75rem !important;
    min-height: 2.75rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .player-control[data-player-mode="loading"] .player-control-icon {
    animation: none;
  }
}

/* Copyable, overflow-aware current track. */
.player-track {
  width: 100%;
  min-width: 0;
  margin: 0 !important;
  overflow: hidden;
}

.player-track-copy {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0.35rem;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
  white-space: nowrap;
  cursor: copy;
}

.player-track-copy:disabled {
  color: inherit;
  cursor: default;
  opacity: 1;
}

.player-track-copy:not(:disabled):hover,
.player-track-copy:not(:disabled):focus-visible {
  color: var(--accent);
  outline: none;
}

.player-track-copy:not(:disabled):focus-visible {
  box-shadow: 0 0 0 2px rgba(110, 231, 216, 0.36);
}

.player-track-text {
  display: inline-block;
  min-width: max-content;
  transform: translateX(0);
  will-change: transform;
}

.player-track-copy[data-overflow="true"] .player-track-text {
  animation:
    player-track-scroll var(--player-track-duration, 10s)
    ease-in-out infinite alternate;
}

.player-track-copy[data-overflow="true"]:hover .player-track-text,
.player-track-copy[data-overflow="true"]:focus-visible .player-track-text {
  animation-play-state: paused;
}

@keyframes player-track-scroll {
  0%,
  15% {
    transform: translateX(0);
  }

  85%,
  100% {
    transform: translateX(var(--player-track-distance, 0));
  }
}

@media (prefers-reduced-motion: reduce) {
  .player-track-copy[data-overflow="true"] .player-track-text {
    animation: none;
  }
}

/* Bound station labels inside the fixed player on every viewport. */
.player-bar,
.player-info,
.player-station {
  min-width: 0;
  max-width: 100%;
}

.player-info {
  width: 100%;
  overflow: hidden;
}

.player-info .player-station {
  display: block;
  width: 100%;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

