/* General styles for the music player page */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

/* Container styles */
.container {
    width: 100%;
    max-width: 100%;
    padding: 20px;
    margin: 0;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: row;
    gap: 10px;
}

/* Controls area - adjust width to complement staff container */
.controls-area {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    padding: 10px;
    margin: 0;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e6e6e6;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Staff container - now placed on the right */
#staff-container {
    width: calc(100% - 200px);
    height: fit-content;
    flex-grow: 1;
    margin: 0;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    box-sizing: border-box;
    position: relative;
    gap: 20px;
    overflow-x: auto;
}

#staff-canvas {
    width: 100%;
    height: auto;
    transform-origin: center top;
}

/* Ensure click positions remain accurate */
#staff-container canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Adjust control group for smaller width */
.control-group {
    background-color: #ffffff;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.control-group:hover {
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.1);
}

/* File controls */
.file-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#file-input {
    padding: 10px;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    width: 100%;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

#file-input:hover, #file-input:focus {
    border-color: #0066cc;
    box-shadow: 0 0 5px rgba(0, 102, 204, 0.2);
}

/* Adjust playback buttons container */
.playback-buttons {
    display: flex;
    gap: 5px;
    flex-direction: column;
}

/* Search controls */
.search-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#search-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#search-results {
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
}

/* Tempo and transpose controls */
.playback-tempo-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tone-transpose-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.transpose-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tempo-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tempo-label-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

#tempo-slider {
    width: 100%;
    height: 10px;
}

/* Sound controls */
.sound-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Adjust slider containers */
.slider-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    margin-top: 8px;
    width: 100%;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 3px;
    background: #e6e6e6;
    outline: none;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]:hover {
    background: #d9d9d9;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #0052a3;
    transform: scale(1.1);
}

/* Repeat controls */
.repeat-control {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.repeat-instructions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
}

.repeat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Note info styles - inside staff container */
.note-info {
    width: 100%;
    background-color: #f8f9fa;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.note-info div {
    flex: 0 0 48%;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background-color: rgba(0, 102, 204, 0.05);
    border-radius: 4px;
}

.note-info label {
    color: #666;
    font-weight: 500;
}

.note-info span {
    color: #0066cc;
    font-weight: 600;
    padding-left: 10px;
}

/* Adjust buttons for smaller width */
button {
    background: linear-gradient(45deg, #0066cc, #0099ff);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background: linear-gradient(45deg, #0052a3, #007acc);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Responsive styles for tablet and mobile */
@media screen and (max-width: 1024px) {
    .container {
        flex-direction: column;
        padding: 15px;
    }
    
    .controls-area {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        padding: 15px;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
        margin-bottom: 20px;
    }

    .file-control,
    .search-control {
        grid-column: 1 / -1;
    }

    .tempo-tone-container {
        display: flex;
        gap: 15px;
        grid-column: 1 / -1;
    }

    .tempo-control-area,
    .tone-control-area {
        flex: 1;
        min-width: 0;
        margin-bottom: 0;
    }

    .sound-controls {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 10px;
    }

    .repeat-control {
        grid-column: 1 / -1;
    }

    #staff-container {
        width: 100%;
        margin-top: 0;
    }

    /* Adjust button sizes for touch */
    button {
        padding: 10px 15px;
        font-size: 14px;
    }

    /* Improve slider touch targets */
    input[type="range"] {
        height: 8px;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }
}

@media screen and (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .controls-area {
        padding: 12px;
        gap: 12px;
    }

    .tempo-tone-container {
        flex-direction: row;
        gap: 12px;
    }

    .tempo-control-area,
    .tone-control-area {
        width: calc(50% - 6px);
        min-width: 0;
    }

    .sound-controls {
        grid-template-columns: repeat(2, 1fr);
    }

    .tone-header,
    .tempo-header {
        margin-bottom: 12px;
    }

    .transpose-button,
    .tone-master-button,
    .tempo-btn {
        padding: 10px;
        font-size: 13px;
        height: 36px;
    }
}

@media screen and (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .controls-area {
        padding: 10px;
        gap: 10px;
        grid-template-columns: 1fr;
    }

    .tempo-tone-container {
        flex-direction: column;
        gap: 10px;
    }

    .tempo-control-area,
    .tone-control-area {
        width: 100%;
    }

    .sound-controls {
        grid-template-columns: 1fr;
    }

    .tone-controls,
    .tempo-controls {
        gap: 10px;
    }

    .transpose-buttons,
    .tone-master-buttons {
        flex-direction: row;
        gap: 8px;
    }

    .transpose-button,
    .tone-master-button,
    .tempo-btn {
        padding: 12px;
        font-size: 14px;
        height: 40px;
    }
}

/* Additional improvements for very small screens */
@media screen and (max-width: 360px) {
    .transpose-buttons,
    .tone-master-buttons {
        flex-direction: column;
    }

    .transpose-button,
    .tone-master-button,
    .tempo-btn {
        width: 100%;
    }
}

/* Guitar lesson text styles */
.lesson-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    color: #333;
    margin: 15px 0;
    font-weight: 500;
}

