//
// Defaults
//

html,
body {
    background: transparent;
    min-height: 100vh;
    overflow: hidden;
    padding: 0;
    margin: 0;
    position: relative;
    user-select: none;
}


//
// Panel
//

#root {

    &>.window-base {
        background: var(--tray-background);
        box-shadow: 0.5px 0.5px 0 0.5px var(--tray-border) inset;
        color: var(--tray-text);
        font-family: 'Segoe UI Variable Text', 'Segoe UI';
        width: 100vw;
        box-sizing: border-box;
        padding: 15px 15px 0 15px;
        position: absolute;
        top: 0;
        left: 0;
        transition: opacity 0s, transform 0s cubic-bezier(0.075, 0.82, 0.165, 1), background-color 0.5s, border-color 0.2s, color 0.2s;
        transform: translate(0px, 0px);
        opacity: 1;
        pointer-events: none;

        & > div {
            z-index: 2;
            position: relative;
            &#mica {
                z-index: 1;
            }
        }
    }

    &[data-visible="true"]>.window-base {
        pointer-events: all;
    }

    &[data-position="TOP"]>.window-base {
        box-shadow: 0.5px -0.5px 0 0.5px var(--tray-border) inset;
        top: auto !important;
        bottom: 0 !important;
    }

    &[data-position="LEFT"]>.window-base {
        box-shadow: -0.5px 0.5px 0 0.5px var(--tray-border) inset;
    }

    &[data-position="RIGHT"]>.window-base {}

}



@media (prefers-reduced-motion: reduce) {
    #root>.window-base {
        transition: none !important;
    }
}


body[data-acrylic="false"],
body[data-transparent="false"],
body[data-use-native-animation="false"] {
    #root {
        &>.window-base {
            opacity: 0;
            pointer-events: none;
            transform: translateY(120px);
        }

        &[data-visible="true"]>.window-base {
            transition: opacity 0.2s, transform 0.5s cubic-bezier(0.075, 0.82, 0.165, 1), background-color 0.85s, border-color 0.2s, color 0.2s;
            transform: translateY(0%) !important;
            opacity: 1;
            pointer-events: all;
        }

        &[data-position="TOP"]>.window-base {
            border-width: 0 0 1px 1px;
            transform: translateY(-120px);
        }

        &[data-position="LEFT"]>.window-base {
            border-width: 1px 1px 0 0;
            transform: translateX(-120px);
        }

        &[data-position="RIGHT"]>.window-base {
            transform: translateX(120px);
        }
    }
}


//
// Titlebar
//

.titlebar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    margin-bottom: 20px;

    .title {
        font-size: 14.5px;
        font-weight: 400;
    }

    .icons {
        display: flex;
        font-family: "Segoe MDL2 Assets";
        font-size: 22px;

        div {
            cursor: pointer;
            opacity: 0.7;

            &:hover {
                opacity: 1;
            }

            &[data-active="true"] {
                color: var(--system-accent-medium);
                opacity: 1;
            }
        }

        div+div {
            margin-left: 20px;
        }
    }
}


//
// Update bar
//

.updateBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--system-accent-color);
    color: white;
    padding: 15px;
    width: 100%;
    margin: 0px -15px 0px;
    line-height: 1;

    .left {
        font-size: 13px;
        opacity: 0.8;

        &.progress {
            padding-right: 15px;
            width: 100%;
        }
    }

    .right {
        display: flex;
        font-size: 13px;
        align-items: center;

        a {
            cursor: pointer;
            padding: 1px 5px;
            margin: 0px 0;
            font-weight: 500;
            opacity: 1;

            &:hover {
                opacity: 0.8;
            }

            &+a {
                margin-left: 6px;
            }
        }

        .icon {
            margin-bottom: -1px;
        }
    }
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 5px;
    max-width: 320px;
    background: rgba(white, 0.2);

    &>div {
        position: absolute;
        top: 0;
        left: 0;
        width: 0%;
        height: 100%;
        background: white;
    }
}

.icon {
    font-family: "Segoe MDL2 Assets";
    &.icon-text {
        font-family: inherit !important;
        font-size: 13px;
        min-width: 22px;
        text-align: center;
    }
}

.monitor-item {
    margin: 0 !important;
    height: 73px;

    .input--range {
        //padding-bottom: 15px;
    }
}

$overlayBarWidth: 11px;
$overlayBarWidthOff: $overlayBarWidth * -0.5;

