:root {
  --knob-size: 32px;
  --waveshape-svg-width: 28px;
  --waveshape-svg-height: 7px;
  --folder-anchored-height: 26px;
}

#toggleClick svg {
  width: 30px;
}

#toggleClick.enabled {
  background-color: green;
}

#toggleClick.highlighted {
  border-color: #6e6e6e !important;
}

svg {
  /* width: 90%; */
  height: var(--header-btn-height);
  user-select: none;
  touch-action: none;
}

svg {
  width: 100%;
  height: 100%;
}

svg.toggleFullScreen {
  width: 65%;
}

svg#microphone {
  width: 40%;
}

/* Dual Button */
.dual-btn {
  position: absolute;
  z-index: 0;
  background-color: var(--button-bg);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.header-btn.dual {
  position: relative;
  background-color: transparent;
  z-index: 1;
  font-size: 28px;
  font-weight: bold;
}

.dual-btn .label {
  color: #fff109;
  background-color: black;
  font-size: 13px;
}

.dual-btn #octave-value {
  font-weight: bold;
  font-size: 28px;
  background-color: black;
  color: #bccc39;
}

/* OCTAVE*/
#octave-down,
#octave-up {
  width: 55px;
}

#octave-down {
  background-color: #ff000010;
  border-right: none;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

#octave-up {
  background-color: #3700ff10;
  border-left: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Dropdown */
select {
  outline: none;
}

select option {
  font-family: 'Courier New', Courier, monospace;
  font-size: 28px;
  text-align: left;
  background-color: #333;
}

select.show-scale {
  font-size: 14px;
}

#transpose-dropdown {
  background-color: var(--root-note-color);
}

/* Svg Button */
.svg-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px;
  border-radius: 4px;
  width: 100%;
}

.svg-btn.horizontal {
  flex-direction: row;
}

.svg-btn .overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 9;
}

.svg-btn .svg {
  display: flex;
}

/* KNOB */
.knob-line,
.knob-col {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
  padding-left: 8px;
  border: 1px solid transparent;
  position: relative;
  padding-bottom: 6px;
  background-color: #09141e;
}

.knob-line {
  justify-content: space-around;
}

.knob-col {
  flex-direction: column;
  justify-content: space-around;
  gap: 8px;
}

.knob-line:nth-child(even) {
  background-color: #051727;
}

.knob {
  background: transparent;
  user-select: none;
  border-radius: 5px;
  position: relative;
  color: #ccc;
  width: calc(var(--knob-size) + 10px);
  border: 1px solid transparent;
}

.knob.selected {
  border-color: coral;
}

.knob-inner {
  width: var(--knob-size);
  height: var(--knob-size);
  position: relative;
  user-select: none;
  transition: var(--knob-transition);
}

.knob-inner svg {
  width: var(--knob-size);
  height: var(--knob-size);
}

.knob-label {
  font-size: 14px;
  transform: translateX(-2px);
}

.knob.gear-knob .knob-label {
  display: none;
}

.knob .value {
  font-size: 14px;
  padding: 0.1em 0.2em;
  color: #64ffc4;
  background: #161616;
  border-radius: 5px;
  position: absolute;
  bottom: 0;
  right: 0;
  transform: translate(30%, 40%);
  font-family: Arial, Helvetica, sans-serif;

}

.knob.gear-knob .value {
  font-size: 18px;
}

.knob.clone {
  width: 58px;
  padding: 4px 6px;
}

.knob.gear-knob.clone .knob-label {
  display: block;
}

.knob.clone .knob-inner {
  width: 48px;
  height: 48px;
}

.knob.clone .knob-inner svg {
  width: 48px;
  height: 48px;
}

.knob.clone .value {
  font-size: 13px;
  transform: translate(10%, 30%);
}

#clickLevelKnob {
  width: 100%;
  display: flex;
  justify-content: center;
  border: 1px solid #6e6e6e;
  border-radius: 5px;
}

/* TRACK CONTROLS (Anchored Controls) */

#justControlsBackdrop,
#trackControlsBackdrop {
  position: fixed;
  background-color: #000000c7;
  width: 100%;
  height: 100%;
  z-index: 20;
  top: 0;
  color: transparent;
}

#justControlsBackdrop {
  display: none;
  position: absolute;
  background-color: #000000a8;
}

