/* Complete redesign with modern dark theme, premium colors, and refined animations */

/* ==================== CSS Reset & Base ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* ==================== Design Tokens ==================== */
:root {
  /* Primary Colors - Dark Premium */
  --bg-primary: #0f172a;
  --bg-secondary: #1a1f35;
  --bg-tertiary: #232d45;

  /* Accent Colors - Blue & Purple Gradient */
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-teal: #14b8a6;

  /* Spotify Green */
  --spotify-green: #1db954;
  --spotify-green-light: #1ed760;

  /* Text Colors */
  --text-primary: #f5f7fa;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  /* Status Colors */
  --status-success: #10b981;
  --status-error: #ef4444;
  --status-warning: #f59e0b;

  /* Shadows & Effects */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.3);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
  --shadow-glow-purple: 0 0 20px rgba(139, 92, 246, 0.3);
  --shadow-glow-green: 0 0 20px rgba(29, 185, 84, 0.3);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif;
  --font-mono: "Fira Code", "Monaco", monospace;

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 500ms ease-in-out;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==================== Background Animations ==================== */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  pointer-events: none;
}

body::before {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  top: -200px;
  left: -200px;
  animation: float 20s ease-in-out infinite;
}

body::after {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
  bottom: -150px;
  right: -150px;
  animation: float 25s ease-in-out infinite reverse;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(80px, -80px);
  }
}

/* ==================== Page Wrapper ==================== */
.page-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==================== Header ==================== */
.header {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--spotify-green) 0%, var(--accent-teal) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-glow-green);
  animation: pulse 3s ease-in-out infinite;
}

.logo-icon svg {
  width: 22px;
  height: 22px;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.btn-help {
  background: transparent;
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-help:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-help svg {
  width: 20px;
  height: 20px;
}

/* ==================== Main Content ==================== */
.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
}

.container {
  width: 100%;
  max-width: 700px;
  animation: slideIn 0.6s var(--transition-base);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ==================== Hero Section ==================== */
.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
  letter-spacing: -1px;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ==================== Input Section ==================== */
.input-section {
  background: var(--bg-tertiary);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.input-group {
  margin-bottom: 1.5rem;
}

.input-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  gap: 0.5rem;
}

.input-field {
  flex: 1;
  background: var(--bg-secondary);
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-radius: 10px;
  padding: 0.875rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-base);
  font-family: var(--font-sans);
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field:focus {
  outline: none;
  background: var(--bg-secondary);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

.input-field.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

.btn-paste {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.875rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-glow-blue);
  white-space: nowrap;
}

.btn-paste:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

.btn-paste:active {
  transform: translateY(0);
}

.btn-paste svg {
  width: 18px;
  height: 18px;
}

/* ==================== Buttons ==================== */
.btn-primary,
.btn-secondary,
.btn-download {
  font-family: var(--font-sans);
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 1rem;
}

.btn-download {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--spotify-green) 0%, var(--accent-teal) 100%);
  color: white;
  box-shadow: var(--shadow-glow-green);
  position: relative;
  overflow: hidden;
}

.btn-download::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.btn-download:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 0 40px rgba(29, 185, 84, 0.5);
}

.btn-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
  color: white;
  box-shadow: var(--shadow-glow-blue);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-secondary:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* ==================== Result Section ==================== */
.result-section {
  margin-bottom: 2rem;
}

.result-container {
  background: var(--bg-tertiary);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 16px;
  padding: 2rem;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.4s ease-out;
}

.result-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.result-placeholder svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.result-placeholder p {
  font-size: 0.95rem;
}

/* Result success state */
.result-success {
  background: var(--bg-tertiary);
}

.result-success .song-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.song-cover {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  object-fit: cover;
  margin: 0 auto;
}

.song-info h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--spotify-green-light);
}

.song-info p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.song-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.song-controls audio {
  width: 100%;
  border-radius: 10px;
  background: var(--bg-secondary);
}

.song-download {
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition-base);
}

