/* ==========================================
   VIBESEED — MAIN STYLESHEET
   ========================================== */

:root {
  --bg: #060608;
  --bg-card: rgba(255,255,255,0.03);
  --bg-card-hover: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.07);
  --text: #e8e4f0;
  --text-dim: rgba(255,255,255,0.45);
  --green: #22c55e;
  --purple: #a855f7;
  --pink: #ec4899;
  --amber: #f59e0b;
  --cyan: #06b6d4;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

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

/* ---- PARTICLES ---- */
#particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ---- NAV ---- */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 60px;
  background: rgba(6,6,8,0.85);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.logo-icon { font-size: 22px; }

.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--green), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 4px;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.nav-btn.active {
  background: rgba(168, 85, 247, 0.15);
  color: var(--purple);
}

.nav-btn:hover:not(.active) {
  color: var(--text);
}

.btn-spotify {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1DB954;
  color: #000;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-spotify:hover {
  transform: scale(1.04);
  box-shadow: 0 0 20px rgba(29, 185, 84, 0.3);
}

.btn-spotify.connected {
  background: rgba(29, 185, 84, 0.15);
  color: #1DB954;
}

/* ---- PAGES ---- */
.page {
  display: none;
  min-height: 100vh;
  padding-top: 80px;
  position: relative;
  z-index: 1;
}

.page.active {
  display: block;
  animation: fadeUp 0.5s var(--ease);
}

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

/* ---- HERO ---- */
.hero {
  text-align: center;
  padding: 60px 24px 40px;
  max-width: 720px;
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 16px;
}

.hero-line1 {
  display: block;
  font-size: clamp(36px, 7vw, 56px);
  color: var(--text-dim);
  font-weight: 300;
  font-style: italic;
}

.hero-line2 {
  display: block;
  font-size: clamp(52px, 10vw, 88px);
  background: linear-gradient(135deg, var(--green) 0%, var(--purple) 40%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -3px;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.6;
  max-width: 460px;
  margin: 0 auto 40px;
}

/* ---- SEARCH ---- */
.search-wrap {
  max-width: 520px;
  margin: 0 auto 24px;
  position: relative;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 18px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 18px 20px 18px 52px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  outline: none;
  transition: all 0.3s var(--ease);
}

.search-box input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1), 0 8px 32px rgba(0,0,0,0.3);
  background: rgba(255,255,255,0.06);
}

.search-box input::placeholder {
  color: var(--text-dim);
}

/* ---- SEARCH DROPDOWN ---- */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #111114;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  z-index: 50;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.search-results.hidden { display: none; }

.search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-item:hover {
  background: rgba(168, 85, 247, 0.08);
}

.search-item img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.search-item-info {
  overflow: hidden;
}

.search-item-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-artist {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---- SEEDS ---- */
.seeds-container {
  max-width: 520px;
  margin: 0 auto 32px;
}

.seeds-container.hidden { display: none; }

.seeds-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 500;
}

.seeds-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.seed-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 12px;
  padding: 8px 14px;
  animation: popIn 0.3s var(--ease);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.seed-chip img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.seed-chip-name {
  font-size: 13px;
  font-weight: 600;
}

.seed-chip-artist {
  font-size: 11px;
  color: var(--text-dim);
}

.seed-chip-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  transition: color 0.2s;
}

.seed-chip-remove:hover { color: var(--pink); }

.btn-plant {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--green), var(--purple));
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.2);
}

.btn-plant:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(34, 197, 94, 0.3);
}

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

/* ---- QUICK VIBES ---- */
.quick-vibes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.vibe-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px 18px;
  border-radius: 24px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.vibe-pill:hover {
  border-color: var(--purple);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.15);
}

/* ---- LOADER ---- */
.loader {
  text-align: center;
  padding: 60px 24px;
}

.loader.hidden { display: none; }

.loader-seed {
  font-size: 48px;
  animation: seedGrow 1.2s ease-in-out infinite;
}

@keyframes seedGrow {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.3) rotate(10deg); }
}

.loader p {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 15px;
}

/* ---- RESULTS ---- */
.results-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 100px;
}

.results-section.hidden { display: none; }

/* VIBE DNA */
.vibe-dna {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.dna-label {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* TABS */
.results-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 4px;
}

.tab {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.tab.active {
  background: rgba(168, 85, 247, 0.12);
  color: var(--purple);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeUp 0.4s var(--ease); }

/* ---- TRACK GRID ---- */
.track-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.track-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  animation: fadeUp 0.5s var(--ease) both;
}

.track-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(168, 85, 247, 0.2);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.track-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.track-card-body {
  padding: 14px;
}

.track-card-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-card-artist {
  font-size: 12px;
  color: var(--text-dim);
}

.track-card-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

/* DREAM CARD */
.dream-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  transition: all 0.3s var(--ease);
  animation: fadeUp 0.5s var(--ease) both;
  position: relative;
  overflow: hidden;
}

.dream-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--purple));
}

.dream-card:hover {
  transform: translateY(-4px);
  border-color: rgba(168, 85, 247, 0.2);
}

.dream-card-genre {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--card-accent, var(--purple));
  margin-bottom: 8px;
}

