/* ============================================
   麦动KTV 网页版 - 样式表
   KTV 暗色主题，TV 横屏布局
   ============================================ */

/* --- CSS 变量 --- */
:root {
  --bg-primary: #0a0f1a;
  --bg-secondary: #0d121a;
  --bg-sidebar: #0c1219;
  --bg-card: #111827;
  --bg-hover: #1a2332;
  --bg-input: #1a2230;
  --accent-red: #e53e3e;
  --accent-gold: #ffd56b;
  --accent-green: #27cca4;
  --accent-blue: #4299e1;
  --text-white: #ffffff;
  --text-dim: #8899aa;
  --text-muted: #556677;
  --border-color: #1e2a3a;
  --divider-color: #1a2535;
  --nav-selected: rgba(229, 62, 62, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --top-bar-h: 56px;
  --bottom-bar-h: 48px;
  --sidebar-w: 170px;
}

/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-white);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
}

input {
  outline: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
}

ul { list-style: none; }

a { color: inherit; text-decoration: none; }

/* --- App Container --- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* --- Top Bar --- */
.top-bar {
  display: flex;
  align-items: center;
  height: var(--top-bar-h);
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(13, 18, 26, 0.98), rgba(10, 15, 26, 0.95));
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  flex-shrink: 0;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 1px;
}

.top-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.top-page-title {
  font-size: 18px;
  color: var(--text-dim);
  font-weight: 500;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.btn-top-search {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-white);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background 0.2s;
}
.btn-top-search:hover { background: rgba(255, 255, 255, 0.14); }

.btn-top-action {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-white);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  transition: background 0.2s;
}
.btn-top-action:hover { background: rgba(255, 255, 255, 0.12); }
.btn-top-action .badge {
  background: var(--accent-red);
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* --- Bottom Bar --- */
.bottom-bar {
  display: flex;
  align-items: center;
  height: var(--bottom-bar-h);
  padding: 0 20px;
  background: linear-gradient(0deg, rgba(13, 18, 26, 0.98), rgba(10, 15, 26, 0.95));
  border-top: 1px solid var(--border-color);
  z-index: 100;
  flex-shrink: 0;
}

.bottom-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.np-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.np-song {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-current {
  color: var(--accent-gold);
  font-weight: 600;
  max-width: 40%;
}

.np-next-label {
  color: var(--text-muted);
}

.np-next {
  color: var(--text-dim);
  max-width: 30%;
}

/* --- 底部中间加载进度 --- */
.bottom-center {
  flex: 0 1 280px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 280px;
}

.loading-text {
  font-size: 12px;
  color: var(--accent-green);
}

.loading-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 40%;
  background: var(--accent-green);
  border-radius: 2px;
  animation: loading-slide 1.2s ease-in-out infinite;
}

@keyframes loading-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.bottom-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.btn-glass {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-white);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background 0.2s;
}
.btn-glass:hover { background: rgba(255, 255, 255, 0.15); }

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

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.nav-brand {
  padding: 16px 14px;
  font-size: 21px;
  font-weight: 700;
  color: var(--accent-gold);
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 2px;
}

.nav-items {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-white);
}
.nav-item.active {
  background: var(--nav-selected);
  color: var(--accent-red);
  font-weight: 600;
}

/* --- Content Area --- */
.content-area {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* --- Player Panel --- */
.player-panel {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  padding: 10px;
  gap: 8px;
  overflow-y: auto;
}

.player-container {
  position: relative;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  min-height: 160px;
}

.player-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  padding: 10px;
  transition: opacity 0.3s;
}

.player-song-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-gold);
}

.player-song-singer {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.download-progress {
  position: absolute;
  inset: 0;
  background: rgba(13, 10, 26, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: var(--accent-green);
}

.download-progress .progress-bar {
  width: 80%;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
}
.download-progress .progress-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 2px;
  transition: width 0.3s;
  width: 0%;
}

.player-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ctrl-btn-sm {
  flex: 1;
  min-width: 58px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-white);
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  text-align: center;
  transition: background 0.2s;
  white-space: nowrap;
}
.ctrl-btn-sm:hover { background: rgba(255, 255, 255, 0.14); }
.ctrl-btn-sm.active { background: var(--accent-red); border-color: var(--accent-red); }

