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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: #e0e0e0;
  background-color: #1e1e1e;
  height: 100vh;
  overflow: hidden;
}

.daw-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #2d2d2d;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: #1a1a1a;
  border-bottom: 1px solid #3d3d3d;
}

.logo {
  font-size: 1.2rem;
  font-weight: bold;
  color: #3498db;
  margin-right: 2rem;
}

/* Transport Controls */
.transport-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background-color: #252525;
  border-bottom: 1px solid #3d3d3d;
  margin: 0;
}

.transport-controls button {
  padding: 0.5rem 1rem;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.transport-controls button:hover {
  background-color: #2980b9;
}

.transport-controls .add-track {
  margin-left: auto;
}

.time-display {
  font-family: monospace;
  font-size: 1.1rem;
  color: #e0e0e0;
  padding: 0.5rem;
  background-color: #333;
  border-radius: 4px;
}

.tempo-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background-color: #333;
  border-radius: 4px;
}

.tempo-controls label {
  font-size: 0.9rem;
  color: #e0e0e0;
  white-space: nowrap;
}

.tempo-input {
  width: 60px;
  padding: 0.3rem;
  background-color: #1a1a1a;
  border: 1px solid #3d3d3d;
  color: #e0e0e0;
  border-radius: 4px;
  font-size: 0.9rem;
  text-align: center;
}

.tempo-input:focus {
  outline: none;
  border-color: #3498db;
}

.tempo-unit {
  font-size: 0.8rem;
  color: #999;
  white-space: nowrap;
}

.click-toggle {
  padding: 0.5rem 1rem;
  background-color: #555;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-size: 0.9rem;
}

.click-toggle:hover {
  background-color: #666;
}

.click-toggle.active {
  background-color: #e74c3c;
}

.click-toggle.active:hover {
  background-color: #c0392b;
}

