/* Track grid */
.track-grid {
  display: block;
  height: 120px;
  min-width: calc(var(--max-number-of-bars) * var(--track-grid-bar-width));
  /* 32 bars * --track-grid-bar-width */
  background-size: var(--track-grid-bar-width) 120px;
  background-image:
    /* Vertical lines for bars */
    linear-gradient(to right,
      transparent calc(var(--track-grid-bar-width) - 1px), #3a3a3a calc(var(--track-grid-bar-width) - 1px), #3a3a3a var(--track-grid-bar-width));
  position: relative;
  border-bottom: 1px solid #3a3a3a;
}

.track-grid.pencil-cursor {
  cursor: crosshair;
}

.add-track-btn {
  background: transparent;
  border: none;
  outline: none;
  color: #999;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  height: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-track-btn:focus,
.add-track-btn:focus-visible {
  outline: none;
}

.add-track-btn:hover {
  color: #e0e0e0;
}

.track {
  display: flex;
  height: 120px;
  position: relative;
  border-bottom: none;
}

.track-info {
  width: var(--track-info-panel-width);
  height: 120px;
  padding: 15px 5px 15px 15px;
  background-color: #2d2d2d;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #3a3a3a;
  border-bottom: 1px solid #3a3a3a;
  flex-shrink: 0;
  box-sizing: border-box;
  cursor: grab;
  position: relative;
}

.track-info:active {
  cursor: grabbing;
}

.track-info.selected {
  background-color: #363636;
}

/* Drag and drop styles */
.track-info.drag-over {
  border-top: 2px solid #5a9fd4;
}

.track-grid.drag-over {
  border-top: 2px solid #5a9fd4;
}

/* Dragging state */
.track-info.dragging {
  opacity: 0.5;
  background-color: #444;
}

.track-grid.dragging {
  opacity: 0.5;
  background-color: #333;
}

/* Remove drag indicator since hover cursor is sufficient */

.track-name {
  font-size: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-name:hover {
  color: #5a9fd4;
}

.track-name:hover::before {
  content: "\270E";
  position: absolute;
  right: 0px;
  font-size: 16px;
  opacity: 1;
}

.track-controls {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.track-name-and-volume {
  display: flex;
  flex-direction: row;
  flex: 1;
  align-items: flex-start;
  gap: 8px;
}

.instrument-image {
  flex-shrink: 0;
  margin-top: -10px;
  margin-left: -10px;
}

.instrument-image img {
  display: block;
  border-radius: 4px;
}

.track-name-and-controls {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.volume-slider {
  margin-bottom: 15px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-slider .volume-label {
  flex-shrink: 0;
  font-size: 9px;
  color: #aaa;
  min-width: 22px;
  text-align: left;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.volume-slider .volume-label-clickable {
  cursor: pointer;
}

.volume-slider .volume-label-clickable:hover {
  color: #ddd;
}

.volume-slider .volume-label-input {
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 3px;
  color: #e0e0e0;
  padding: 0 2px;
  width: 36px;
  outline: none;
}

.volume-slider input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 6px;
}

.volume-slider .reset-volume {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #3a3a3a;
  color: #e0e0e0;
  /* border: 1px solid #444; */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
}

.volume-slider .reset-volume:hover {
  background: #4a4a4a;
}

.pan-controls {
  display: flex;
}

.pan-controls button {
  background: #3a3a3a;
  border: none;
  color: #e0e0e0;
  margin-right: 5px;
  width: 24px;
  height: 24px;
  font-size: 12px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pan-controls button.solo.active {
  background: #c8a400;
  /* yellow */
  color: #101010;
}

.pan-controls button.mute.active {
  background: #d32f2f;
  /* red */
  color: #ffffff;
}

.pan-controls button.automation.active {
  background: #d7eef9;
  color: #101010;
}

.track-grid.automation-active {
  position: relative;
}

.track-automation-lane {
  position: absolute;
  inset: 0;
  z-index: 30;
  cursor: default;
}

.track-automation-lane.pencil-cursor {
  cursor: crosshair;
}

.track-automation-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.track-automation-center-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.track-automation-svg {
  position: absolute;
  inset: 0;
}

.track-automation-line {
  pointer-events: none;
}

.track-automation-point {
  cursor: pointer;
}

.track-automation-point.selected {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.35));
}

.track-automation-value {
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  user-select: none;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.7);
  stroke-width: 2px;
  stroke-linejoin: round;
}

.track-automation-selection-box {
  position: absolute;
  border: 1px solid rgba(135, 206, 250, 0.85);
  background: rgba(135, 206, 250, 0.15);
  pointer-events: none;
}
