/* ── Reset & variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f14;
  --surface:   #131720;
  --surface2:  #1a1f2e;
  --border:    #252d42;
  --accent:    #7c5cbf;
  --accent2:   #5b8af5;
  --green:     #3ecf8e;
  --red:       #f56565;
  --yellow:    #f6c26e;
  --text:      #e2e8f0;
  --muted:     #6b7897;
  --radius:    10px;
  --font:      'Inter', 'Segoe UI', system-ui, sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo { display: flex; align-items: center; gap: 10px; }

.logo-icon {
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .5px;
}

.logo-sub {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  align-self: flex-end;
  padding-bottom: 2px;
}

.header-actions { display: flex; gap: 10px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
}
.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:not(:disabled):hover { border-color: var(--accent2); }
.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
}
.btn-ghost:not(:disabled):hover { color: var(--red); border-color: var(--red); }

/* ── Main layout ─────────────────────────────────────────── */
main {
  flex: 1;
  padding: 32px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Drop zone ───────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .2s, background .2s;
  cursor: pointer;
  outline: none;
}

.drop-zone.drag-over {
  border-color: var(--accent2);
  background: #1a233a;
}

.drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px 24px;
}

.drop-icon {
  font-size: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.drop-title { font-size: 18px; font-weight: 600; }
.drop-sub   { font-size: 13px; color: var(--muted); }

/* ── Section headers ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-header h2 { font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }
.queue-stats { font-size: 12px; color: var(--muted); }

/* ── Queue list ───────────────────────────────────────────── */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  align-items: center;
}

.queue-item-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-status {
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.queue-status.pending  { color: var(--muted); }
.queue-status.analyzing { color: var(--yellow); }
.queue-status.done     { color: var(--green); }
.queue-status.error    { color: var(--red); }

.progress-bar-wrap {
  grid-column: 1 / -1;
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .3s ease;
  width: 0%;
}
.progress-bar.indeterminate {
  width: 40%;
  animation: slide 1.4s ease-in-out infinite;
}

@keyframes slide {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(350%); }
}

/* ── Results table ───────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  white-space: nowrap;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sort-asc  .sort-icon::after { content: ' ↑'; }
th.sort-desc .sort-icon::after { content: ' ↓'; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

td {
  padding: 11px 16px;
  vertical-align: middle;
}

.col-num    { width: 44px; color: var(--muted); font-size: 11px; }
.col-name   { min-width: 200px; }
.col-bpm    { width: 90px; }
.col-cam    { width: 80px; }
.col-trad   { width: 140px; }
.col-dur    { width: 90px; }
.col-energy { width: 120px; }

.track-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
  display: block;
}

/* Camelot badge */
.camelot-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .3px;
}
.camelot-A { background: #1e2a3a; color: #5b8af5; border: 1px solid #2e3f5e; }
.camelot-B { background: #1e2e28; color: #3ecf8e; border: 1px solid #2a4a3a; }

/* Energy bar */
.energy-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.energy-track {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.energy-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}
.energy-label { font-size: 11px; color: var(--muted); width: 14px; text-align: right; }

/* BPM value */
.bpm-value { font-weight: 700; font-size: 15px; }

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