.song-download:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-blue);
}

/* Result error state */
.result-error {
  color: var(--status-error);
  padding: 1rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
  border-radius: 8px;
}

/* ==================== Info Cards ==================== */
.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.info-card {
  background: var(--bg-tertiary);
  border: 1px solid rgba(59, 130, 246, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: all var(--transition-base);
}

.info-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15);
}

.info-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: var(--accent-blue);
}

.info-icon svg {
  width: 24px;
  height: 24px;
}

.info-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.info-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ==================== Footer ==================== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid rgba(59, 130, 246, 0.1);
  padding: 3rem 1rem 1.5rem;
  margin-top: 2rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h4 {
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.footer-section p,
.footer-section a {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.8;
  text-decoration: none;
  display: block;
  transition: color var(--transition-base);
}

.footer-section a:hover {
  color: var(--accent-blue);
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(59, 130, 246, 0.1);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==================== Cookies Notice ==================== */
.cookies-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  max-width: 400px;
  background: var(--bg-tertiary);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  animation: slideUp 0.4s var(--transition-base);
  backdrop-filter: blur(10px);
  display: none;
}

.cookies-notice.show {
  display: block;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cookies-content h3 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.cookies-text p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.cookies-actions {
  display: flex;
  gap: 1rem;
}

.cookies-actions button {
  flex: 1;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  border-radius: 6px;
  font-weight: 600;
}

/* ==================== Onboarding Modal ==================== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  backdrop-filter: blur(4px);
}

.onboarding-overlay.show {
  display: flex;
}

.onboarding-modal {
  background: var(--bg-tertiary);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: popIn 0.4s var(--transition-base);
  position: relative;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.onboarding-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 2rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.onboarding-close:hover {
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.1);
  border-radius: 50%;
}

.onboarding-content {
  text-align: center;
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.onboarding-content.active {
  display: block;
}

.onboarding-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--accent-blue);
  font-size: 2.5rem;
}

.onboarding-icon svg {
  width: 40px;
  height: 40px;
}

.onboarding-content h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.onboarding-content p {
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.onboarding-dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.2);
  cursor: pointer;
  transition: all var(--transition-base);
}

.dot.active {
  background: var(--accent-blue);
  width: 24px;
  border-radius: 4px;
}

.onboarding-actions {
  display: flex;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(59, 130, 246, 0.1);
}

.onboarding-actions button {
  flex: 1;
}

/* ==================== Loading State ==================== */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

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

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
  .header-content {
    padding: 0 1rem;
  }

  .logo-section {
    font-size: 1rem;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
  }

  .logo-icon svg {
    width: 18px;
    height: 18px;
  }

  .main-content {
    padding: 2rem 1rem;
  }

  .container {
    max-width: 100%;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .input-section {
    padding: 1.5rem;
  }

  .info-cards {
    grid-template-columns: 1fr;
  }

  .cookies-notice {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
    max-width: none;
  }

  .onboarding-modal {
    padding: 1.5rem;
    max-width: 90vw;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0.75rem 0;
  }

  .header-content {
    padding: 0 0.75rem;
  }

  .logo-section {
    font-size: 0.9rem;
    gap: 0.5rem;
  }

  .hero {
    margin-bottom: 2rem;
  }

  .input-wrapper {
    flex-direction: column;
  }

  .btn-paste {
    width: 100%;
    justify-content: center;
  }

  .input-section,
  .result-container {
    padding: 1.25rem;
  }

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

/* Fix modal layout and add blur backdrop + improved animations */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  backdrop-filter: blur(8px);
  padding: 1rem;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--bg-tertiary);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  position: relative;
  text-align: center;
}

.modal-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.1));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--status-error);
  animation: pulseError 2s ease-in-out infinite;
}

.modal-icon svg {
  width: 40px;
  height: 40px;
}

@keyframes pulseError {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px rgba(239, 68, 68, 0.3));
  }
  50% {
    transform: scale(1.05);
    filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.5));
  }
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 700;
}
