@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --bg: #0d0d0d;
  --surface: #141414;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #4a8fe8;
  --radius: 12px;
  --font: 'JetBrains Mono', monospace;
}

html {
  font-size: 14px;
  line-height: 1.6;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Nav ── */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: rgba(13, 13, 13, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

nav .logo {
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.04em;
}

nav .step-indicator {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ── Layout ── */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 120px 60px 60px;
}

.container--narrow {
  max-width: 560px;
}

.container--medium {
  max-width: 800px;
}

/* ── Typography ── */

h1 {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
}

h2 {
  font-size: 18px;
  font-weight: 400;
  margin-bottom: 8px;
}

p.subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 40px;
}

label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── Form elements ── */

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-group {
  margin-bottom: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s;
  border: none;
  outline: none;
}

.btn:hover {
  opacity: 0.85;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: 100px;
  padding: 14px 32px;
  width: 100%;
}

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 24px;
  width: 100%;
}

.btn-secondary:hover {
  color: var(--text);
  border-color: var(--muted);
  opacity: 1;
}

.btn-icon {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 8px;
  border-radius: 8px;
}

.btn-icon:hover {
  color: var(--text);
  opacity: 1;
}

.btn-spotify {
  background: #1db954;
  color: #fff;
  border-radius: 100px;
  padding: 14px 32px;
}

/* ── Cards ── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.playlist-card {
  position: relative;
  margin-bottom: 16px;
}

.playlist-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.playlist-card .card-number {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ── Loading ── */

.loading-container {
  text-align: center;
  padding: 80px 0;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 24px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-steps {
  list-style: none;
  display: inline-flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.loading-steps li {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.loading-steps li.active {
  color: var(--text);
}

.loading-steps li.done {
  color: var(--accent);
}

.loading-steps li .step-icon {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

/* ── Results ── */

.results-header {
  text-align: center;
  margin-bottom: 48px;
}

.results-header--row {
  text-align: left;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.results-header--row .subtitle {
  margin-bottom: 0;
}

.btn-compact {
  white-space: nowrap;
  width: auto;
  padding: 10px 20px;
  flex-shrink: 0;
}

.results-grid {
  display: grid;
  gap: 24px;
}

.result-playlist {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.result-playlist-header {
  background: var(--surface);
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-playlist-header h2 {
  margin: 0;
  font-size: 16px;
}

.result-playlist-header .track-count {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.track-list {
  list-style: none;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.track-item:last-child {
  border-bottom: none;
}

.track-item .track-number {
  color: var(--muted);
  font-size: 12px;
  width: 20px;
  text-align: right;
  flex-shrink: 0;
}

.track-item .track-name {
  color: var(--text);
}

.track-item .track-artist {
  color: var(--muted);
  margin-left: auto;
  text-align: right;
}

/* ── Actions bar ── */

.actions-bar {
  display: flex;
  gap: 12px;
  margin-top: 40px;
  justify-content: center;
}

.actions-bar .btn-primary {
  width: auto;
}

/* ── Status messages ── */

.status-message {
  text-align: center;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 24px;
}

.status-message.success {
  background: rgba(29, 185, 84, 0.1);
  border: 1px solid rgba(29, 185, 84, 0.3);
  color: #1db954;
}

.status-message.error {
  background: rgba(232, 74, 74, 0.1);
  border: 1px solid rgba(232, 74, 74, 0.3);
  color: #e84a4a;
}

/* ── Helper text ── */

.helper-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.helper-text a {
  color: var(--accent);
  text-decoration: none;
}

.helper-text a:hover {
  opacity: 0.85;
}

/* ── Unassigned tracks ── */

.unassigned-section {
  margin-top: 40px;
}

.unassigned-header {
  margin-bottom: 16px;
}

.unassigned-header h2 {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

.unassigned-header p {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.7;
}

.unassigned-count {
  opacity: 0.6;
}

/* ── Spotify Embeds ── */

.embeds-grid {
  display: grid;
  gap: 24px;
}

.embed-card {
  border-radius: var(--radius);
  overflow: hidden;
}

.embed-card iframe {
  display: block;
  border-radius: var(--radius);
}

/* ── Footer ── */

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: rgba(13, 13, 13, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  margin-top: 80px;
}

footer .footer-brand {
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.04em;
}

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

footer .footer-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s;
}

footer .footer-link:hover {
  opacity: 0.75;
}

footer .footer-heart {
  color: #e84a4a;
}

footer .footer-links {
  display: flex;
  gap: 24px;
}

footer .footer-links a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

footer .footer-links a:hover {
  color: var(--text);
}

/* ── Responsive ── */

@media (max-width: 600px) {
  .container {
    padding: 100px 20px 40px;
  }

  nav {
    padding: 16px 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .track-item .track-artist {
    display: none;
  }

  .actions-bar {
    flex-direction: column;
  }

  .actions-bar .btn-primary {
    width: 100%;
  }

  footer {
    padding: 16px 20px;
  }
}
