/* ═══════════════════════════════════════════════════════════════
   ProduceHits Shared Design System
   Import in every product: <link rel="stylesheet" href="/_shared/producehits.css">
   Override per-product: set --accent, --gradient-accent in product <style>
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens ── */
:root {
  /* Background layers */
  --bg:         #060a10;
  --bg2:        #0a0f18;
  --surface:    #0f1520;
  --surface2:   #141c2b;
  --surface3:   #1a2436;
  --surface-alt:#1a1a2e;

  /* Accent — override per product */
  --accent:       #5b9cff;
  --accent-dim:   rgba(91,156,255,0.06);
  --accent-glow:  rgba(91,156,255,0.12);

  /* Gradient — override per product */
  --gradient-accent: linear-gradient(135deg, #5b9cff, #8b5cf6, #d946ef);

  /* Status colors */
  --green:      #34d97c;
  --green-dim:  rgba(52,217,124,0.08);
  --red:        #ff5555;
  --red-dim:    rgba(255,85,85,0.08);
  --orange:     #f59e0b;
  --orange-dim: rgba(245,158,11,0.08);

  /* Text */
  --text:       #eaf0f8;
  --text-muted: #8899aa;
  --text-dim:   #556677;

  /* Borders */
  --border:       #1f2b3d;
  --border-hover: #2a3a52;
  --glass-border: rgba(255,255,255,0.06);

  /* Radius */
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Transition */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}


/* ── 2. Base Reset & Typography ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection { background: rgba(91,156,255,0.25); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }


/* ── 3. Layout ── */
.page { display: none; padding: 24px; max-width: 1200px; margin: 0 auto; }
.page.active { display: block; animation: ph-pageIn 0.3s var(--ease); }
.spacer { flex: 1; }


/* ── 4. Header ── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 64px;
  background: rgba(6,10,16,0.82);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
}

.logo {
  font-size: 18px; font-weight: 800; letter-spacing: -0.5px;
  background: var(--gradient-accent);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-header nav {
  display: flex; gap: 2px;
  background: var(--surface); border-radius: 12px; padding: 4px;
  border: 1px solid var(--border);
}
.app-header nav button {
  background: none; border: none; color: var(--text-muted);
  padding: 8px 16px; border-radius: 9px; cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: var(--font);
  transition: all 0.2s var(--ease); letter-spacing: -0.1px;
}
.app-header nav button:hover { color: var(--text); background: var(--surface2); }
.app-header nav button.active {
  background: var(--gradient-accent); color: #fff;
  box-shadow: 0 2px 8px rgba(91,156,255,0.25);
}


/* ── 5. Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  position: relative; overflow: hidden;
  transition: all 0.3s var(--ease);
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient-accent); opacity: 0; transition: opacity 0.3s;
}
.card:hover { border-color: rgba(91,156,255,0.2); }
.card:hover::before { opacity: 1; }

.card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; font-size: 14px; font-weight: 700;
}
.card-title {
  font-size: 14px; font-weight: 700;
  letter-spacing: -0.3px;
}


/* ── 6. Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; font-family: var(--font);
  cursor: pointer; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text);
  transition: all 0.2s var(--ease); letter-spacing: -0.1px;
  white-space: nowrap; user-select: none;
}
.btn:hover { border-color: var(--border-hover); background: var(--surface3); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  background: var(--gradient-accent); color: #fff; border: none;
  box-shadow: 0 2px 12px rgba(91,156,255,0.25);
}
.btn-primary:hover { box-shadow: 0 4px 20px rgba(91,156,255,0.35); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.btn-danger {
  background: transparent; border: 1px solid var(--red); color: var(--red);
}
.btn-danger:hover { background: var(--red-dim); box-shadow: 0 0 12px rgba(255,85,85,0.15); }

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 6px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }
.btn-icon.sm { width: 28px; height: 28px; border-radius: 7px; font-size: 12px; }

.btn:disabled, .btn.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }


/* ── 7. Forms ── */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 0; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 6px;
}
.form-group select,
.form-group input[type="number"],
.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
  width: 100%; padding: 10px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 13px; font-family: var(--font);
  transition: all 0.2s;
}
.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px rgba(91,156,255,0.06);
}


