:root {
  --primary: #1db954;
  --primary-dark: #159140;
  --secondary: #fa233b;
  --background: #f7fafc;
  --card-bg: #fff;
  --shadow: 0 4px 24px rgba(30,40,60,0.08);
  --radius: 18px;
  --transition: 0.16s cubic-bezier(.4,0,.2,1);
}
html, body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', Arial, sans-serif;
  background: var(--background);
  color: #19202a;
  min-height: 100vh;
}
*, *::before, *::after { box-sizing: inherit; }

/* Simple Header */
header {
  background: #111;
  box-shadow: 0 2px 8px rgba(30,40,60,0.10);
}
.simple-header {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 24px;
  position: relative;
}
.header-logo {
  height: 36px;
  width: 36px;
  margin-right: 16px;
  display: inline-block;
}
.header-title {
  color: #fff;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-left: 10px;
  vertical-align: middle;
}

/* Header links box on top right */
.header-links-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #232323;
  border-radius: 12px;
  padding: 6px 18px;
  margin-left: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.header-links-box a,
.header-links-box button {
  color: #fff;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0 5px;
  text-decoration: none;
  transition: color 0.15s;
}
.header-links-box a:hover,
.header-links-box button:hover {
  color: #1db954;
  text-decoration: underline;
}

@media (max-width: 800px) {
  .simple-header {
    flex-wrap: wrap;
    padding: 0 10px;
    height: auto;
    min-height: 48px;
  }
  .header-links-box {
    padding: 4px 10px;
    gap: 8px;
    font-size: 0.97rem;
    margin-left: auto;
  }
}
@media (max-width: 600px) {
  .simple-header {
    height: 52px;
    padding: 0 5px;
  }
  .header-logo {
    height: 28px;
    width: 28px;
    margin-right: 10px;
  }
  .header-title {
    font-size: 1.25rem;
    letter-spacing: 0;
    margin-left: 6px;
  }
}

/* Wizard/Stepper */
.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 8px 0 18px 0;
}
.stepper .step {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 10px 10px 10px 40px;
  box-shadow: var(--shadow);
  min-height: 44px;
}
.stepper .step::before {
  content: attr(data-step);
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e6f6ee;
  color: #16763b;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
}
.stepper .step small {
  display: block;
  color: #6a7a89;
  margin-top: 2px;
  font-weight: 500;
}
.stepper .step.active {
  outline: 2px solid var(--primary);
}
.stepper .step.done {
  background: linear-gradient(0deg, #f7fff9, #fff);
}
.stepper .step.done::before {
  content: "✓";
  background: var(--primary);
  color: #fff;
}
@media (max-width: 900px) {
  .stepper {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 520px) {
  .stepper {
    grid-template-columns: 1fr;
  }
}

/* How it Works Steps */
.steps-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  margin-top: 28px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.step-box {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(30,40,60,0.10);
  text-align: center;
  padding: 28px 20px 22px 20px;
  flex: 1 1 220px;
  max-width: 260px;
  min-width: 180px;
  transition: box-shadow .18s cubic-bezier(.4,0,.2,1), transform .18s cubic-bezier(.4,0,.2,1);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.step-box:hover {
  box-shadow: 0 8px 28px rgba(30,185,84,0.13);
  transform: translateY(-4px) scale(1.03);
}
.step-icon {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-icon img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.09);
  background: #f5f5f5;
  display: block;
}
.step-box h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  margin-top: 0;
  color: #222;
  letter-spacing: 1px;
}
.step-box p {
  font-size: 1.07rem;
  color: #444;
  margin: 0;
}
@media (max-width: 900px) {
  .steps-container {
    flex-direction: column;
    gap: 18px;
    align-items: stretch;
    margin: 0;
    padding: 0;
  }
  .step-box {
    max-width: 100%;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
  }
}

/* Main content */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 20px 30px 20px;
}
.instructions, .actions, .status-section, .playlist-section, .history-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
  padding: 30px 28px;
  transition: box-shadow var(--transition);
}
.instructions h2, .playlist-section h2, .status-section h2, .history-section h2 {
  font-size: 1.38rem;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  font-weight: 700;
}
.instructions ol {
  padding-left: 22px;
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.06rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-size: 1.07rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: none;
  border-radius: 40px;
  padding: 12px 28px;
  margin: 12px 14px 8px 0;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  outline: none;
  box-shadow: 0 2px 16px rgba(30,185,84,0.10);
  background: #e3e3e3;
  color: #1a1a1a;
  position: relative;
  user-select: none;
}
.btn:focus-visible {
  outline: 3px solid #9be7c5;
  outline-offset: 2px;
}
.btn:active, .btn:focus {
  transform: scale(0.98);
  box-shadow: 0 2px 12px rgba(30,185,84,0.16);
}
.btn.spotify {
  background: linear-gradient(90deg, #1db954, #1ed760);
  color: #fff;
  box-shadow: 0 1px 9px rgba(30,185,84,0.15);
}
.btn.apple-music {
  background: linear-gradient(90deg, #fa233b, #ff5c6c);
  color: #fff;
  box-shadow: 0 1px 9px rgba(250,35,59,0.13);
}
.btn.transfer {
  background: linear-gradient(90deg, #4a90e2, #6fb3f2);
  color: #fff;
  box-shadow: 0 1px 9px rgba(74,144,226,0.13);
}
.btn.connected {
  background: linear-gradient(90deg, #0f9d58, #22c15e);
}
.btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  filter: grayscale(0.23);
}
.btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* Playlist filter/search */
.playlist-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 14px 0;
}
.playlist-filter input[type="search"] {
  flex: 1;
  border: 1px solid #e1e6ea;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 1rem;
  outline: none;
  transition: border var(--transition), box-shadow var(--transition);
}
.playlist-filter input[type="search"]:focus {
  border-color: #bde7cf;
  box-shadow: 0 0 0 4px rgba(29,185,84,0.12);
}

/* Playlist list */
.playlist-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.playlist-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(30,40,60,0.07);
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 14px;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
  padding: 12px 14px;
  min-height: 90px;
  position: relative;
}
.playlist-card:hover, .playlist-card.selected {
  box-shadow: 0 6px 22px rgba(30,185,84,0.13);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.playlist-card img {
  width: 62px;
  height: 62px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 2px 9px rgba(0,0,0,0.08);
}
.playlist-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 4px 0;
}
.playlist-count {
  font-size: 0.93rem;
  color: #888;
  margin: 0;
}

/* Status */
.status-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-size: 1.06rem;
}
.status-section .status-message {
  margin-top: 8px;
  opacity: 0.92;
}

