/* Song Studio — dark, atmospheric, glowing card aesthetic */

:root {
  --bg:        #0d0b14;
  --surface:   #161322;
  --surface2:  #1e1a2e;
  --surface3:  #231d35;
  --border:    #2a2540;
  --accent:    #7c5cfc;
  --accent2:   #4a9eff;
  --gold:      #f5c842;
  --text:      #e8e4f0;
  --text-muted:#8a82a0;
  --green:     #5fd97a;
  --cyan:      #22d3ee;
  --pink:      #e879f9;
  --radius:    12px;
  --radius-lg: 16px;
}

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

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

/* ─── NAV ─────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(13, 11, 20, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
nav .logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
nav .logo span { color: var(--accent); }
nav .nav-links { display: flex; align-items: center; gap: 28px; }
nav a { color: var(--text-muted); text-decoration: none; font-size: 0.88rem; transition: color 0.2s; }
nav a:hover { color: var(--text); }
nav .btn-nav {
  background: var(--accent);
  color: #fff !important;
  padding: 7px 18px;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s;
}
nav .btn-nav:hover { background: #6a4ae0; }

/* ─── STUDIO HEADER ─────────────────────────────── */
.studio-header {
  text-align: center;
  padding: 80px 24px 0;
  max-width: 800px;
  margin: 0 auto;
}

.studio-header .studio-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(124, 92, 252, 0.12);
  border: 1px solid rgba(124, 92, 252, 0.3);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.studio-header h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #e8e4f0 0%, #7c5cfc 60%, #4a9eff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.studio-header p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* ─── STUDIO LAYOUT ──────────────────────────────── */
.studio-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 100px;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

/* ─── LEFT PANEL ────────────────────────────────── */
.studio-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── SECTION CARD ──────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 0 0 1px rgba(124, 92, 252, 0.04);
  transition: border-color 0.25s;
}

.card:hover {
  border-color: rgba(124, 92, 252, 0.25);
}

.card-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
}

/* ─── GENRE PILLS ───────────────────────────────── */
.genre-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.genre-btn {
  padding: 8px 18px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}

.genre-btn:hover {
  border-color: rgba(124, 92, 252, 0.4);
  color: var(--text);
  background: var(--surface3);
}

.genre-btn.selected {
  background: rgba(124, 92, 252, 0.15);
  border-color: rgba(124, 92, 252, 0.6);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(124, 92, 252, 0.15);
}

/* ─── SUB-GENRE (dependent on genre) ────────────── */
.subgenre-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 44px;
}

.subgenre-btn {
  padding: 5px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}

.subgenre-btn:hover {
  border-color: rgba(74, 158, 255, 0.4);
  color: var(--accent2);
}

.subgenre-btn.selected {
  background: rgba(74, 158, 255, 0.1);
  border-color: rgba(74, 158, 255, 0.5);
  color: var(--accent2);
}

.no-subgenre-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── MOOD / INSTRUMENT TAGS ────────────────────── */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  padding: 5px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}

.tag:hover {
  border-color: rgba(245, 200, 66, 0.4);
  color: var(--gold);
  background: rgba(245, 200, 66, 0.05);
}

.tag.selected {
  background: rgba(245, 200, 66, 0.1);
  border-color: rgba(245, 200, 66, 0.45);
  color: var(--gold);
  box-shadow: 0 0 10px rgba(245, 200, 66, 0.1);
}

/* ─── BPM / KEY INPUTS ──────────────────────────── */
.param-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.param-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.param-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 10px 14px;
  transition: border-color 0.2s;
  width: 100%;
}

.param-input:focus {
  outline: none;
  border-color: var(--accent);
}

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

/* ─── KEY/BPM CUSTOM DESCRIPTION ───────────────── */
.description-field {
  width: 100%;
}

.description-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 14px;
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
  transition: border-color 0.2s;
}

.description-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.description-textarea::placeholder { color: var(--text-muted); }

/* ─── BUILT TAGS STRING ────────────────────────── */
.built-tags-display {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 40px;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.built-tag-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid;
}

.built-tag-item.mood {
  background: rgba(245, 200, 66, 0.08);
  border-color: rgba(245, 200, 66, 0.35);
  color: var(--gold);
}

.built-tag-item.instrument {
  background: rgba(74, 158, 255, 0.08);
  border-color: rgba(74, 158, 255, 0.35);
  color: var(--accent2);
}

.built-tag-item.genre-tag {
  background: rgba(124, 92, 252, 0.08);
  border-color: rgba(124, 92, 252, 0.35);
  color: var(--accent);
}

.built-tag-item.remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.85rem;
  margin-left: 2px;
  border-radius: 4px;
  transition: color 0.15s;
}

.built-tag-item.remove:hover { color: #ff6b6b; }

.built-tags-empty {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* ─── ACTION BUTTONS ─────────────────────────────── */
.action-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-compose {
  flex: 1;
  background: var(--accent);
  color: #fff;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 24px rgba(124, 92, 252, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-compose:hover {
  background: #6a4ae0;
  box-shadow: 0 0 36px rgba(124, 92, 252, 0.5);
  transform: translateY(-1px);
}

.btn-reset {
  padding: 14px 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset:hover {
  border-color: var(--accent2);
  color: var(--text);
}

/* ─── RIGHT PANEL (STICKY) ──────────────────────── */
.studio-right {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── LIVE PREVIEW ──────────────────────────────── */
.preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.preview-header-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.live-dot-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--green);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.preview-body {
  padding: 20px;
  background: var(--bg);
  min-height: 160px;
}

.preview-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.7;
}

.preview-rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preview-row {
  display: flex;
  gap: 8px;
}

.preview-row-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  min-width: 52px;
  padding-top: 2px;
  flex-shrink: 0;
}

.preview-row-value {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
  flex: 1;
}

.preview-row-value .tag-chip {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(124, 92, 252, 0.1);
  border: 1px solid rgba(124, 92, 252, 0.3);
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--accent);
  margin: 1px;
}

/* ─── OUTPUT CARD ───────────────────────────────── */
.output-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.output-header-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-btn.copied {
  background: rgba(95, 217, 122, 0.1);
  border-color: rgba(95, 217, 122, 0.45);
  color: var(--green);
}

.output-body {
  padding: 20px;
  background: var(--bg);
  min-height: 120px;
}

.output-placeholder {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.output-prompt {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.output-prompt .section-block {
  margin-bottom: 12px;
}

.output-prompt .section-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  display: block;
  margin-bottom: 3px;
}

/* ─── SEND TO SUNO ───────────────────────────────── */
.suno-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.suno-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.suno-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(124, 92, 252, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.suno-text-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.suno-text-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-copy-link {
  padding: 9px 20px;
  background: rgba(124, 92, 252, 0.12);
  border: 1px solid rgba(124, 92, 252, 0.35);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-copy-link:hover {
  background: rgba(124, 92, 252, 0.2);
  border-color: var(--accent);
}

/* ─── HINT TEXT ─────────────────────────────────── */
.hint-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.hint-text {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.hint-text strong { color: var(--text); }

/* ─── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 900px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
  .studio-right {
    position: static;
  }
}

@media (max-width: 600px) {
  nav { padding: 14px 20px; }
  nav .nav-links { gap: 16px; }
  .studio-header { padding: 80px 16px 0; }
  .studio-layout { padding: 20px 16px 60px; }
  .param-row { grid-template-columns: 1fr; }
  .action-row { flex-direction: column; }
  .suno-card { flex-direction: column; align-items: flex-start; }
}