.guitar-lessons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    padding: 0 15px;
}

.lesson-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    margin: 5px 0;
    transition: background-color 0.3s;
}

.lesson-button:hover {
    background-color: #45a049;
}

/* Tempo display */
.tempo-display {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    color: #333;
    margin: 10px 0;
}

/* Adjust labels for smaller width */
label, .volume-label {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: left;
}

/* Tempo Control Area */
.tempo-control-area {
    background-color: #ffffff;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 15px;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
}

.tempo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.tempo-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.tempo-value {
    font-size: 16px;
    font-weight: 600;
    color: #0066cc;
    padding: 4px 8px;
    background: rgba(0, 102, 204, 0.1);
    border-radius: 4px;
    min-width: 60px;
    text-align: center;
}

.tempo-slider-container {
    position: relative;
    padding: 10px 0;
}

.tempo-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e6e6e6;
    outline: none;
    transition: all 0.2s ease;
}

.tempo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.tempo-slider::-webkit-slider-thumb:hover {
    background: #0052a3;
    transform: scale(1.1);
}

.tempo-marks {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.tempo-mark {
    font-size: 12px;
    color: #666;
    position: relative;
    text-align: center;
}

.tempo-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    gap: 10px;
}

.tempo-btn {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e6e6e6;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tempo-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.tempo-btn.active {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

/* Tone Control Area */
.tone-control-area {
    background-color: #ffffff;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 12px;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
}

.tone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tone-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.tone-value {
    font-size: 14px;
    font-weight: 600;
    color: #0066cc;
    padding: 4px 8px;
    background: rgba(0, 102, 204, 0.1);
    border-radius: 4px;
    min-width: 30px;
    text-align: center;
}

.tone-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transpose-buttons {
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

.transpose-button {
    flex: 1;
    padding: 6px 10px;
    font-size: 13px;
    background: #f8f9fa;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 32px;
}

.tone-master-buttons {
    display: flex;
    gap: 6px;
}

.tone-master-button {
    flex: 1;
    padding: 6px 10px;
    font-size: 13px;
    background: #f8f9fa;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 32px;
}

/* Repeat controls within tone area - reduced spacing */
.tone-controls .repeat-control {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e6e6e6;
}

.repeat-instructions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.repeat-instructions span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.repeat-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

#clearFlagsButton {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e6e6e6;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s ease;
    min-height: 32px;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .tone-control-area {
        padding: 10px;
    }

    .tone-controls {
        gap: 6px;
    }

    .tone-controls .repeat-control {
        margin-top: 8px;
        padding-top: 8px;
    }

    .repeat-instructions {
        font-size: 11px;
    }

    .checkbox-label,
    #clearFlagsButton {
        font-size: 11px;
    }
}

@media screen and (max-width: 480px) {
    .tone-control-area {
        padding: 8px;
    }

    .tone-controls {
        gap: 6px;
    }

    .repeat-actions {
        gap: 6px;
    }

    #clearFlagsButton {
        padding: 8px;
    }
}

/* Remove old repeat control styles */
.control-group.repeat-control {
    display: none;
}