/* Progress Bar */
.progress-bar-wrap {
  width: 100%;
  background: #f1f1f1;
  border-radius: 8px;
  height: 16px;
  margin: 12px 0 8px 0;
  overflow: hidden;
  box-shadow: 0 1px 5px rgba(30,185,84,0.05);
}
.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #1db954, #24e07e);
  width: 0%;
  border-radius: 8px;
  transition: width 0.38s cubic-bezier(.77,0,.18,1);
}
.progress-label {
  font-size: 0.98rem;
  margin-top: 2px;
  color: #16763b;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* FLEX LAYOUT FOR PLAYLIST & TRACK SELECTOR */
.playlist-track-flex {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 32px;
}
@media (max-width: 900px) {
  .playlist-track-flex {
    flex-direction: column;
    gap: 18px;
  }
}
#playlists.playlist-section {
  flex: 1 1 300px;
  max-width: 400px;
  min-width: 240px;
}
#track-selector-section.playlist-section {
  flex: 2 1 0;
  min-width: 0;
}

/* Track Selector */
#track-selector-section {
  margin-top: 20px;
}
#track-selector-section ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
#track-selector-section li {
  margin: 6px 0;
  font-size: 1.02rem;
  display: flex;
  align-items: center;
  line-height: 1.3;
}
.track-box {
  margin-right: 8px;
}
#select-all {
  margin-right: 8px;
}

/* History */
.history-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
  padding: 30px 28px;
}
.history-entry {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid #eee;
  padding: 10px 0;
}
.history-playlist {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-date {
  color: #888;
  font-size: 0.98em;
}
.history-status.success {
  color: #1db954;
  font-weight: 600;
}
.history-status.fail {
  color: #fa233b;
  font-weight: 600;
}
.history-view {
  color: #4a90e2;
  text-decoration: underline;
  margin-left: auto;
}

/* Info note */
.info-note {
  font-size: 0.94rem;
  color: #5a6b79;
  margin-top: 6px;
}

/* Footer */
footer {
  text-align: center;
  font-size: 1.02rem;
  color: #7a7a7a;
  background: none;
  margin-top: 22px;
  padding-bottom: 20px;
  opacity: 0.8;
}

/* Utility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ================================
   NEW: Spotify Access Modal Styles
   ================================ */
.spotify-access-modal {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(30,40,60,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 3000;
}
.spotify-access-modal-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.17);
  padding: 24px 10px 16px 10px;
  max-width: 400px;
  width: 95vw;
  position: relative;
  animation: popin .24s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.spotify-access-close {
  position: absolute; top: 13px; right: 16px; font-size: 2.2rem; font-weight: 400; color: #aaa; cursor: pointer;
  transition: color .15s;
  z-index: 1;
}
.spotify-access-close:hover { color: #fa233b; }
@media (max-width: 500px) {
  .spotify-access-modal-content {
    max-width: 98vw;
    padding: 18px 2vw 12px 2vw;
  }
}
.header-logo-link img {
  height: 38px;
  width: 38px;
  object-fit: contain;
  vertical-align: middle;
  transition: transform 0.15s;
  border-radius: 20%;
  background: #fff;
}
@media (max-width: 600px) {
  .header-logo-link img {
    height: 30px;
    width: 30px;
  }
}

/* Responsive: Stack on mobile */
@media (max-width: 1100px) {
  .stepper {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .steps-container {
    flex-wrap: wrap;
    gap: 20px;
  }
}
@media (max-width: 900px) {
  .stepper {
    grid-template-columns: 1fr 1fr;
  }
  .steps-container {
    flex-direction: column;
    gap: 18px;
    align-items: stretch;
  }
}
@media (max-width: 700px) {
  .stepper {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .steps-container {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
  }
}

/* Optional: Make header and instructions text larger for balance */
.status-section h1,
.instructions h2 {
  font-size: 2rem;
}
#progress-container {
  max-width: 420px;
  margin: 28px auto 0 auto;
  text-align: center;
  z-index: 1002;
  position: relative;
}
.progress-label {
  font-size: 1.08rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}
.progress-bar-wrap {
  width: 100%;
  height: 16px;
  background: #f1f1f1;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 5px rgba(30,185,84,0.07);
}
.progress-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1db954, #24e07e);
  border-radius: 8px;
  transition: width 0.38s cubic-bezier(.77,0,.18,1);
}
@media (max-width: 600px) {
  #progress-container {
    max-width: 95vw;
    margin-top: 18px;
  }
}