/* rockstar v1.1 by Pixamation - Web App Styles */

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

:root {
  --bg-dark: #1a1a2e;
  --bg-panel: #16213e;
  --bg-item: #0f3460;
  --accent-blue: #00d9ff;
  --accent-green: #00ff88;
  --accent-red: #ff4757;
  --accent-yellow: #ffd93d;
  --accent-orange: #ff9f43;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --border-color: #2a2a4a;
  --highlight-yellow: #ffff00;
  --pixamation-green: #7AC143;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--bg-panel), #1e3a5f);
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--accent-blue);
}

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

.app-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 217, 255, 0.4);
  transition: transform 0.3s, box-shadow 0.3s;
}

.app-logo:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(0, 217, 255, 0.6);
}

.app-header h1 {
  font-size: 20px;
  color: var(--accent-blue);
  text-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
  line-height: 1;
  margin: 0;
}

.pixamation-logo {
  height: 22px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.9;
  transition: opacity 0.3s;
}

.pixamation-logo:hover {
  opacity: 1;
}

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

.master-controls label {
  color: var(--text-secondary);
  font-size: 13px;
}

.master-volume-slider {
  width: 120px;
  cursor: pointer;
}

#masterVolumeValue {
  min-width: 40px;
  color: var(--accent-green);
  font-size: 13px;
}

/* Main Content */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Panel Styles */
section {
  padding: 10px;
  border-right: 1px solid var(--border-color);
}