body[data-is-win11="false"] #root {
    &[data-mode="overlay"] {
        .input--range .progress {
            height: $overlayBarWidth;
            margin-top: $overlayBarWidthOff;
        }

        .input--range .range::-webkit-slider-thumb {
            height: $overlayBarWidth;
            width: $overlayBarWidth;
            border-radius: 0;
            margin-top: 0px;
            background: white;
        }

        .input--range .range::-webkit-slider-runnable-track {
            height: $overlayBarWidth;
            background: #6a6a6a;
        }

        .titlebar {
            display: none;
        }

        .monitor-item .input--range {
            padding-bottom: 15px;
        }

        .monitor-item {
            height: 140px;
            height: 136px;
            width: 40px;
            box-sizing: content-box;
            overflow: visible;
            position: relative;
            align-items: flex-start;
        }

        &>.window-base {
            border: none;
            border: 0px solid var(--tray-border) !important;
            width: calc(100% - 60px);
            width: auto;
            padding: 2px 13px;
            transition: none !important;
            display: flex;
            background: rgba(19, 19, 19, 0.95) !important;
            box-shadow: none !important;
        }

        .monitor-item .name-row .icon {
            display: none !important;
        }

        .input--range {
            width: 66px;
            height: $overlayBarWidth;
            overflow: visible;
            position: relative;
            left: 50%;
            margin-left: -8px;
            will-change: transform;
        }

        .input--range .rangeGroup {
            flex: none;
            width: 80px;
            transform: rotate(-90deg) translate(0.5px, 0.5px);
            position: relative;
            top: 53px;
            left: -33.5px;
        }

        .input--range .val {
            font-size: 13px;
            width: 40px;
            padding-right: 4px;
            color: white;

            position: absolute;
            top: 104px;
            left: -21px;
            width: 50px;
            text-align: center;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;

        }

        .monitor-item .name-row .title {
            display: none;
            position: absolute;
            top: 108px;
            left: 8px;
            width: 50px;
            font-size: 10px;
            text-align: center;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .updateBar, .feature-power-icon, .feature-icon, .feature-row + .feature-row, .monitor-sliders.extended + .monitor-sliders.extended:before {
            display: none;
        }

        .feature-row {
            height: auto;
            margin-top: -18px;
        }
    }
}

// Sun Valley tweaks
#root[data-fluent-icons="true"] {

    .titlebar .icons, .icon {
        font-family: "Segoe Fluent Icons", "Segoe MDL2 Assets";
    }

    &[data-mode="normal"] {
        .monitor-item .name-row {
            margin-bottom: 2px;
            .icon {
                margin-bottom: -2px;
                margin-top: -1px;
            }
        }
    }
}
#root[data-segoe-u-i-variable="true"] {

    &[data-mode="normal"] {
        .titlebar .title {
            font-family: "Segoe UI Variable Small", "Segoe UI";
            font-weight: 300;
            font-size: 13.5px;
        }
        .monitor-item .name-row .title {
            font-family: "Segoe UI Variable Small", "Segoe UI";
            font-weight: 300;
            font-size: 14.5px;
        }
    }
}
//
// DDC/CI Features 
//
.feature-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    height: 34px;
    margin-top: -10px;
    padding-bottom: 10px;
    .monitor-item {
        flex: 1;
        display: flex;
        align-items: center;
        height: auto;
        .input--range {
            padding: 0;

            .val {
                font-size: 16px;
            }
        }
    }
}
.feature-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    padding-right: 18px;
}
.feature-power-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--tray-text);
    justify-self: flex-end;
    padding: 6px;
    margin: -5px 0 -6px auto;
    cursor: pointer;
    opacity: 0.7;
    font-size: 14px;

    &.simple {
        margin: -8px 0 -4px auto;
    }

    &:hover, &:focus {
        opacity: 1;
    }

    span.icon {
        font-size: 16px !important;
        font-weight: 400;
        margin-right: 6px !important;
        margin-left: -1px !important;
        font-family: "Segoe MDL2 Assets", "Segoe Fluent Icons"; // Old icon works better at small sizes
    }
}


.monitor-sliders.extended {
    & + .monitor-sliders.extended {
        &:before {
            content: '';
            display: block;
            height: 1px;
            width: 100%;
            margin: 10px 0 25px;
            margin-bottom: 0;
        }
    }
}

.feature-row.large .feature-icon {
    font-size: 32px;
}