#app[data-mapping-sequencer="1"] #justControlsBackdrop {
  display: block;
}

.track-controls-container {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 2px;
  background-color: #1e1e1e;
  z-index: 25;
  max-width: 100%;
  /* nuevo: */
  max-height: 90vh;
  overflow-y: auto;
}

#anchoredInstrumentControls,
#anchoredEffectControls {
  width: 99vw;
  border: 1px solid #a6411c;
}

#anchoredInstrumentControls {
  position: relative;
  margin-bottom: 4px;
  background-color: #ff6c0030;
}

#instrumentControlsFoldedOverlay {
  background-color: #261800;
}

#anchoredInstrumentControls.folded #instrumentModules,
#anchoredEffectControls.folded #effectModules {
  height: 0 !important;
  overflow: hidden;
}

/* CONTROLS HEADER */

.controls-header {
  background-color: #161616;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: none;
  border-bottom: 1px solid;
}

.controls-header.instrument {
  border-color: #a6411c;
}

.controls-header.effects {
  border-color: teal;
}

.folded .controls-header {
  border-bottom: none;
}

.controls-header .heading {
  padding-left: 4px;
  font-size: 16px;
  line-height: 32px;
  font-weight: normal;
}

.folded #instrumentHeading {
  display: none;
}

#controlsHeaderInstrumentName {
  display: none;
}

.folded #controlsHeaderInstrumentName {
  display: block;
}

.controls-header .left-side {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none;
  padding: 7px 4px;
}

.controls-header .left-side.highlighted {
  background-color: #ffffff30;
}

.controls-header .right-side {
  display: flex;
}

.controls-header .btn {
  min-width: 42px;
  text-align: center;
}

.expand-icon-container {
  display: flex;
  align-items: center;
  display: none;
}

.expand-icon {
  border: 3px solid #bbbbbb;
  width: 20px;
  height: 19px;
  border-radius: 3px;
}

.minus-sign-container {
  display: flex;
  align-items: center;
}

.minus-sign {
  border-bottom: 4px solid #bbbbbb;
  width: 20px;
  height: 19px;
}

.folded .expand-icon-container {
  display: flex;
}

.folded .minus-sign-container {
  display: none;
}

.add-module-container {
  display: flex;
  align-items: center;
}

.add-module-btn {
  padding: 1px 16px;
  font-size: 38px;
  font-weight: bold;
  border: none;
}

.add-module-btn.highlighted {
  background-color: #ffffff30;
}

.add-module-btn.instrument {
  color: coral;
}

.add-module-btn.effects {
  color: #00f9f9;
}

#instrumentControlsFoldedOverlay,
#effectControlsFoldedOverlay {
  display: none;
  align-items: center;
  position: absolute;
  z-index: 25;
  width: 100%;
  height: 100%;
  font-size: 18px;
}

#anchoredEffectControls {
  position: relative;
  background-color: #00d5d530;
  border: 1px solid teal;
  padding: 1px;
}

#effectControlsFoldedOverlay {
  background-color: #003939;
}

/* Instrument/Effect RACKS: */

.instrument-rack {
  width: 100%;
  overflow-x: auto;
}

.effects-rack {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  /* overflow-x: auto; */
  column-gap: 6px;
  row-gap: 2px;
  padding-bottom: 4px;
}

/* AUDIO MODULES */

.audio-module {
  position: relative;
  background-color: #111;
  padding-bottom: 4px;
}

legend {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  gap: 0.5rem;
}

.module-name {
  padding: 6px;
  font-weight: normal;
  width: 100%;
  border: 1px solid transparent;
}

.delete-btn {
  padding: 1px 1px;
  border: 1px solid transparent;
  background-color: black;
  max-width: 32px;
  background-color: #003939;
}

.delete-btn svg {
  margin-top: 5px;
  width: 28px;
  height: 24px;
}

#instrumentModules {
  position: relative;
}

.instrument-rack {
  position: absolute;
}

.instrument-rack legend {
  color: #ff6c00;
  background-color: #421c00;
}

.effects-rack legend {
  color: #00d5d5;
  background-color: #002828;
}

.audio-module.folded {
  min-width: 34px;
  max-width: 34px;
  max-height: 146px;
  /* height: 128px; */
  overflow: hidden;
}

