/* ARP PATTERN EDITOR - Visual Step Sequencer
   Matches global-controls-section styling */

.arp-editor-section {
  width: 100% !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  padding: 20px !important;
  background: linear-gradient(135deg, #1a1a2e 0%, #0a0a0a 100%) !important;
  border-radius: 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  margin-top: 16px !important;
}

.arp-editor-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.arp-editor-header .section-label {
  font-size: 12px !important;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.arp-editor-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.arp-control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.arp-control-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Length Buttons */
.arp-length-btns,
.arp-mode-btns,
.arp-preset-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.arp-len-btn,
.arp-mode-btn,
.arp-preset-btn {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.arp-len-btn:hover,
.arp-mode-btn:hover,
.arp-preset-btn:hover {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: var(--accent);
  color: var(--text);
}

.arp-len-btn.active,
.arp-mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.3);
}

.arp-preset-btn {
  padding: 6px 12px;
}

.arp-preset-btn:active {
  transform: scale(0.95);
}

/* === VISUAL GRID === */
.arp-grid-container {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.arp-grid-labels {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 56px;
  flex-shrink: 0;
}

.arp-label-header {
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-tertiary);
  padding: 4px 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px 4px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: none;
}

.arp-note-label {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.arp-note-label .note-octave {
  font-size: 8px;
  color: var(--text-tertiary);
  font-weight: 400;
  opacity: 0.7;
}

.arp-rest-label {
  background: rgba(255, 92, 92, 0.08) !important;
  color: rgba(255, 92, 92, 0.7) !important;
  border: 1px dashed rgba(255, 92, 92, 0.25) !important;
}

.arp-grid {
  display: flex;
  gap: 6px;
  flex: 1;
}

.arp-step {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 48px;
  flex: 1;
}

.arp-step-header {
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-tertiary);
  padding: 4px 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px 4px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: none;
}

.arp-cell {
  height: 32px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.arp-cell:hover {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.4);
}

/* Active note cell - primary */
.arp-cell.active {
  background: var(--accent) !important;
  border-color: var(--accent-bright) !important;
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.5),
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.arp-cell.active::after {
  content: '';
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

/* Secondary note (dimmer) */
.arp-cell.active-secondary {
  background: rgba(var(--accent-rgb), 0.4) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.3);
}

.arp-cell.active-secondary::after {
  content: '';
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
}

/* Rest cell */
.arp-cell.rest-cell {
  background: rgba(255, 92, 92, 0.05);
  border: 1px dashed rgba(255, 92, 92, 0.2);
}

.arp-cell.rest-cell:hover {
  background: rgba(255, 92, 92, 0.12);
  border-color: rgba(255, 92, 92, 0.4);
}

.arp-cell.rest-cell.active {
  background: rgba(255, 92, 92, 0.25) !important;
  border: 2px solid rgba(255, 92, 92, 0.6) !important;
  box-shadow: 0 0 8px rgba(255, 92, 92, 0.3);
}

.arp-cell.rest-cell.active::after {
  content: '';
  width: 8px;
  height: 2px;
  background: rgba(255, 92, 92, 0.8);
  border-radius: 1px;
}

/* Disabled steps - keep clickable for auto-extend */
.arp-step.disabled {
  opacity: 0.2;
  cursor: pointer;
}

.arp-step.disabled .arp-cell {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

/* === VELOCITY SLIDERS === */
.arp-velocity-container {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: center;
}

.arp-velocity-label,
.arp-octave-label {
  width: 56px;
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.arp-velocity-sliders {
  display: flex;
  gap: 6px;
  flex: 1;
}

.arp-velocity-step {
  flex: 1;
  min-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.arp-velocity-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  cursor: pointer;
}

.arp-velocity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.4);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.arp-velocity-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6);
}

.arp-velocity-value {
  font-size: 8px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* === OCTAVE CONTROLS === */
.arp-octave-container {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
}

.arp-octave-controls {
  display: flex;
  gap: 6px;
  flex: 1;
}

.arp-octave-step {
  flex: 1;
  min-width: 48px;
  display: flex;
  justify-content: center;
}

.arp-octave-btns {
  display: flex;
  gap: 2px;
}

.arp-oct-btn {
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  color: var(--text-tertiary);
  font-size: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.arp-oct-btn:hover {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: rgba(var(--accent-rgb), 0.4);
  color: var(--text);
}

.arp-oct-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.3);
}

/* === ACTION BUTTONS === */
.arp-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.arp-action-btn {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.arp-clear-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}

.arp-clear-btn:hover {
  background: rgba(255, 92, 92, 0.1);
  border-color: rgba(255, 92, 92, 0.5);
  color: #ff6b6b;
}

.arp-send-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3);
}

.arp-send-btn:hover {
  background: var(--accent-bright);
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.4);
  transform: translateY(-1px);
}

.arp-send-btn:active {
  transform: translateY(0);
}

/* === PLAYBACK INDICATOR === */
.arp-step.playing .arp-step-header {
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.5);
}

/* === THEME OVERRIDES === */

/* Light theme */
body.light-theme .arp-editor-section {
  background: linear-gradient(135deg, #f0f0f5 0%, #e8e8ed 100%) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .arp-note-label,
body.light-theme .arp-step-header,
body.light-theme .arp-cell {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .arp-cell:hover {
  background: rgba(0, 102, 204, 0.1);
}

/* Sunset theme */
body.sunset-theme .arp-editor-section {
  background: linear-gradient(135deg, #2A1A1F 0%, #1A1215 100%) !important;
  border-color: rgba(255, 107, 91, 0.2) !important;
}

/* Ocean theme */
body.ocean-theme .arp-editor-section {
  background: linear-gradient(135deg, #0F1D2A 0%, #0A1520 100%) !important;
  border-color: rgba(0, 217, 217, 0.2) !important;
}

/* Violet theme */
body.violet-theme .arp-editor-section {
  background: linear-gradient(135deg, #1A1725 0%, #12101A 100%) !important;
  border-color: rgba(168, 85, 247, 0.2) !important;
}

/* Forest theme */
body.forest-theme .arp-editor-section {
  background: linear-gradient(135deg, #151F17 0%, #0F1510 100%) !important;
  border-color: rgba(74, 222, 128, 0.2) !important;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .arp-editor-controls {
    gap: 12px;
  }

  .arp-step {
    min-width: 40px;
  }

  .arp-cell {
    height: 28px;
  }

  .arp-grid-labels {
    width: 48px;
  }

  .arp-note-label {
    font-size: 8px;
    height: 28px;
  }
}

@media (max-width: 600px) {
  .arp-editor-section {
    padding: 12px !important;
  }

  .arp-editor-controls {
    flex-direction: column;
    gap: 12px;
  }

  .arp-grid-container {
    flex-direction: column;
  }

  .arp-grid-labels {
    flex-direction: row;
    width: 100%;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
  }

  .arp-note-label {
    flex: 1;
    min-width: 40px;
    height: auto;
    padding: 4px 6px;
    justify-content: center;
  }

  .arp-note-label .note-octave {
    display: none;
  }

  .arp-grid {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .arp-step {
    min-width: 36px;
  }

  .arp-cell {
    height: 24px;
  }

  .arp-velocity-container,
  .arp-octave-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .arp-velocity-label,
  .arp-octave-label {
    width: 100%;
  }

  .arp-velocity-sliders,
  .arp-octave-controls {
    width: 100%;
    overflow-x: auto;
  }

  .arp-velocity-step,
  .arp-octave-step {
    min-width: 36px;
  }

  .arp-actions {
    justify-content: center;
  }
}
