@import url('fonts.css');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

button, input, select, textarea {
  font-family: inherit;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus,
button:focus-visible,
button:active,
*:focus-visible {
  outline: none !important;
}

:root {
  --bg-primary: #0a0a0d;
  --bg-surface: #121218;
  --bg-elevated: #1a1a24;
  --bg-card: rgba(26, 26, 36, 0.65);
  
  --soul-red: #ff2a2a;
  --soul-red-glow: rgba(255, 42, 42, 0.35);
  --save-gold: #ffd700;
  --save-gold-glow: rgba(255, 215, 0, 0.3);
  
  --text-primary: #ffffff;
  --text-secondary: #a3a3b8;
  --text-muted: #6b6b80;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 42, 42, 0.6);
  --border-pixel: 2px solid var(--border-subtle);
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  min-height: 100vh;
  line-height: 1.5;
  letter-spacing: 0.5px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(255, 42, 42, 0.04) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(255, 215, 0, 0.02) 0%, transparent 40%);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #252535;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--soul-red);
}

/* Container */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 180px 20px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.soul-heart-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px var(--soul-red-glow));
  animation: pulse-soul 2.5s infinite ease-in-out;
  display: block;
}

@keyframes pulse-soul {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 6px var(--soul-red-glow)); }
  50% { transform: scale(1.12); filter: drop-shadow(0 0 14px rgba(255, 42, 42, 0.6)); }
}

.brand-title {
  font-size: 1.5rem;
  font-weight: normal;
  letter-spacing: 2px;
  color: #fff;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--save-gold);
  margin-left: 8px;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Network / Quality Badge */
.quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.quality-badge:hover {
  border-color: var(--save-gold);
  color: #fff;
}

.quality-badge .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00ff88;
  box-shadow: 0 0 6px #00ff88;
}

.quality-badge.data-saver .status-dot {
  background: var(--save-gold);
  box-shadow: 0 0 6px var(--save-gold);
}

.quality-badge .badge-label {
  letter-spacing: 1px;
}

/* Search & Filter Bar */
.search-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px 12px 42px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  transition: var(--transition-fast);
  outline: none;
}

