@use '../abstract/variables' as *;
@use '../abstract/mixin' as *;

.controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 1;
    font-size: 12px;
    width: 100%;

    .wrapper {
        display: flex;
        align-items: end;
    }
}

.keys-container {
    display: grid;
    grid-auto-flow: column;
    justify-content: start;
    gap: 2px;

    padding-inline-start: 12px;
    padding-block-end: 12px;

    .keys {
        display: flex;
        align-items: center;
        justify-content: center;

        width: 24px;
        height: 24px;

        border-radius: 2px;
        text-align: center;

        color: white;
        border: 1px solid white;

        grid-row: 2 / 3;

        &.active,
        &:hover {
            background-color: #7894937e;
        }
    }

    .keyW {
        grid-row: 1;
        grid-column: 2;
    }

    .keySpace {
        width: 96px;
    }

    .action {
        display: flex;
        align-items: center;
        padding-inline: 4px 8px;

        font-size: 12px;
        color: white;

        grid-row: 2;
    }
}

$slider-width: 120px;
$slider-height: 32px;
$slider-track-height: 2px;
$slider-thumb-height: 22px;
$slider-thumb-width: 6px;
$slider-thumb-border-radius: 4px;

.slider-container {
    color: white;
    display: flex;
    align-items: center;
    gap: 4px;
    padding-inline-end: 8px;

    grid-row: 2;

    width: 100%;
    padding-block-end: 8px;

    .slider-input {
        min-width: 24px;
        height: $slider-height;
        position: relative;

        appearance: none;
        background: transparent;
        cursor: url('/icons/hand_point.svg'), auto;

        // Webkit-based browser (Chrome, Safari)
        &::-webkit-slider-runnable-track {
            width: 100%;
            height: $slider-track-height;
            background: white;

            position: absolute;
            top: 50%;
            transform: translateY(-50%);
        }

        &::-webkit-slider-thumb {
            width: $slider-thumb-width;
            height: $slider-thumb-height;

            /* Center thumb with the track */
            margin-top: calc(
                ($slider-thumb-height - $slider-track-height) / -2
            );

            appearance: none;
            border-radius: $slider-thumb-border-radius;
            background: white;
        }

        // Firefox
        &::-moz-range-track {
            height: $slider-track-height;
            border: none;
            background: white;
        }

        &::-moz-range-thumb {
            width: $slider-thumb-width;
            height: $slider-thumb-height;
            border: none;
            border-radius: $slider-thumb-border-radius;
            background: white;
        }
    }

    .slider-value {
        width: 16px;
    }
}

@include touchscreen {
    .controls-overlay {
        .wrapper {
            flex-direction: column;
            align-items: center;
        }
    }

    .keys-container {
        .keys {
            width: 44px;
            height: 44px;
        }

        .keySpace {
            width: 124px;
        }
    }

    .slider-container {
        justify-content: center;
    }
}