/* ── 8. Upload Area ── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl); padding: 48px 32px;
  text-align: center; cursor: pointer;
  transition: all 0.3s var(--ease);
  position: relative; overflow: hidden;
}
.upload-area::before {
  content: ''; position: absolute; inset: -2px; border-radius: var(--radius-xl);
  background: var(--gradient-accent); opacity: 0;
  transition: opacity 0.3s; z-index: -1;
}
.upload-area:hover { border-color: var(--accent); background: var(--accent-dim); }
.upload-area.dragover {
  border-color: transparent;
  box-shadow: 0 0 40px rgba(91,156,255,0.15);
}
.upload-area.dragover::before { opacity: 0.15; }

.upload-icon { font-size: 36px; margin-bottom: 12px; }
.upload-text { font-size: 14px; color: var(--text-muted); line-height: 1.7; }
.upload-text strong { color: var(--text); font-weight: 700; }

.file-info { margin-top: 12px; font-size: 13px; color: var(--green); display: none; font-weight: 600; }
.upload-progress { width: 100%; height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; margin-top: 12px; display: none; }
.upload-progress-fill { height: 100%; background: var(--gradient-accent); border-radius: 3px; transition: width 0.2s ease; width: 0%; }
.upload-pct { font-size: 11px; color: var(--text-muted); margin-top: 4px; }


/* ── 9. Waveform ── */
.waveform-wrap {
  background: linear-gradient(180deg, rgba(6,10,16,0.98) 0%, rgba(15,21,32,0.98) 50%, rgba(6,10,16,0.98) 100%);
  border-radius: var(--radius-lg); overflow: hidden;
  margin: 16px 0;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.02), 0 4px 16px rgba(0,0,0,0.3);
  position: relative;
}
.waveform-wrap::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(91,156,255,0.15), transparent);
  pointer-events: none;
}
.waveform-wrap .ws-container { min-height: 160px; }
.waveform-wrap .ws-timeline { height: 22px; }


/* ── 10. Transport ── */
.transport { display: flex; gap: 6px; align-items: center; padding: 10px 0; flex-wrap: wrap; }
.transport .spacer { flex: 1; }
.transport-info {
  font-size: 12px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; font-weight: 500;
}


/* ── 11. Tables ── */
.seg-table-wrap {
  max-height: 340px; overflow-y: auto;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
}
.seg-table-wrap::-webkit-scrollbar { width: 6px; }
.seg-table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.segment-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.segment-table th {
  padding: 10px 16px; text-align: left; color: var(--text-dim); font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.8px; background: var(--surface2);
  position: sticky; top: 0; z-index: 1;
}
.segment-table td { padding: 8px 16px; border-bottom: 1px solid rgba(31,43,61,0.4); }
.segment-table tr { cursor: pointer; transition: all 0.15s; }
.segment-table tbody tr:hover { background: var(--accent-dim); }
.segment-table tbody tr.seg-active { background: var(--accent-dim); box-shadow: inset 3px 0 0 var(--accent); }
.segment-table input[type="checkbox"] { accent-color: var(--green); width: 16px; height: 16px; cursor: pointer; }


/* ── 12. Progress Bar ── */
.progress-bar { height: 8px; background: var(--surface3); border-radius: 4px; overflow: hidden; margin: 12px 0; }
.progress-fill {
  height: 100%; background: var(--gradient-accent);
  border-radius: 4px; transition: width 0.5s ease; width: 0%;
  position: relative;
}
.progress-fill::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 80px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: ph-progressShimmer 1.5s ease infinite;
}
.status-text { font-size: 13px; color: var(--text); font-weight: 600; }
.progress-detail { display: flex; justify-content: space-between; align-items: center; }
.progress-elapsed { font-size: 11px; color: var(--text-muted); font-weight: 400; }


