/* ── MAI — Music Audience Insights — Cyberpunk Theme ── */

:root {
  --bg-primary: #0a0e27;
  --bg-card: rgba(255, 255, 255, 0.05);
  --text-primary: #e0e6ed;
  --text-secondary: #8892a4;
  --text-muted: #5a6378;
  --accent-start: #667eea;
  --accent-end: #764ba2;
  --accent-orange: #f97316;
  --accent-yellow: #eab308;
  --accent-green: #22c55e;
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.2);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-start); border-radius: 3px; }

/* ── Background ── */
.bg-gradient {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 20% 40%, rgba(102,126,234,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(118,75,162,0.06) 0%, transparent 50%),
    var(--bg-primary);
}

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.glass-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 30px rgba(102,126,234,0.1);
}

/* ── Gradient Text ── */
.mai-gradient {
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; color: transparent;
}

/* ── Buttons ── */
.search-button {
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  border: none; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.3s;
}
.search-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102,126,234,0.35);
}
.search-button:active { transform: translateY(0); }

/* ── Spinner ── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-start);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Search Results ── */
.search-result {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: rgba(102,126,234,0.08); }
.search-result img {
  width: 48px; height: 48px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--border); flex-shrink: 0;
}

.avatar-placeholder {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(102,126,234,0.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #667eea; flex-shrink: 0;
}

/* ── Section Title ── */
.section-title {
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 16px;
}

/* ── Genre Tags ── */
.genre-tag {
  display: inline-block; padding: 4px 12px;
  border-radius: 20px; font-size: 0.75rem;
  font-weight: 500; border: 1px solid;
}

/* ── Artist Image ── */
.artist-image {
  width: 120px; height: 120px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--accent-start);
  box-shadow: 0 0 30px rgba(102,126,234,0.3); flex-shrink: 0;
}

/* ── Links ── */
.external-link {
  color: var(--accent-start); text-decoration: none; transition: color 0.2s;
}
.external-link:hover { color: var(--accent-end); }

/* ── Stats Bar ── */
.stats-bar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 24px;
  background: var(--bg-card); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 16px;
  flex-wrap: wrap;
}
.stats-bar-chips { display: flex; gap: 20px; flex-wrap: wrap; }
.stat-chip { display: flex; align-items: center; gap: 8px; }
.stat-chip-label {
  font-size: 0.65rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
}
.stat-chip-value { font-size: 1rem; font-weight: 700; }
.stats-bar-actions { display: flex; gap: 8px; }
.action-btn {
  padding: 6px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-size: 0.8rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.action-btn:hover { border-color: var(--accent-start); color: var(--accent-start); }
.action-btn-orange:hover { border-color: var(--accent-orange); color: var(--accent-orange); }

/* ── Track List ── */
.track-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; transition: background 0.2s;
}
.track-item:hover { background: rgba(255,255,255,0.03); }
.track-thumb {
  width: 44px; height: 44px; border-radius: 6px;
  object-fit: cover; flex-shrink: 0;
}
.play-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--accent-start);
  background: rgba(102,126,234,0.1); color: var(--accent-start);
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-size: 11px;
  transition: all 0.2s; flex-shrink: 0;
}
.play-btn:hover { background: var(--accent-start); color: white; }

/* ── Audience Bars ── */
.audience-bar-bg {
  height: 8px; background: rgba(255,255,255,0.05);
  border-radius: 4px; overflow: hidden;
}
.audience-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  transition: width 0.8s ease-out;
}
.flag-img {
  width: 24px; height: 16px; border-radius: 2px;
  object-fit: cover; flex-shrink: 0;
}

/* ── MAI Pulse Bar ── */
.pulse-bar-bg {
  height: 12px; background: rgba(255,255,255,0.05);
  border-radius: 6px; overflow: hidden;
}
.pulse-bar-fill {
  height: 100%; border-radius: 6px; transition: width 1s ease-out;
}

/* ── Timeline ── */
.timeline-container { position: relative; padding-left: 32px; }
.timeline-line {
  position: absolute; left: 15px; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(to bottom, var(--accent-start), var(--accent-end));
}
.timeline-item { position: relative; padding-bottom: 32px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-node {
  position: absolute; left: -25px; top: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--accent-start);
  background: var(--bg-primary); z-index: 1;
}

/* ── Spotlight Card ── */
.spotlight-card {
  background: linear-gradient(135deg, rgba(102,126,234,0.08), rgba(118,75,162,0.08));
  border: 1px solid rgba(102,126,234,0.2);
  border-radius: 16px; position: relative; overflow: hidden;
}
.spotlight-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
}

