/* public/style.css */

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #FFFFFF;
  color: #000000;
  display: flex;
  justify-content: center;
  /* align-items: center; */ /* Removed to prevent potential horizontal layout interference */
  min-height: auto;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}

.web-piano-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background-color: #F0F0F0;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  /* Removed max-width, width, and overflow-x to allow natural sizing without scroll */
}

h1 {
  margin-bottom: 30px;
  color: #333333; /* dark gray */
}

.controls {
  margin-bottom: 20px;
}

.controls button {
  background-color: #333333; /* dark gray */
  color: #FFFFFF; /* white */
  border: none;
  padding: 10px 20px;
  margin: 0 5px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.2s;
}

.controls button:hover:not(:disabled) {
  background-color: #555555; /* slightly lighter dark gray */
}

.controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.piano-container {
  display: flex;
  position: relative;
  background-color: #333333; /* dark gray */
  padding: 10px 20px; /* Reduced vertical padding */
  border-radius: 5px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
  margin-bottom: 20px;
  /* Removed overflow-x, white-space, flex-grow, flex-shrink to fit content */
  /* Keys will now wrap if needed, or be responsive */
  flex-wrap: wrap; /* Allow keys to wrap to new line if they exceed container width */
  justify-content: center; /* Center keys if they wrap */
}

.piano-key {
  cursor: pointer;
  border-radius: 3px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 10px;
  font-size: 0.8em;
  user-select: none;
  transition: background-color 0.1s ease;
  position: relative; /* Added for key labels */
  flex-shrink: 0; /* Prevent keys from shrinking */
}

.white-key {
  width: 60px;
  height: 200px;
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  margin-right: 2px;
  z-index: 1;
  color: #333;
}

.white-key.active {
  background-color: #e0e0d0;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.black-key {
  width: 40px;
  height: 120px;
  background-color: #333;
  border: 1px solid #222;
  margin-left: -20px; /* Overlap with white keys */
  margin-right: -20px; /* Overlap with white keys */
  z-index: 2;
  color: #eee;
  position: relative;
}

.black-key.active {
  background-color: #1a1a1a;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.note-label {
  position: absolute;
  bottom: 5px; /* Position at the bottom of the key */
  font-size: 0.8em; /* Match piano-key font size */
  color: #333333; /* Dark gray for notes on white keys */
}

.black-key .note-label {
  color: #eee; /* Light gray for notes on black keys */
}

.computer-key-label {
  position: absolute;
  top: 5px; /* Position at the top of the key */
  font-size: 0.7em; /* Slightly smaller than note label */
  font-family: 'SF Mono', 'Courier New', monospace; /* Monospace for keyboard feel */
  background-color: #E0E0E0; /* Light gray background for keycap feel */
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid #CCC;
  color: #333333; /* Dark text for keycap */
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  z-index: 3; /* Ensure it's above other elements if needed */
}

.black-key .computer-key-label {
  background-color: #555555; /* Darker keycap for black keys */
  color: #F0F0F0; /* Lighter text for black keys */
  border-color: #444;
}



/* --- Mapping Controls --- */
.mapping-controls {
  margin-left: 20px; /* Add some spacing from buttons */
  display: flex;
  align-items: center;
  gap: 10px;
}

.mapping-controls label {
  font-size: 0.9em;
  color: #333333;
  font-weight: 500;
}

.mapping-controls select {
  padding: 8px 12px;
  border-radius: 5px;
  border: 1px solid #CCC;
  background-color: #FFFFFF;
  color: #333333;
  font-size: 0.9em;
  cursor: pointer;
  -webkit-appearance: none; /* Remove default browser styling for select */
  -moz-appearance: none;
  appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13.2-5.4H18.2c-7.9%200-14.3%206.4-14.3%2014.3%200%204.9%202.4%209.5%206.1%2012.3l139.4%20139.4c3.4%203.4%208%205.4%2013%205.4s9.6-2%2013-5.4l139.4-139.4c3.9-3.9%206.1-9.5%206.1-15.3z%22%2F%3E%3C%2Fsvg%3E'); /* Custom arrow */
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  padding-right: 25px; /* Make space for the arrow */
}

.mapping-controls select:focus {
  outline: none;
  border-color: #007AFF; /* Apple blue on focus */
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}
.mapping-controls button {
  background-color: #333333; /* dark gray */
  color: #FFFFFF; /* white */
  border: none;
  padding: 8px 12px; /* Adjusted padding */
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.2s;
  margin: 0 5px; /* Spacing between buttons and select */
}

.mapping-controls button:hover {
  background-color: #555555; /* slightly lighter dark gray */
}

/* Styles for the new note slider */
#note-slider-container {
  width: 200px; /* Adjust as needed */
  height: 10px;
  background-color: #ddd;
  border-radius: 5px;
  position: relative;
  cursor: pointer;
  margin-left: 10px;
}

#note-slider-handle {
  width: 20px;
  height: 20px;
  background-color: #333;
  border-radius: 50%;
  position: absolute;
  top: -5px; /* Center handle vertically on the track */
  left: 0;
  cursor: grab;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Styles for the new note slider */
#note-slider-container {
  width: 200px; /* Adjust as needed */
  height: 10px;
  background-color: #ddd;
  border-radius: 5px;
  position: relative;
  cursor: pointer;
  margin-left: 10px;
}

#note-slider-handle {
  width: 20px;
  height: 20px;
  background-color: #333;
  border-radius: 50%;
  position: absolute;
  top: -5px; /* Center handle vertically on the track */
  left: 0;
  cursor: grab;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

#note-slider-handle:active {
  cursor: grabbing;
}
