/* =============================================================================
   Camelot Wheel DJ Harmonic Mixer — Stylesheet
   Pure vanilla CSS, no frameworks.
   ============================================================================= */

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

:root {
  --bg-page:      #111827;
  --bg-card:      #1f2937;
  --bg-muted:     #111827aa;
  --bg-hover:     #374151;
  --bg-input:     #374151;

  --accent:       #9333ea;   /* purple */
  --accent-hover: #7e22ce;
  --accent-light: #c084fc;

  --orange:       #f97316;
  --blue:         #3b82f6;
  --blue-light:   #60a5fa;
  --green:        #4ade80;

  --text:         #f9fafb;
  --text-muted:   #9ca3af;
  --text-dim:     #6b7280;
  --border:       #374151;

  --radius:       0.75rem;
  --radius-sm:    0.5rem;
  --transition:   0.15s ease;
}

html { font-size: 16px; }

body {
  font-family: ui-sans-serif, system-ui, sans-serif;
  background: linear-gradient(135deg, var(--bg-page) 0%, #1f2937 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 1rem;
}

/* ---- Layout ---- */
.app {
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .two-col { grid-template-columns: 1fr 1fr; }
}

.key-grids {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ---- Card ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .card { padding: 2rem; }
}

/* ---- Header ---- */
header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  text-align: center;
}

h1 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

@media (min-width: 768px) {
  h1 { font-size: 1.875rem; }
}

h2 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
 
  flex-direction:column;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.25rem 0 0.5rem;
}

p { color: #d1d5db; line-height: 1.625; }

/* ---- Key type toggle ---- */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.toggle-label { color: var(--text-muted); font-size: 0.875rem; }

.toggle-btn {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--bg-input);
  color: #d1d5db;
  transition: background var(--transition), color var(--transition);
}

.toggle-btn:hover { background: var(--bg-hover); }
.toggle-btn.active { background: var(--accent); color: #fff; }

/* ---- Section titles ---- */
.section-title { margin-bottom: 1rem; }
.section-title.orange { color: var(--orange); }
.section-title.blue   { color: var(--blue-light); }

/* ---- Key grids ---- */
.key-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .key-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }
}

/* Individual key button */
.key-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid transparent;
  background: #fff;
  color: #111;
  transition: all var(--transition);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

@media (min-width: 768px) {
  .key-btn { font-size: 1.125rem; }
}

.key-btn:hover {
  background: #ede9fe;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Minor keys get orange border, Major keys get blue border */
.key-btn.minor { border-color: var(--orange); }
.key-btn.major { border-color: var(--blue); }

/* Currently selected / active key */
.key-btn.selected {
  background: var(--accent);
  color: #fff;
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(147,51,234,0.5);
}

/* ---- Matches panel ---- */
#matches-title {
  color: var(--text);
  margin-bottom: 1.5rem;
}

.match-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-muted);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  width: 100%;
  text-align: left;
  color: var(--text);
}

.match-item:hover { background: var(--bg-hover); }

.match-type {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  color: var(--text);
}

.match-key {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--blue-light);
}

.match-energy {
  font-size: 1.75rem;
  text-align: right;
}

.match-energy-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  margin-bottom: 0.2rem;
}

/* ---- Mix sequence ---- */
#sequence-display {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.seq-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.seq-key {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: background var(--transition);
  white-space: nowrap;
}

.seq-key.past    { background: var(--bg-input); color: #d1d5db; }
.seq-key.current { background: var(--accent);   color: #fff; }
.seq-key.past:hover { background: var(--bg-hover); }

.seq-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0.25rem;
}

.seq-arrow svg  { color: var(--text-dim); }
.seq-arrow-type { font-size: 0.7rem; color: var(--text-muted); }
.seq-arrow-energy { font-size: 1.25rem; }

.seq-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  margin-left: 0.5rem;
  transition: color var(--transition);
}
.seq-clear:hover { color: var(--text); }

/* ---- Energy chart ---- */
.chart-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

#energy-chart-container,
#playlist-chart-container {
  background: var(--bg-muted);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  overflow-x: auto;
}

#energy-chart,
#playlist-chart {
  width: 100%;
  min-width: 400px;
  height: 300px;
  display: block;
}

/* ---- Playlist analyser ---- */
.file-label {
  display: block;
  margin-bottom: 1.5rem;
  cursor: pointer;
}

.file-label input[type="file"] { display: none; }

.file-btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

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

/* Individual track row in playlist */
.track-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  transition: background var(--transition);
}

.track-row:hover { background: var(--bg-hover); }

.track-title {
  flex: 1;
  color: #d1d5db;
  font-size: 0.9rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-key {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  background: var(--bg-input);
  color: #d1d5db;
  white-space: nowrap;
  font-size: 0.9rem;
  min-width: 60px;
  text-align: center;
}

.track-transition {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  gap: 0.1rem;
}

.track-transition .energy { font-size: 1.25rem; }

/* ---- Info list ---- */
.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.info-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: #d1d5db;
  line-height: 1.5;
}

.dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---- Icons ---- */
.icon-music {
  width: 2rem;
  height: 2rem;
  color: var(--accent-light);
}

.icon-inline {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text);
  flex-shrink: 0;
}

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