/* ═══════════════════════════════════════════════════════
   Layout — Desktop (Windows)
   ═══════════════════════════════════════════════════════ */

/* App container — full viewport flex column */
#app-desktop.visible {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* ── Top Bar ── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--top-bar-height);
  padding: 0 var(--space-6);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: var(--z-sticky);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.logo {
  flex-shrink: 0;
}

.app-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.top-bar-center {
  flex: 1;
  max-width: 480px;
  margin: 0 var(--space-8);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Main Content ── */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: var(--space-4) 0;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--space-3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-3) var(--space-2);
}

.sidebar-section-title {
  padding: var(--space-3) 12px var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ── Album List ── */
.album-list {
  padding: var(--space-2) 0;
}

.album-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
}

.album-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.album-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.album-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  overflow: hidden;
}

.album-item-info {
  flex: 1;
  min-width: 0;
}

.album-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.album-item-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Playlist Panel ── */
.playlist-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.playlist-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-6) var(--space-6) var(--space-3);
  flex-shrink: 0;
}

.playlist-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.song-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}

.playlist-header-row {
  display: grid;
  grid-template-columns: 40px 1fr 180px 60px 40px;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-6);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.playlist {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-1) 0;
}

.playlist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
  color: var(--text-muted);
  gap: var(--space-4);
}

.playlist-empty p {
  font-size: var(--text-sm);
}

/* ── Now Playing Panel ── */
.now-playing-panel {
  width: var(--now-playing-width);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.now-playing-content {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-6);
}

.np-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-muted);
  text-align: center;
}

.np-placeholder p {
  font-size: var(--text-sm);
}

.np-active {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.np-cover-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  background: var(--bg-tertiary);
}

.np-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.np-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
  pointer-events: none;
}

.visualizer-canvas {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  pointer-events: none;
  opacity: 0.5;
}

.np-info {
  width: 100%;
  text-align: center;
}

.np-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--space-1);
}

.np-artist {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-progress-container {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.np-time-current,
.np-time-total {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
}

.np-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
}

.np-progress-fill {
  height: 100%;
  background: var(--text-primary);
  border-radius: var(--radius-full);
  width: 0%;
  position: relative;
}

.np-progress-bar:hover .np-progress-fill {
  background: var(--accent);
}

.np-progress-handle {
  position: absolute;
  top: 50%;
  right: -6px;
  width: 12px;
  height: 12px;
  background: var(--text-primary);
  border-radius: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.np-progress-bar:hover .np-progress-handle {
  opacity: 1;
}

.np-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}

.np-extra-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  width: 100%;
}

/* ── Player Bar ── */
.player-bar {
  display: flex;
  align-items: center;
  height: var(--player-bar-height);
  padding: 0 var(--space-4);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: var(--z-player-bar);
  position: relative;
}

.player-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: var(--player-progress-height);
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
  z-index: 1;
}

.player-bar-info {
  display: flex;
  align-items: center;
  width: 30%;
  min-width: 180px;
  gap: var(--space-3);
}

.player-bar-cover {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.player-bar-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-bar-text {
  min-width: 0;
  flex: 1;
}

.player-bar-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-bar-artist {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-bar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  max-width: 600px;
  flex-direction: column;
  gap: var(--space-1);
}

.player-bar-controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.player-bar-progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

.player-bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 30%;
  min-width: 180px;
  gap: var(--space-2);
}

/* ── Modals ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-right {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  border-radius: 0;
  border-left: 1px solid var(--border);
  max-height: 100vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: 700;
}

.modal-body {
  padding: var(--space-4) var(--space-5);
  overflow-y: auto;
  flex: 1;
}

/* ── Shortcuts Modal ── */
.shortcut-group {
  margin-bottom: var(--space-6);
}

.shortcut-group h4 {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.shortcut-row kbd {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-primary);
  min-width: 24px;
  justify-content: center;
}

/* ── Context Menu ── */
.context-menu {
  position: fixed;
  z-index: var(--z-dropdown);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1) 0;
  min-width: 180px;
}

.ctx-item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
}

.ctx-item:hover {
  background: var(--bg-hover);
}

.ctx-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-1) 0;
}
