/* Main Styles for Programmable Soundboard */

:root {
  --primary-color: #6200ea;
  --primary-light: #9d46ff;
  --primary-dark: #0a00b6;
  --secondary-color: #03dac6;
  --secondary-light: #66fff8;
  --secondary-dark: #00a896;
  --background: #121212;
  --surface: #1e1e1e;
  --error: #cf6679;
  --on-primary: #ffffff;
  --on-secondary: #000000;
  --on-background: #ffffff;
  --on-surface: #ffffff;
  --on-error: #000000;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
  background-color: var(--background);
  color: var(--on-background);
  line-height: 1.6;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

header {
  background-color: var(--primary-dark);
  color: var(--on-primary);
  padding: 1rem 0;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

h1, h2, h3 {
  margin-bottom: 1rem;
}

button {
  background-color: var(--primary-color);
  color: var(--on-primary);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: var(--primary-light);
}

button:disabled {
  background-color: #555;
  cursor: not-allowed;
}

button.secondary {
  background-color: var(--secondary-color);
  color: var(--on-secondary);
}

button.secondary:hover {
  background-color: var(--secondary-light);
}

button.danger {
  background-color: var(--error);
  color: var(--on-error);
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* Control Panel */
.control-panel {
  background-color: var(--surface);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Sound Pads */
.sound-pads {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.sound-pad {
  background-color: var(--primary-dark);
  color: var(--on-primary);
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  text-align: center;
  font-weight: bold;
}

.sound-pad:hover {
  background-color: var(--primary-color);
  transform: scale(1.05);
}

.sound-pad:active, .sound-pad.active {
  background-color: var(--primary-light);
  transform: scale(0.95);
}

/* Loop Sequencer */
.sequencer {
  background-color: var(--surface);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  overflow-x: auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sequencer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.loop-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.loop-label {
  width: 100px;
  padding-right: 1rem;
  font-weight: bold;
  display: flex;
  align-items: center;
}

.loop-steps {
  display: flex;
  flex-grow: 1;
}

.step {
  width: 30px;
  height: 30px;
  margin-right: 2px;
  background-color: #333;
  border: 1px solid #444;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.step:hover {
  background-color: #444;
}

.step.active {
  background-color: var(--primary-color);
}

.step.current {
  border: 2px solid var(--secondary-color);
}

/* Loop Controls */
.loop-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.loop-controls button {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

/* Parameter Controls */
.parameter-controls {
  background-color: var(--surface);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.parameter-group {
  margin-bottom: 1rem;
}

.parameter-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.parameter-label {
  width: 100px;
  padding-right: 1rem;
}

.parameter-input {
  flex-grow: 1;
}

input[type="range"] {
  width: 100%;
  background-color: #333;
  height: 6px;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--secondary-color);
  cursor: pointer;
}

input[type="number"], select {
  background-color: #333;
  color: var(--on-surface);
  border: 1px solid #444;
  padding: 0.5rem;
  border-radius: 4px;
  width: 100%;
}

/* Song Management */
.song-management {
  background-color: var(--surface);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.song-list {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 1rem;
  border: 1px solid #444;
  border-radius: 4px;
}

.song-item {
  padding: 0.5rem;
  border-bottom: 1px solid #444;
  cursor: pointer;
}

.song-item:hover {
  background-color: #333;
}

.song-item:last-child {
  border-bottom: none;
}

/* Code Editor */
.code-editor {
  background-color: var(--surface);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.editor-container {
  position: relative;
  height: 300px;
  border: 1px solid #444;
  border-radius: 4px;
  overflow: hidden;
}

.editor-textarea {
  width: 100%;
  height: 100%;
  background-color: #1a1a1a;
  color: var(--on-surface);
  border: none;
  padding: 1rem;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  resize: none;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: var(--surface);
  padding: 2rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.close-modal {
  background: none;
  border: none;
  color: var(--on-surface);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Responsive Design */
@media (max-width: 768px) {
  .control-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .sound-pads {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
  
  .loop-label {
    width: 80px;
  }
  
  .step {
    width: 25px;
    height: 25px;
  }
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.pulse {
  animation: pulse 0.5s infinite;
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}
