/* ─── Reset & Base ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --spotify-green: #1DB954;
  --spotify-green-dark: #1aa34a;
  --spotify-black: #121212;
  --spotify-dark: #181818;
  --spotify-card: #282828;
  --spotify-hover: #333333;
  --spotify-text: #ffffff;
  --spotify-subtext: #b3b3b3;
  --spotify-border: #404040;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--spotify-black);
  color: var(--spotify-text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Screens ─── */
.screen {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.screen.active {
  display: flex;
}

/* ─── Login Screen ─── */
.login-container {
  text-align: center;
  padding: 2rem;
  max-width: 480px;
}

.logo svg {
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 30px rgba(29, 185, 84, 0.3));
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--spotify-subtext);
  font-size: 1.1rem;
  margin-bottom: 3rem;
}

#login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--spotify-green);
  color: var(--spotify-black);
  border: none;
  padding: 1rem 2.5rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font);
  letter-spacing: 0.01em;
}

#login-btn:hover {
  background: var(--spotify-green-dark);
  transform: scale(1.05);
}

.privacy-note {
  margin-top: 2rem;
  color: var(--spotify-subtext);
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ─── Loading ─── */
.loading-container {
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--spotify-card);
  border-top: 4px solid var(--spotify-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

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

#loading-text {
  color: var(--spotify-subtext);
  font-size: 1rem;
}

/* ─── Roast Screen ─── */
.roast-container {
  max-width: 700px;
  width: 100%;
  padding: 2rem;
  margin: 2rem auto;
}

.roast-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--spotify-card);
}

.roast-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.roast-subtitle {
  color: var(--spotify-subtext);
  font-size: 0.9rem;
}

/* ─── Tracks Preview ─── */
.tracks-preview {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--spotify-border) transparent;
}

.track-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--spotify-card);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.track-chip img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.track-chip-info {
  white-space: nowrap;
}

.track-chip-name {
  font-weight: 600;
  font-size: 0.8rem;
}

.track-chip-artist {
  color: var(--spotify-subtext);
  font-size: 0.7rem;
}

/* ─── Roast Card ─── */
.roast-card {
  background: var(--spotify-dark);
  border: 1px solid var(--spotify-border);
  border-radius: 12px;
  padding: 2rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--spotify-text);
  margin-bottom: 2rem;
  white-space: pre-wrap;
}

.roast-card p {
  margin-bottom: 1rem;
}

.roast-card p:last-child {
  margin-bottom: 0;
}

/* ─── Verdict & Metrics ─── */
.verdict-text {
  color: #ff4a4a;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 74, 74, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 74, 74, 0.2);
  margin-left: 0.5rem;
  display: inline-block;
}

.metrics-card {
  background: var(--spotify-dark);
  border: 1px solid var(--spotify-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.metrics-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--spotify-text);
}

.table-container {
  overflow-x: auto;
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.metrics-table th {
  color: var(--spotify-subtext);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--spotify-border);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.metrics-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
  line-height: 1.4;
}

.metrics-table tr:last-child td {
  border-bottom: none;
}

.metrics-table td:first-child {
  font-weight: 700;
  color: var(--spotify-text);
  white-space: nowrap;
}

.metrics-table td:nth-child(2) {
  font-weight: 600;
  color: #ff9f43; /* Warn/attention color */
}

.metrics-table td:nth-child(3) {
  color: var(--spotify-subtext);
}

/* ─── Buttons ─── */
.roast-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn-secondary {
  background: var(--spotify-green);
  color: var(--spotify-black);
  border: none;
  padding: 0.8rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font);
}

.btn-secondary:hover {
  background: var(--spotify-green-dark);
  transform: scale(1.03);
}

.btn-ghost {
  background: none;
  color: var(--spotify-subtext);
  border: 1px solid var(--spotify-border);
  padding: 0.8rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font);
}

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

/* ─── Error Screen ─── */
.error-container {
  text-align: center;
  padding: 2rem;
}

.error-container h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.error-container p {
  color: var(--spotify-subtext);
  margin-bottom: 2rem;
}

.error-container button {
  background: var(--spotify-green);
  color: var(--spotify-black);
  border: none;
  padding: 0.8rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  font-family: var(--font);
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .logo h1 {
    font-size: 1.8rem;
  }

  .roast-container {
    padding: 1rem;
  }

  .roast-card {
    padding: 1.25rem;
    font-size: 0.95rem;
  }

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