/* Match Help button height to other buttons */
#helpBtn {
  padding: 5px 15px;
  height: auto;
  font-size: 14px;
  line-height: 1.2;
}

.product-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Align titles in both sections */
#currentScaleName,
#scale-list-title {
  padding-bottom: 12px;
  border-bottom: 1px solid white;
  margin-top: 0;
  margin-bottom: 20px;
  width: 100%;
  box-sizing: border-box;
  color: #fff;
  font-size: 18px;
  font-weight: 400;
}


.keyboard-section,
.scales-section {
  flex: 1 1 50%;
  min-width: 0;
}

.keyboard {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin: 0 auto 20px;
    position: relative;
    background: #000;
    border-top: 6px solid #C1272D;
    padding: 0
}

.key {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 10px;
    -webkit-user-select: none;
    user-select: none;
    font-size: 12px
}

.white-key {
    flex: 0 0 calc(100% / 7);
    height: 100%;
    background: #fff;
    border: 1px solid #555;
    border-top: 0px;
    border-radius: 0 0 4px 4px;
    position: relative;
    color: #333
}

.white-key:last-of-type {
    border-right: none
}

.white-key span {
    padding: 2px 6px;
    margin: 0 2px 2px
}

.white-key.active span {
    background: #009245;
    color: #fff;
    padding: 2px 6px;
    border-radius: 2px;
    font-weight: 700;
    margin: 0 2px 2px
}

.black-key {
    width: calc((100% / 7) * .6);
    height: 65%;
    background: #333;
    color: #fff;
    position: absolute;
    z-index: 2;
    transform: translate(-50%);
    border-radius: 0 0 4px 4px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 0 0 2px
}

.black-key span {
    padding: 2px;
    margin: 0 2px 2px
}

.black-key.active span {
    background: #009245;
    padding: 2px;
    border-radius: 2px;
    font-weight: 700;
    margin: 0 2px 2px
}

input[type=text] {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #555;
    border-radius: 25px;
    font-size: 1em;
    background: #000;
    color: #fff
}

input[type=text]::placeholder {
    color: #888
}

button.clear {
    background: transparent;
    border-color: #fff;
    color: #fff
}

@media(hover:hover) and (pointer:fine) {
    button:hover {
        border: 1px solid #FF5100;
        color: #ff5100
    }
}

.scale-list {
    margin-top: 0
}

.scale-list-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px
}

.scale-items-container:empty+.scale-list-controls {
    margin-top: 0
}

.scale-items-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0
}

.scale-items-container::-webkit-scrollbar {
    width: 4px
}

.scale-items-container::-webkit-scrollbar-track {
    background: #333;
    border-radius: 2px
}

.scale-items-container::-webkit-scrollbar-thumb {
    background: #fff;
    border-radius: 2px
}

.scale-items-container.has-scrollbar {
    padding-right: 10px
}

.scale-item {
    padding: 15px 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
    cursor: default
}

.scale-item:first-child {
    padding-top: 0
}

.scale-item:hover {
    background: #ffffff0d
}

.drag-handle {
    flex-shrink: 0;
    cursor: grab;
    display: flex;
    align-items: stretch;
    padding: 0;
    min-height: 100%
}

.drag-handle img,
.drag-handle .handle-icon {
    width: auto;
    height: 100%;
    display: block;
    object-fit: contain;
    padding-left: 10px;
    padding-right: 20px;
    object-position: center;
    margin-top: 3px
}

.scale-item.dragging .drag-handle {
    cursor: grabbing
}

.scale-item-content {
    flex: 1;
    display: flex;
    flex-direction: column
}

.scale-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 5px;
    margin-bottom: 10px;
    border-bottom: 1px solid #888
}

.scale-info {
    flex: 1
}

.scale-name {
    color: #fff;
    margin-bottom: 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px
}

.scale-item.selected .scale-name {
    font-weight: 700
}

.scale-item.selected .scale-name:before {
    content: "▶";
    font-size: 10px
}

.scale-data {
    color: #888;
    font-size: .85em
}

.scale-actions {
    display: flex;
    gap: 0px;
    align-items: flex-end
}

