/* CTN Sheet + Chord bottom practice toolbar.
 * Adapted from the Meta-chords toolbar with CTN green accents.
 * Strictly scoped to .ctn-practice-toolbar; keep legacy event handlers intact.
 */
#toolBar.ctn-practice-toolbar {
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

#toolBar.ctn-practice-toolbar #subToolBar {
    float: none !important;
    width: 100% !important;
    box-sizing: border-box;
    border: 1px solid #e2e5e9 !important;
    border-top: 2px solid #278b57 !important;
    border-radius: 8px 8px 0 0;
    background-color: #fff !important;
    box-shadow: 0 -3px 12px rgba(20, 30, 45, 0.07);
}

#toolBar.ctn-practice-toolbar #subToolBar > table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 0;
}

#toolBar.ctn-practice-toolbar #subToolBar > table > tbody > tr > td:first-child {
    width: auto !important;
    min-width: 0;
    padding: 0;
    overflow: hidden;
}

#toolBar.ctn-practice-toolbar #scrlDiv {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 7px;
    float: none !important;
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100%;
    padding: 6px 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

#toolBar.ctn-practice-toolbar #scrlDiv > .chord-comp {
    flex: 0 0 auto;
    display: inline-flex !important;
    align-items: center;
    float: none !important;
    box-sizing: border-box;
    min-height: 34px;
    margin: 0 !important;
    padding: 1px 5px !important;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    background-color: #fff !important;
    color: #303846;
    font-size: 14px;
    white-space: nowrap;
}

#toolBar.ctn-practice-toolbar #scrlDiv .chord-lb {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    color: #4b5563;
    font-size: 13px;
    font-weight: bold;
    line-height: 29px;
}

#toolBar.ctn-practice-toolbar #scrlDiv input[type="button"] {
    box-sizing: border-box;
    width: 30px !important;
    min-width: 30px;
    height: 29px;
    margin: 0 2px;
    padding: 2px 4px !important;
    border: 1px solid #e2e5e9;
    border-radius: 5px !important;
    background-color: #f3f4f6 !important;
    color: #334155 !important;
    font-size: 15px;
    font-weight: bold;
    line-height: 1;
    vertical-align: middle;
    cursor: pointer;
}

#toolBar.ctn-practice-toolbar #scrlDiv input[type="button"]:hover:not(:disabled) {
    border-color: #96c9a9;
    background-color: #f0faf3 !important;
}

#toolBar.ctn-practice-toolbar #scrlDiv input[type="button"]:disabled {
    background-color: #f7f7f8 !important;
    color: #9ca3af !important;
    border-color: #eceef0;
    cursor: not-allowed;
}

#toolBar.ctn-practice-toolbar #scrlDiv select {
    box-sizing: border-box;
    height: 29px;
    min-width: 45px;
    margin-top: 0;
    margin-bottom: 0;
    padding: 2px 4px;
    border: 1px solid #e2e5e9;
    border-radius: 5px;
    background-color: #fff !important;
    color: #303846 !important;
    font-size: 14px;
    font-weight: bold;
    vertical-align: middle;
}

/* Keep metronome controls on the same baseline as the other toolbar groups.
   The legacy template sets height:15px and float:right on #beat-outer. */
#toolBar.ctn-practice-toolbar #beat-outer {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    float: none !important;
    height: auto !important;
    min-height: 29px;
}

#toolBar.ctn-practice-toolbar #beat-outer #beat-play {
    float: none !important;
}

#toolBar.ctn-practice-toolbar #beat-outer #beatSlower {
    margin-left: 2px !important;
}

#toolBar.ctn-practice-toolbar #beat-outer #beatTempo {
    margin: 0 4px !important;
}

#toolBar.ctn-practice-toolbar #beat-outer #tempoSep {
    float: none !important;
    height: 24px !important;
    margin: 0 2px;
    align-self: center;
}

#toolBar.ctn-practice-toolbar #ch-type {
    width: 88px;
}

#toolBar.ctn-practice-toolbar #scrlDiv #ch-index,
#toolBar.ctn-practice-toolbar #scrlDiv #ch-tone {
    color: #334155;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

#toolBar.ctn-practice-toolbar #showedBar {
    width: 36px;
    min-width: 36px;
    box-sizing: border-box;
    padding: 0 7px !important;
    border-left: 1px solid #e4e7eb;
    background-color: #f8f9fa !important;
    color: #475467 !important;
    text-align: center;
    font-size: 17px;
    cursor: pointer;
}

#toolBar.ctn-practice-toolbar #showedBar:hover {
    background-color: #eef0f3 !important;
}

#toolBar.ctn-practice-toolbar #hiddenBar {
    box-sizing: border-box;
    min-width: 40px;
    height: 40px;
    padding: 0 11px !important;
    border: 1px solid #e2e5e9;
    border-left: 3px solid #278b57;
    border-radius: 0 6px 0 0;
    background-color: #fff !important;
    box-shadow: 0 -2px 8px rgba(20, 30, 45, 0.07);
    color: #475467 !important;
    text-align: center;
    font-size: 17px;
}

