/* Track Region Styles */
.track-region {
  position: absolute;
  background-color: #4a6b8a;
  border: 2px solid #5a7b9a;
  border-radius: 3px;
  height: calc(100%);
  margin: 0px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.1s ease;
  will-change: transform;
}

.track-region:hover {
  box-shadow: 0 0 0 1px #7a9bba;
}

.track-region.selected {
  /* box-shadow: 0 0 0 2px #ffffff, 0 0 8px rgba(255, 255, 255, 0.3); */ /* let's only apply a border */
  border-color: #ffffff;
}

.track-region.selected-secondary {
  border-color: rgba(255, 255, 255, 0.7);
}

.track-region.dragging {
  opacity: 0.8;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  z-index: 100;
  pointer-events: none;
  transform-origin: center center;
  animation: pulse 1.5s infinite;
  cursor: grabbing;
  transition: none; /* Remove transition during drag for immediate response */
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(122, 155, 186, 0.7);
  }
  70% {
    box-shadow: 0 0 0 5px rgba(122, 155, 186, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(122, 155, 186, 0);
  }
}

.region-header {
  background-color: #5a7b9a;
  color: #fff;
  padding: 2px 6px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: move;
  height: 18px;
  user-select: none;
}

.track-region:hover .region-header {
  background-color: #6a8baa;
}

.region-content {
  height: calc(100% - 18px);
  background-color: #87CEFA; /* Light blue */
  width: 100%;
  position: relative; /* Allow overlayed controls */
}

.region-content.audio-region-content {
  background-color: #90EE90; /* Light green for audio regions */
}

/* Audio region overrides */
.track-region.audio-region {
  background-color: #3a6b4a;
  border-color: #4a8b5a;
}

.track-region.audio-region:hover {
  box-shadow: 0 0 0 1px #6aab7a;
}

.track-region.audio-region.selected {
  border-color: #ffffff;
}

.track-region.audio-region.selected-secondary {
  border-color: rgba(255, 255, 255, 0.7);
}

.track-region[data-preview-region='true'] {
  opacity: 0.55;
  pointer-events: none;
}

.track-region.audio-region .region-header {
  background-color: #4a8b5a;
}

.track-region.audio-region:hover .region-header {
  background-color: #5a9b6a;
}

/* Left-side button cluster inside region-content */
.region-left-buttons {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  z-index: 2;
}

/* Shared style for all region content buttons */
.region-pencil-btn,
.region-waveform-btn,
.region-spectrogram-btn,
.region-hybrid-btn {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.region-pencil-btn:hover,
.region-spectrogram-btn:hover,
.region-hybrid-btn:hover {
  background: rgba(0, 0, 0, 0.35);
}

.region-waveform-btn {
  display: none;
}

.region-waveform-btn:hover {
  background: rgba(0, 0, 0, 0.35);
}

/* Fine-move widget: sits inline in the left button cluster */
.region-fine-move-widget {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
}

.region-fine-move-btn {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  padding: 2px;
  margin: 0;
  cursor: ew-resize;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.region-fine-move-btn:hover {
  background: rgba(0, 0, 0, 0.35);
}

.region-fine-move-label {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  padding: 2px 4px;
  font-size: 10px;
  white-space: nowrap;
  line-height: 1;
  user-select: none;
}

/* Instrument dropdown specific styles */
.instrument-dropdown .quant-dropdown {
  min-width: 80px;
  width: auto;
  right: auto;
  left: 0;
}

/* Settings dropdown specific styles */
.settings-dropdown .quant-dropdown {
  min-width: 100px;
  width: auto;
  right: auto;
  left: 0;
}