.lyric-display {
  text-align: center;
  padding: 8px 0;
  border-top: 1px solid var(--divider-color);
  border-bottom: 1px solid var(--divider-color);
}

.lyric-current {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent-gold);
  min-height: 28px;
}
.lyric-next {
  font-size: 13px;
  color: var(--text-dim);
  min-height: 22px;
  margin-top: 2px;
}

.queue-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 4px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--divider-color);
}

.queue-list {
  overflow-y: auto;
  flex: 1;
}

.queue-list li {
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-list li:hover { background: var(--bg-hover); color: var(--text-white); }
.queue-list li.playing { color: var(--accent-gold); font-weight: 600; }

/* --- Page Content --- */
.page-content {
  flex: 1;
  padding: 14px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* --- Page Sections --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-white);
}

/* --- Search Bar --- */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-white);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { border-color: var(--accent-blue); }

.search-bar button {
  background: var(--accent-red);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.search-bar button:hover { opacity: 0.85; }

/* --- Category Filters --- */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.category-filters button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  transition: all 0.2s;
  white-space: nowrap;
}
.category-filters button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-white);
}
.category-filters button.active {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: white;
  font-weight: 600;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  flex-shrink: 0;
}

.pagination button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-white);
  padding: 6px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background 0.2s;
}
.pagination button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }
.pagination button:disabled { opacity: 0.35; cursor: default; }
.pagination .page-info {
  font-size: 13px;
  color: var(--accent-gold);
  min-width: 60px;
  text-align: center;
}

/* --- Song List --- */
.song-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.song-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--divider-color);
}
.song-item:hover { background: var(--bg-hover); }
.song-item .song-info {
  flex: 1;
  min-width: 0;
}
.song-item .song-title {
  font-size: 14px;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-item .song-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.song-item .song-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.song-item .song-actions button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  transition: all 0.2s;
}
.song-item .song-actions button:hover {
  background: var(--accent-red);
  color: white;
}

/* --- Home Page --- */
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  flex: 1;
}

.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 80px;
}
.home-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent-red);
  transform: translateY(-1px);
}
.home-card .card-icon {
  font-size: 24px;
  margin-bottom: 6px;
}
.home-card .card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-white);
}
.home-card .card-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* --- Settings Page --- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.setting-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.setting-item:hover { background: var(--bg-hover); }
.setting-item .setting-label {
  font-size: 13px;
  color: var(--text-dim);
}
.setting-item .setting-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-gold);
  margin-top: 4px;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-content h3 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--accent-gold);
}

.modal-content .form-group {
  margin-bottom: 12px;
}
.modal-content .form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.modal-content .form-group input,
.modal-content .form-group select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-white);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.modal-content .form-group input[type="range"] {
  padding: 0;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-color);
}
.modal-content .form-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-red);
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

.modal-actions button {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}
.btn-primary {
  background: var(--accent-red);
  color: white;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  border: 1px solid var(--border-color);
}

/* --- Fullscreen Overlay --- */
#fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.fullscreen-video-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.fullscreen-video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.fullscreen-chrome {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.fullscreen-chrome.visible {
  opacity: 1;
  pointer-events: auto;
}

.fullscreen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(0,0,0,0.7), transparent);
}
.fullscreen-song-info {
  font-size: 16px;
  color: var(--text-white);
  font-weight: 600;
}

.fullscreen-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 0;
}

.fullscreen-controls .ctrl-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-white);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background 0.2s;
}
.fullscreen-controls .ctrl-btn:hover { background: rgba(255, 255, 255, 0.25); }

.fullscreen-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 16px;
  background: linear-gradient(0deg, rgba(0,0,0,0.7), transparent);
}
.fullscreen-progress input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
}
.fullscreen-progress input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-red);
  cursor: pointer;
}
.progress-time {
  font-size: 13px;
  color: var(--text-white);
  min-width: 100px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- Utility --- */
.hidden { display: none !important; }

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: var(--accent-gold);
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 3000;
  animation: toast-in 0.3s ease;
  pointer-events: none;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .sidebar { width: 120px; }
  .player-panel { width: 240px; }
  .home-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .sidebar { display: none; }
  .player-panel { display: none; }
  .top-right { display: none; }
  .home-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}