section h2 {
  font-size: 14px;
  color: var(--accent-blue);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

/* Left Panel - Audio Decks */
.audio-decks-panel {
  width: 380px;
  min-width: 340px;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease;
}

.audio-decks-panel.layout-10x2 {
  width: 520px;
  min-width: 480px;
}

.audio-decks-panel.layout-10x2 .audio-deck {
  padding: 4px 6px;
}

.audio-decks-panel.layout-10x2 .deck-header {
  margin-bottom: 2px;
}

.audio-decks-panel.layout-10x2 .deck-timers {
  font-size: 11px;
  margin-bottom: 2px;
}

.audio-decks-panel.layout-10x2 .deck-controls button {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.audio-decks-panel.layout-10x2 .deck-visualizer {
  height: 24px;
}

.audio-decks-panel.layout-10x2 .deck-volume {
  max-width: 50px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.btn-layout-toggle {
  background: var(--bg-item);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-layout-toggle:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-layout-toggle.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: var(--bg-dark);
}

.layout-icon {
  font-size: 14px;
}

.audio-decks {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 10x2 Layout - Two columns with proper ordering */
.audio-decks-panel.layout-10x2 .audio-decks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(10, auto);
  grid-auto-flow: column;
  gap: 4px;
}

/* Compact Audio Deck */
.audio-deck {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 8px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.audio-deck:hover {
  border-color: var(--accent-blue);
}

.audio-deck.playing {
  border-color: var(--accent-green);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.audio-deck.paused {
  border-color: var(--accent-yellow);
}

.audio-deck.queued,
.audio-deck.playing.queued {
  border-left: 3px solid var(--accent-orange);
}

.deck-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.deck-number {
  background: var(--accent-blue);
  color: var(--bg-dark);
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 11px;
}

.deck-filename {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  font-size: 12px;
  color: var(--highlight-yellow);
  position: relative;
}

.deck-filename-inner {
  display: inline-block;
  padding-right: 50px;
}

/* Marquee scrolling animation for long filenames */
.deck-filename.scrolling .deck-filename-inner {
  animation: marquee-scroll 8s linear infinite;
}

@keyframes marquee-scroll {
  0% {
    transform: translateX(0);
  }
  10% {
    transform: translateX(0);
  }
  90% {
    transform: translateX(calc(-100% + 150px));
  }
  100% {
    transform: translateX(calc(-100% + 150px));
  }
}

.btn-queue {
  background: var(--bg-item);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  transition: all 0.2s;
}

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

.btn-queue.active {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: var(--bg-dark);
}

.btn-remove {
  background: var(--accent-red);
  border: none;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.btn-remove:hover {
  background: #ff6b7a;
}

/* Compact Timers */
.deck-timers {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.timer-separator {
  color: var(--text-secondary);
}

.timer.elapsed {
  color: var(--accent-green);
}

.timer.length {
  color: var(--accent-blue);
}

.timer.remaining {
  color: var(--accent-red);
  margin-left: auto;
}

/* Progress Bar */
.deck-progress {
  height: 4px;
  background: var(--bg-item);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
  cursor: pointer;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
  width: 0%;
  transition: width 0.1s linear;
}

/* Compact Deck Controls */
.deck-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.deck-visualizer {
  flex: 1;
  height: 28px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  margin-left: 4px;
}

.deck-controls button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: transform 0.1s, background 0.2s;
}

.deck-controls button:hover {
  transform: scale(1.1);
}

.deck-controls button:active {
  transform: scale(0.95);
}

.btn-play {
  background: var(--accent-green);
  color: var(--bg-dark);
}

.btn-pause {
  background: var(--accent-yellow);
  color: var(--bg-dark);
}

.btn-stop {
  background: var(--accent-red);
  color: white;
}

.deck-volume {
  flex: 1;
  cursor: pointer;
  max-width: 80px;
}

/* Center Panel - Hot Buttons */
.hot-buttons-panel {
  width: 260px;
  min-width: 220px;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
}

.hot-buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(10, auto);
  grid-auto-flow: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.hot-button {
  background: linear-gradient(180deg, #3a3a5a, #2a2a4a);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  min-height: 50px;
}

.hot-button:hover {
  border-color: var(--accent-blue);
  background: linear-gradient(180deg, #4a4a6a, #3a3a5a);
}

.hot-button.assigned {
  background: linear-gradient(180deg, #2a4a2a, #1a3a1a);
  border-color: var(--accent-green);
}

.hot-button.playing {
  background: linear-gradient(180deg, var(--accent-green), #00aa55);
  border-color: var(--accent-green);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 5px var(--accent-green); }
  50% { box-shadow: 0 0 20px var(--accent-green); }
}

.hot-number {
  font-size: 16px;
  font-weight: bold;
  color: var(--accent-blue);
  margin-bottom: 2px;
}

.hot-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hot-button.assigned .hot-label {
  color: var(--highlight-yellow);
}

.hot-buttons-hint {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

/* Right Panel - File Browser */
.file-browser-panel {
  flex: 1;
  min-width: 280px;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  border-right: none;
}

/* Directory Slots */
.directory-slots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.directory-slot {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  background: var(--bg-dark);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.directory-slot:hover {
  filter: brightness(1.1);
}

.directory-slot.active {
  border-width: 3px;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

/* Slot 1 - Blue */
.directory-slot.slot-1 {
  background: linear-gradient(135deg, #1a3a5c 0%, #0d1f33 100%);
  border-color: #00d4ff;
}
.directory-slot.slot-1.active {
  background: linear-gradient(135deg, #1f4a70 0%, #122a42 100%);
}
.directory-slot.slot-1 .dir-path {
  color: #00d4ff;
}

/* Slot 2 - Purple */
.directory-slot.slot-2 {
  background: linear-gradient(135deg, #3d1a5c 0%, #1f0d33 100%);
  border-color: #bf00ff;
}
.directory-slot.slot-2.active {
  background: linear-gradient(135deg, #4d2270 0%, #2a1242 100%);
}
.directory-slot.slot-2 .dir-path {
  color: #d966ff;
}

/* Slot 3 - Yellow */
.directory-slot.slot-3 {
  background: linear-gradient(135deg, #5c5c1a 0%, #33330d 100%);
  border-color: #ffdd00;
}
.directory-slot.slot-3.active {
  background: linear-gradient(135deg, #70701f 0%, #424212 100%);
}
.directory-slot.slot-3 .dir-path {
  color: #ffee55;
}

/* Slot 4 - Green */
.directory-slot.slot-4 {
  background: linear-gradient(135deg, #1a5c3a 0%, #0d331f 100%);
  border-color: #00ff88;
}
.directory-slot.slot-4.active {
  background: linear-gradient(135deg, #22704a 0%, #12422a 100%);
}
.directory-slot.slot-4 .dir-path {
  color: #66ffaa;
}

.btn-select-dir {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 9px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-select-dir:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.dir-path {
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.current-path-display {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--active-slot-color, var(--text-secondary));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Active slot color themes */
.file-browser-panel.slot-1-active {
  --active-slot-color: #00d4ff;
  --active-slot-bg: rgba(0, 212, 255, 0.1);
  --active-slot-border: #00d4ff;
}

.file-browser-panel.slot-2-active {
  --active-slot-color: #d966ff;
  --active-slot-bg: rgba(191, 0, 255, 0.1);
  --active-slot-border: #bf00ff;
}

.file-browser-panel.slot-3-active {
  --active-slot-color: #ffee55;
  --active-slot-bg: rgba(255, 221, 0, 0.1);
  --active-slot-border: #ffdd00;
}

.file-browser-panel.slot-4-active {
  --active-slot-color: #66ffaa;
  --active-slot-bg: rgba(0, 255, 136, 0.1);
  --active-slot-border: #00ff88;
}

.folder-item {
  background: var(--bg-dark) !important;
  color: var(--active-slot-color, var(--text-primary)) !important;
  font-weight: normal;
}

.folder-item:hover {
  background: var(--active-slot-bg, rgba(255, 255, 255, 0.05)) !important;
}

.folder-item .file-icon {
  color: var(--active-slot-color, var(--accent-yellow));
}

.search-container {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.search-input {
  flex: 1;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.btn-search {
  background: var(--accent-blue);
  border: none;
  color: var(--bg-dark);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 12px;
}

.btn-search:hover {
  background: #33e5ff;
}

/* File List */
.file-list-container {
  flex: 1;
  overflow: hidden;
}

.file-list {
  height: 100%;
  overflow-y: auto;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.file-list-empty {
  color: var(--text-secondary);
  text-align: center;
  padding: 30px 15px;
  font-size: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: background 0.2s, filter 0.2s;
  background: var(--active-slot-color, #888);
  color: #000;
  font-weight: 500;
}

.file-item:hover {
  filter: brightness(1.15);
}

.file-item.selected {
  filter: brightness(1.3);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Click-to-assign mode - visual indicator when file is selected */
.audio-deck.awaiting-file,
.hot-button.awaiting-file {
  animation: awaiting-pulse 1.5s ease-in-out infinite;
}

@keyframes awaiting-pulse {
  0%, 100% { 
    box-shadow: 0 0 0 0 rgba(0, 217, 255, 0);
  }
  50% { 
    box-shadow: 0 0 8px 2px rgba(0, 217, 255, 0.4);
  }
}

.file-item.dragging {
  opacity: 0.5;
}

.file-icon {
  margin-right: 8px;
  font-size: 14px;
}

.file-name {
  flex: 1;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status Bar */
.status-bar {
  background: var(--bg-dark);
  padding: 6px 15px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-secondary);
}

#statusTime {
  color: var(--accent-blue);
}

/* Context Menu */
.context-menu,
.deck-select-menu {
  position: fixed;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 0;
  min-width: 150px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.context-item,
.deck-select-item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  background: none;
  border: none;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  font-size: 12px;
}

.context-item:hover,
.deck-select-item:hover {
  background: var(--bg-item);
  color: var(--accent-blue);
}

/* Drop Overlay */
.drop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 26, 46, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.drop-overlay.active {
  display: flex;
}

.drop-overlay-content {
  text-align: center;
}

.drop-icon {
  font-size: 60px;
  display: block;
  margin-bottom: 15px;
}

.drop-text {
  font-size: 20px;
  color: var(--accent-blue);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-blue);
}

/* Drag and Drop */
.drag-over {
  border: 2px dashed var(--accent-blue) !important;
  background: rgba(0, 217, 255, 0.1) !important;
}

/* Input Range Styling */
input[type="range"] {
  -webkit-appearance: none;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: var(--bg-item);
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  margin-top: -4px;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #33e5ff;
}

/* Responsive */
@media (max-width: 1200px) {
  .hot-buttons-panel {
    width: 200px;
    min-width: 180px;
  }
  
  .audio-decks-panel {
    width: 320px;
    min-width: 280px;
  }
}

@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
  }
  
  .audio-decks-panel,
  .hot-buttons-panel,
  .file-browser-panel {
    width: 100%;
    min-width: unset;
    max-height: 40vh;
  }
  
  .hot-buttons-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
