/* =========================================================================
 * Super Live Music Lyrics — persistent player (dock/float) + PJAX loading bar.
 * DOCK  = overlays the hero box (plays inline); position set by JS each frame.
 * FLOAT = draggable corner mini-player (the "popup").
 * Uses --nmui-* tokens with safe fallbacks.
 * ========================================================================= */

.niyal-pp {
  position: fixed;
  z-index: 2147483000;                 /* above content, below the search overlay */
  display: none;
  background: #000;
  overflow: hidden;
}
.niyal-pp.is-open { display: block; }

/* ---------- FLOAT (popup) ---------- */
.niyal-pp.is-float {
  right: 16px;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px)); /* clear the mobile bottom nav */
  left: auto; top: auto;
  width: clamp(260px, 82vw, 380px);
  height: auto;
  border-radius: var(--nmui-r-md, 16px);
  background: var(--nmui-surface, #14161c);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  touch-action: none;
}
.niyal-pp.is-float.is-wide { width: calc(100vw - 12px) !important; left: 6px !important; right: 6px; }

/* ---------- DOCK (inline over the hero) ---------- */
.niyal-pp.is-dock {
  border-radius: 10px;
  box-shadow: var(--nmui-shadow-md, 0 6px 18px rgba(0, 0, 0, .18));
  /* left/top/width/height are set inline by JS to track the hero box */
}
.niyal-pp.is-dock .niyal-pp-bar { display: none; }
.niyal-pp.is-dock .niyal-pp-box { height: 100%; aspect-ratio: auto; }
.niyal-pp.is-dock .niyal-pp-popout { display: inline-flex; }

/* ---------- title bar (float only) ---------- */
.niyal-pp-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px 7px 10px;
  cursor: grab;
  color: var(--nmui-text, #e8eaed);
  background: var(--nmui-elev, #232730);
  user-select: none;
}
.niyal-pp.is-dragging .niyal-pp-bar { cursor: grabbing; }
.niyal-pp-grip { width: 22px; height: 4px; border-radius: 999px; background: currentColor; opacity: .35; flex: 0 0 auto; }
.niyal-pp-title { flex: 1; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.niyal-pp-btn { flex: 0 0 auto; border: none; background: transparent; color: inherit; width: 26px; height: 26px; border-radius: 7px; font-size: 15px; line-height: 1; cursor: pointer; opacity: .8; }
.niyal-pp-btn:hover { opacity: 1; background: rgba(255, 255, 255, .1); color: var(--nmui-accent, #e4422e); }
.niyal-pp-dock { display: none; }                 /* re-dock: shown only when floating */
.niyal-pp.is-float .niyal-pp-dock { display: inline-flex; }

/* ---------- video box ---------- */
.niyal-pp-box { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; touch-action: manipulation; }
@supports not (aspect-ratio: 1 / 1) { .niyal-pp.is-float .niyal-pp-box { height: 0; padding-top: 56.25%; } }
.niyal-pp-mount, .niyal-pp-mount iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* pop-out button (dock mode, top-right over the video) */
.niyal-pp-popout {
  display: none;
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 34px; height: 34px; align-items: center; justify-content: center;
  border: none; border-radius: 999px; cursor: pointer;
  color: #fff; background: rgba(0, 0, 0, .55); backdrop-filter: blur(6px);
  transition: background .2s, transform .15s;
}
.niyal-pp-popout:hover { background: var(--nmui-accent, #e4422e); transform: translateY(-1px); }

/* Like / Dislike (top-left over the video) — drives the next-song picks. */
.niyal-pp-react { position: absolute; top: 8px; left: 8px; z-index: 3; display: flex; gap: 6px; opacity: 0; transition: opacity .2s; }
.niyal-pp:hover .niyal-pp-react, .niyal-pp.is-float .niyal-pp-react, .niyal-pp-react:focus-within { opacity: 1; }
.niyal-pp-like, .niyal-pp-dislike {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 999px; cursor: pointer; font-size: 15px; line-height: 1;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(6px); color: #fff;
  transition: background .18s, transform .15s;
}
.niyal-pp-like:hover, .niyal-pp-dislike:hover { transform: translateY(-1px); }
.niyal-pp-like.is-on { background: rgba(37, 197, 94, .95); box-shadow: 0 0 0 2px rgba(37, 197, 94, .35); }
.niyal-pp-dislike.is-on { background: rgba(239, 68, 68, .95); box-shadow: 0 0 0 2px rgba(239, 68, 68, .35); }

/* minimized (float) — just the bar */
.niyal-pp.is-float.is-min .niyal-pp-box { display: none; }

@media (max-width: 600px) {
  .niyal-pp.is-float { right: 8px; left: 8px; width: auto; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .niyal-pp.is-float.is-wide { left: 4px !important; }
}

/* -------------------- PJAX top loading bar -------------------- */
html.niyal-pjax-loading::after {
  content: "";
  position: fixed; left: 0; top: 0; height: 3px; width: 100%;
  z-index: 2147483600;
  background: linear-gradient(90deg, var(--nmui-accent, #e4422e), #db2777);
  transform-origin: left;
  animation: niyal-pjax-bar 1.1s ease-in-out infinite;
}
@keyframes niyal-pjax-bar { 0% { transform: scaleX(0); opacity: 1; } 60% { transform: scaleX(.75); } 100% { transform: scaleX(1); opacity: .3; } }
html.niyal-pjax-loading { cursor: progress; }

/* Old inline float controls on the hero facade are superseded by the dock player. */
.niyal-video .niyal-pip-toggle, .niyal-video .niyal-video-head { display: none !important; }