.audio-module.folded legend {
  display: none;
}

.audio-module:not(.folded) .folded-overlay {
  display: none;
}

.folded-overlay {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  padding-top: 12px;
  font-size: 17px;
  border: 1px solid transparent;
}

.instrument-rack .folded-overlay {
  background-color: #311a09;
}

.effects-rack .folded-overlay {
  background-color: rgba(0, 46, 46, 1);
}

.audio-module.Distortion.folded {
  min-height: 140px;
  padding-bottom: 22px;
}

/* Custom Dropdown */
.module-dropdown {
  position: relative;
  border: 1px solid #ccc;
  background-color: #222;
  z-index: 15;
}

.module-dropdown .options {
  border: 1px solid #aaa;
  background-color: #222;
  position: absolute;
  bottom: -1px;
  left: -1px;
  z-index: 1000;
}

.module-dropdown .option {
  padding: 6px 10px;
}

.module-dropdown .option.is-current {
  background-color: #454545;
}

.module-dropdown .current {
  text-align: center;
  padding: 2px 4px;
}

/* Surgeon */
.audio-module.surgeon {
  padding-top: 2px;
}

.surgeon .presets {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 7px 4px;
}

.surgeon .preset-btn {
  border: 1px solid white;
  font-size: 14px;
  padding: 4px;
}

.surgeon .preset-btn.selected {
  border-color: coral;
}

.surgeon .knob-line {
  border: none;
  margin-left: 1px;
  border-left: 3px solid;
}

.surgeon .knob-line.A {
  border-color: #ffa60080;
}

.surgeon .knob-line.B {
  border-color: #ff00ff80;
}

.surgeon .knob-line.C {
  border-color: #00f2f280;
}

.surgeon .knob-line.D {
  border-color: #ffff0080;
}

/* Surgeon config */
.surgeon-config-selector {
  position: relative;
  width: 100%;
  background-color: transparent;
  z-index: 10;
  /* z-index: 1000; */
  height: 65px;
}

.surgeon-config-selector svg {
  height: unset;
  width: unset;
}

.surgeon-config-options {
  position: absolute;
  bottom: 0;
  right: 0;
  transform: translate(-0px, 101%);
  background-color: #222;
  padding: 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(255, 255, 255, 0.1) inset;
  border: 1px solid #a5a5a5;
  display: grid;
  grid-template-rows: repeat(2, 1fr);
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  z-index: 1000;
}

.config-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 54px;
}

.surgeon-current-config {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #222;
}

/* SEQUENCER */
.Sequencer {
  z-index: 20;
}

.Sequencer .svg-btn {
  border-radius: 4px;
  width: 40px;
  background-color: #17174f;
  border: 1px solid #333;
}

.sequencer-grid {
  padding: 2px;
  background-color: cyan;
}

.sequencer-row {
  display: flex;
  gap: 2px;
  margin-bottom: 2px;
}

.sequencer-row.selected .sub{
  background-color: #008f8f;
}


.sequencer-row:last-child {
  margin-bottom: 0px;
}

.sequencer-row .sub {
  width: 50px;
  height: 50px;
  background-color: #004b4b
}


.sequencer-row .sub.selected {
  background-color: cyan;
}

/* LOOPER */
.Looper {}

.looper-controls {
  display: flex;
  gap: 8px;
  padding: 4px;
  background-color: #09141e;
}

.looper-left-side,
.looper-buttons {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: space-around;
  gap: 8px;
  background-color: #09141e;
}

.Looper .btn {
  border-radius: 4px;
  width: 40px;
  background-color: #17174f;
  border: 1px solid #333;
}

.Looper .magic-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 80px;
  height: 58px;
  border-radius: 6px;
  border: 1px solid #bbbbbb;
  background-color: #1d1d1d;
}

.magic-btn svg {
  width: 40px;
}

.Looper .undo {
  padding: 4px;
}

.Looper .clear {
  padding: 3px;
  color: red;
}

.Looper[data-status='CLEARED'] .magic-btn svg {
  color: red;
}

.Looper[data-status='RECORDING'] .magic-btn svg {
  width: 34px;
}