.scale-actions .icon-btn {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer !important;
    display: flex;
    align-items: center;
    justify-content: center
}

.scale-actions .icon-btn img,
.scale-actions .icon-btn svg {
    width: 18px;
    height: 18px
}

.scale-actions .edit-icon {
    color: #00c853
}

.scale-actions .delete-icon {
    color: #f56565
}

.delete-btn {
    padding: 8px 16px;
    background: transparent;
    border-color: #f56565;
    color: #f56565;
    font-size: .85em
}

.delete-btn:hover {
    background: #f565651a
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: #000000e6;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000
}

.modal-content {
    text-align: center;
    padding: 40px
}

.modal-content p {
    font-size: 1.2em;
    margin-bottom: 30px;
    line-height: 1.5
}

.help-modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: left
}

.help-modal-content h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 400
}

.help-modal-content h3 {
    font-size: 1.1em;
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 700
}

.help-modal-content p {
    font-size: 1em;
    margin-bottom: 15px;
    line-height: 1.6
}

.help-modal-content .modal-buttons {
    margin-top: 30px
}

.modal-content input[type=text] {
    width: 100%;
    max-width: 300px;
    padding: 12px 15px;
    margin-bottom: 30px;
    border: 1px solid #555;
    border-radius: 6px;
    font-size: 1em;
    background: #000;
    color: #fff;
    text-align: center
}

.modal-content input[type=text]::placeholder {
    color: #888
}

.modal-buttons {
    display: flex;
    gap: 20px;
    justify-content: center
}

.modal-buttons button {
    min-width: 100px;
    padding: 10px 20px
}

.current-scale {
    text-align: center;
    margin-bottom: 20px;
    font-family: Courier New, monospace;
    font-size: 1.1em;
    color: #fff;
    font-weight: 700
}



@media(min-width:10px) {
    .main-content {
        display: flex;
        flex-direction: row;
        gap: 35px
    }
    .keyboard-section{
        width: 340px;
        margin-left: 50px;
    }

    .scales-section {
        width: 340px;
        margin-right: 50px;
    }

    .keyboard {
        width: 340px;
        height: 310px
    }

    .controls {
        flex-direction: row;
        gap: 10px
    }

    .controls button {
        padding: 5px;
        width: 165px;
        border: 1px solid
    }

    .scale-items-container {
        max-height: 310px
    }

    .scale-list-controls {
        flex-direction: row;
        gap: 10px
    }

    .scale-list-controls button {
        flex: 1;
        border: 1px solid;
        padding: 5px
    }

    .black-key.active span {
        padding-left: 3.5px;
        padding-right: 3.5px
    }

    .white-key.active span {
        padding-left: 7.5px;
        padding-right: 7.5px
    }
}

@media(min-width:660px) and (max-width:799px) {
    .main-content {
        display: flex;
        flex-direction: row;
        gap: 20px
    }
    .keyboard-section{
        width:94%;
        margin-left: 20px;
    }
    
    .scales-section {
        width: 94%;
        margin-left: 20px;
    }
    .keyboard {
        width: 300px;
        height: 280px;
    }
    .scale-items-container {
        max-height: 280px
    }
    .scale-list-controls {
        flex-direction: row;
        gap: 10px
    }
    .scale-list-controls button {
        flex: 1;
        padding: 5px
    }
}

@media(max-width:659px) {
    .main-content {
        flex-direction: column;
        gap: 30px
    }
    .keyboard-section {
        display: flex;
        flex-direction: column;
        width: 94%;
        justify-content: space-between;
        margin-left: 20px;
    }
    .scales-section {
        width: 94%;
        margin-left: 20px;
    }

    .keyboard {
        width: 300px;
        height: 280px;
        border-top: 6px solid #C1272D;
        margin: 0 0 20px
    }

    .controls {
        flex-direction: row
    }
    .scale-items-container {
        max-height: 250px
    }

    .scale-list-controls {
        flex-direction: row
    }

    .scale-list-controls button {
        flex: 1;
    }
}

@media(max-width:319px) {
    .keyboard {
        width: 290px;
        height: 150px
    }
}