/* ── TTS Player — Floating Pill ── */

/* Base pill — collapsed state, bottom-right corner */
#player-bar {
  position: fixed;
  bottom: calc(var(--statusbar-height) + 12px);
  right: 1.25rem;
  z-index: 50;
  display: none; /* hidden until TTS is active */
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}
#player-bar.visible {
  display: flex;
}

/* Pill button */
.player-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem 0.45rem 0.7rem;
  background: var(--accent);
  color: #fff;
  border-radius: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(184,92,56,0.35);
  border: none;
  font-family: var(--font-ui);
  font-size: var(--font-sm);
  font-weight: 500;
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
  white-space: nowrap;
}
.player-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(184,92,56,0.45);
}

/* Mini progress bar inside pill */
.pill-progress-wrap {
  width: 60px;
  height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  overflow: hidden;
}
.pill-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transition: width var(--duration-fast);
}

/* Pill play/pause icon */
.pill-play-btn {
  width: 22px;
  height: 22px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0;
  transition: background var(--duration-fast);
}
.pill-play-btn:hover { background: rgba(255,255,255,0.35); }
.pill-play-btn svg { width: 12px; height: 12px; }

/* Expanded panel — full controls */
.player-expanded-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-hover-shadow);
  padding: 1rem;
  width: 300px;
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  order: -1; /* renders above the pill */
}
.player-expanded-panel.open { display: flex; }

/* Panel header */
.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Track title */
.player-scene-name {
  font-family: var(--font-ui);
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  flex-shrink: 1;
}

/* Minimize button */
.player-minimize-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 0;
  transition: color var(--duration-fast);
  flex-shrink: 0;
}
.player-minimize-btn:hover { color: var(--accent); }
.player-minimize-btn svg { width: 14px; height: 14px; }

/* ── Rows ── */
.player-row { display: flex; align-items: center; gap: 0.75rem; }
.player-row-main { gap: 0.5rem; justify-content: center; }

/* Time display */
.player-time {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-family: var(--font-ui);
}

/* ── Buttons ── */
.player-btn {
  background: none; border: none;
  color: var(--text); cursor: pointer;
  padding: 5px; border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.player-btn:hover { color: var(--accent); }
.player-btn.play-pause {
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  transition: transform var(--duration-fast), background var(--duration-fast);
}
.player-btn.play-pause:hover { transform: scale(1.05); background: var(--accent); }

/* ── Progress / seek ── */
.pb-seek-wrap {
  flex: 1; height: 5px;
  background: var(--surface-2);
  border-radius: 3px; cursor: pointer; position: relative;
  min-width: 40px;
}
.pb-seek-fill {
  height: 100%; background: var(--accent);
  border-radius: 3px; pointer-events: none;
}

/* ── Speed buttons ── */
.speed-btns { display: flex; gap: 3px; flex-wrap: nowrap; }
.speed-btn {
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--muted);
  padding: 2px 7px; border-radius: 4px;
  font-size: 0.72rem; cursor: pointer;
  white-space: nowrap;
}
.speed-btn.active { border-color: var(--accent); color: var(--accent); }
.speed-btn:hover { border-color: var(--accent); }

/* ── Voice select ── */
.voice-select {
  background: var(--surface-2);
  border: 1px solid var(--surface-2);
  color: var(--text);
  padding: 3px 8px; border-radius: 4px;
  font-size: 0.78rem; cursor: pointer;
}
.voice-select:hover, .voice-select:focus { border-color: var(--accent); outline: none; }

/* ── Sleep button ── */
.sleep-btn {
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--muted);
  padding: 3px 10px; border-radius: 4px;
  font-size: 0.75rem; cursor: pointer; white-space: nowrap;
}
.sleep-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Sliders ── */
.slider-wrap { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); }
.slider-wrap input[type=range] { width: 80px; accent-color: var(--accent); }

/* ── Mobile: 44px touch targets ── */
@media (max-width: 768px) {
  #player-bar {
    right: 0.75rem;
    bottom: calc(var(--statusbar-height) + 8px);
  }
  .player-expanded-panel {
    width: calc(100vw - 1.5rem);
  }
  .player-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  .player-btn.play-pause {
    min-width: 48px;
    min-height: 48px;
  }
  .pb-seek-wrap {
    height: 24px;
    border-radius: 4px;
  }
  .pb-seek-fill {
    height: 100%;
  }
  .player-time { font-size: 0.72rem; }
  .slider-wrap input[type=range] { width: 60px; }
  .speed-btns { gap: 2px; }
  .speed-btn {
    padding: 6px 8px;
    font-size: 0.68rem;
    min-height: 36px;
  }
  .voice-select {
    min-height: 36px;
    padding: 6px 8px;
  }
  .sleep-btn {
    min-height: 36px;
    padding: 6px 10px;
  }
}
