:root {
  --bg: #0d0d0f;
  --card: #17171b;
  --border: #2a2a30;
  --text: #eaeaea;
  --muted: #9a9aa3;
  --accent: #ff3b3b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 64px;
}

.top-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

h1 {
  font-size: clamp(22px, 4vw, 34px);
  letter-spacing: 0.02em;
  margin: 0 0 4px;
}

.lang-switch {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.lang-switch a {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.lang-switch a.active {
  color: var(--text);
  border-color: var(--accent);
}

.lang-switch button {
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.lang-switch button.active {
  color: var(--text);
  border-color: var(--accent);
}

.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 15px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
}

.tab.active {
  color: var(--text);
  border-color: var(--accent);
}

.forms {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}

.releases-filter {
  margin-bottom: 16px;
}

.hint {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

.genre-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.genre-cat {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 10px;
  background: #0d0d0f;
}

.genre-cat summary {
  cursor: pointer;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  list-style: none;
}

.genre-cat summary::-webkit-details-marker {
  display: none;
}

.genre-cat summary::before {
  content: "▸ ";
  color: var(--muted);
}

.genre-cat[open] summary::before {
  content: "▾ ";
}

.genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 10px;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.chip span {
  display: inline-block;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.chip input:checked + span {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

select,
input[type="number"] {
  background: #0d0d0f;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}

input[type="text"],
textarea {
  background: #0d0d0f;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  width: 100%;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  align-self: flex-start;
}

button:hover { opacity: 0.9; }

h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

.tracklist,
.releases {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tracklist li,
.releases li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.track-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.track-name {
  font-weight: 600;
  font-size: 14.5px;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-input { color: var(--accent); border-color: var(--accent); }

.track-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.track-meta a { color: var(--muted); }

.transition {
  margin-top: 8px;
  font-size: 13px;
  color: #c9c9ce;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.release-tracks {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.site-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.site-footer a { color: var(--muted); }

.note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 16px;
}

/* ── Track actions / replace button ── */

.track-actions {
  margin-left: auto;
}

.btn-replace {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  align-self: auto;
  font-family: inherit;
}

.btn-replace:hover {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}

.track-replacing {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Loading overlay ── */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 15, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.loading-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  color: var(--muted);
  font-size: 14px;
  margin-top: 14px;
}

.progress-bar-wrap {
  width: 240px;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 16px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

/* ── Responsive: tablet / small desktop ── */

@media (min-width: 900px) {
  main {
    max-width: 1200px;
    padding: 40px 40px 80px;
  }

  .forms {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .tracklist li,
  .releases li {
    padding: 16px 20px;
  }
}

/* ── Responsive: wide desktop ── */

@media (min-width: 1400px) {
  main {
    max-width: 1400px;
  }

  .forms {
    gap: 32px;
  }
}


/* ============================================================
   Spotify integration styles
   ============================================================ */

/* --- Top-row right side: Spotify + lang switch --- */

.top-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* --- Spotify connect button --- */

.spotify-connect-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-spotify-connect {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid #1DB954;
  border-radius: 999px;
  background: transparent;
  color: #1DB954;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.btn-spotify-connect:hover {
  background: #1DB95420;
}

.btn-spotify-connect.connected {
  background: #1DB954;
  color: #000;
}

.btn-spotify-connect.connected:hover {
  background: #1aa34a;
}

.btn-spotify-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.btn-spotify-logout:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Set actions (above tracklist) --- */

.set-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.btn-spotify-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: #1DB954;
  color: #000;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
}

.btn-spotify-play:hover {
  background: #1aa34a;
  transform: scale(1.02);
}

.btn-spotify-play:disabled {
  opacity: 0.65;
  cursor: default;
  transform: none;
}

.set-action-note {
  font-size: 12px;
  color: var(--muted);
}

/* --- Preview button on each track --- */

.track-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-preview {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: inherit;
}

.btn-preview:hover {
  border-color: #1DB954;
  color: #1DB954;
}

.btn-preview:disabled {
  opacity: 0.5;
  cursor: default;
}

/* inline "no preview" hint */
.preview-hint {
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
  animation: fadeout 3s forwards;
}

@keyframes fadeout {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* --- Mini audio player (fixed bottom bar) --- */

.mini-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #111114;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}

.mini-player[hidden] {
  display: none;
}

.mini-player-art {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.mini-player-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.mini-player-track {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.mini-player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.mini-player-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1DB954;
  border: none;
  color: #000;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  font-family: inherit;
}

.mini-player-play:hover {
  background: #1aa34a;
}

.mini-player-bar {
  width: 100px;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.mini-player-fill {
  height: 100%;
  background: #1DB954;
  border-radius: 3px;
  width: 0%;
  transition: width 0.2s linear;
}

.mini-player-time {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  width: 30px;
  text-align: right;
}

.mini-player-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.mini-player-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* On mobile: mini player more compact */
@media (max-width: 480px) {
  .mini-player {
    gap: 8px;
    padding: 8px 12px;
  }
  .mini-player-art {
    width: 32px;
    height: 32px;
  }
  .mini-player-bar {
    width: 60px;
  }
  .btn-spotify-connect span {
    display: none; /* show only icon on very small screens */
  }
}

/* Extra bottom padding so mini player doesn't cover last track */
body.player-active main {
  padding-bottom: 88px;
}