/* ── 13. Toast Notifications ── */
.toast {
  position: fixed; top: 76px; right: 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 24px;
  font-size: 13px; font-weight: 600;
  z-index: 1000; max-width: 400px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(91,156,255,0.05);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  animation: ph-toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.toast.success { border-color: var(--green); color: var(--green); background: linear-gradient(135deg, var(--surface), rgba(52,217,124,0.03)); }
.toast.error   { border-color: var(--red);   color: var(--red);   background: linear-gradient(135deg, var(--surface), rgba(255,85,85,0.03)); }
.toast.info    { border-color: var(--accent); color: var(--accent); background: linear-gradient(135deg, var(--surface), rgba(91,156,255,0.03)); }


/* ── 14. Dialogs / Overlays ── */
.dialog-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  animation: ph-overlayIn 0.2s ease;
}
.dialog {
  background: var(--surface); border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl); padding: 32px;
  min-width: 400px; max-width: 520px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(91,156,255,0.05);
  animation: ph-dialogIn 0.25s var(--ease); position: relative;
}
.dialog h3 { margin: 0 0 20px; font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.dialog-close {
  position: absolute; top: 16px; right: 18px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
  cursor: pointer; font-size: 16px; line-height: 1; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; transition: all 0.2s;
}
.dialog-close:hover { color: var(--text); background: var(--surface3); }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }


/* ── 15. Tags / Chips ── */
.tag {
  background: var(--surface2); padding: 3px 10px; border-radius: 6px;
  border: 1px solid var(--border); font-size: 11px; font-weight: 600;
  letter-spacing: -0.1px; transition: all 0.15s; display: inline-block;
}
.tag:hover { border-color: var(--accent); color: var(--accent); }

.chip {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 20px;
  padding: 8px 16px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px;
  user-select: none;
}
.chip:hover { border-color: var(--accent); background: var(--accent-dim); }
.chip.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }


/* ── 16. Tabs ── */
.tab-strip { display: flex; gap: 4px; flex-wrap: wrap; }
.tab-btn {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted);
  padding: 6px 16px; border-radius: 9px; cursor: pointer;
  font-size: 11px; font-weight: 600; font-family: var(--font);
  transition: all 0.2s; letter-spacing: -0.1px;
}
.tab-btn:hover { color: var(--text); border-color: var(--border-hover); transform: translateY(-1px); }
.tab-btn.active { background: var(--gradient-accent); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(91,156,255,0.25); }

.lib-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.lib-tab {
  padding: 10px 20px; font-size: 13px; font-weight: 600; color: var(--text-dim); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.2s; background: none;
  border-top: none; border-left: none; border-right: none;
}
.lib-tab:hover { color: var(--text); background: var(--accent-dim); }
.lib-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.lib-section { display: none; }
.lib-section.active { display: block; }


/* ── 17. Grids ── */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.samples-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 8px; }


/* ── 18. Sample Items ── */
.sample-item {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; font-size: 11px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s var(--ease); font-weight: 500;
}
.sample-item:hover { border-color: var(--accent); background: var(--accent-dim); transform: translateX(3px); }
.sample-item.playing { border-color: var(--green); background: var(--green-dim); box-shadow: 0 0 16px rgba(52,217,124,0.15); }

.play-icon {
  width: 22px; height: 22px; border-radius: 50%; background: var(--surface3);
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0;
  transition: background 0.1s, transform 0.1s;
}
.sample-item:hover .play-icon { background: var(--accent); transform: scale(1.1); }
.sample-item.playing .play-icon { background: var(--green); }


/* ── 19. Selection Bar ── */
.selection-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(135deg, rgba(52,217,124,0.08), rgba(52,217,124,0.03));
  border: 1px solid rgba(52,217,124,0.25);
  border-radius: var(--radius-lg); margin-top: 12px;
}
.selection-bar .sel-count { font-size: 13px; font-weight: 700; color: var(--green); }


