* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #000;
  --surface: rgba(15, 15, 15, 0.82);
  --surface-solid: #1a1a1a;
  --accent: #1db954;
  --text: #fff;
  --muted: #aaa;
  --danger: #e05252;
}

body {
  background: #000 url('https://files.andric.studio/IMG_2191.jpg') center center / auto 40% no-repeat fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Login */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}
.login-box {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 2rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 300px;
  max-width: 90vw;
}
.login-box h1 { text-align: center; font-size: 1.75rem; letter-spacing: -0.5px; }
.login-box input {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  padding: .75rem 1rem;
  border-radius: 10px;
  font-size: 1rem;
  width: 100%;
}
.login-box input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login-box button {
  background: var(--accent);
  color: #000;
  border: none;
  padding: .75rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.error { color: var(--danger); font-size: .875rem; text-align: center; }

/* App layout */
#app { display: flex; flex-direction: column; height: 100vh; }

header {
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: .75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 10;
}
.search-wrap { display: flex; gap: .5rem; align-items: center; }
#search-input {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  padding: .625rem .875rem;
  border-radius: 20px;
  font-size: 1rem;
}
#search-input:focus { outline: 2px solid var(--accent); }
.source-toggle { display: flex; gap: .25rem; flex-shrink: 0; }
.source-btn {
  background: rgba(255,255,255,0.1);
  color: var(--muted);
  border: none;
  padding: .375rem .625rem;
  border-radius: 12px;
  font-size: .8rem;
  cursor: pointer;
}
.source-btn.active { background: var(--accent); color: #000; font-weight: 600; }

/* Now Playing bar */
#now-playing {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  background: rgba(29, 185, 84, 0.12);
  border-bottom: 1px solid rgba(29, 185, 84, 0.25);
}
#np-art {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #1a1a1a;
}
#np-info { flex: 1; min-width: 0; }
#np-title {
  font-size: .88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#np-artist {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#np-badge {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
  flex-shrink: 0;
}

main { flex: 1; overflow-y: auto; padding-bottom: 1rem; }

/* Track card */
.track {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.35);
  transition: background .15s;
}
.track:active { background: rgba(0,0,0,0.55); }
.track-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: #222;
  flex-shrink: 0;
}
.track-info { flex: 1; min-width: 0; }
.track-title {
  font-size: .95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-sub {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.track-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.source-badge {
  font-size: .68rem;
  padding: .15rem .4rem;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}
.source-badge.youtube { background: #f00; color: #fff; }
.source-badge.spotify { background: var(--accent); color: #000; }
.dl-btn {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.18);
  padding: .375rem .75rem;
  border-radius: 8px;
  font-size: .8rem;
  cursor: pointer;
  white-space: nowrap;
}
.dl-btn.in-library { color: var(--accent); border-color: var(--accent); cursor: default; }
.dl-btn.downloading { color: var(--muted); border-color: #333; cursor: default; }
.dl-btn.done { color: var(--accent); border-color: var(--accent); }
.dl-btn.error { color: var(--danger); border-color: var(--danger); }

/* Queue FAB */
#queue-fab {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--accent);
  color: #000;
  border: none;
  padding: .6rem 1rem;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: .4rem;
}
#queue-fab-count {
  background: #000;
  color: var(--accent);
  border-radius: 10px;
  padding: .1rem .4rem;
  font-size: .75rem;
  min-width: 18px;
  text-align: center;
}

/* Queue panel (slide up from bottom) */
#queue-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 1rem;
  max-height: 60vh;
  overflow-y: auto;
  z-index: 99;
  border-radius: 16px 16px 0 0;
}
.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
}
.queue-header h3 { font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
#queue-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: .25rem .5rem;
}

.queue-item {
  padding: .5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.queue-item:last-child { border-bottom: none; }
.queue-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .3rem;
}
.queue-track { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 75%; font-size: .85rem; }
.queue-status { font-size: .75rem; flex-shrink: 0; }
.queue-status.pending { color: var(--muted); }
.queue-status.running { color: #fa0; }
.queue-status.done { color: var(--accent); }
.queue-status.error { color: var(--danger); }

/* Progress bar */
.queue-progress-wrap {
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.queue-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s ease;
}

.hidden { display: none !important; }
#loading, #empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: .95rem;
}
