/* ==========================================================================
   CLASSIC-WINAMP DETAIL ANIMATIONS
   Small touches ported from Winamp 2.x: pause blink, titlebar song ticker.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Pause blink — play button fades while paused (track loaded, not playing)
   -------------------------------------------------------------------------- */

@keyframes classic-pause-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.transport-btn.is-paused .transport-icon {
  animation: classic-pause-blink 1s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .transport-btn.is-paused .transport-icon {
    animation: none;
    opacity: 0.6;
  }
}

/* --------------------------------------------------------------------------
   Titlebar song ticker — scrolls when playing
   -------------------------------------------------------------------------- */

.title-bar-left {
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.title-bar-text {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  max-width: 100%;
}

/* Only scroll when text actually overflows its container. JS sets
   data-overflows="true" on the element when measured wider than parent. */
.title-bar-text[data-overflows="true"].is-scrolling {
  animation: classic-title-scroll 12s linear infinite;
}

@keyframes classic-title-scroll {
  0%   { transform: translateX(0); }
  8%   { transform: translateX(0); }
  92%  { transform: translateX(calc(-100% + var(--title-bar-width, 120px))); }
  100% { transform: translateX(calc(-100% + var(--title-bar-width, 120px))); }
}

@media (prefers-reduced-motion: reduce) {
  .title-bar-text.is-scrolling {
    animation: none;
  }
}

/* LCD time remaining — subtle color shift so user knows mode flipped */
.lcd-time.lcd-time-remaining {
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Volume / Balance OSD — big floating readout that fades out
   -------------------------------------------------------------------------- */

.classic-osd {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  padding: 20px 40px;
  background: rgba(0, 0, 0, 0.85);
  border: 2px solid var(--accent, #00ff66);
  border-radius: 8px;
  color: var(--accent, #00ff66);
  font-family: 'JetBrains Mono', monospace;
  font-size: 56px;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-shadow:
    0 0 8px var(--accent-glow, rgba(0, 255, 102, 0.6)),
    0 0 16px var(--accent-glow-wide, rgba(0, 255, 102, 0.2));
  box-shadow:
    0 0 20px var(--accent-glow, rgba(0, 255, 102, 0.6)),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  z-index: 9998;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  white-space: nowrap;
  line-height: 1;
}

.classic-osd.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.classic-osd-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.2em;
  opacity: 0.7;
  margin-bottom: 4px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .classic-osd {
    transition: opacity 0.1s linear;
  }
}

/* --------------------------------------------------------------------------
   Windowshade mode — collapses player to a thin title+LCD+transport strip
   Classic Winamp: double-click the titlebar to toggle.
   -------------------------------------------------------------------------- */

#player.is-shaded .viz-container,
#player.is-shaded .seek-bar-container,
#player.is-shaded .slider-row,
#player.is-shaded .feature-bar,
#player.is-shaded .eq-panel,
#player.is-shaded .fx-panel,
#player.is-shaded .playlist-panel,
#player.is-shaded .character-panel,
#player.is-shaded .character-overlay,
#player.is-shaded .lcd-marquee-container,
#player.is-shaded .lcd-badges {
  display: none !important;
}

#player.is-shaded {
  min-height: 0;
}
#player.is-shaded .lcd-section {
  padding: 4px 8px;
  min-height: auto;
}
#player.is-shaded .lcd-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#player.is-shaded .controls-section {
  padding: 4px 8px;
}
#player.is-shaded .transport-row {
  gap: 4px;
}
#player.is-shaded .transport-btn {
  min-width: 28px;
  height: 24px;
  padding: 2px 4px;
}
#player.is-shaded .transport-btn svg {
  width: 12px;
  height: 12px;
}
/* Hide the "extra" transport buttons — keep only prev/play/next/stop/open */
#player.is-shaded #btn-rwd,
#player.is-shaded #btn-fwd,
#player.is-shaded .transport-spacer {
  display: none;
}

.title-bar {
  cursor: default;
  user-select: none;
}

/* --------------------------------------------------------------------------
   Double-size mode — scales the whole player 2x.
   Toggled by Ctrl+D or the clutterbar "D" button. Pixel-perfect style via
   image-rendering: pixelated so visualizer canvas keeps chunky look.
   -------------------------------------------------------------------------- */

body.is-2x #player {
  transform: scale(2);
  transform-origin: top left;
  /* Account for the scale so layout below stays usable */
  margin-bottom: calc(var(--player-height, 600px));
  margin-right: calc(var(--player-width, 400px));
}

body.is-2x #viz-canvas,
body.is-2x .waveform-canvas {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

@media (max-width: 900px) {
  body.is-2x #player {
    /* No double size on small screens — would overflow */
    transform: none;
    margin-bottom: 0;
    margin-right: 0;
  }
}

