/* ============================================
   NexHome Music Bottom Bar
   Slim persistent player bar at page bottom
   ============================================ */

/* Bottom bar container */
.music-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-card, #1A2D42);
  border-top: 1px solid rgba(56, 189, 248, 0.12);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.music-bar.collapsed {
  transform: translateY(calc(100% - 3px));
}

/* Thin pull tab to expand when collapsed */
.music-bar-tab {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card, #1A2D42);
  border: 1px solid rgba(56, 189, 248, 0.12);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 4px 16px;
  cursor: pointer;
  color: var(--text-muted, #64748B);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.music-bar-tab:hover {
  color: var(--accent-cyan, #38BDF8);
}

.music-bar-tab i.spinning {
  animation: mb-spin 3s linear infinite;
}

@keyframes mb-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Bar inner layout */
.music-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  max-width: 100%;
}

/* Cover */
.mb-cover {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elevated, #213A52);
}

/* Song info */
.mb-info {
  flex: 0 1 180px;
  min-width: 0;
}

.mb-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #E2E8F0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mb-artist {
  font-size: 11px;
  color: var(--text-muted, #64748B);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Controls */
.mb-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mb-btn {
  background: none;
  border: none;
  color: var(--text-secondary, #94A3B8);
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mb-btn:hover {
  color: var(--accent-cyan, #38BDF8);
  background: rgba(56, 189, 248, 0.1);
}

.mb-btn.play-main {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary, linear-gradient(135deg, #38BDF8, #818CF8));
  color: #fff;
  font-size: 16px;
}

.mb-btn.play-main:hover {
  transform: scale(1.08);
  color: #fff;
}

/* Progress */
.mb-progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.mb-time {
  font-size: 11px;
  color: var(--text-muted, #64748B);
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.mb-progress {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.mb-progress:hover { height: 6px; }

.mb-progress-fill {
  height: 100%;
  background: var(--gradient-primary, linear-gradient(135deg, #38BDF8, #818CF8));
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* Volume */
.mb-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mb-vol-icon {
  color: var(--text-muted, #64748B);
  font-size: 14px;
  cursor: pointer;
}

.mb-vol-bar {
  width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  cursor: pointer;
}

.mb-vol-fill {
  height: 100%;
  background: var(--accent-cyan, #38BDF8);
  border-radius: 2px;
}

/* Extra actions */
.mb-extra {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.mb-extra button {
  background: none;
  border: none;
  color: var(--text-muted, #64748B);
  cursor: pointer;
  font-size: 13px;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
}

.mb-extra button:hover {
  color: var(--accent-cyan, #38BDF8);
  background: rgba(56, 189, 248, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .mb-volume { display: none; }
  .mb-info { flex: 0 1 120px; }
  .mb-progress-wrap { min-width: 60px; }
  .mb-playlist-panel {
    width: calc(100vw - 32px);
    right: 16px;
    left: 16px;
  }
}

@media (max-width: 480px) {
  .mb-progress-wrap { display: none; }
  .mb-extra { display: none; }
  .mb-playlist-panel {
    width: 100%;
    right: 0;
    left: 0;
    border-radius: 12px 12px 0 0;
    bottom: 56px;
  }
}

/* Playlist Panel */
.mb-playlist-panel {
  position: fixed;
  bottom: 58px;
  right: 16px;
  width: 360px;
  max-height: 400px;
  background: var(--bg-card, #1A2D42);
  border: 1px solid rgba(56, 189, 248, 0.12);
  border-radius: 12px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 201;
}

.mb-playlist-panel.open {
  display: flex;
}

.mb-pl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #E2E8F0);
}

.mb-pl-header button {
  background: none;
  border: none;
  color: var(--text-muted, #64748B);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.mb-pl-header button:hover {
  color: var(--accent-cyan, #38BDF8);
  background: rgba(56, 189, 248, 0.1);
}

.mb-pl-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.mb-pl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
}

.mb-pl-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.mb-pl-item.mb-pl-active {
  background: rgba(56, 189, 248, 0.08);
}

.mb-pl-item.mb-pl-active .mb-pl-name {
  color: var(--accent-cyan, #38BDF8);
}

.mb-pl-idx {
  width: 24px;
  text-align: center;
  color: var(--text-muted, #64748B);
  font-size: 12px;
  flex-shrink: 0;
}

.mb-pl-info {
  flex: 1;
  min-width: 0;
}

.mb-pl-name {
  color: var(--text-primary, #E2E8F0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mb-pl-artist {
  font-size: 11px;
  color: var(--text-muted, #64748B);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mb-pl-dur {
  color: var(--text-muted, #64748B);
  font-size: 12px;
  flex-shrink: 0;
}
