:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface-hover: #222240;
  --accent: #6c5ce7;
  --accent-hover: #5b4bdb;
  --text: #e0e0e0;
  --text-muted: #888;
  --border: #2a2a40;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: 100px;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

header h1 {
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--accent), #a29bfe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

/* Buttons */
.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.btn-icon {
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem;
  font-size: 1.1rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { background: var(--surface-hover); }

.btn-close { font-size: 1rem; padding: 0.3rem 0.6rem; }

/* Inputs */
input[type="text"], input[type="password"], .select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
}

.select {
  cursor: pointer;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
}

.song-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.song-card:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.song-card.playing {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.song-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #a29bfe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
}

.song-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-genre {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.song-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0,0,0,0.6);
  color: #ff6b6b;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.song-card:hover .song-delete { opacity: 1; }
.song-delete:hover { background: rgba(255,0,0,0.2); }

/* Player Bar */
.player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 100;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}

.player-art {
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #a29bfe);
  border-radius: 8px;
}

.player-info {
  flex: 0 0 auto;
  min-width: 120px;
}

.player-title { font-weight: 600; font-size: 0.9rem; }
.player-genre { color: var(--text-muted); font-size: 0.75rem; }

.player-controls {
  display: flex;
  gap: 0.3rem;
}

.player-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.player-progress span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.seek-bar {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
}

.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.seek-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-small { max-width: 350px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header h2 { font-size: 1.2rem; }

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  transition: border-color 0.2s;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.05);
}

.drop-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.drop-zone p { color: var(--text-muted); margin-bottom: 0.8rem; }

/* Upload List */
.upload-list {
  margin-top: 1rem;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.upload-item .filename {
  flex: 1;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-item input {
  flex: 0 0 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

.upload-item .status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.upload-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Login */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.login-form .text-input { width: 100%; }

.login-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

/* Empty / Loading */
.empty-state, .loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }

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

/* Responsive */
@media (max-width: 640px) {
  header h1 { font-size: 1.4rem; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }
  .player { flex-wrap: wrap; padding: 0.6rem 1rem; }
  .player-progress { order: 3; flex-basis: 100%; }
}
