/* ═══════════════════════════════════════════
   DJ DECKS — Browser Crossfader
   Professional DJ aesthetic
   ═══════════════════════════════════════════ */

:root {
  --bg: #0a0a0a;
  --bg-deck: #111111;
  --bg-surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-muted: #666;
  --deck-a: #00d4ff;
  --deck-b: #ff00d4;
  --deck-c: #ffd400;
  --green: #39ff14;
  --red: #ff3333;
  --orange: #ff8800;
  --radius: 8px;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', -apple-system, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ═══ APP LAYOUT ═══ */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
}

/* ═══ HEADER ═══ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.1em;
  color: var(--text);
}

.logo svg { color: var(--green); }

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

/* ═══ BUTTONS ═══ */
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

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

.btn-play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--text);
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-play:hover {
  background: var(--text);
  color: var(--bg);
}

.btn-play.playing {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
}

.deck-a .btn-play.playing { background: var(--deck-a); border-color: var(--deck-a); }
.deck-b .btn-play.playing { background: var(--deck-b); border-color: var(--deck-b); }

.btn-play-c {
  width: 44px;
  height: 44px;
}

.btn-cue {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-cue:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.btn-cue-c {
  width: 36px;
  height: 36px;
}

.btn-load {
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-load:hover {
  opacity: 0.8;
}

.btn-load-c {
  padding: 8px 14px;
  font-size: 11px;
}

/* ═══ DECKS ═══ */
.decks {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.deck {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-right: 1px solid var(--border);
  min-height: 0;
}

.deck-b {
  border-right: none;
  border-left: 1px solid var(--border);
}

.deck-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.deck-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
}

.deck-a .deck-label { color: var(--deck-a); }
.deck-b .deck-label { color: var(--deck-b); }

.deck-label-c {
  font-size: 18px;
  color: var(--deck-c);
}

.deck-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ═══ PLAYER ═══ */
.deck-player {
  flex: 1;
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  min-height: 0;
  margin-bottom: 12px;
}

.deck-player-c {
  flex: 1;
  min-height: 60px;
  margin-bottom: 0;
  margin-top: 8px;
}

.deck-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

.deck-placeholder svg { opacity: 0.3; }

.deck-placeholder p {
  font-size: 12px;
  font-family: var(--font-mono);
}

.deck-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
}

.deck-video iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.deck-video.active {
  display: block;
}

.deck-placeholder.hidden {
  display: none;
}

/* ═══ CONTROLS ═══ */
.deck-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.deck-controls-c {
  margin-bottom: 0;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  margin-left: auto;
}

.volume-control-c {
  flex: 1;
}

.volume-control label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 120px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: 2px solid var(--bg);
}

.deck-a .volume-slider::-webkit-slider-thumb { background: var(--deck-a); }
.deck-b .volume-slider::-webkit-slider-thumb { background: var(--deck-b); }

.volume-slider-c {
  max-width: 80px;
}

.volume-slider-c::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  background: var(--deck-c);
}

.volume-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 24px;
  text-align: right;
}

/* ═══ URL INPUT ═══ */
.deck-input {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.deck-input-c {
  margin-top: 8px;
}

.url-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.url-input:focus {
  border-color: var(--text);
}

.url-input-c {
  padding: 8px 12px;
  font-size: 11px;
}

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

/* ═══ CROSSFADER SECTION ═══ */
.crossfader-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  width: 200px;
  flex-shrink: 0;
}

.crossfader-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.crossfader-container {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 8px;
}

.cf-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  min-width: 20px;
  text-align: center;
}

.cf-a { color: var(--deck-a); }
.cf-b { color: var(--deck-b); }

.crossfader-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: linear-gradient(to right, var(--deck-a), var(--deck-b));
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.crossfader-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 32px;
  border-radius: 4px;
  background: var(--text);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.crossfader-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ═══ MASTER VU ═══ */
.master-section {
  width: 100%;
  margin-bottom: 20px;
}

.master-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 8px;
}

.master-vu {
  display: flex;
  gap: 4px;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
  padding: 2px;
}

.vu-bar {
  flex: 1;
  background: var(--green);
  border-radius: 2px;
  height: 100%;
  transition: width 0.1s;
  width: 0%;
}

/* ═══ DECK C (SMALL) ═══ */
.deck-c {
  width: 100%;
  padding: 0;
}

.deck-header {
  margin-bottom: 8px;
}

.deck-small .deck-header {
  margin-bottom: 6px;
}

/* ═══ FOOTER ═══ */
.footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.shortcuts {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.shortcuts span {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text);
  margin: 0 2px;
}

/* ═══ MODAL ═══ */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-deck);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
}

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

.modal-header h3 {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.05em;
}

.modal-close {
  width: 32px;
  height: 32px;
  font-size: 20px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
}

.shortcuts-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.shortcuts-table td:first-child {
  font-family: var(--font-mono);
  white-space: nowrap;
  width: 100px;
}

.shortcuts-table td:last-child {
  color: var(--text-muted);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
  .decks {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .deck {
    border-right: none !important;
    border-left: none !important;
    border-bottom: 1px solid var(--border);
  }

  .crossfader-section {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 12px 16px;
    gap: 16px;
  }

  .crossfader-container {
    max-width: 300px;
  }

  .footer {
    display: none;
  }
}

/* ═══ ACTIVE DECK HIGHLIGHT ═══ */
.deck.active-deck {
  background: rgba(255,255,255,0.02);
}

.deck-a.active-deck { border-top: 2px solid var(--deck-a); }
.deck-b.active-deck { border-top: 2px solid var(--deck-b); }

/* ═══ PULSE ANIMATION ═══ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.deck-status.loading {
  color: var(--orange);
  animation: pulse 1s infinite;
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
