/*
 * Styling for Choon Player Wordpress plugin
 */

/*
Copyright (C) 2020 Andy Linton

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

choon-player {
    display: grid;
    width: 80%;
    margin: 1.5rem auto 1.5rem;
    grid-template-areas:
        "audioControl"
        "loopControl"
        "speedControl"
        "playerButton";
    row-gap: 2rem;
}

.choon-audioControl {
    grid-area: audioControl;
}

.choon-loopControl {
    grid-area: loopControl;
    display: inline-flex;
    flex-flow: wrap;
    justify-content: center;
}

.choon-speedControl {
    grid-area: speedControl; 
}

.choon-playerButton {
    grid-area: playerButton;
    height: 3.0rem;
    width: 3.0rem;
    border: none;
    margin: auto;
    border-radius: 50%;
    box-shadow: 5px 8px 10px 2px darkslategray;
}

.choon-playImage {
    background: url(../images/play.svg);
}

.choon-pauseImage {
    background: url(../images/pause.svg);
}

.choon-loopButton {
    background-color: darkslategrey;
    color: white;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 0.5rem;
    font-size: 75%;
    box-shadow: 5px 8px 10px 2px darkslategrey;
}

.choon-abc-show {
    display: block;
    width: 100%;
}

.choon-abc-hide {
    display: none;
}

/* END: controls for audio player */

/* See https://github.com/leongersen/noUiSlider/releases/tag/15.7.1
 * These styles are required for noUiSlider to function
 * May need change things here if noUiSlider changes materially
 */
.noUi-target,
.noUi-target * {
    touch-action: none;
    user-select: none;
    box-sizing: border-box;
}

.noUi-target {
    position: relative;
}