/* ── 20. Spectral Loader ── */
.pulse-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  animation: ph-pulseDot 1.4s ease-in-out calc(var(--d) * 0.15s) infinite;
}
.spectral-status { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: 0.5px; }


/* ── 21. Nudge Controls ── */
.nudge-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; background: var(--surface2);
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  margin: 12px 0; flex-wrap: wrap;
}
.nudge-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-muted); white-space: nowrap; }
.nudge-value {
  font-size: 14px; font-weight: 800;
  background: var(--gradient-accent); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  min-width: 32px; text-align: center; font-variant-numeric: tabular-nums;
}
.nudge-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface3); border: 1px solid var(--border); color: var(--text);
  font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s; font-weight: 700; line-height: 1; font-family: var(--font);
}
.nudge-btn:hover { background: var(--gradient-accent); color: #fff; border-color: transparent; }
.nudge-btn:active { transform: scale(0.92); }

.nudge-select, .nudge-input {
  height: 30px; padding: 0 6px; border-radius: 7px; font-family: var(--font);
  background: var(--surface3); border: 1px solid var(--border); color: var(--text);
}
.nudge-select { font-size: 11px; cursor: pointer; max-width: 170px; }
.nudge-input { font-size: 12px; text-align: center; font-weight: 700; }
.nudge-select:focus, .nudge-input:focus { border-color: var(--accent); outline: none; }


/* ── 22. Footer ── */
.app-footer {
  text-align: center; padding: 32px 24px; margin-top: 48px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim);
}
.app-footer a { color: var(--text-muted); }
.app-footer a:hover { color: var(--accent); }


/* ── 23. Spinner ── */
.spinner {
  width: 28px; height: 28px; margin: 0 auto;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: ph-spin 0.7s linear infinite;
}


/* ── 24. Stem Colors ── */
.stem-drums    { --stem-color: #e8443a; }
.stem-bass     { --stem-color: #a855f7; }
.stem-other    { --stem-color: #4f8ff7; }
.stem-vocals   { --stem-color: #2dcc71; }
.stem-instrumental { --stem-color: #f59e0b; }
.stem-mixed    { --stem-color: #ec4899; }

.stem-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--stem-color, var(--accent));
}


/* ── 25. Utility Classes ── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-700 { font-weight: 700; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.tabular { font-variant-numeric: tabular-nums; }


/* ── 26. Animations ── */
@keyframes ph-pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ph-fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ph-toastIn {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes ph-toastOut {
  from { transform: translateX(0) scale(1); opacity: 1; }
  to   { transform: translateX(100%) scale(0.9); opacity: 0; }
}
@keyframes ph-overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ph-dialogIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes ph-spin {
  to { transform: rotate(360deg); }
}
@keyframes ph-progressShimmer {
  0%   { transform: translateX(-60px); }
  100% { transform: translateX(60px); }
}
@keyframes ph-pulseDot {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.7); }
  40%           { opacity: 1; transform: scale(1.2); }
}
@keyframes ph-cardReveal {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-reveal { animation: ph-cardReveal 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }


/* ── 27. Responsive ── */
@media (max-width: 768px) {
  .form-row { flex-direction: column; }
  .form-group { width: 100%; }
  .pack-grid { grid-template-columns: 1fr; }
  .samples-grid { grid-template-columns: 1fr; }
  .transport { gap: 4px; }
  .app-header { padding: 0 16px; height: 56px; gap: 12px; }
  .app-header nav button { padding: 6px 12px; font-size: 11px; }
  .logo { font-size: 16px; }
  .page { padding: 16px; }
  .upload-area { padding: 36px 24px; }
  .dialog { min-width: auto; max-width: 95vw; padding: 24px; }
  .nudge-strip { padding: 10px 14px; gap: 8px; }
}