.dream-card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.dream-card-artist {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.dream-card-mood {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.5;
}

/* ---- STORY ---- */
.story-view {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.story-text {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.9;
  color: var(--text);
  font-weight: 300;
  font-style: italic;
  padding: 40px 0;
}

.story-text strong {
  color: var(--purple);
  font-weight: 700;
  font-style: normal;
}

.btn-story-new {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 24px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-story-new:hover {
  border-color: var(--purple);
}

/* ---- MOOD CHAIN ---- */
.chain-header {
  text-align: center;
  padding: 40px 24px 20px;
  max-width: 520px;
  margin: 0 auto;
}

.chain-header h2 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 8px;
}

.chain-header p {
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 24px;
}

.chain-search-wrap {
  position: relative;
  margin-bottom: 20px;
}

.chain-search-wrap input {
  width: 100%;
  padding: 14px 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s;
}

.chain-search-wrap input:focus {
  border-color: var(--purple);
}

.chain-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.slider-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
}

.slider-label input[type="range"] {
  width: 240px;
  accent-color: var(--purple);
}

.chain-view {
  padding: 40px 24px 100px;
  overflow-x: auto;
}

.chain-nodes {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: max-content;
  padding: 20px;
}

.chain-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: popIn 0.4s var(--ease) both;
  cursor: pointer;
  transition: transform 0.2s;
}

.chain-node:hover { transform: scale(1.08); }

.chain-node img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  transition: border-color 0.3s;
}

.chain-node:hover img {
  border-color: var(--purple);
}

.chain-node-name {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chain-node-artist {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
}

.chain-link {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, var(--green), var(--purple));
  flex-shrink: 0;
  opacity: 0.4;
}

/* ---- AR SCAN ---- */
.scan-header {
  text-align: center;
  padding: 40px 24px 20px;
}

.scan-header h2 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 8px;
}

.scan-header p {
  color: var(--text-dim);
  font-size: 15px;
}

.scan-area {
  position: relative;
  max-width: 480px;
  margin: 24px auto;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: #111;
}

.scan-area video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scan-corners {
  position: absolute;
  inset: 40px;
  border: 2px solid rgba(168, 85, 247, 0.4);
  border-radius: 16px;
}

.scan-corners::before,
.scan-corners::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid var(--purple);
}

.scan-corners::before {
  top: -2px; left: -2px;
  border-right: none; border-bottom: none;
  border-radius: 8px 0 0 0;
}

.scan-corners::after {
  bottom: -2px; right: -2px;
  border-left: none; border-top: none;
  border-radius: 0 0 8px 0;
}

.scan-line {
  position: absolute;
  left: 40px; right: 40px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--purple), transparent);
  animation: scanMove 2.5s ease-in-out infinite;
}

@keyframes scanMove {
  0%, 100% { top: 40px; }
  50% { top: calc(100% - 42px); }
}

.btn-capture {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--purple);
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
  transition: all 0.3s;
}

.btn-capture:hover {
  background: #9333ea;
  transform: translateX(-50%) scale(1.05);
}

.scan-results {
  max-width: 480px;
  margin: 20px auto;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.scan-results.hidden { display: none; }

/* ---- MINI PLAYER ---- */
.mini-player {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(10, 10, 14, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}

.mini-player.hidden { display: none; }

.mini-player img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
}

.player-info { flex: 1; overflow: hidden; }
.player-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: 11px; color: var(--text-dim); }

.player-play {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.player-play:hover { transform: scale(1.1); }

.player-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  #nav { padding: 0 16px; }
  .nav-links { gap: 2px; }
  .nav-btn { padding: 8px 12px; font-size: 12px; }
  .hero { padding: 40px 16px 24px; }
  .hero-sub { font-size: 14px; }
  .track-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .results-section { padding: 0 16px 100px; }
  .chain-node img { width: 56px; height: 56px; }
  .chain-link { width: 24px; }
  .btn-spotify span:last-child { display: none; }
}

/* ---- UTILITY ---- */
.hidden { display: none !important; }

/* Staggered animations */
.track-card:nth-child(1) { animation-delay: 0ms; }
.track-card:nth-child(2) { animation-delay: 60ms; }
.track-card:nth-child(3) { animation-delay: 120ms; }
.track-card:nth-child(4) { animation-delay: 180ms; }
.track-card:nth-child(5) { animation-delay: 240ms; }
.track-card:nth-child(6) { animation-delay: 300ms; }
.track-card:nth-child(7) { animation-delay: 360ms; }
.track-card:nth-child(8) { animation-delay: 420ms; }
.track-card:nth-child(9) { animation-delay: 480ms; }
.track-card:nth-child(10) { animation-delay: 540ms; }

.dream-card:nth-child(1) { animation-delay: 0ms; }
.dream-card:nth-child(2) { animation-delay: 80ms; }
.dream-card:nth-child(3) { animation-delay: 160ms; }
.dream-card:nth-child(4) { animation-delay: 240ms; }
.dream-card:nth-child(5) { animation-delay: 320ms; }
.dream-card:nth-child(6) { animation-delay: 400ms; }

.chain-node:nth-child(1) { animation-delay: 0ms; }
.chain-node:nth-child(3) { animation-delay: 200ms; }
.chain-node:nth-child(5) { animation-delay: 400ms; }
.chain-node:nth-child(7) { animation-delay: 600ms; }
.chain-node:nth-child(9) { animation-delay: 800ms; }
.chain-node:nth-child(11) { animation-delay: 1000ms; }
.chain-node:nth-child(13) { animation-delay: 1200ms; }
.chain-node:nth-child(15) { animation-delay: 1400ms; }
