@use "../colors.scss";

@keyframes rotation {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(359deg);
    }
}

.bar {
    &.bar-background {
        background: colors.$surface;
    }
    color: colors.$on_background;

    &.floating {
        border-radius: 50rem;
        &.bar-background {
            &:not(.separated) {
                box-shadow: 0px 0px 0px 1px inset
                    rgba(colors.$outline_variant, 0.5);
            }
            &.separated {
                .left-widgets,
                .center-widgets,
                .right-widgets {
                    &:not(.empty) {
                        box-shadow: 0px 0px 0px 1px inset
                            rgba(colors.$outline_variant, 0.5);
                    }
                }
            }
        }
    }

    &.extrapadding {
        &:not(.vertical) {
            .left-widgets {
                padding-left: 1rem;
            }
            .right-widgets {
                padding-right: 1rem;
            }
        }

        &.vertical {
            .left-widgets {
                padding-top: 1rem;
            }
            .right-widgets {
                padding-bottom: 1rem;
            }
        }
    }

    &.separated {
        background: transparent;
        &.bar-background {
            .left-widgets,
            .center-widgets,
            .right-widgets {
                &:not(.empty) {
                    background: colors.$background;
                }
            }
        }

        &.top {
            .left-widgets {
                border-bottom-right-radius: 20px;
            }
            .center-widgets {
                border-bottom-left-radius: 20px;
                border-bottom-right-radius: 20px;
            }
            .right-widgets {
                border-bottom-left-radius: 20px;
            }
        }
        &.bottom {
            .left-widgets {
                border-top-right-radius: 20px;
            }
            .center-widgets {
                border-top-left-radius: 20px;
                border-top-right-radius: 20px;
            }
            .right-widgets {
                border-top-left-radius: 20px;
            }
        }
        &.floating {
            .left-widgets,
            .center-widgets,
            .right-widgets {
                border-radius: 50rem;
            }
        }
    }
    &.round {
        &.top {
            border-bottom-left-radius: 20px;
            border-bottom-right-radius: 20px;
            .left-widgets {
                border-bottom-left-radius: 20px;
            }
            .right-widgets {
                border-bottom-right-radius: 20px;
            }
        }
        &.bottom {
            border-top-left-radius: 20px;
            border-top-right-radius: 20px;
            .left-widgets {
                border-top-left-radius: 20px;
            }
            .right-widgets {
                border-top-right-radius: 20px;
            }
        }
    }

    &.compact {
        .left-widgets,
        .center-widgets,
        .right-widgets {
            padding: 2px;
        }
    }
    &.compact-plus {
        .left-widgets,
        .center-widgets,
        .right-widgets {
            padding: 2px 2px;
        }
    }
    &.ultracompact {
        .left-widgets,
        .center-widgets,
        .right-widgets {
            padding: 0px 0px;
        }
    }

    .system-info-tray:hover,
    .recording-indicator:hover {
        background: colors.$primary_container;
        color: colors.$on_primary_container;
    }
}

.left-widgets,
.center-widgets,
.right-widgets {
    padding: 5px;
    & > box,
    & > button {
        border-radius: 15px;
    }
}

.module-backgrounds {
    .left-widgets,
    .center-widgets,
    .right-widgets {
        & > box,
        & > button {
            border-radius: 5px;
            background: colors.$surface_container;

            &:first-child {
                border-top-left-radius: 20px;
                border-bottom-left-radius: 20px;
            }

            &:last-child {
                border-top-right-radius: 20px;
                border-bottom-right-radius: 20px;
            }

            button {
                background: transparent;
            }
        }
    }
}

.center-widgets {
    margin: 0px 1rem;
}

// Window Info
.winfo {
    padding: 0px 15px 0px 10px;

    .title {
        font-weight: 500;
        margin-bottom: -3px;
    }

    .app_id {
        font-weight: 400;
        font-size: 8pt;
        opacity: 0.8;
    }
}

// Workspaces
.workspaces {
    padding: 2px;

    .workspace {
        padding: 0;
        font-weight: 400;
        font-size: 10pt;
        color: colors.$on_background;
        transition: 300ms cubic-bezier(0.19, 1, 0.22, 1);
        min-width: 25px;
        min-height: 25px;
        border-radius: 20px;
        background: transparent;

        &:hover {
            background: colors.$surface_container_highest;
        }

        &.empty {
            opacity: 0.5;
        }

        &.active {
            background: colors.$primary;
            color: colors.$on_primary;
            padding: 0px 10px;
            font-weight: 700;
            border-radius: 20px;
            opacity: 1;
        }
    }

    &.windows {
        .workspace {
            color: colors.$on_background;
            padding: 0px 10px;

            &:hover {
                background: colors.$surface_container_highest;
            }

            &.active {
                background: colors.$primary;
                color: colors.$on_primary;
                border-radius: 20px;
            }
        }
    }

    &.dots {
        padding: 0px 15px;
        .workspace {
            font-size: 0pt;
            padding: 0px;
            min-width: 6px;
            min-height: 6px;
            color: colors.$on_background;
            background: rgba(colors.$on_background, 0.5);
            border-radius: 2rem;

            &.active {
                min-height: 10px;
                min-width: 20px;
                background: colors.$on_background;
            }
        }
    }
}

