/* ══════════════════════════════════════════════════════
   MY TOMBPLAY — Personal player overlay
   ══════════════════════════════════════════════════════ */

/* Full-screen overlay — inset from Discord's top chrome and the bottom tab bar */
.mtp-overlay {
  position: fixed;
  top: var(--sait, 0px);
  left: 0;
  right: 0;
  bottom: calc(50px + var(--saib, 0px));
  z-index: 9000;
  background: var(--bg-primary, #0f0f0f);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Inner player container */
.mtp-player {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* ── Header ──────────────────────────────────────────── */
.mtp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--bg-tertiary, #2a2a2a);
  flex-shrink: 0;
}

.mtp-close-btn {
  background: none;
  border: 1px solid var(--bg-tertiary, #2a2a2a);
  border-radius: 8px;
  color: var(--text-secondary, #a0a0a0);
  font-size: 14px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.mtp-close-btn:hover {
  background: var(--bg-tertiary, #2a2a2a);
  color: var(--text-primary, #fff);
}

.mtp-source-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hide volume control on phones (touch-only devices don't need it — device volume is used) */
@media (max-width: 480px) {
  .mtp-volume-desktop { display: none !important; }
}

/* ── Inactivity warning ───────────────────────────────── */
.mtp-inactivity-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 12px;
  padding: 8px 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1.5px solid rgba(239, 68, 68, 0.55);
  border-radius: 10px;
  font-size: 12px;
  color: #fca5a5;
  animation: mtp-pulse-red 2s ease-in-out infinite;
  flex-shrink: 0;
}
.mtp-inactivity-time {
  font-size: 16px;
  font-weight: 700;
  font-family: monospace;
  color: #ef4444;
}
@keyframes mtp-pulse-red {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* ── Now-playing wrap ────────────────────────────────── */
.mtp-now-playing-wrap {
  flex-shrink: 0;
  padding: 8px 12px 4px;
}

/* ── Transport row (prev / shuffle / loop / next) ────── */
.mtp-transport-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 6px 12px;
  flex-shrink: 0;
}

.mtp-transport-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary, #a0a0a0);
  border-radius: 8px;
  padding: 6px 10px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}
.mtp-transport-btn:hover {
  color: var(--text-primary, #fff);
  background: var(--bg-secondary, #1a1a1a);
}
/* Shuffle / Loop active state */
.mtp-transport-btn.mtp-toggle-btn.active {
  color: var(--primary-color, #a78bfa);
}

/* ── Tabs ────────────────────────────────────────────── */
.mtp-tabs {
  display: flex;
  gap: 4px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--bg-tertiary, #2a2a2a);
  flex-shrink: 0;
}

.mtp-tab-btn {
  background: none;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #a0a0a0);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.mtp-tab-btn:hover {
  background: var(--bg-secondary, #1a1a1a);
  color: var(--text-primary, #fff);
}
.mtp-tab-btn.active {
  background: color-mix(in srgb, var(--secondary-color, #8b5cf6) 20%, transparent);
  color: var(--primary-color, #a78bfa);
}

/* ── Tab content ─────────────────────────────────────── */
.mtp-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  min-height: 0;
}
.mtp-tab-content::-webkit-scrollbar { width: 4px; }
.mtp-tab-content::-webkit-scrollbar-track { background: transparent; }
.mtp-tab-content::-webkit-scrollbar-thumb { background: var(--bg-tertiary, #2a2a2a); border-radius: 2px; }

/* ── Queue / Played list items ───────────────────────── */
.mtp-queue-list { display: flex; flex-direction: column; gap: 4px; }
.mtp-queue-item { cursor: default; }
.mtp-played-item { opacity: 0.65; }

/* Remove drag handle area that live player has — MTP queue is not draggable */
.mtp-queue-item .drag-handle { display: none; }

/* MTP mini player reuses .mini-player classes from components.css — no extra CSS needed */

/* ── Mobile: karaoke lyrics layout ───────────────────────────────────────── */
/*
 * On mobile the MTP has no reaction wheel, so the rolling lyrics can wrap to a
 * full-width second row instead of being squeezed into the same flex row as the
 * cover and track-info column.
 *
 * Desktop flex row:  [Cover] [Info] [|] [Rolling lyrics]
 * Mobile layout:     [Cover] [Info (fills row)]
 *                    [Rolling lyrics — full width]
 */
@media (max-width: 768px) {
  /* Enable wrapping so the lyrics row falls below cover + info */
  .mtp-overlay .now-playing-layout-desktop {
    flex-wrap: wrap;
    align-content: flex-start;
  }

  /* Info column: fill the remaining width of the first row */
  .mtp-overlay .now-playing-info-right {
    flex: 1;
    min-width: 0;
  }

  /* Vertical dividers make no sense in a wrapped layout — hide them */
  .mtp-overlay .np-divider {
    display: none;
  }

  /* Rolling lyrics: drop to a full-width second row */
  .mtp-overlay .rolling-lyrics-box {
    flex-basis: 100%;
    order: 10;
    min-height: 100px;
    max-height: 160px;
    padding: 4px 0;
  }

  /* Let lines wrap naturally instead of being scaleX-squished */
  .mtp-overlay .rolling-line {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
  }

  /* Responsive font sizes for the 5 lyric slots */
  .mtp-overlay .rolling-line.rl-p3 {
    font-size: clamp(14px, 4.5vw, 22px);
  }

  .mtp-overlay .rolling-line.rl-p2,
  .mtp-overlay .rolling-line.rl-p4 {
    font-size: clamp(11px, 3.5vw, 17px);
  }

  .mtp-overlay .rolling-line.rl-p1,
  .mtp-overlay .rolling-line.rl-p5 {
    font-size: clamp(9px, 2.8vw, 13px);
  }
}

/* Override the global "hide rolling lyrics on very small screens" rule.
 * Inside MTP the lyrics are now on their own row and readable at any width. */
@media (max-width: 380px) {
  .mtp-overlay .rolling-lyrics-box {
    display: flex !important;
  }
}
