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

html, body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  min-height: 100vh;
  line-height: 1.6;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  min-height: 100vh;
}

.header {
  padding: 0 0 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.subtitle {
  margin: 0;
  color: #94a3b8;
  font-size: 16px;
  font-weight: 400;
}

.tabs {
  display: flex;
  gap: 12px;
  margin: 20px 0 24px;
  background: rgba(15, 23, 42, 0.8);
  padding: 8px;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tabs button {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  flex: 1;
}

.tabs button.active {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.tabs button:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

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

.panel {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.panel h2 {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 600;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h2::before {
  content: "";
  width: 4px;
  height: 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 2px;
}

.panel h3 {
  margin: 16px 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #cbd5e1;
}

.sliders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.slider {
  background: rgba(15, 23, 42, 0.6);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  margin-bottom: 12px;
  color: #e2e8f0;
  font-weight: 500;
}

.slider input[type=range] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  -webkit-appearance: none;
}

.slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.slider input[type=range]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.genres {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
}

.genres .chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(30, 64, 175, 0.2) 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.genres .chip:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(30, 64, 175, 0.3) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.genres input {
  margin: 0;
}

.genres .chip span {
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 500;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.actions button {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  backdrop-filter: blur(10px);
}

.actions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.actions button:active {
  transform: translateY(0);
}

.actions button#build {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.actions button#build:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.actions button#loginSpotify {
  background: linear-gradient(135deg, #1db954 0%, #1ed760 100%);
  box-shadow: 0 4px 15px rgba(29, 185, 84, 0.3);
}

.actions button#loginSpotify:hover {
  box-shadow: 0 6px 20px rgba(29, 185, 84, 0.4);
}

.actions button#exportSpotify {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.actions button#exportSpotify:hover {
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.playlist {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 400px;
  overflow-y: auto;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.playlist::-webkit-scrollbar {
  width: 6px;
}

.playlist::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.playlist::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 3px;
}

.playlist li {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: background 0.3s ease;
}

.playlist li:hover {
  background: rgba(255, 255, 255, 0.05);
}

.playlist li:last-child {
  border-bottom: none;
}

.playlist .meta {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
}

.summary {
  margin: 16px 0 0 0;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.footer {
  margin-top: 32px;
  color: #64748b;
  font-size: 13px;
  text-align: center;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

canvas {
  width: 100%;
  height: 280px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(10px);
}

/* Modern input styles */
input[type="text"], input[type="range"] {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px;
  color: #e2e8f0;
  font-size: 14px;
  transition: all 0.3s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type="text"]::placeholder {
  color: #64748b;
}

/* Responsive design */
@media (max-width: 768px) {
  .app {
    padding: 20px 16px;
  }
  
  .header h1 {
    font-size: 28px;
  }
  
  .tabs {
    flex-direction: column;
  }
  
  .sliders {
    grid-template-columns: 1fr;
  }
  
  .actions {
    flex-direction: column;
  }
  
  .playlist li {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}


/* ─── AI DJ PANEL ─────────────────────────────────────────── */

.ai-dj-panel {
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: linear-gradient(160deg, rgba(15,23,42,0.95) 0%, rgba(30,14,60,0.6) 100%);
  position: relative;
  overflow: hidden;
}

.ai-dj-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #8b5cf6, #3b82f6, #8b5cf6);
  background-size: 200% 100%;
  animation: dj-shimmer 3s linear infinite;
}

@keyframes dj-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ai-dj-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.ai-dj-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-dj-title h2::before { display: none; }

.ai-dj-pulse {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #8b5cf6;
  box-shadow: 0 0 0 0 rgba(139,92,246,0.5);
  animation: dj-pulse 2s ease-in-out infinite;
}

@keyframes dj-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,0.5); }
  50%       { box-shadow: 0 0 0 8px rgba(139,92,246,0); }
}

.ai-dj-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
}

.ai-dj-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-dj-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(139,92,246,0.3);
}

.ai-dj-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(139,92,246,0.45);
}

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

.ai-dj-btn--secondary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.ai-dj-btn--secondary:hover {
  box-shadow: 0 6px 18px rgba(59,130,246,0.45);
}

.ai-dj-feed {
  min-height: 120px;
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 20px;
  scroll-behavior: smooth;
}

.ai-dj-feed::-webkit-scrollbar { width: 4px; }
.ai-dj-feed::-webkit-scrollbar-track { background: transparent; }
.ai-dj-feed::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.4); border-radius: 2px; }

.dj-empty-state {
  text-align: center;
  padding: 32px 20px;
  color: #64748b;
}

.dj-empty-icon { font-size: 36px; margin-bottom: 12px; }
.dj-empty-state p { font-size: 14px; line-height: 1.6; max-width: 380px; margin: 0 auto; }

.dj-message {
  padding: 16px 18px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.65;
  animation: dj-fade-in 0.35s ease;
  margin-bottom: 10px;
}

@keyframes dj-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dj-message--dj {
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(59,130,246,0.1));
  border: 1px solid rgba(139,92,246,0.25);
  border-left: 3px solid #8b5cf6;
}

.dj-message--user {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  border-left: 3px solid #3b82f6;
  margin-left: 24px;
}

.dj-message--error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-left: 3px solid #ef4444;
  color: #fca5a5;
}

.dj-message-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  opacity: 0.7;
}

.dj-message--dj .dj-message-label { color: #a78bfa; }
.dj-message--user .dj-message-label { color: #60a5fa; }

.dj-track-card {
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 6px 0 4px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.dj-track-num {
  font-size: 22px;
  font-weight: 800;
  color: rgba(139,92,246,0.4);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  line-height: 1;
  padding-top: 2px;
}

.dj-track-info { flex: 1; }
.dj-track-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.dj-track-intro { font-size: 13px; color: #94a3b8; line-height: 1.55; margin-bottom: 6px; }

.dj-mix-tip {
  font-size: 12px;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 5px;
}

.dj-mix-tip::before { content: '→'; font-weight: 700; }

.dj-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  background: rgba(139,92,246,0.08);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: 14px;
  margin-bottom: 10px;
  animation: dj-fade-in 0.2s ease;
}

.dj-typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #8b5cf6;
  animation: dj-bounce 1.2s ease-in-out infinite;
}
.dj-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.dj-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dj-bounce {
  0%,60%,100% { transform: translateY(0); opacity:0.4; }
  30%          { transform: translateY(-6px); opacity:1; }
}

.ai-dj-chat {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 16px;
}

.ai-dj-chat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  margin-bottom: 10px;
}

.ai-dj-chat-input-row {
  display: flex;
  gap: 10px;
}

.ai-dj-input {
  flex: 1;
  background: rgba(15,23,42,0.8) !important;
  border: 1px solid rgba(139,92,246,0.3) !important;
  border-radius: 12px !important;
  padding: 12px 16px !important;
  color: #e2e8f0 !important;
  font-size: 14px !important;
  transition: all 0.25s ease !important;
  font-family: inherit;
}

.ai-dj-input:focus {
  outline: none !important;
  border-color: #8b5cf6 !important;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15) !important;
}

.ai-dj-input::placeholder { color: #475569 !important; }

.ai-dj-send {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  border: none;
  border-radius: 12px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(139,92,246,0.35);
}

.ai-dj-send:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(139,92,246,0.5); }
.ai-dj-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }