/* Custom LFO Editor - matches app theme */

.lfo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  display: none; /* toggled by JS */
}

.lfo-modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(935px, 78.2vw);
  background: #0f0f10;
  border: 1px solid #2a2a2e;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  overflow: hidden;
}

.lfo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #141416;
  border-bottom: 1px solid #242429;
  min-height: 44px;
}

.lfo-modal-title {
  color: #d8d8dc;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.lfo-modal-close {
  min-width: 28px;
  height: 28px;
  line-height: 26px;
  padding: 0 8px;
  border-radius: 4px;
}

.lfo-modal-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 12px 12px 12px;
  /* Prevent layout recalculation from affecting grid */
  contain: layout;
}

.lfo-canvas-wrap {
  position: relative;
  background: #0a0a0b;
  border: 1px solid #1f1f23;
  border-radius: 4px;
  overflow: hidden;
  /* Reserve space for scrollbar to prevent width changes */
  padding-right: 4px;
  box-sizing: border-box;
  /* Prevent layout recalculation */
  contain: layout;
  /* Lock width to prevent grid recalculation */
  min-width: 0;
}

.lfo-canvas {
  display: block;
  width: 100%;
  height: 360px; /* fixed height - no expand/animate */
  background: #0b0b0c;
  cursor: crosshair;
}

.lfo-side-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0px 8px 14px;
  background: #101012;
  border-left: 1px solid #1f1f23;
  border-radius: 0 6px 6px 0;
  width: fit-content;
  min-width: 100px;
}

.lfo-side-label {
  color: #a9abb3;
  font-size: 12px;
  letter-spacing: 0.6px;
  margin-bottom: 2px;
}

.lfo-snap-row {
  display: flex;
  gap: 16px;
  align-items: center;
}

.lfo-checkbox {
  color: #c6c8d0;
  font-size: 12px;
}

.lfo-reset-btn {
  margin-top: 8px;
  width: 120px;
  border-radius: 4px;
  height: 30px;
}

.lfo-actions-row {
  display: flex;
  justify-content: flex-start;
}

/* Custom checkboxes */
.lfo-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.lfo-checkbox input {
  appearance: none;
  width: 0;
  height: 0;
  position: absolute;
  opacity: 0;
}
.lfo-checkbox-box {
  font-family: "Noto Sans", sans-serif;
  background: var(--control-bg, #37373766);
  color: var(--text-secondary, #aaa);
  border: none;
  border-radius: 2px;
  padding: 1px 2px;
  cursor: pointer;
  font-size: 8px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 16px;
  height: 14px;
  font-weight: 500;
}
.lfo-checkbox-box:hover {
  background: #3c3c45;
  transform: translateY(-1px);
}
.lfo-checkbox input:checked + .lfo-checkbox-box {
  background: var(--accent-color, #c9c9c9);
  color: #181820;
  font-weight: bold;
  box-shadow: 0 0 3px rgba(201, 201, 201, 0.25);
}
.lfo-checkbox input:checked + .lfo-checkbox-box:hover {
  background: #d6d6d6;
  transform: translateY(-1px);
  box-shadow: 0 0 4px rgba(201, 201, 201, 0.3);
}

/* Grid Y Scale slider and value */
.lfo-scale-value {
  color: #a9abb3;
  font-size: 12px;
  letter-spacing: 0.6px;
  margin-left: 4px;
}

/* Grid Y Scale slider - wrapper to match master volume structure */
.lfo-slider-wrapper {
  position: relative;
  width: 100px;
  height: 10px;
}

.lfo-slider {
  width: 100%;
  height: 6px !important;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
  background: #0f0f10 !important;
  border: 1px solid rgba(160, 160, 160, 0.4);
  outline: none;
  -webkit-appearance: none !important;
  appearance: none !important;
  -moz-appearance: none !important;
  margin: 0;
  padding: 0;
}

/* Fill effect - dark modal background */
.lfo-slider::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--slider-fill, 0%);
  border-radius: 3px;
  background: linear-gradient(to right,
    rgba(201, 201, 201, 0.3) 0%,
    rgba(201, 201, 201, 0.25) 100%);
  pointer-events: none;
  z-index: 1;
  transition: width 0.05s linear;
}

.lfo-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px !important;
  border-radius: 3px;
  background: transparent !important;
  border: none;
}

.lfo-slider::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 20px !important;
  height: 8px !important;
  border-radius: 4px !important;
  background: var(--accent-color, #c9c9c9) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
  cursor: pointer;
  border: none !important;
  transition: left 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  opacity: 1;
  margin-top: -1px;
  position: relative;
  z-index: 2;
}

.lfo-slider::-webkit-slider-thumb:hover {
  background: #d6d6d6 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6) !important;
  transform: none !important;
}

.lfo-slider::-moz-range-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: transparent;
  border: none;
}

.lfo-slider::-moz-range-thumb {
  width: 20px !important;
  height: 8px !important;
  border-radius: 4px !important;
  background: var(--accent-color, #c9c9c9) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
  cursor: pointer;
  border: none !important;
  transition: left 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  opacity: 1;
  position: relative;
  z-index: 2;
}

.lfo-slider::-moz-range-thumb:hover {
  background: #d6d6d6 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6) !important;
}

/* Responsive */
@media (max-width: 860px) {
  .lfo-modal-body {
    grid-template-columns: 1fr;
  }
  .lfo-canvas {
    height: 240px;
  }
  .lfo-side-controls {
    border-left: none;
    border-top: 1px solid #1f1f23;
    border-radius: 0 0 6px 6px;
  }
}

/* Custom scrollbar for LFO editor */
.lfo-scrollbar {
  position: absolute;
  right: 0;
  top: 0;
  width: 4px;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  box-sizing: border-box;
  overflow: hidden;
  /* Always reserve space to prevent layout shifts - use opacity only for visibility */
  visibility: visible;
  opacity: 0;
  transition: opacity 0.15s ease;
  /* Ensure no margins or borders affect layout */
  margin: 0;
  padding: 0;
  border: none;
}

.lfo-scrollbar-track {
  width: 100%;
  height: 100%;
  background: transparent;
  position: relative;
  cursor: pointer;
  border: none;
  /* Use box-shadow instead of border to prevent layout shifts */
  box-shadow: inset -1px 0 0 rgba(160, 160, 160, 0.15);
  box-sizing: border-box;
  pointer-events: auto;
}

.lfo-scrollbar-thumb {
  position: absolute;
  width: calc(100% - 2px);
  left: 1px;
  background: rgba(160, 160, 160, 0.4);
  border-radius: 2px;
  cursor: grab;
  transition: background 0.2s;
  min-height: 20px;
}

.lfo-scrollbar-thumb:hover {
  background: rgba(160, 160, 160, 0.6);
}

.lfo-scrollbar-thumb:active {
  cursor: grabbing;
  background: rgba(160, 160, 160, 0.8);
}