/* Disable all buttons */
.Looper[data-status='PLAY_SCHEDULED'] .btn,
.Looper[data-status='STARTING'] .btn,
.Looper[data-status='CLEARED'] .btn {
  background-color: #757575;
  color: #9b9b9b;
  opacity: 0.25;
  /* Comment out for debugging */
  pointer-events: none;
}

.Looper[data-status='RECORDING'] .btn.playPause,
.Looper[data-status='RECORDING'] .btn.undo {
  background-color: #757575;
  color: #9b9b9b;
  opacity: 0.25;
}

.Looper[data-status='RECORDING'] .magic-btn {
  border-color: red;
  color: red;
}

.Looper[data-status='PLAYING'] .magic-btn {
  border-color: green;
  color: rgb(255, 78, 78);
}

.Looper[data-status='BUFFERED'] .magic-btn,
.Looper[data-status='STOPPED'] .magic-btn {
  border-color: green;
  color: green;
}

/* Disabled */
.Looper[data-status='STARTING'] .magic-btn,
.Looper[data-status='STOPPING'] .magic-btn,
.Looper[data-status='PLAY_SCHEDULED'] .magic-btn,
.Looper[data-status='BUFFERING'] .magic-btn {
  color: #aaa;
  border-color: #afafaf;
  background-color: #7b7b7b;
}

/* SAMPLER */
.Sampler {}

.Sampler .top-row {
  padding: 8px;
  margin-bottom: 5px;
  background-color: #202020;
}

.Sampler .bottom-row {
  padding: 8px;
  background-color: #09141e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 64px;
}

.Sampler .bottom-row .knob-line {
  background-color: #09141e;
  margin: 0;
  gap: 2rem;
}

.bottom-row .buttons {
  display: flex;
  justify-content: end;
  gap: 12px;
  width: 100%;
}

.sampler-btn {
  border: 1px solid #333;
  background-color: #132230;
  padding: 8px;
  border-radius: 50%;
  text-align: center;
  width: 48px;
  height: 48px;
}

.sampler-btn.first-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  width: unset;
}

.sampler-btn.first-stage svg {
  width: 28px;
}

.sampler-btn.stop-rec {
  color: #ff5858;
  border-color: #ff5858;
}

.sampler-btn.upload {
  border-color: green;
}

.sampler-btn.library {
  border-color: rgb(153, 153, 0);
}

.sampler-btn.rec {
  border-color: #ff1111;
}

.sampler-btn.rec svg {
  color: #ff1111;
  width: 24px;
}

.sampler-btn.stop-rec svg {
  width: 22px;
}

.sampler-btn.save {
  color: #00a116;
}

.sampler-btn.clear {
  color: #fd1717;
}

/* STATUSSES */
.Sampler:not([data-status='BUFFER_CLEARED']) .display-while-cleared {
  display: none;
}

.Sampler:not([data-status='RECORDING']) .display-while-recording {
  display: none;
}

.Sampler:not([data-status='BUFFER_SET']) .display-while-buffer-set {
  display: none;
}

.Sampler[data-status='BUFFER_SET'] .hide-while-buffer-set {
  visibility: hidden;
}

.upload-sample {
  position: relative;
  width: 100%;
  background: #222;
}

.upload-sample .label {
  position: relative;
  padding: 2rem 1rem;
  font-size: 18px;
  overflow-x: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 2;
  background-color: #111;
}

.upload-sample input {
  position: absolute;
  opacity: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
}

.sampler-canvas {
  position: absolute;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: #91ff87;
}

.Sampler .sampler-start-offset,
.Sampler .sampler-end-offset {
  position: absolute;
  z-index: 2;
  background-color: #000000c4;
  top: 0;
  height: 100%;
}

.Sampler .sampler-start-offset {
  left: 0;
}

.Sampler .sampler-end-offset {
  right: 0;
}

/* EQ3 */
.audio-module.EQ3 {
  display: flex;
}

/* Waveshape dropdown */
.audio-module.surgeon .module-dropdown svg,
.audio-module.BiquadFilter .module-dropdown svg,
.audio-module.SyncGate .module-dropdown svg {
  width: var(--waveshape-svg-width);
  height: var(--waveshape-svg-height);
}

.audio-module.surgeon .module-dropdown svg {
  width: 20px;
}

.selector-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.selector-container .selector-label {
  background: #333;
  padding: 0px 4px;
}