/* ── YouTube ── */
.yt-video-card {
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s, border-color 0.3s;
  background: rgba(255,255,255,0.02);
  display: block; text-decoration: none; color: var(--text-primary);
}
.yt-video-card:hover { transform: translateY(-4px); border-color: var(--border-hover); }
.yt-video-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.yt-stat {
  text-align: center; padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border-radius: 12px; border: 1px solid var(--border);
}

/* ── Discography Grid ── */
.disco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.disco-card {
  text-decoration: none; color: var(--text-primary);
  transition: transform 0.2s; display: block;
}
.disco-card:hover { transform: translateY(-4px); }
.disco-img {
  width: 100%; aspect-ratio: 1; border-radius: 10px;
  object-fit: cover; margin-bottom: 8px;
  border: 1px solid var(--border);
}
.disco-img-placeholder {
  width: 100%; aspect-ratio: 1; border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border); margin-bottom: 8px;
}
.disco-name {
  font-size: 0.8rem; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px;
}
.disco-meta { font-size: 0.7rem; color: var(--text-muted); }
.disco-type {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 0.6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.type-album { background: rgba(102,126,234,0.15); color: var(--accent-start); }
.type-single { background: rgba(118,75,162,0.15); color: var(--accent-end); }

/* ── Related Artists ── */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 20px;
}
.related-card {
  text-align: center; cursor: pointer; transition: transform 0.2s;
}
.related-card:hover { transform: translateY(-4px); }
.related-img {
  width: 72px; height: 72px; border-radius: 50%;
  object-fit: cover; margin: 0 auto 8px;
  border: 2px solid var(--border); transition: border-color 0.3s;
}
.related-card:hover .related-img { border-color: var(--accent-start); }
.related-img-placeholder {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(102,126,234,0.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #667eea; margin: 0 auto 8px; font-size: 1.2rem;
}
.related-name {
  font-size: 0.8rem; font-weight: 600; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.related-followers { font-size: 0.7rem; color: var(--text-muted); }

/* ── Comparison ── */
.compare-header {
  display: flex; align-items: center; justify-content: center;
  gap: 32px; margin-bottom: 32px;
}
.compare-artist { text-align: center; }
.compare-img {
  width: 80px; height: 80px; border-radius: 50%;
  object-fit: cover; margin-bottom: 8px;
  border: 3px solid var(--accent-start);
}
.compare-name { font-size: 1.1rem; font-weight: 700; }
.compare-vs { font-size: 1.5rem; font-weight: 900; color: var(--text-muted); }
.compare-stats { max-width: 500px; margin: 0 auto; }
.compare-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.compare-row:last-child { border-bottom: none; }
.compare-val { width: 120px; font-size: 0.95rem; font-weight: 600; }
.compare-val:first-child { text-align: left; }
.compare-val:last-child { text-align: right; }
.compare-label {
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  text-align: center; flex: 1;
}

/* ── Grade Badge ── */
.grade-badge {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 900;
  margin: 0 auto 12px;
  border: 3px solid;
}
.grade-S { border-color: #f97316; color: #f97316; background: rgba(249,115,22,0.1); text-shadow: 0 0 20px rgba(249,115,22,0.4); box-shadow: 0 0 25px rgba(249,115,22,0.2); animation: gradeGlow 2s ease-in-out infinite alternate; }
@keyframes gradeGlow { from { box-shadow: 0 0 15px rgba(249,115,22,0.15); } to { box-shadow: 0 0 30px rgba(249,115,22,0.3); } }
.grade-A { border-color: #eab308; color: #eab308; background: rgba(234,179,8,0.1); }
.grade-B { border-color: #22c55e; color: #22c55e; background: rgba(34,197,94,0.1); }
.grade-C { border-color: #667eea; color: #667eea; background: rgba(102,126,234,0.1); }
.grade-D { border-color: #5a6378; color: #5a6378; background: rgba(90,99,120,0.1); }

/* ── Sound Radar ── */
.radar-container { position: relative; width: 100%; max-width: 200px; margin: 0 auto; }
.radar-container canvas { width: 100% !important; height: auto !important; }
.radar-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.radar-label { font-size: 0.75rem; color: var(--text-secondary); }
.radar-bar-bg { flex: 1; height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; margin: 0 10px; overflow: hidden; }
.radar-bar-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease-out; }
.radar-val { font-size: 0.75rem; font-weight: 700; width: 35px; text-align: right; }

/* ── Tour Card ── */
.tour-market {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  transition: background 0.2s;
}
.tour-market:hover { background: rgba(255,255,255,0.03); }
.tour-venue-badge {
  display: inline-block; padding: 6px 16px;
  border-radius: 20px; font-size: 0.85rem; font-weight: 700;
  background: rgba(102,126,234,0.12); color: var(--accent-start);
  border: 1px solid rgba(102,126,234,0.25);
}

/* ── Revenue Card ── */
.revenue-amount {
  font-size: 1.6rem; font-weight: 800;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; color: transparent;
}

/* ── Recent Artists ── */
.recent-grid {
  display: flex; gap: 16px; overflow-x: auto;
  padding-bottom: 8px; scrollbar-width: thin;
}
.recent-card {
  flex-shrink: 0; width: 90px; text-align: center;
  cursor: pointer; transition: transform 0.2s;
}
.recent-card:hover { transform: translateY(-3px); }
.recent-card img {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; margin: 0 auto 6px;
  border: 2px solid var(--border);
}
.recent-card .recent-name {
  font-size: 0.7rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Theme Toggle ── */
.theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 100;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); font-size: 1.2rem;
  cursor: pointer; transition: all 0.3s;
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { border-color: var(--accent-start); color: var(--accent-start); }

/* ── Light Theme ── */
body.light {
  --bg-primary: #f5f5f7;
  --bg-card: rgba(0, 0, 0, 0.03);
  --text-primary: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #888;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
}
body.light .bg-gradient {
  background: radial-gradient(ellipse at 20% 40%, rgba(102,126,234,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(118,75,162,0.04) 0%, transparent 50%),
    #f5f5f7;
}
body.light .search-button { color: #fff; }
body.light .glass-card { backdrop-filter: blur(8px); }
body.light .mai-gradient { -webkit-text-fill-color: transparent; }
body.light .artist-image { box-shadow: 0 0 20px rgba(102,126,234,0.15); }
body.light .spotlight-card { background: linear-gradient(135deg, rgba(102,126,234,0.05), rgba(118,75,162,0.05)); }
body.light ::-webkit-scrollbar-thumb { background: #bbb; }

/* ── Comparison Bars ── */
.compare-bar-row { display: flex; gap: 4px; margin: -4px 0 8px; padding: 0 120px; }
.compare-bar-a, .compare-bar-b { height: 4px; border-radius: 2px; transition: width 0.6s ease-out; }
.compare-bar-a { background: var(--accent-start); margin-left: auto; }
.compare-bar-b { background: var(--accent-orange); }

/* ── Career Chart ── */
.chart-container { position: relative; height: 200px; }

/* ── Spotify Embed ── */
.spotify-iframe { border-radius: 12px; border: none; width: 100%; }

/* ── Wiki Bio ── */
.wiki-text { font-size: 0.9rem; line-height: 1.7; color: var(--text-secondary); }
.wiki-source { font-size: 0.7rem; color: var(--text-muted); margin-top: 8px; }
.wiki-source a { color: var(--accent-start); text-decoration: none; }

/* ── Show Rows ── */
.show-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px; border-radius: 10px; transition: background 0.2s;
  border-bottom: 1px solid var(--border);
}
.show-row:last-child { border-bottom: none; }
.show-row:hover { background: rgba(255,255,255,0.03); }
.show-date {
  font-size: 0.8rem; font-weight: 700; color: var(--accent-start);
  width: 90px; flex-shrink: 0;
}

/* ── Social Links ── */
.social-link {
  display: inline-block; padding: 3px 10px;
  border-radius: 12px; font-size: 0.7rem; font-weight: 600;
  border: 1px solid var(--border); color: var(--text-secondary);
  text-decoration: none; transition: all 0.2s;
}
.social-link:hover {
  border-color: var(--accent-start); color: var(--accent-start);
  background: rgba(102,126,234,0.08);
}

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Suggest Chips ── */
.suggest-chip {
  padding: 8px 20px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-size: 0.85rem;
  font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.suggest-chip:hover {
  border-color: var(--accent-start); color: var(--accent-start);
  background: rgba(102,126,234,0.08);
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.5s ease-out forwards; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .artist-image { width: 80px; height: 80px; }
  .track-item { gap: 8px; padding: 8px; }
  .track-thumb { width: 36px; height: 36px; }
  .stats-bar-inner { flex-direction: column; align-items: flex-start; }
  .stats-bar-actions { flex-wrap: wrap; }
  .disco-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
  .related-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 12px; }
  .related-img, .related-img-placeholder { width: 56px; height: 56px; }
  .compare-header { gap: 16px; }
  .compare-img { width: 60px; height: 60px; }
  .compare-bar-row { padding: 0 16px; }
  .compare-val { width: 80px; font-size: 0.8rem; }
  .compare-label { font-size: 0.75rem; }
  .spotlight-card { padding: 20px !important; }
}
@media (max-width: 480px) {
  .artist-image { width: 64px; height: 64px; }
  .compare-bar-row { padding: 0 8px; }
  .compare-val { width: 60px; font-size: 0.75rem; }
}