#toolBar.ctn-practice-toolbar #showedBar:focus,
#toolBar.ctn-practice-toolbar #hiddenBar:focus,
#toolBar.ctn-practice-toolbar #scrlDiv input[type="button"]:focus,
#toolBar.ctn-practice-toolbar #scrlDiv select:focus {
    outline: 2px solid #278b57;
    outline-offset: -2px;
}


/* Restore the original repeat icon without inheriting global button backgrounds. */
#toolBar.ctn-practice-toolbar #scrlDiv #ch-scroll-repeat {
    width: 32px !important;
    min-width: 32px;
    background-color: #f3f4f6 !important;
    background-image: none !important;
    color: #334155 !important;
    font-family: "Segoe UI Symbol", "DejaVu Sans", Arial, sans-serif;
    font-size: 23px !important;
    font-weight: normal;
    line-height: 1;
}

/* The repeat settings modal lives inside #scrlDiv; override toolbar button sizing. */
#toolBar.ctn-practice-toolbar #scrlDiv #chord-scroll-rp #chord-repeat-ok {
    display: inline-block;
    width: auto !important;
    min-width: 88px;
    max-width: none;
    height: 36px !important;
    padding: 6px 16px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 600;
    line-height: 20px !important;
    white-space: nowrap;
    overflow: visible;
    text-indent: 0;
}

#toolBar.ctn-practice-toolbar #chord-scroll-rp #chord-delay-time {
    box-sizing: border-box;
    width: 46px;
    height: 32px;
    padding: 4px 5px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    text-align: center;
}

@media (max-width: 600px) {
    #toolBar.ctn-practice-toolbar #scrlDiv {
        gap: 5px;
        padding: 5px 6px;
    }

    #toolBar.ctn-practice-toolbar #scrlDiv input[type="button"] {
        min-width: 32px;
        width: 32px !important;
        height: 32px;
    }

    #toolBar.ctn-practice-toolbar #showedBar {
        width: 40px;
        min-width: 40px;
    }
}

/* Both CTN detail pages retain the existing collapse/expand interaction.
   Keep the toolbar horizontal and low so it does not cover the score/lyrics. */
#toolBar.ctn-practice-toolbar {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    max-width: 100%;
}

#toolBar.ctn-practice-toolbar #scrlDiv .chord-comp {
    border-radius: 6px !important;
}

#toolBar.ctn-practice-toolbar #scrlDiv .ccb2,
#toolBar.ctn-practice-toolbar #scrlDiv .clb2 {
    display: inline-flex;
    align-items: center;
    min-height: 29px;
    margin: 0;
    white-space: nowrap;
}

#toolBar.ctn-practice-toolbar #scrlDiv input[type="checkbox"] {
    vertical-align: middle;
    margin: 0 4px !important;
    accent-color: #278b57;
}

#toolBar.ctn-practice-toolbar #scrlDiv #chord-manip {
    border-left: 0 !important;
    float: none !important;
}

#toolBar.ctn-practice-toolbar #scrlDiv #scrl-manip,
#toolBar.ctn-practice-toolbar #scrlDiv #ch-size-div {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    float: none !important;
}

#toolBar.ctn-practice-toolbar #scrlDiv #ch-scroll-repeat {
    background-image: none !important;
}

/* The sheet toolbar has two groups (scroll + metronome), whereas the
   chord toolbar has all its groups inside #scrlDiv. */
#toolBar.ctn-sheet-toolbar .ctn-sheet-toolbar-controls {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    padding: 6px 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

#toolBar.ctn-sheet-toolbar #scrlDiv {
    display: block !important;
    flex: 0 0 auto;
    width: auto !important;
    max-width: none !important;
    overflow: visible;
    float: none !important;
    padding: 0 !important;
}

#toolBar.ctn-sheet-toolbar #scrl-comp {
    float: none !important;
    margin: 0 !important;
    width: auto;
}

#toolBar.ctn-sheet-toolbar #scrl-comp .chord-comp,
#toolBar.ctn-sheet-toolbar #beatDiv .chord-comp {
    display: inline-flex !important;
    align-items: center;
    box-sizing: border-box;
    float: none !important;
    height: 34px;
    min-height: 34px;
    margin: 0 !important;
    padding: 1px 5px !important;
    border: 1px solid #e4e7eb;
    border-radius: 6px !important;
    background: #fff !important;
    white-space: nowrap;
}

#toolBar.ctn-sheet-toolbar #beatDiv {
    display: block !important;
    flex: 0 0 auto;
    float: none !important;
    padding: 0 !important;
}

#toolBar.ctn-sheet-toolbar #scrlDiv #scrl-manip {
    float: none !important;
    display: inline-flex;
    align-items: center;
}

#toolBar.ctn-sheet-toolbar #scrlDiv #ch-scroll-repeat {
    font-size: 23px !important;
}

/* Don't shrink the repeat dialog's Close button to a 30px square. */
#toolBar.ctn-practice-toolbar #chord-scroll-rp #chord-repeat-ok {
    width: auto !important;
    min-width: 80px;
    height: 36px !important;
    padding: 6px 14px !important;
    line-height: 20px !important;
}

@media (max-width: 600px) {
    #toolBar.ctn-sheet-toolbar .ctn-sheet-toolbar-controls {
        gap: 6px;
        padding: 5px 6px;
    }
}