.noUi-base,
.noUi-connects {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* Wrapper for all connect elements.
 */
.noUi-connects {
    overflow: hidden;
    z-index: 0;
}

.noUi-connect,
.noUi-origin {
    will-change: transform;
    position: absolute;
    z-index: 1;
    top: 0;
    right: 0;
    height: 100%;
    width: 100%;
    transform-origin: 0 0;
    transform-style: flat;
}

/* Offset direction
 */
.noUi-txt-dir-rtl.noUi-horizontal .noUi-origin {
    left: 0;
    right: auto;
}

/* Give origins 0 height/width so they don't interfere with clicking the
 * connect elements.
 */

.noUi-horizontal .noUi-origin {
    height: 0;
}

.noUi-handle {
    backface-visibility: hidden;
    position: absolute;
}

.noUi-touch-area {
    height: 100%;
    width: 100%;
}

.noUi-state-tap .noUi-connect,
.noUi-state-tap .noUi-origin {
    transition: transform 0.3s;
}

.noUi-state-drag * {
    cursor: inherit !important;
}

/* Slider size and handle placement;
 */
.noUi-horizontal {
    height: 0.6rem;
}

.noUi-horizontal .noUi-handle {
    width: 1.2rem;
    height: 1.2rem;
    top: -0.4rem;
    right: -0.6rem;
    background: slategrey;
    cursor: pointer;
}

.noUi-txt-dir-rtl.noUi-horizontal .noUi-handle {
    left: -17px;
    right: auto;
}

/* Styling;
 * Giving the connect element a border radius causes issues with using transform: scale
 */

.noUi-connects {
    border-radius: 3px;
}

.noUi-connect {
    background: #3FB8AF;
}

/* Handles and cursors;
 */


.noUi-active {
    box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB;
}

/* Handle stripes;
 */
.noUi-handle:before,
.noUi-handle:after {
    content: "";
    display: block;
    position: absolute;
    height: 14px;
    width: 1px;
    background: #E8E7E6;
    left: 14px;
    top: 6px;
}

.noUi-handle:after {
    left: 17px;
}



/* Base;
 *
 */
.noUi-pips,
.noUi-pips * {
    box-sizing: border-box;
}

.noUi-pips {
    position: absolute;
    color: #999;
}

/* Values;
 *
 */
.noUi-value {
    position: absolute;
    white-space: nowrap;
    text-align: center;
}

.noUi-value-sub {
    color: #ccc;
    font-size: 10px;
}

/* Markings;
 *
 */
.noUi-marker {
    position: absolute;
    background: #CCC;
}

.noUi-marker-sub {
    background: #AAA;
}

.noUi-marker-large {
    background: #AAA;
}

/* Horizontal layout;
 *
 */
.noUi-pips-horizontal {
    padding: 10px 0;
    height: 80px;
    top: 100%;
    left: 0;
    width: 100%;
}

.noUi-value-horizontal {
    transform: translate(-50%, 50%);
}

.noUi-rtl .noUi-value-horizontal {
    transform: translate(50%, 50%);
}

.noUi-marker-horizontal.noUi-marker {
    margin-left: -1px;
    width: 2px;
    height: 5px;
}

.noUi-marker-horizontal.noUi-marker-sub {
    height: 10px;
}

.noUi-marker-horizontal.noUi-marker-large {
    height: 15px;
}


.noUi-tooltip {
    display: block;
    position: absolute;
    border: 1px solid #D9D9D9;
    border-radius: 3px;
    background: #fff;
    color: #000;
    padding: 5px;
    text-align: center;
    white-space: nowrap;
}

.noUi-horizontal .noUi-tooltip {
    transform: translate(-50%, 0);
    left: 50%;
    bottom: 120%;
}

.noUi-horizontal .noUi-origin>.noUi-tooltip {
    transform: translate(50%, 0);
    left: auto;
    bottom: 10px;
}


/* START Override slider defaults */

.noUi-target {
    background: none;
    border: none;
    box-shadow: none;
}


.noUi-horizontal .noUi-origin {
    padding: 0 1rem;
}

html:not([dir="rtl"]) .noUi-horizontal .noUi-handle {
    left: auto;
}

.noUi-handle {
    border: 1px solid slategrey;
    border-radius: 0.2rem;
    background: slategrey;
    cursor: default;
    box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB;
}

.noUi-handle::before,
.noUi-handle::after {
    background: none;
}

.noUi-tooltip {
    display: block;
    position: absolute;
    border: 0 solid darkslategrey;
    border-radius: 8px;
    background: transparent;
    color: darkslategrey;
    padding: 0 0.1rem;
    text-align: center;
    white-space: nowrap;
}

.noUi-horizontal .noUi-tooltip {
    transform: translate(-50%, 190%);
    left: 50%;
    bottom: 120%;
    font-size: small;
    padding: 0.2rem;
    z-index: -1;
}

.noUi-horizontal .noUi-handle[data-handle='1'] {
    background: green;
    border-radius: 50%;

}

.noUi-horizontal .noUi-handle[data-handle='1'] .noUi-tooltip {
    transform: translate(-50%, 20%);
    left: 50%;
    bottom: 120%;
    font-size: small;
    padding: 0.3rem;
    z-index: -1;
    box-sizing: border-box;
}

.noUi-connects {
    height: 60%;
    background: lightgrey;
    border: none;
}

.noUi-connect {
    background: slategrey;

}

/* END: Override Slider defaults */


/* 
 * Some basic CSS to make the Audio controls in abcjs presentable. 
 * Derived from https://github.com/paulrosen/abcjs - abcjs-audio.css
 * Some of these may be redundant!
 * May need to incorporate changes if abcjs-audio.css changes materially
*/

.abcjs-inline-audio {
    padding: 0.5rem;
    background-color: transparent;
    display: inline-flex;
    flex-flow: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.abcjs-inline-audio.abcjs-disabled {
    opacity: 0.5;
}

.abcjs-inline-audio .abcjs-btn {
    display: block;
    width: 2rem;
    height: 2rem;
    padding: 0.5rem;
    border-radius: 8px;
    border: 2px solid darkslategray;
    box-sizing: border-box;
    line-height: 1;
    box-shadow: 5px 8px 10px 2px darkslategray;
}

.abcjs-btn g {
    fill: darkslategray;
    stroke: darkslategray;
}

.abcjs-inline-audio .abcjs-btn:hover g {
    fill: lightslategray;
    stroke: lightslategray;
}

.abcjs-inline-audio .abcjs-midi-selection.abcjs-pushed {
    border: 1px solid darkslategray;
    background-color: lightskyblue !important;
}

.abcjs-inline-audio .abcjs-midi-loop.abcjs-pushed {
    border: 1px solid darkslategrey;
    background-color: lightskyblue !important;
}

.abcjs-inline-audio .abcjs-midi-start.abcjs-pushed {
    border: 1px solid darkslategrey;
    background-color: lightskyblue !important;
}

.abcjs-inline-audio .abcjs-midi-reset.abcjs-pushed {
    border: 1px solid darkslategrey;
}

.abcjs-inline-audio .abcjs-midi-start .abcjs-pause-svg {
    display: none;
}

.abcjs-inline-audio .abcjs-midi-start .abcjs-loading-svg {
    display: none;
}

.abcjs-inline-audio .abcjs-midi-start.abcjs-pushed .abcjs-play-svg {
    display: none;
}

.abcjs-inline-audio .abcjs-midi-start.abcjs-loading .abcjs-play-svg {
    display: none;
}

.abcjs-inline-audio .abcjs-midi-start.abcjs-pushed .abcjs-pause-svg {
    display: block;
}

.abcjs-inline-audio .abcjs-midi-progress-background {
    background-color: lightskyblue;
    height: 10px;
    border-radius: 5px;
    border: 2px solid darkslategrey;
    margin: 0 8px 0 15px;
    position: relative;
    flex: 1;
    padding: 0;
    box-sizing: border-box;
}

.abcjs-inline-audio .abcjs-midi-progress-indicator {
    width: 20px;
    margin-left: -10px;
    /* half of the width */
    height: 14px;
    background-color: darkslategrey;
    position: absolute;
    display: inline-block;
    border-radius: 6px;
    top: -4px;
    left: 0;
    box-sizing: border-box;
}

.abcjs-inline-audio .abcjs-midi-clock {
    margin-left: 4px;
    margin-top: 1px;
    margin-right: 2px;
    display: inline-block;
    font-family: sans-serif;
    font-size: 1rem;
    box-sizing: border-box;
    color: darkslategray;
}

.abcjs-inline-audio .abcjs-tempo-wrapper {
    font-size: 1rem;
    font-weight: bold;
    background-color: lightgray;
    color: darkslategrey;
    padding: 0.5rem;
    border-radius: 8px;
    box-sizing: border-box;
    display: flex;
    flex-flow: row;
    align-items: center;
    justify-content: center;
    box-shadow: 5px 8px 10px 2px darkslategray;
}

.abcjs-inline-audio .abcjs-midi-tempo {
    border-radius: 2px;
    border: none;
    margin: 0 2px 0 4px;
    width: fit-content;
    padding-left: 2px;
    box-sizing: border-box;
}

.abcjs-inline-audio .abcjs-loading .abcjs-loading-svg {
    display: inherit;
}

.abcjs-inline-audio .abcjs-loading {
    outline: none;
    animation-name: abcjs-spin;
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;

}

.abcjs-inline-audio .abcjs-loading-svg circle {
    stroke: darkslategrey;
}

@keyframes abcjs-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.abcjs-css-warning {
    display: none;
}

/*
* Overide abcjs defaults
*/

.abcjs-inline-audio .abcjs-tempo-wrapper label::before {
    content: "Speed: ";
}

.abcjs-inline-audio .abcjs-tempo-wrapper span {
    display: none;
}

/*
  * The cursor that tracks ABC playback
  */
.abcjs-cursor {
    color: red;
}