/* --------------------------------------------------------------------------
   Classic Clutterbar — vertical O/A/I/D/V strip on the left edge.
   Tiny monospace letters, very subtle. Classic Winamp detail.
   -------------------------------------------------------------------------- */

.clutterbar {
  position: absolute;
  left: 4px;
  top: 40px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  z-index: 10;
}

.clutter-btn {
  width: 10px;
  height: 9px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  color: var(--text-dim, rgba(255, 255, 255, 0.35));
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 0;
  line-height: 9px;
  cursor: pointer;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s ease;
  user-select: none;
}
.clutter-btn:hover,
.clutter-btn:focus-visible {
  color: var(--accent, #00ff66);
  outline: none;
  text-shadow: 0 0 4px var(--accent-glow, rgba(0, 255, 102, 0.5));
}
.clutter-btn.is-active {
  color: var(--accent, #00ff66);
}

/* Hide clutterbar on tiny screens and in windowshade */
@media (max-width: 500px) {
  .clutterbar { display: none; }
}
#player.is-shaded .clutterbar {
  top: 6px;
}

/* --------------------------------------------------------------------------
   About modal
   -------------------------------------------------------------------------- */
.about-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 24px;
}
.about-panel {
  background: var(--bg-player);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 28px;
  max-width: 420px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.about-panel h2 {
  color: var(--accent);
  font-size: 22px;
  margin: 0 0 4px;
  letter-spacing: 0.15em;
}
.about-panel .about-version {
  font-size: 11px;
  letter-spacing: 0.2em;
  opacity: 0.6;
  margin-bottom: 16px;
}
.about-panel .about-tag {
  font-style: italic;
  color: var(--accent);
  margin: 12px 0;
  font-size: 13px;
}
.about-panel .about-credits {
  font-size: 11px;
  opacity: 0.7;
  line-height: 1.6;
}
.about-panel .about-close {
  margin-top: 18px;
  padding: 6px 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.15em;
  transition: all 0.15s;
}
.about-panel .about-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Llama easter egg overlay
   -------------------------------------------------------------------------- */
.llama-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at center, #1a0f1a 0%, #000 80%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10000;
  cursor: pointer;
  animation: llama-enter 0.4s ease-out;
}

@keyframes llama-enter {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.llama-art {
  font-family: 'Courier New', monospace;
  color: #fffa80;
  font-size: 14px;
  line-height: 1.05;
  text-shadow:
    0 0 8px #ffcc00,
    0 0 20px #ff8800;
  white-space: pre;
}
.llama-art pre {
  margin: 0;
}

.llama-phrase {
  font-family: 'JetBrains Mono', monospace;
  color: #26ff40;
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 0.15em;
  text-shadow:
    0 0 10px #26ff40,
    0 0 20px #26ff40,
    0 0 40px #0dbf1f;
  animation: llama-shake 0.15s linear infinite;
}

@keyframes llama-shake {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(-1px, 1px); }
  50%      { transform: translate(1px, -1px); }
  75%      { transform: translate(-1px, -1px); }
}

.llama-sub {
  font-family: 'JetBrains Mono', monospace;
  color: #888;
  font-size: 11px;
  letter-spacing: 0.25em;
}

@media (prefers-reduced-motion: reduce) {
  .llama-overlay,
  .llama-phrase {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   File Info dialog (F3)
   -------------------------------------------------------------------------- */
.fileinfo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 24px;
}
.fileinfo-panel {
  background: var(--bg-player);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 340px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}
.fileinfo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.2em;
  font-weight: bold;
}
.fileinfo-close {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
  border-radius: 4px;
}
.fileinfo-close:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
}
.fileinfo-body {
  padding: 16px 20px 20px;
}
.fileinfo-body dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 14px;
  margin: 0;
  font-size: 12px;
}
.fileinfo-body dt {
  color: var(--text-dim);
  letter-spacing: 0.1em;
}
.fileinfo-body dd {
  margin: 0;
  word-break: break-all;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Stream URL dialog (Ctrl+L)
   -------------------------------------------------------------------------- */
.stream-url-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 24px;
}
.stream-url-panel {
  background: var(--bg-player);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 460px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.stream-url-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.2em;
  font-weight: bold;
}
.stream-url-close {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
  border-radius: 4px;
}
.stream-url-close:hover { color: var(--accent); background: rgba(255,255,255,0.06); }
.stream-url-body {
  padding: 18px 20px 20px;
}
.stream-url-body label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.stream-url-body input[type="url"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.stream-url-body input[type="url"]:focus {
  border-color: var(--accent);
}
.stream-url-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.stream-url-actions button {
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.15em;
  transition: all 0.15s;
}
.stream-url-actions .stream-url-ok {
  border-color: var(--accent);
  color: var(--accent);
}
.stream-url-actions button:hover {
  background: rgba(255,255,255,0.05);
}


