/* ===== APP SHELL ===== */

.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--fg);
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--fg-muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
}

/* ===== BROWSE LAYOUT ===== */

.browse-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

/* Sidebar */
.filter-panel {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-subtle);
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.filter-panel-inner {
  padding: 28px 24px;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
}

.filter-clear {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.filter-clear:hover { color: var(--fg); }

.filter-group {
  margin-bottom: 28px;
}

.filter-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--fg-dim);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.filter-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-pill.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.pill-unit {
  opacity: 0.6;
}

.capitalize { text-transform: capitalize; }

/* Main content */
.browse-main {
  flex: 1;
  padding: 36px 40px;
  overflow-y: auto;
}

.browse-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
}

.browse-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.browse-count {
  font-size: 0.85rem;
  color: var(--fg-dim);
}

/* Kit grid */
.kits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.kit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}

.kit-card:hover {
  border-color: var(--kit-color, var(--accent));
  transform: translateY(-2px);
}

.kit-card-header {
  height: 100px;
  overflow: hidden;
}

.kit-color-block {
  width: 100%;
  height: 100%;
  background: var(--kit-color, var(--accent));
  opacity: 0.15;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  position: relative;
}

/* Override: the color block itself shouldn't be semi-transparent, apply to content */
.kit-card-header {
  background: var(--kit-color, #c4f54a);
  opacity: 1;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 16px;
}

.kit-mini-wave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 40px;
}

.mini-bar {
  width: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.25);
  animation: mini-pulse 2s ease-in-out infinite;
  min-height: 4px;
}

@keyframes mini-pulse {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.5); }
}

.kit-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.kit-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kit-genre {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--fg-dim);
  text-transform: uppercase;
}

.kit-mood {
  font-size: 11px;
  color: var(--fg-muted);
  text-transform: capitalize;
}

.kit-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.kit-desc {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.55;
  flex: 1;
}

.kit-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.kit-stats {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--fg-dim);
  font-family: var(--font-mono);
}

.stat-val {
  color: var(--fg-muted);
  font-weight: 500;
}

.kit-stat-sep {
  color: var(--border);
  margin: 0 2px;
}

.kit-arrow {
  color: var(--fg-dim);
  font-size: 1rem;
  transition: color 0.2s, transform 0.2s;
}

.kit-card:hover .kit-arrow {
  color: var(--kit-color, var(--accent));
  transform: translateX(4px);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 100px 24px;
  color: var(--fg-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.btn-ghost {
  display: inline-block;
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 8px 20px;
  border-radius: 100px;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-ghost:hover {
  background: var(--accent-dim);
}

/* ===== KIT DETAIL LAYOUT ===== */

.kit-detail-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

/* Left info panel */
.kit-info-panel {
  width: 360px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-subtle);
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--fg-dim);
  text-decoration: none;
  padding: 20px 24px 0;
  transition: color 0.15s;
}

.back-link:hover { color: var(--fg); }

.kit-info-header {
  height: 140px;
  background: var(--kit-color, var(--accent));
  display: flex;
  align-items: flex-end;
  padding: 20px 24px;
  margin-top: 16px;
}

.kit-info-wave {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 60px;
  width: 100%;
}

.info-wave-bar {
  flex: 1;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.2);
  animation: mini-pulse 2.5s ease-in-out infinite;
  min-height: 4px;
}

.kit-info-meta {
  padding: 24px;
  flex: 1;
}

.kit-detail-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 8px 0 14px;
}

.kit-detail-desc {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 24px;
}

.kit-detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.detail-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-stat-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--fg-dim);
  text-transform: uppercase;
}

.detail-stat-val {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
}

.kit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 28px;
}

.kit-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 100px;
}

.btn-download {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #0a0a0f;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-download:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-download:active { transform: translateY(0); }
.btn-download:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-icon {
  font-size: 1.1rem;
}

/* Right stems panel */
.stems-panel {
  flex: 1;
  padding: 36px 40px;
  overflow-y: auto;
}

.stems-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.stems-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.master-controls {
  display: flex;
  gap: 8px;
}

.ctrl-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

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

/* Stem rows */
.stems-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stem-row {
  display: grid;
  grid-template-columns: 44px 180px 1fr 72px 64px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s;
}

.stem-row:hover {
  border-color: rgba(196, 245, 74, 0.2);
}

.stem-row.stem-muted {
  opacity: 0.4;
}

.stem-row.stem-inactive {
  opacity: 0.3;
}

.stem-controls {
  display: flex;
  justify-content: center;
}

.stem-play-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--fg);
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.15s;
}

.stem-play-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.stem-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.stem-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stem-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stem-name {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stem-instrument {
  font-size: 0.75rem;
  color: var(--fg-dim);
  text-transform: lowercase;
}

/* Waveform */
.stem-waveform {
  position: relative;
  height: 48px;
  background: var(--bg-subtle);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.stem-waveform:hover {
  border-color: rgba(196, 245, 74, 0.3);
}

.waveform-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px 4px;
}

.wf-bar {
  flex: 1;
  border-radius: 1px;
  background: var(--border);
  transition: background 0.1s;
  min-height: 2px;
}

.wf-bar.played {
  background: var(--accent);
  opacity: 0.7;
}

.waveform-progress {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0;
  background: rgba(196, 245, 74, 0.08);
  pointer-events: none;
  transition: width 0.05s linear;
}

.waveform-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  left: 0;
  pointer-events: none;
  transition: left 0.05s linear;
}

/* Duration */
.stem-duration {
  font-size: 0.72rem;
  color: var(--fg-dim);
  display: flex;
  gap: 2px;
  align-items: center;
  white-space: nowrap;
}

.dur-sep { color: var(--border); }

/* Track controls */
.stem-track-controls {
  display: flex;
  gap: 4px;
}

.track-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.solo-btn:hover, .solo-btn.active {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.mute-btn:hover, .mute-btn.active {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.player-info {
  margin-top: 20px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

/* ===== 404 ===== */
.page-404 {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}

.page-404 h1 {
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 16px;
}

.page-404 p {
  color: var(--fg-muted);
  margin-bottom: 32px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .stem-row {
    grid-template-columns: 44px 140px 1fr 60px 60px;
    gap: 8px;
  }
}

@media (max-width: 900px) {
  .browse-layout { flex-direction: column; }

  .filter-panel {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .browse-main { padding: 24px 20px; }

  .kit-detail-layout { flex-direction: column; }

  .kit-info-panel {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .stems-panel { padding: 24px 20px; }

  .stem-row {
    grid-template-columns: 40px 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 8px;
  }

  .stem-waveform { grid-column: 1 / -1; }
  .stem-duration { display: none; }
}

@media (max-width: 600px) {
  .kits-grid { grid-template-columns: 1fr; }
  .app-nav { padding: 0 16px; }
}