.search-input:focus {
  border-color: var(--soul-red);
  box-shadow: 0 0 0 2px rgba(255, 42, 42, 0.2);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.filter-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.filter-btn:hover, .filter-btn.active {
  border-color: var(--soul-red);
  color: #fff;
}

.filter-btn.active {
  background: rgba(255, 42, 42, 0.12);
}

.btn-text-mobile {
  display: none;
}

/* Tracklist */
.tracklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.track-row {
  display: grid;
  grid-template-columns: 48px 54px 1fr 100px 90px;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  cursor: pointer;
  user-select: none;
}

.track-row:hover {
  background: var(--bg-elevated);
  border-color: rgba(255, 255, 255, 0.12);
}

.track-row.active {
  background: rgba(255, 42, 42, 0.08);
  border-color: var(--border-active);
  box-shadow: 0 0 12px rgba(255, 42, 42, 0.15);
}

.track-number-col {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hover-play-icon {
  display: none !important;
  width: 14px;
  height: 14px;
  fill: var(--soul-red);
}

.track-row:not(.active):hover .track-number-col .num-text {
  display: none !important;
}

.track-row:not(.active):hover .track-number-col .hover-play-icon {
  display: block !important;
}

/* While listening/active: ALWAYS hide triangle and number, ALWAYS show equalizer */
.track-row.active .hover-play-icon,
.track-row.active:hover .hover-play-icon,
.track-row.active .track-number-col .hover-play-icon,
.track-row.active:hover .track-number-col .hover-play-icon {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.track-row.active .num-text,
.track-row.active:hover .num-text {
  display: none !important;
}

.track-row.active .playing-anim,
.track-row.active:hover .playing-anim {
  display: flex !important;
}

.playing-anim {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.playing-anim span {
  width: 3px;
  background: var(--soul-red);
  animation: equalize 0.8s infinite ease-in-out alternate;
}
.playing-anim span:nth-child(1) { height: 60%; animation-delay: 0.1s; }
.playing-anim span:nth-child(2) { height: 100%; animation-delay: 0.3s; }
.playing-anim span:nth-child(3) { height: 40%; animation-delay: 0.2s; }

@keyframes equalize {
  0% { height: 20%; }
  100% { height: 100%; }
}

.track-thumb-col img {
  width: 42px;
  height: 41px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  object-fit: cover;
  display: block;
}

.track-info-col {
  padding: 0 12px;
  overflow: hidden;
}

.track-title {
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-row.active .track-title {
  color: var(--soul-red);
  text-shadow: 0 0 8px rgba(255, 42, 42, 0.4);
}

.track-artist {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.track-duration-col {
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.track-actions-col {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.action-btn {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.action-btn:hover {
  color: #fff;
  background: transparent !important;
  transform: scale(1.15);
}

.action-btn:focus,
.action-btn:focus-visible,
.action-btn:active {
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.action-btn.saved {
  color: #00ff88;
}

.action-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  shape-rendering: crispEdges;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state h3 {
  color: #fff;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

/* ===============================================
   NOW PLAYING FLOATING PLAYER (Sticky Bottom)
   =============================================== */
.player-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 1260px;
  background: rgba(18, 18, 24, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 42, 42, 0.3);
  box-shadow: 
    0 12px 36px rgba(0, 0, 0, 0.7),
    0 0 20px rgba(255, 42, 42, 0.15);
  border-radius: var(--radius-lg);
  padding: 12px 28px;
  display: grid;
  grid-template-columns: 320px 1fr 260px;
  align-items: center;
  gap: 28px;
  z-index: 100;
  transition: var(--transition-smooth);
}

/* Player Left: Now Playing Info */
.player-track-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
}

.player-cover-art {
  width: 52px;
  height: 50px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 42, 42, 0.4);
  box-shadow: 0 0 10px rgba(255, 42, 42, 0.25);
  object-fit: cover;
  flex-shrink: 0;
}

.player-text-details {
  overflow: hidden;
}

.player-track-number {
  font-size: 0.7rem;
  color: var(--save-gold);
  letter-spacing: 1px;
}

.player-track-title {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

/* Player Center: Controls & Progress */
.player-center-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ctrl-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.ctrl-btn:hover {
  color: #fff;
  transform: scale(1.08);
}

.ctrl-btn.active {
  color: var(--soul-red);
}

.ctrl-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.play-pause-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--soul-red);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--soul-red-glow);
  transition: var(--transition-fast);
}

.play-pause-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 24px rgba(255, 42, 42, 0.6);
}

.play-pause-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Progress bar */
.progress-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.progress-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
  position: relative;
}

.progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--soul-red);
  box-shadow: 0 0 8px var(--soul-red-glow);
  cursor: pointer;
  transition: var(--transition-fast);
}

.progress-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

/* Player Right: Volume & Extra */
.player-right-options {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.volume-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 110px;
}

.volume-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.quality-toggle-pill {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.quality-toggle-pill:hover {
  border-color: var(--save-gold);
  color: #fff;
}

/* Keyboard hint toast */
.keyboard-hints {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 32px;
  letter-spacing: 0.8px;
}

.keyboard-hints kbd {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 2px 6px;
  color: #fff;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .player-bar {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px)) 14px;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    border-top: 1px solid rgba(255, 42, 42, 0.4);
    border-left: none;
    border-right: none;
    border-bottom: none;
    gap: 6px;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.7);
  }
  
  .player-cover-art {
    width: 38px;
    height: 38px;
  }

  .player-track-meta {
    gap: 10px;
  }

  .player-track-number {
    font-size: 0.65rem;
  }

  .player-track-title {
    font-size: 0.85rem;
  }

  .player-center-controls {
    gap: 2px;
  }

  .player-buttons {
    gap: 12px;
  }

  .play-pause-btn {
    width: 34px;
    height: 34px;
  }

  .play-pause-btn svg {
    width: 16px;
    height: 16px;
  }

  .ctrl-btn {
    padding: 4px;
  }

  .ctrl-btn svg {
    width: 15px;
    height: 15px;
  }

  .progress-bar-row {
    font-size: 0.75rem;
    gap: 8px;
  }

  .player-right-options {
    justify-content: space-between;
    padding-top: 2px;
  }

  .volume-slider {
    width: 70px;
  }

  .quality-toggle-pill {
    padding: 3px 8px;
    font-size: 0.75rem;
  }

  .track-row {
    grid-template-columns: 36px 44px 1fr 70px 40px;
    padding: 6px 8px;
  }
  
  .brand-title {
    font-size: 1.2rem;
  }
}

/* Mobile Mode: Buttons display ALL and OFFLINE */
@media (max-width: 768px) {
  .btn-text-desktop {
    display: none !important;
  }
  .btn-text-mobile {
    display: inline !important;
  }
  .filter-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
  }
}