// Time & Date
.clock {
    padding: 0px 10px;
    min-height: 0px;

    .time {
        font-weight: 500;
        margin-bottom: -2px;
    }

    .date,
    .month {
        font-weight: 400;
        font-size: 8pt;
        opacity: 0.8;
    }
}

// Time & Date
.media {
    padding: 0px 5px;
    padding-right: 10px;
    min-height: 0px;

    .icon_container {
        border-radius: 20px;
        min-width: 16px;
        margin: 0px;
    }

    box:not(.is-paused) .icon_container {
        animation: rotation 10s infinite linear;
    }

    .overlay-bg {
        margin: 0px;
        border-radius: 20px;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        transition: 100ms;
    }

    .overlay-icon {
        opacity: 0;
        transition: 100ms;
    }

    .title {
        font-weight: 500;
        margin-bottom: -3px;
    }

    .artist {
        font-weight: 400;
        font-size: 8pt;
        opacity: 0.8;
    }

    .is-paused {
        .overlay-bg,
        .overlay-icon {
            opacity: 0.8;
        }
    }

    &:hover {
        .overlay-bg,
        .overlay-icon {
            opacity: 1;
        }

        &:active .overlay-icon {
            transform: scale(1.2);
        }
    }
}

// Tray
.tray {
    padding: 0px;
    min-width: 12px;

    .tray-item {
        padding: 0px;
    }

    .tray-icon {
        margin: 0px;
        padding: 0px;
    }
}

#recording-indicator {
    padding: 0px 10px;

    font-weight: 400;

    &.recording-active {
        background: colors.$error_container;
        color: colors.$on_error_container;
    }

    &.paused {
        background: colors.$tertiary_container;
        color: colors.$on_tertiary_container;
    }

    .recording-icon {
        font-family: "Material Symbols Outlined", "Material Icons Outlined";
        font-size: 12pt;
        font-weight: 600;
    }

    * {
        background: transparent;
    }
}

.compact-plus {
    #recording-indicator {
        border-radius: 50rem;
    }
}

.battery-widget {
    .battery-box {
        border-radius: 20px;
        background: rgba(colors.$on_surface, 0.6);
        color: colors.$surface;
        font-weight: 700;
        font-size: 8.5pt;
        .battery-fill {
            background: colors.$on_surface;
        }
        .battery-status {
            font-size: 10pt;
            font-family: "Material Symbols Outlined", "Material Icons Outlined";
        }
    }
    &.low {
        .battery-box {
            background: rgba(colors.$error, 0.7);
            color: colors.$on_error;
            .battery-fill {
                background: colors.$error;
            }
        }
    }
    &.charging {
        .battery-box {
            background: rgba(lightgreen, 0.6);
            color: colors.$surface;
            .battery-fill {
                background: lightgreen;
            }
            .battery-status {
                font-variation-settings: "FILL" 1;
            }
        }
    }
}

.system-info-tray {
    padding: 0px 10px;
    .system-info-tray-container {
        padding: 0px;
        .icon {
            font-family: "Material Symbols Outlined", "Material Icons Outlined";
            font-size: 13.5pt;
            font-weight: 500;
        }
    }

    &:hover {
        background: colors.$primary_container;
        color: colors.$on_primary_container;
    }

    transition: 200ms;
}

.launcher-button {
    font-size: 12pt;
    &:hover {
        background: colors.$primary_container;
        color: colors.$on_primary_container;
    }
    padding: 0px 10px;
}