.feature-row.large .monitor-item .input--range .val {
    font-size: 22px;
}

.feature-row.large {
    height: 42px;
}



// Windows 11 style
body[data-is-win11="true"] {
    #root[data-mode="normal"], #root[data-mode="overlay"] {
        & > .window-base {
            display: flex;
            flex-direction: column;
            box-shadow: none;
            border: 1px solid var(--tray-border);
            border-radius: 8px;
            overflow: hidden;
            top: 12px;
            left: 12px;
            width: calc(100vw - 24px);
            padding: 20px;
            padding-bottom: 0;
            transform: translateX(220px);
            box-shadow: inset 0 0 0 1px #c5c5c547, 0 8px 15px -5px rgb(0 0 0 / 75%);
            box-shadow: 0 8px 15px -5px rgb(0 0 0 / 75%);
            box-shadow: none;
            border: none;

            filter: drop-shadow(0 5px 6px rgb(0 0 0 / 40%));
            @media screen and (prefers-color-scheme: dark) {
                filter: drop-shadow(0 5px 6px rgb(0 0 0 / 45%));
            }
    
            &:before {
                pointer-events: none;
                content: '';
                display: block;
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                box-shadow: inset 0 0 0 1px #41414144;
                z-index: 111;
                border-radius: 8px;
                @media screen and (prefers-color-scheme: dark) {
                    box-shadow: inset 0 0 0 1px #c5c5c528;
                }
            }
    
            .titlebar {
                position: relative;
                order: 100;
                margin: 5px 0 1px -19px;
                padding: 20px;
                width: calc(100% - 2px);
                backdrop-filter: brightness(0.97) saturate(1.25);
    
                @media screen and (prefers-color-scheme: dark) {
                    backdrop-filter: brightness(0.85) saturate(1.25);
                }
    
                &:before {
                    content: "";
                    display: block;
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 1px;
                    background-color: #000000;
                    opacity: 0.14;
                    mix-blend-mode: color;
                    z-index: 2;
                }
    
                .icons {
                    font-size: 18px;
                }
                & > * {
                    position: relative;
                    z-index: 2;
                }
            }
    
            &[data-position="TOP"]>.window-base {
                transform: translateX(220px);
            }
    
            &[data-position="LEFT"]>.window-base {
                transform: translateX(-220px);
            }
    
            &[data-position="RIGHT"]>.window-base {
                transform: translateX(220px);
            }
    
        }
    }

    #root[data-mode="overlay"] {

        & > .window-base {
            transform: translateY(220px);
            padding: 12px 15px;

            filter: drop-shadow(0 5px 5px rgb(0 0 0 / 18%));
            @media screen and (prefers-color-scheme: dark) {
                filter: drop-shadow(0 5px 5px rgb(0 0 0 / 36%));
            }
        }

        .titlebar, .updateBar {
            display: none;
        }

        #mica {
            //display: none !important;
        }

        .monitor-sliders.extended {
            height: 28px;

            & + .monitor-sliders.extended:before {
                display: none;
            }

            & > .monitor-item {
                display: none !important;
            }
            .name-row, .feature-row {
                display: none;
            }
            .feature-row.feature-brightness {
                display: flex;
                height: 28px;
                margin: 0;
                padding: 0;

                .feature-icon {
                    padding: 0;
                    width: 26px;
                    justify-content: flex-start;
                    .icon {
                        font-size: 16px !important;
                        padding-right: 0;
                    }
                }
            }
        }

        .monitor-item {
            height: auto;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            height: 28px;

            .icon {
                font-size: 15px !important;
                padding-right: 0;
                position: relative;
                top: -2px;
            }

            .name-row {
                width: 26px;
                .title, .feature-power-icon {
                    display: none;
                }
            }

            .val {
                width: 32px;
                font-size: 13px;
                padding-right: 4px;
            }

            .input--range {
                position: relative;
                top: -2px;
                flex: 1;
                .range {
                    &::-webkit-slider-thumb {
                        opacity: 0;
                    }
                }
            }

            &+.monitor-item {
                margin-top: 0px !important;
            }
        }
    }
    

    #mica {
        backdrop-filter: brightness(1.15) saturate(1);
        //mix-blend-mode: color;
        .displays .blur {
            opacity: 0.9;
            @media screen and (prefers-color-scheme: dark) {
                opacity: 0.53;
            }
        }
    }
}