/* Timeline */
.timeline-container {
  height: 60px;
  background-color: #252525;
  border-bottom: 1px solid #3d3d3d;
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.timeline-ruler {
  height: 20px;
  background-color: #1a1a1a;
  border-bottom: 1px solid #3d3d3d;
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 300px;
}

.timeline-ruler::before {
  content: '';
  position: absolute;
  left: 300px;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: #3d3d3d;
}

.timeline-grid {
  height: calc(100% - 20px);
  background-color: #252525;
  position: relative;
  padding-left: 300px;
}

/* Time markers */
.timeline-ruler::after {
  content: '';
  position: absolute;
  left: 300px;
  right: 0;
  top: 0;
  bottom: 0;
  background-image: linear-gradient(to right, #3d3d3d 1px, transparent 1px);
  background-size: 100px 100%;
  background-size: 100px 100%; /* 1 second = 100px */
  pointer-events: none;
}

/* Time labels */
.time-marker {
  position: absolute;
  top: 0;
  font-size: 10px;
  color: #666;
  padding: 2px 4px;
  transform: translateX(-50%);
}

/* Grid lines */
.timeline-grid::after {
  content: '';
  position: absolute;
  left: 300px;
  right: 0;
  top: 0;
  bottom: 0;
  background-image: linear-gradient(to right, #3d3d3d 1px, transparent 1px);
  background-size: 100px 100%; /* 1 second = 100px */
  opacity: 0.3;
  pointer-events: none;
}

/* Track Grid */
.track-grid-container {
  display: grid;
  grid-template-columns: 200px 1fr;
  width: 100%;
  height: 100%;
  background-color: #2d2d2d;
  position: relative;
}

.track-names-column {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
  background-color: #252525;
  border-right: 1px solid #3d3d3d;
  overflow-y: auto;
  flex-shrink: 0;
  height: 100%;
}

.timeline-content-column {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.timeline-ruler {
  height: 20px;
  background-color: #1a1a1a;
  border-bottom: 1px solid #3d3d3d;
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 0;
}

.timeline-grid {
  height: 40px;
  background-color: #252525;
  position: relative;
  padding-left: 0;
}

.audio-content-column {
  flex: 1;
  overflow: auto;
  background-color: #2d2d2d;
  position: relative;
  width: 100%;
}

/* Ensure audio files list aligns with timeline */
.audio-files-list {
  position: relative;
  height: 100%;
  width: 100%;
}

.track-list, .tracks-list {
  display: flex;
  flex-direction: column;
}

/* Track Styles */
.track {
  height: 80px;
  background-color: #2d2d2d;
  border-bottom: 1px solid #3d3d3d;
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
}

.track.selected {
  background-color: #3d3d3d;
}

.track.drag-target {
  background-color: #2c3e50;
  box-shadow: inset 0 0 0 2px #3498db;
}

.track-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-bottom: 1px solid #3d3d3d;
  background-color: #252525;
}

.track-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0 0.5rem;
}

.track-name {
  font-size: 0.9rem;
  color: #e0e0e0;
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}

.track-name:hover {
  background-color: #3d3d3d;
}

.track-name:focus {
  background-color: #3d3d3d;
  box-shadow: 0 0 0 2px #3498db;
}

.track-name:empty::before {
  content: 'Click to edit name';
  color: #666;
  font-style: italic;
}

.track-controls {
  display: flex;
  gap: 0.3rem;
}

.track-controls button {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  background-color: #3498db;
  color: white;
  transition: background-color 0.2s;
}

.track-controls button:hover {
  background-color: #2980b9;
}

.track-controls button.active {
  background-color: #e74c3c;
}

.track-controls button.active:hover {
  background-color: #c0392b;
}

.track-record-button {
  padding: 0.5rem 1rem;
  background-color: #e74c3c;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.track-record-button:hover {
  background-color: #c0392b;
}

.track-record-button:disabled {
  background-color: #7f8c8d;
  cursor: not-allowed;
}

/* Project Selection Modal */
.project-selection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background-color: #2d2d2d;
  padding: 2rem;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transform: translate(-50%, -50%);
  position: absolute;
  top: 50%;
  left: 50%;
}

.modal-content h2 {
  margin-bottom: 1.5rem;
  color: #e0e0e0;
  text-align: center;
}

/* Connection Status */
.connection-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.start-collaboration {
  padding: 8px 16px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
}

.start-collaboration:hover {
  background-color: #45a049;
}

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

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-indicator.connected {
  background-color: #4CAF50;
}

.status-indicator.disconnected {
  background-color: #f44336;
}

.session-token {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #f5f5f5;
  padding: 4px 8px;
  border-radius: 4px;
}

.token-label {
  font-weight: 500;
  color: #666;
}

.token-value {
  font-family: monospace;
  font-size: 14px;
  color: #333;
}

.copy-token {
  padding: 2px 8px;
  background-color: #e0e0e0;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

.copy-token:hover {
  background-color: #d0d0d0;
}

/* Buttons */
button {
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #2980b9;
}

/* Inputs */
input {
  background-color: #333;
  border: 1px solid #3d3d3d;
  color: #e0e0e0;
  padding: 0.5rem;
  border-radius: 4px;
}

input:focus {
  outline: none;
  border-color: #3498db;
}

/* Work Directory Section */
.work-directory-section {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.work-directory {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.work-directory:hover {
  background-color: #2980b9;
}

/* Project Selection */
.projects-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.project-button {
  display: block;
  width: 100%;
  max-width: 400px;
  margin: 0.5rem auto;
  padding: 1.2rem 2rem;
  background: linear-gradient(90deg, #28a745 60%, #34d058 100%);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.08);
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.project-button:hover {
  background: linear-gradient(90deg, #218838 60%, #28a745 100%);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 16px rgba(40, 167, 69, 0.15);
}

.create-project-section {
  display: flex;
  gap: 1rem;
}

.project-name-input {
  flex: 1;
  padding: 0.8rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 1rem;
}

.create-project {
  padding: 0.8rem 1.5rem;
  background-color: #2ecc71;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.create-project:hover {
  background-color: #27ae60;
}

/* Main Controls */
.main-controls {
  display: flex;
  flex-direction: column;
  flex: 1;
  background-color: #2d2d2d;
  margin: 0;
  padding: 0;
}

/* Track Management */
.track-management {
  margin-bottom: 2rem;
}

.track-controls-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.new-track-name {
  flex: 1;
  padding: 0.8rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 1rem;
}

.add-track {
  padding: 0.8rem 1.5rem;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.add-track:hover {
  background-color: #2980b9;
}

.audio-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.audio-file {
  position: absolute;
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background-color: #2d2d2d;
  border-bottom: 1px solid #3d3d3d;
  cursor: grab;
  user-select: none;
  transition: transform 0.2s ease;
  z-index: 1;
  height: 100%;
  min-width: 120px;
}

.audio-file:hover {
  z-index: 2;
  transform: scale(1.02);
}

.audio-file-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

.audio-waveform {
  width: 100%;
  height: calc(100% - 20px);
  object-fit: cover;
  border-radius: 3px;
  margin-bottom: 2px;
}

.audio-file-name {
  color: #e0e0e0;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: left;
  height: 18px;
  line-height: 18px;
}

.audio-file button {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  background-color: #e74c3c;
  color: white;
  align-self: flex-start;
}

.audio-file button:hover {
  background-color: #c0392b;
}

/* Sound Clips */
.sound-clips {
  margin-bottom: 2rem;
}

.clip {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.clip audio {
  flex: 1;
}

.project-controls {
  margin-bottom: 2rem;
  padding: 1rem;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}

.play-all-tracks {
  padding: 0.8rem 1.5rem;
  background-color: #2ecc71;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-size: 1rem;
}

.play-all-tracks:hover {
  background-color: #27ae60;
}

/* Context Menu */
.context-menu {
  position: fixed;
  background-color: #2d2d2d;
  border: 1px solid #3d3d3d;
  border-radius: 4px;
  padding: 0.5rem 0;
  min-width: 150px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.context-menu-item {
  padding: 0.5rem 1rem;
  color: #e0e0e0;
  cursor: pointer;
  transition: background-color 0.2s;
}

.context-menu-item:hover {
  background-color: #3d3d3d;
}

.context-menu-item.delete-audio {
  color: #e74c3c;
}

.context-menu-item.delete-audio:hover {
  background-color: #c0392b;
  color: white;
}

.playhead {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 100%;
  background: #ff5252;
  z-index: 20;
  pointer-events: none;
}

/* --- Robust Track Grid Layout --- */
.track-grid-container {
  display: grid;
  grid-template-columns: 200px 1fr;
  width: 100%;
  height: 100%;
  background-color: #2d2d2d;
  position: relative;
}

.track-names-column {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
  background-color: #252525;
  border-right: 1px solid #3d3d3d;
  overflow-y: auto;
  flex-shrink: 0;
  height: 100%;
}

.timeline-content-column {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.timeline-ruler {
  height: 20px;
  background-color: #1a1a1a;
  border-bottom: 1px solid #3d3d3d;
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 0;
}

.timeline-grid {
  height: 40px;
  background-color: #252525;
  position: relative;
  padding-left: 0;
}

.audio-content-column {
  flex: 1;
  overflow: auto;
  background-color: #2d2d2d;
  position: relative;
  width: 100%;
}

/* Remove or update any other padding-left: 200px or similar from .timeline-ruler, .timeline-grid, etc. */

.timeline-ruler::before,
.timeline-ruler::after,
.timeline-grid::after {
  left: 0 !important;
}

.mute-button, .solo-button {
  min-width: 30px;
  font-weight: bold;
}

.audio-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-x: hidden;
}

.audio-file-shadow {
  background-color: #3498db;
  border: 2px dashed #2980b9;
  border-radius: 4px;
  pointer-events: none;
  transition: opacity 0.2s ease;
  opacity: 0.7;
  max-height: 48px;
  min-width: 120px;
  width: 160px;
  height: 48px !important;
  z-index: 1000;
  box-sizing: border-box;
  overflow: hidden;
}

.audio-file-shadow .audio-file-content {
  height: 100%;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.5;
}

.join-session-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #3d3d3d;
}

.join-session-section h3 {
  color: #e0e0e0;
  margin-bottom: 1rem;
  text-align: center;
}

.join-session-inputs {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.session-token-input {
  flex: 1;
  padding: 0.8rem;
  background-color: #333;
  border: 1px solid #3d3d3d;
  color: #e0e0e0;
  border-radius: 4px;
}

.join-session {
  padding: 0.8rem 1.5rem;
  background-color: #2ecc71;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.join-session:hover {
  background-color: #27ae60;
}

/* Live Waveform Styles */
.live-waveform-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
  border: 2px solid #e74c3c; /* Debug border */
  background: rgba(231, 76, 60, 0.1); /* More visible background */
}

.live-waveform-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.9; /* More visible */
  mix-blend-mode: screen;
  border: 1px solid #e74c3c; /* Debug border for canvas */
}

/* Recording indicator animation */
@keyframes recording-pulse {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

.live-waveform-container canvas {
  animation: recording-pulse 1s ease-in-out infinite;
}

/* Track recording state */
.track.recording .track-header {
  background-color: rgba(231, 76, 60, 0.2);
  border-left: 3px solid #e74c3c;
}

.track.recording .track-record-button {
  background-color: #e74c3c;
  animation: recording-pulse 1s ease-in-out infinite;
}

.track.recording .track-record-button:hover {
  background-color: #c0392b;
} 