.tasks {
    padding: 0px 5px;
    .app-button {
        padding: 3px 6px;
        border-radius: 50rem;
        background-color: transparent;
        color: colors.$on_surface;
        transition: 200ms cubic-bezier(0.19, 1, 0.22, 1);

        &.open-app {
            /* background-color: colors.$surface_container; */
        }

        .app-indicator {
            background-color: colors.$on_surface;
            border-radius: 50rem;
            transition: 200ms cubic-bezier(0.19, 1, 0.22, 1);
            transition-property: padding;

            &.top {
                margin-top: -5px;
                margin-bottom: 8px;
                min-width: 5px;
                min-height: 2px;
            }
            &.bottom {
                margin-top: 8px;
                margin-bottom: -5px;
                min-width: 5px;
                min-height: 2px;
            }
            &.left {
                margin-left: -5px;
                margin-right: 8px;
                min-height: 5px;
                min-width: 2px;
            }
            &.right {
                margin-right: -5px;
                margin-left: 8px;
                min-height: 5px;
                min-width: 2px;
            }
        }

        &:hover {
            background-color: colors.$surface_container_highest;
        }

        &.active-app {
            /* background-color: colors.$secondary_container; */
            .app-indicator {
                background-color: colors.$secondary;
                &.top,
                &.bottom {
                    padding: 0px 8px;
                }
                &.left,
                &.right {
                    padding: 8px 0px;
                }
            }
        }

        .icon {
            background-color: transparent;
        }
    }
}

// Vertical Bar
.vertical {
    &.module-backgrounds {
        .left-widgets,
        .center-widgets,
        .right-widgets {
            & > box,
            & > button {
                border-radius: 5px;

                &:first-child {
                    border-top-left-radius: 20px;
                    border-top-right-radius: 20px;
                }

                &:last-child {
                    border-bottom-left-radius: 20px;
                    border-bottom-right-radius: 20px;
                }
            }
        }
    }

    .workspaces {
        .workspace.active {
            padding: 10px 0px;
        }
        &.windows .workspace {
            padding: 5px 0px;
        }
        &.dots {
            padding: 15px 0px;
            .workspace {
                font-size: 0pt;
                min-width: 6px;
                min-height: 6px;

                &.active {
                    min-height: 8px;
                    min-width: 10px;
                }
            }
        }
    }

    .center-widgets {
        margin: 1rem 0px;
    }

    .media {
        padding: 5px 0px;
    }

    .winfo {
        padding: 8px 0px;
    }

    .clock {
        padding: 10px 0px;
        .date {
            font-size: 8pt;
            margin-left: -5px;
        }
        .month {
            font-size: 8pt;
            margin-right: -5px;
        }
        .separator {
            padding: 0px;
        }
        separator {
            min-height: 2px;
            transform: skewY(-20deg);
            margin: 0px 5px;
            background: rgba(colors.$on_surface, 0.3);
        }
    }

    .tray {
        padding: 0px;
    }

    #recording-indicator {
        padding: 5px 0px;
    }

    .system-info-tray {
        padding: 10px 0px;
    }

    .launcher-button {
        padding: 5px 0px;
    }

    .tasks {
        padding: 5px 0px;
        .app-button {
            padding: 3px 5px;
        }
    }

    &.separated {
        background: transparent;

        &.left {
            .left-widgets {
                border-bottom-right-radius: 20px;
            }
            .center-widgets {
                border-top-right-radius: 20px;
                border-bottom-right-radius: 20px;
            }
            .right-widgets {
                border-top-right-radius: 20px;
            }
        }
        &.right {
            .left-widgets {
                border-bottom-left-radius: 20px;
            }
            .center-widgets {
                border-top-left-radius: 20px;
                border-bottom-left-radius: 20px;
            }
            .right-widgets {
                border-top-left-radius: 20px;
            }
        }
        &.floating {
            .left-widgets,
            .center-widgets,
            .right-widgets {
                border-radius: 50rem;
            }
        }
    }
    &.round {
        &.left {
            border-top-right-radius: 20px;
            border-bottom-right-radius: 20px;
            .left-widgets {
                border-top-right-radius: 20px;
            }
            .right-widgets {
                border-bottom-right-radius: 20px;
            }
        }
        &.right {
            border-top-left-radius: 20px;
            border-bottom-left-radius: 20px;
            .left-widgets {
                border-top-left-radius: 20px;
            }
            .right-widgets {
                border-bottom-left-radius: 20px;
            }
        }
    }

    &.compact {
        .left-widgets,
        .center-widgets,
        .right-widgets {
            padding: 2px;
        }
        .workspaces:not(.windows):not(.dots) {
            padding: 0px;
            .workspace {
                padding: 1px 0px;
            }
        }
    }
    &.compact-plus {
        .left-widgets,
        .center-widgets,
        .right-widgets {
            padding: 5px 2px;
        }
        .workspaces:not(.dots) {
            padding: 0px;
            &:not(.windows) .workspace.active {
                padding: 0px 0px;
            }
        }
    }
    &.ultracompact {
        .left-widgets,
        .center-widgets,
        .right-widgets {
            padding: 5px 0px;
        }
        .workspaces:not(.dots) {
            padding: 0px;
            &:not(.windows) .workspace.active {
                padding: 0px 0px;
            }
        }
    }
}
